Cut down on a bunch of one-offs of install(new *Module() {...}) by
choosing a more appropriate base module class. This doesn't solve all
such cases, for example RpcServletModule must still inherit from
ServletModule, but it does clean up some code. (And who knows, fewer
modules may even mean faster startup time.)
Change-Id: Ie1aed05d0a64f7f11b121c9a637bb30d80e9a595
* stable-2.7:
Bump JSch to 1.5.0 to fix Java7 compatibility
Extend AddBranchResult with toString method implementation
Get rid of JdbcSQLException while numbers are read from cache
Conflicts:
gerrit-common/src/main/java/com/google/gerrit/common/data/AddBranchResult.java
pom.xml
Change-Id: Ic3bae80a40bfa2d8e8eee598bcdbd771b99cbeda
* stable-2.6:
Bump JSch to 1.5.0 to fix Java7 compatibility
Extend AddBranchResult with toString method implementation
Get rid of JdbcSQLException while numbers are read from cache
Exception org.h2.jdbc.JdbcSQLException: Hexadecimal string with odd
number of characters: "0" is thrown when number with value 0 or string
with value "0" is stored in H2Cache and read is performed.
The fix modifies implementation so that Java de-serialization is
performed even for built-in (e.g. Integer) types.
Change-Id: I953487cb75b3712e8825a74613977425873507a1
Signed-off-by: Jacek Centkowski <geminica.programs@gmail.com>
This method from joda-time supports replacing the system time provider
with a custom provider for tests. Since it is verbose, and we expect
more related methods, put it in the more succinct TimeUtil.nowMs().
This commit covers the trivial cases in the server side; client-side
code still uses System.currentTimeMillis().
Change-Id: I6c56e8c5bbb0cf7b0271e431d1ebdb532967b9e8
The JavaDoc of CacheBuilder.removalListener(...) states that after
invoking this method this CacheBuilder should not be used anymore but
only the returned CacheBuilder.
Change-Id: Ibe7cb90624ca29e3492dbc84d029758bed0055c3
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
The Maven build does not work since the introduction of CodeMirror.
Remove the build until to prevent people from trying to use a broken
build process. If buck is rejected this commit will be reverted, and
we will attempt to fix the Maven build to include CodeMirror. If buck
is accepted, we just saved time by avoiding a messy Maven change.
Change-Id: I147d8d1741d52f59de1d2ddce8e5e82583990c14
java_library() targets must now list every dependency they need for
an import. This permits buck to run more targets in parallel as it
has a better view of the dependency graph, and opens the door for
buck to make even more optimizations in the future.
Change-Id: I132bf47a725e44ba5950ba6ca76bfa72c3876906
Implement a new build system using Buck[1], Facebook's
open source clone of Google's internal build system.
Pros:
- Concise build language
- Test and build output is concise
- Test failures and stack traces show on terminal
- Reliable incrementals; clean is unnecessary
- Extensible with simple blocks of Python
- Fast
buck: clean: 0.452s, full 1m21.083s [*], no-op: 7.145s,
mvn: clean: 4.596s, full 2m53.776s, no-op: 59.108s,
[*] full build includes downloading all dependencies,
time can vary due to remote server performance.
Cons:
- No Windows support
- No native Maven Central support (added by macros)
- No native GWT, Prolog, or WAR support (added by macros)
- Bootstrap of buck requires Ant
Getting started:
git clone https://gerrit.googlesource.com/buck
cd buck
ant
Mac OS X:
PATH="`pwd`/bin:/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands:$PATH"
Linux:
PATH="`pwd`/bin:$PATH"
Importing into Eclipse:
$ time buck build :eclipse
0m48.949s
Import existing project from `pwd`
Import 'gerrit' (do not import other Maven based projects)
Expand 'gerrit'
Right click 'buck-out' > Properties
Under Attributes check 'Derived'
If the code doesn't currently compile but an updated classpath
is needed, refresh the configs and obtain missing JARs:
$ buck build :eclipse_project :download
Running JUnit tests:
$ time buck test --all -e slow # skip slow tests
0m19.320s
$ time buck test --all # includes acceptance tests
5m17.517s
Building WAR:
$ buck build :gerrit
$ java -jar buck-out/gen/gerrit.war
Building release:
$ buck test --all && buck build :api :release
$ java -jar buck-out/gen/release.war
$ ls -lh buck-out/gen/{extension,plugin}-api.jar
Downloading dependencies:
Dependencies are normally downloaded automatically, but Buck can
inspect its graph and download missing dependencies so future
compiles can run without the network:
$ buck build :download
[1] http://facebook.github.io/buck/
Change-Id: I40853b108bd8e153cefa0896a5280a9a5ff81655
* stable-2.5:
Fix order of top-level menus
Ensure that ObjectOutputStream in H2CacheImpl is closed
Flush persistent H2 cache if the existing entries are incompatible
Fix plugin loading when running as hosted WAR or GWT DevMode.
ChangeMessageAccess: Add index for byPathSet method.
File indentation is sometimes wrong in Side-By-Side
Move the Groups and Plugins menu items to the top level.
Call inserter.flush() when creating code review notes
Add ssh command "test-submit-rule"
Split up canSubmit()
Add submit records to query output.
Conflicts:
Documentation/json.txt
gerrit-gwtui/src/main/java/com/google/gerrit/client/Gerrit.java
gerrit-server/src/main/java/com/google/gerrit/server/project/ChangeControl.java
Change-Id: I6f9d44cfbd7060d65c8eb8a399d089a88f9bc697
Some caches (e.g. 'diff_intraline') are peristent so that the entries
survive a Gerrit restart (e.g. because the entries are expensive to
compute). To persist the cache entries Java serialization is used. If
now a class for a cache entry is changed and its serialVersionUID is
updated, already peristent cache entries cannot be deserialized anymore
since their class is incompatible with the new cache entry class.
Flush the cache if incompatible cache entries are detected.
E.g. commit 2424a8a9d595c87106db51da5867ed417eb8a2f5 changed a cache
entry class and as result the existing entries of the 'diff_intraline'
cache could not be loaded anymore, which caused an exception on each
Gerrit startup and when trying to access one of these cached entries.
To get rid of these exeptions the Gerrit administrator had to manually
flush the cache.
Change-Id: Ia158855d983d51335ae2a4df2b73d6c14fc612f0
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
My Eclipse doesn't like it and claims it's a syntax error.
Change-Id: Ib6a9a2e8e47a1bfc0ca11b382e732be15e2ae176
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
Eclipse overwrites these files when we import projects using m2e.
Eclipse 3 writes a timestamp at the top of these files making the Git
working tree dirty. Eclipse 4 (Juno) still overwrites these files but
doesn't write the timestamp. This should help keeping the working tree
clean. However, since the timestamp is currently present in these
files, Eclispe 4 would still make them dirty by overwriting and
effectively removing the timestamp.
This change removes the timestamp from these files. This help those
using Eclipse 4 and doesn't make it worse for those still using Eclispe
3.
Change-Id: Ic23299a12ac80f7294bcc602c8565889069a0d10
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
This is disabled by default in Guava, but we report in show-caches
average loading time. To ensure it isn't always 0, record stats.
Change-Id: I9861b0b20463c8893933d41788139a4c374caaab
Instead of using Ehcache for in-memory caches, use Guava. The Guava
cache code has been more completely tested by Google in high load
production environments, and it tends to have fewer bugs. It enables
caches to be built at any time, rather than only at server startup.
By creating a Guava cache as soon as it is declared, rather than
during the LifecycleListener.start() for the CachePool, we can promise
any downstream consumer of the cache that the cache is ready to
execute requests the moment it is supplied by Guice. This fixes a
startup ordering problem in the GroupCache and the ProjectCache, where
code wants to use one of these caches during startup to resolve a
group or project by name.
Tracking the Gauva backend caches with a DynamicMap makes it possible
for plugins to define their own in-memory caches using CacheModule's
cache() function to declare the cache. It allows the core server to
make the cache available to administrators over SSH with the gerrit
show-caches and gerrit flush-caches commands.
Persistent caches store in a private H2 database per cache, with a
simple one-table schema that stores each entry in a table row as a
pair of serialized objects (key and value). Database reads are gated
by a BloomFilter, to reduce the number of calls made to H2 during
cache misses. In theory less than 3% of cache misses will reach H2 and
find nothing. Stores happen on a background thread quickly after the
put is made to the cache, reducing the risk that a diff or web_session
record is lost during an ungraceful shutdown.
Cache databases are capped around 128M worth of stored data by running
a prune cycle each day at 1 AM local server time. Records are removed
from the database by ordering on the last access time, where last
accessed is the last time the record was moved from disk to memory.
Change-Id: Ia82d056796b5af9bcb1f219fe06d905c9c0fbc84