aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse/jgit
diff options
context:
space:
mode:
authorTerry Parker <tparker@google.com>2017-05-18 01:30:14 -0700
committerTerry Parker <tparker@google.com>2017-05-18 15:25:21 -0700
commitc46c720e99baa081bff0dd7bcc1ae8ca48b5e3d1 (patch)
tree13225554fd85d707bb2e361d820b580759535e88 /org.eclipse.jgit.test/tst/org/eclipse/jgit
parent69d5e89e99707119837eb1f025ee2c8d6d376996 (diff)
downloadjgit-c46c720e99baa081bff0dd7bcc1ae8ca48b5e3d1.tar.gz
jgit-c46c720e99baa081bff0dd7bcc1ae8ca48b5e3d1.zip
Exclude refs/tags from bitmap commit selection
Commit db77610 ensured that all refs/tags commits are added to the primary GC pack. It did that by adding all of the refs/tags commits to the primary GC pack PackWriter's "interesting" object set. Unfortunately, all commit objects in the "interesting" set are selected as commits for which bitmap indices will be built. In a repository like chromium with lots of tags, this changed the number of bitmaps created from <700 to >10000. That puts huge memory pressure on the GC task. This change restores the original behavior of ignoring tags when selecting commits for bitmaps. In the "uninteresting" set, commits for refs/heads and refs/tags for unannotated tags can not be differentiated. We instead identify refs/tags commits by passing their ObjectIds as a new "noBitmaps" parameter to the PackWriter.preparePack() methods. PackWriterBitmapPreparer.setupTipCommitBitmaps() can then use that "noBitmaps" parameter to exclude those commits. Change-Id: Icd287c6b04fc1e48de773033fe432a9b0e904ac5 Signed-off-by: Terry Parker <tparker@google.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java2
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/pack/GcCommitSelectionTest.java16
2 files changed, 15 insertions, 3 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java
index c817dc3d7b..9b97eb4ff4 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java
@@ -711,7 +711,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
}
ObjectWalk ow = walk.toObjectWalkWithSameObjects();
- pw.preparePack(NullProgressMonitor.INSTANCE, ow, want, have);
+ pw.preparePack(NullProgressMonitor.INSTANCE, ow, want, have, NONE);
String id = pw.computeName().getName();
File packdir = new File(repo.getObjectsDirectory(), "pack");
File packFile = new File(packdir, "pack-" + id + ".pack");
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/pack/GcCommitSelectionTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/pack/GcCommitSelectionTest.java
index 20b8c51ee4..d9b58e206f 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/pack/GcCommitSelectionTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/pack/GcCommitSelectionTest.java
@@ -69,6 +69,15 @@ public class GcCommitSelectionTest extends GcTestCase {
@Test
public void testBitmapSpansNoMerges() throws Exception {
+ testBitmapSpansNoMerges(false);
+ }
+
+ @Test
+ public void testBitmapSpansNoMergesWithTags() throws Exception {
+ testBitmapSpansNoMerges(true);
+ }
+
+ private void testBitmapSpansNoMerges(boolean withTags) throws Exception {
/*
* Commit counts -> expected bitmap counts for history without merges.
* The top 100 contiguous commits should always have bitmaps, and the
@@ -89,7 +98,10 @@ public class GcCommitSelectionTest extends GcTestCase {
assertTrue(nextCommitCount > currentCommits); // programming error
for (int i = currentCommits; i < nextCommitCount; i++) {
String str = "A" + i;
- bb.commit().message(str).add(str, str).create();
+ RevCommit rc = bb.commit().message(str).add(str, str).create();
+ if (withTags) {
+ tr.lightweightTag(str, rc);
+ }
}
currentCommits = nextCommitCount;
@@ -233,7 +245,7 @@ public class GcCommitSelectionTest extends GcTestCase {
m8, m9);
PackWriterBitmapPreparer preparer = newPeparer(m9, commits);
List<BitmapCommit> selection = new ArrayList<>(
- preparer.selectCommits(commits.size()));
+ preparer.selectCommits(commits.size(), PackWriter.NONE));
// Verify that the output is ordered by the separate "chains"
String[] expected = { m0.name(), m1.name(), m2.name(), m4.name(),