summaryrefslogtreecommitdiffstats
path: root/gerrit-server
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-06-17 18:23:37 +0200
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-09-23 17:56:30 +0000
commit86a34f9ae4a66afaa1118b4c8446abca949a7261 (patch)
tree5f4d76520a752a1adf91104cbdbbe0efa7a9498b /gerrit-server
parent23bd4f119457daa0a436c1342722d538f0e1fb02 (diff)
Update JGit to 3.5.3.201412180710-r
This JGit version fixes: - Bug 420915 - jgit gc hangs in partitionTasks with a very small repo - Bug 427107 - cannot push anymore The latter was observed by CollabNet to break Gerrit replication if gc created a bitmap index which may have induced PackWriterBitmapWalker. findObjects() to throw a MissingObjectException. This version of JGit also fixes the recursive merger on all storage systems. Objects created during the virtual base construction of a recursive merge must be written out somewhere and made available through an ObjectReader for later passes to work on. In both local filesystem and DFS implementations Gerrit was no-op'ing the inserter in dry-run mode, causing these objects to be lost and unavailable during the later processing stages of the merger. With a virtual common ancestor tree or blob missing, the dry-run merger fails and a spurious merge conflict is reported. Instead build a non-flushing inserter wrapper around a real inserter for the repository. On local disk (standard storage) this will allow the virtual base to write loose objects, which may be reclaimed in about two weeks by the standard `git prune` invoked by `git gc`. On DFS systems this will create a new pack file and buffer a block of data in memory before starting to store to persistent storage. However with no flush() the DfsInserter will attempt to rollback the pack, which may allow the DFS system to reclaim its storage quickly. Some implementations of DFS may buffer even more deeply than one block, making the discard even cheaper for smaller merges. This update also fixes a potential infinite loop during object inflation within both the WindowCursor or DfsReader versions of ObjectReader. Inflation could get stuck if an object's compression stream within a pack ended at a very precise alignment with the cache block size. The alignment problem is very rare, as it has taken several years to identify and track down. Includes changes done in I9859bd073bd710424e12b8b091abb8278f4f9fcc on master. Change-Id: I898ad7d5e836ebae0f8f84b17d0ae74489479ef9 (cherry picked from commit 2793c58dae47d1f96d642ec56e197ba2eb5af5b4) Reviewed-by: Ismo Haataja <ismo.haataja@digia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'gerrit-server')
-rw-r--r--gerrit-server/src/main/java/com/google/gerrit/server/git/MergeUtil.java25
1 files changed, 7 insertions, 18 deletions
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/MergeUtil.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/MergeUtil.java
index b4992981ca..6ddc5bce80 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/git/MergeUtil.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/MergeUtil.java
@@ -460,7 +460,7 @@ public class MergeUtil {
return false;
}
- final ThreeWayMerger m = newThreeWayMerger(repo, createDryRunInserter());
+ ThreeWayMerger m = newThreeWayMerger(repo, createDryRunInserter(repo));
try {
return m.merge(new AnyObjectId[] {mergeTip, toMerge});
} catch (NoMergeBaseException e) {
@@ -506,8 +506,7 @@ public class MergeUtil {
// that on the current merge tip.
//
try {
- final ThreeWayMerger m =
- newThreeWayMerger(repo, createDryRunInserter());
+ ThreeWayMerger m = newThreeWayMerger(repo, createDryRunInserter(repo));
m.setBase(toMerge.getParent(0));
return m.merge(mergeTip, toMerge);
} catch (IOException e) {
@@ -534,17 +533,12 @@ public class MergeUtil {
}
}
- public ObjectInserter createDryRunInserter() {
- return new ObjectInserter() {
- private final MutableObjectId buf = new MutableObjectId();
- private final static int LAST_BYTE = Constants.OBJECT_ID_LENGTH - 1;
-
+ public static ObjectInserter createDryRunInserter(Repository db) {
+ final ObjectInserter delegate = db.newObjectInserter();
+ return new ObjectInserter.Filter() {
@Override
- public ObjectId insert(int objectType, long length, InputStream in)
- throws IOException {
- // create non-existing dummy ID
- buf.setByte(LAST_BYTE, buf.getByte(LAST_BYTE) + 1);
- return buf.copy();
+ protected ObjectInserter delegate() {
+ return delegate;
}
@Override
@@ -556,11 +550,6 @@ public class MergeUtil {
public void flush() throws IOException {
// Do nothing.
}
-
- @Override
- public void release() {
- // Do nothing.
- }
};
}