Merge branch 'stable-3.4'
* stable-3.4:
Front CacheChronicleMap with a Guava cache
Change-Id: I0c7b73dd04e0155ab4170914c1931bce6f7828da
diff --git a/src/main/java/com/googlesource/gerrit/modules/cache/chroniclemap/ChronicleMapCacheConfig.java b/src/main/java/com/googlesource/gerrit/modules/cache/chroniclemap/ChronicleMapCacheConfig.java
index 1235e53..79e4b38 100644
--- a/src/main/java/com/googlesource/gerrit/modules/cache/chroniclemap/ChronicleMapCacheConfig.java
+++ b/src/main/java/com/googlesource/gerrit/modules/cache/chroniclemap/ChronicleMapCacheConfig.java
@@ -185,7 +185,8 @@
.put("web_sessions", DefaultConfig.create(45, 221, 1000, 1))
.put("change_notes", DefaultConfig.create(36, 10240, 1000, 3))
.put("accounts", DefaultConfig.create(30, 256, 1000, 1))
- .put("diff", DefaultConfig.create(98, 10240, 1000, 2))
+ .put("gerrit_file_diff", DefaultConfig.create(98, 10240, 1000, 2))
+ .put("git_file_diff", DefaultConfig.create(98, 10240, 1000, 2))
.put("diff_intraline", DefaultConfig.create(512, 2048, 1000, 2))
.put("diff_summary", DefaultConfig.create(128, 2048, 1000, 1))
.put("external_ids_map", DefaultConfig.create(128, 204800, 2, 1))
diff --git a/src/main/java/com/googlesource/gerrit/modules/cache/chroniclemap/H2MigrationServlet.java b/src/main/java/com/googlesource/gerrit/modules/cache/chroniclemap/H2MigrationServlet.java
index f96786d..c74594f 100644
--- a/src/main/java/com/googlesource/gerrit/modules/cache/chroniclemap/H2MigrationServlet.java
+++ b/src/main/java/com/googlesource/gerrit/modules/cache/chroniclemap/H2MigrationServlet.java
@@ -41,8 +41,10 @@
import com.google.gerrit.server.patch.DiffSummaryKey;
import com.google.gerrit.server.patch.IntraLineDiff;
import com.google.gerrit.server.patch.IntraLineDiffKey;
-import com.google.gerrit.server.patch.PatchList;
-import com.google.gerrit.server.patch.PatchListKey;
+import com.google.gerrit.server.patch.filediff.FileDiffCacheKey;
+import com.google.gerrit.server.patch.filediff.FileDiffOutput;
+import com.google.gerrit.server.patch.gitfilediff.GitFileDiff;
+import com.google.gerrit.server.patch.gitfilediff.GitFileDiffCacheKey;
import com.google.gerrit.server.query.change.ConflictKey;
import com.google.inject.Inject;
import com.google.inject.Singleton;
@@ -103,7 +105,9 @@
@Named("git_tags") PersistentCacheDef<String, TagSetHolder> gitTagsCacheDef,
@Named("change_notes")
PersistentCacheDef<ChangeNotesCache.Key, ChangeNotesState> changeNotesCacheDef,
- @Named("diff") PersistentCacheDef<PatchListKey, PatchList> diffCacheDef,
+ @Named("gerrit_file_diff")
+ PersistentCacheDef<FileDiffCacheKey, FileDiffOutput> gerritFileDiffDef,
+ @Named("git_file_diff") PersistentCacheDef<GitFileDiffCacheKey, GitFileDiff> gitFileDiffDef,
@Named("diff_intraline")
PersistentCacheDef<IntraLineDiffKey, IntraLineDiff> diffIntraLineCacheDef,
@Named("diff_summary") PersistentCacheDef<DiffSummaryKey, DiffSummary> diffSummaryCacheDef,
@@ -125,7 +129,8 @@
pureRevertCacheDef,
gitTagsCacheDef,
changeNotesCacheDef,
- diffCacheDef,
+ gerritFileDiffDef,
+ gitFileDiffDef,
diffIntraLineCacheDef,
diffSummaryCacheDef,
persistedProjectsCacheDef,
diff --git a/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/AnalyzeH2CachesIT.java b/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/AnalyzeH2CachesIT.java
index 482b9da..c02d581 100644
--- a/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/AnalyzeH2CachesIT.java
+++ b/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/AnalyzeH2CachesIT.java
@@ -49,7 +49,8 @@
String result = adminSshSession.exec(cmd);
adminSshSession.assertSuccess();
- assertThat(result).contains("[cache \"diff\"]\n" + "\tmaxEntries = 1\n");
+ assertThat(result).contains("[cache \"git_file_diff\"]\n" + "\tmaxEntries = 1\n");
+ assertThat(result).contains("[cache \"gerrit_file_diff\"]\n" + "\tmaxEntries = 2\n");
assertThat(result).contains("[cache \"accounts\"]\n" + "\tmaxEntries = 4\n");
assertThat(result).contains("[cache \"diff_summary\"]\n" + "\tmaxEntries = 1\n");
assertThat(result).contains("[cache \"persisted_projects\"]\n" + "\tmaxEntries = 3\n");
@@ -68,7 +69,8 @@
"WARN: Cache diff_intraline is empty, skipping.",
"WARN: Cache change_kind is empty, skipping.",
"WARN: Cache diff_summary is empty, skipping.",
- "WARN: Cache diff is empty, skipping.",
+ "WARN: Cache gerrit_file_diff is empty, skipping.",
+ "WARN: Cache git_file_diff is empty, skipping.",
"WARN: Cache pure_revert is empty, skipping.",
"WARN: Cache git_tags is empty, skipping.");
String result = adminSshSession.exec(cmd);
@@ -87,7 +89,8 @@
"WARN: Cache diff_intraline is empty, skipping.",
"WARN: Cache change_kind is empty, skipping.",
"WARN: Cache diff_summary is empty, skipping.",
- "WARN: Cache diff is empty, skipping.",
+ "WARN: Cache gerrit_file_diff is empty, skipping.",
+ "WARN: Cache git_file_diff is empty, skipping.",
"WARN: Cache pure_revert is empty, skipping.",
"WARN: Cache git_tags is empty, skipping.");
String result = adminSshSession.exec(cmd);
diff --git a/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/AutoAdjustCachesIT.java b/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/AutoAdjustCachesIT.java
index 57b0e46..087e804 100644
--- a/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/AutoAdjustCachesIT.java
+++ b/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/AutoAdjustCachesIT.java
@@ -59,7 +59,8 @@
private static final String SSH_CMD = "cache-chroniclemap auto-adjust-caches";
private static final String REST_CMD = "/plugins/cache-chroniclemap/auto-adjust-caches";
private static final String GROUPS_BYUUID_PERSISTED = "groups_byuuid_persisted";
- private static final String DIFF = "diff";
+ private static final String GERRIT_FILE_DIFF = "gerrit_file_diff";
+ private static final String GIT_FILE_DIFF = "git_file_diff";
private static final String DIFF_SUMMARY = "diff_summary";
private static final String ACCOUNTS = "accounts";
private static final String PERSISTED_PROJECTS = "persisted_projects";
@@ -71,7 +72,13 @@
private static final Function<String, Boolean> MATCH_ALL = (n) -> true;
private static final ImmutableList<String> EXPECTED_CACHES =
- ImmutableList.of(GROUPS_BYUUID_PERSISTED, DIFF, DIFF_SUMMARY, ACCOUNTS, PERSISTED_PROJECTS);
+ ImmutableList.of(
+ GROUPS_BYUUID_PERSISTED,
+ GERRIT_FILE_DIFF,
+ GIT_FILE_DIFF,
+ DIFF_SUMMARY,
+ ACCOUNTS,
+ PERSISTED_PROJECTS);
@Inject private SitePaths sitePaths;
diff --git a/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/MigrateH2CachesInMemoryIT.java b/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/MigrateH2CachesInMemoryIT.java
index dbca0df..3561051 100644
--- a/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/MigrateH2CachesInMemoryIT.java
+++ b/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/MigrateH2CachesInMemoryIT.java
@@ -65,6 +65,6 @@
private RestResponse runMigrationWithAcceptHeader(RestSession restSession, String acceptHeader)
throws IOException {
- return restSession.putWithHeader(MIGRATION_ENDPOINT, new BasicHeader(ACCEPT, acceptHeader));
+ return restSession.putWithHeaders(MIGRATION_ENDPOINT, new BasicHeader(ACCEPT, acceptHeader));
}
}
diff --git a/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/MigrateH2CachesLocalDiskIT.java b/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/MigrateH2CachesLocalDiskIT.java
index 77ae477..57de6cd 100644
--- a/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/MigrateH2CachesLocalDiskIT.java
+++ b/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/MigrateH2CachesLocalDiskIT.java
@@ -288,7 +288,7 @@
private RestResponse runMigrationWithAcceptHeader(RestSession restSession, String acceptHeader)
throws IOException {
- return restSession.putWithHeader(MIGRATION_ENDPOINT, new BasicHeader(ACCEPT, acceptHeader));
+ return restSession.putWithHeaders(MIGRATION_ENDPOINT, new BasicHeader(ACCEPT, acceptHeader));
}
private <T> T findClassBoundWithName(Class<T> clazz, String named) {