summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-06-17 18:23:37 +0200
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-04-27 10:01:55 +0200
commit656d67a2e27438b020e5036ca891e7960894fb03 (patch)
treea97878c5de4e270a657fb08335cc27cbcd0a8d37
parenta433ed0366eba3e59590cabd97eac77737178a1d (diff)
Update JGit to 3.5.3.201412180710-rstable-2.7-plus
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>
-rw-r--r--gerrit-plugin-api/pom.xml8
-rw-r--r--gerrit-server/src/main/java/com/google/gerrit/server/git/MergeUtil.java25
-rw-r--r--gerrit-unsign-jgit/.gitignore6
-rw-r--r--gerrit-unsign-jgit/pom.xml80
-rw-r--r--gerrit-war/pom.xml8
-rw-r--r--pom.xml3
6 files changed, 111 insertions, 19 deletions
diff --git a/gerrit-plugin-api/pom.xml b/gerrit-plugin-api/pom.xml
index 0bfc55d082..84de15804e 100644
--- a/gerrit-plugin-api/pom.xml
+++ b/gerrit-plugin-api/pom.xml
@@ -106,6 +106,14 @@ limitations under the License.
<exclude>gerrit/**</exclude>
</excludes>
</filter>
+ <filter>
+ <artifact>*:*</artifact>
+ <excludes>
+ <exclude>META-INF/*.SF</exclude>
+ <exclude>META-INF/*.DSA</exclude>
+ <exclude>META-INF/*.RSA</exclude>
+ </excludes>
+ </filter>
</filters>
</configuration>
<executions>
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 43f6719c70..b6000964b2 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
@@ -411,7 +411,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) {
@@ -457,8 +457,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) {
@@ -485,17 +484,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
@@ -507,11 +501,6 @@ public class MergeUtil {
public void flush() throws IOException {
// Do nothing.
}
-
- @Override
- public void release() {
- // Do nothing.
- }
};
}
diff --git a/gerrit-unsign-jgit/.gitignore b/gerrit-unsign-jgit/.gitignore
new file mode 100644
index 0000000000..43ebee2c60
--- /dev/null
+++ b/gerrit-unsign-jgit/.gitignore
@@ -0,0 +1,6 @@
+/target
+/.classpath
+/.project
+/.settings/org.maven.ide.eclipse.prefs
+/.settings/org.eclipse.m2e.core.prefs
+/gerrit-unsign-jgit.iml
diff --git a/gerrit-unsign-jgit/pom.xml b/gerrit-unsign-jgit/pom.xml
new file mode 100644
index 0000000000..9b8299177f
--- /dev/null
+++ b/gerrit-unsign-jgit/pom.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (C) 2009 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>com.google.gerrit</groupId>
+ <artifactId>gerrit-parent</artifactId>
+ <version>2.7</version>
+ </parent>
+
+ <artifactId>gerrit-unsign-jgit</artifactId>
+ <name>Gerrit Code Review - Remove signature from JGit</name>
+
+ <description>
+ Make hacked JGit acceptable to the class loader
+ </description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.jgit</groupId>
+ <artifactId>org.eclipse.jgit</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <configuration>
+ <artifactSet>
+ <excludes>
+ <exclude>com.googlecode.javaewah:JavaEWAH</exclude>
+ <exclude>com.jcraft:jsch</exclude>
+ <exclude>org.apache.httpcomponents:httpclient</exclude>
+ <exclude>org.apache.httpcomponents:httpcore</exclude>
+ <exclude>commons-codec:commons-codec</exclude>
+ <exclude>commons-logging:commons-logging</exclude>
+ </excludes>
+ </artifactSet>
+ <filters>
+ <filter>
+ <artifact>*:*</artifact>
+ <excludes>
+ <exclude>META-INF/*.SF</exclude>
+ <exclude>META-INF/*.DSA</exclude>
+ <exclude>META-INF/*.RSA</exclude>
+ </excludes>
+ </filter>
+ </filters>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/gerrit-war/pom.xml b/gerrit-war/pom.xml
index b6c90e1f4a..f65a920f4b 100644
--- a/gerrit-war/pom.xml
+++ b/gerrit-war/pom.xml
@@ -108,6 +108,13 @@ limitations under the License.
</dependency>
<dependency>
+ <groupId>com.google.gerrit</groupId>
+ <artifactId>gerrit-unsign-jgit</artifactId>
+ <version>${project.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<scope>provided</scope>
@@ -209,6 +216,7 @@ limitations under the License.
</includes>
</overlay>
</overlays>
+ <packagingExcludes>WEB-INF/lib/org.eclipse.jgit-*.jar</packagingExcludes>
</configuration>
</plugin>
diff --git a/pom.xml b/pom.xml
index 7f6cc87556..bffe6acfca 100644
--- a/pom.xml
+++ b/pom.xml
@@ -46,7 +46,7 @@ limitations under the License.
</issueManagement>
<properties>
- <jgitVersion>2.3.1.201302201838-r.209-g18030f9</jgitVersion>
+ <jgitVersion>3.5.3.201412180710-r</jgitVersion>
<gwtormVersion>1.6</gwtormVersion>
<gwtjsonrpcVersion>1.3</gwtjsonrpcVersion>
<gwtVersion>2.5.0</gwtVersion>
@@ -68,6 +68,7 @@ limitations under the License.
<modules>
<module>gerrit-patch-commonsnet</module>
<module>gerrit-patch-jgit</module>
+ <module>gerrit-unsign-jgit</module>
<module>gerrit-util-cli</module>
<module>gerrit-util-ssl</module>