Provide default configuration for Gerrit persistent caches
All average[Key|Value] sizes taken from [1]
* 'common_context' number of entries 2000 (as there are
typically 1+ comments per change)
* 'gerrit_file_diff' number of entries 1000
* 'git_file_diff' number of entries 1000
* 'git_modified_files' number of entries 1000
* 'git_tags' number of entries 1000
* 'git_file_diff' number of entries 1000
* 'groups_byuuid_persisted' calculated by calling
`auto-adjust-caches -a -d`
with several groups created with names like in [1] or [2]
[1] review.gerrithub.io
[2] gerrit-review.googlesource.com
Bug: Issue 15865
Change-Id: Idec99fa41aa50d4aff00f82ee8d53b4954e0e7a7
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 96d7ac3..01ba278 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
@@ -263,19 +263,26 @@
@VisibleForTesting
static final ImmutableMap<String, DefaultConfig> defaultMap =
new ImmutableMap.Builder<String, DefaultConfig>()
- .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("change_kind", DefaultConfig.create(59, 26, 1000, 1))
+ .put("change_notes", DefaultConfig.create(36, 10240, 1000, 3))
+ .put("comment_context", DefaultConfig.create(80, 662, 2000, 3))
+ .put("conflicts", DefaultConfig.create(70, 16, 1000, 1))
.put("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))
- .put("oauth_tokens", DefaultConfig.create(8, 2048, 1000, 1))
- .put("change_kind", DefaultConfig.create(59, 26, 1000, 1))
+ .put("gerrit_file_diff", DefaultConfig.create(342, 883, 1000, 1))
+ .put("git_file_diff", DefaultConfig.create(349, 943, 1000, 1))
+ .put("git_modified_files", DefaultConfig.create(349, 943, 1000, 1))
+ .put("git_tags", DefaultConfig.create(43, 6673, 1000, 3))
+ .put("groups_byuuid_persisted", DefaultConfig.create(64, 182, 1000, 1))
.put("mergeability", DefaultConfig.create(79, 16, 65000, 2))
- .put("pure_revert", DefaultConfig.create(55, 16, 1000, 1))
+ .put("modified_files", DefaultConfig.create(138, 2600, 1000, 1))
+ .put("oauth_tokens", DefaultConfig.create(8, 2048, 1000, 1))
.put("persisted_projects", DefaultConfig.create(128, 1024, 250, 2))
- .put("conflicts", DefaultConfig.create(70, 16, 1000, 1))
+ .put("pure_revert", DefaultConfig.create(55, 16, 1000, 1))
+ .put("web_sessions", DefaultConfig.create(45, 221, 1000, 1))
.build();
public static long averageKeySizeFor(String configKey) {
diff --git a/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/ChronicleMapCacheConfigDefaultsIT.java b/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/ChronicleMapCacheConfigDefaultsIT.java
index b3efa35..f3e909d 100644
--- a/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/ChronicleMapCacheConfigDefaultsIT.java
+++ b/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/ChronicleMapCacheConfigDefaultsIT.java
@@ -15,7 +15,6 @@
package com.googlesource.gerrit.modules.cache.chroniclemap;
import static com.google.common.truth.Truth.assertThat;
-import static java.util.stream.Collectors.toSet;
import com.google.gerrit.acceptance.AbstractDaemonTest;
import com.google.gerrit.acceptance.UseLocalDisk;
@@ -43,19 +42,6 @@
@GerritConfig(name = "cache.external_ids_map.diskLimit", value = "1")
public void shouldAllPersistentCachesHaveDefaultConfiguration() throws Exception {
Set<String> allCaches = CacheSerializers.getSerializersNames();
-
- // for the time being filter out all caches that have no defaults so that the test passes
- Set<String> missingDefaults =
- Set.of(
- "comment_context",
- "gerrit_file_diff",
- "git_file_diff",
- "git_modified_files",
- "git_tags",
- "groups_byuuid_persisted",
- "modified_files");
- Set<String> expected =
- allCaches.stream().filter(cache -> !missingDefaults.contains(cache)).collect(toSet());
- assertThat(Defaults.defaultMap.keySet()).containsExactlyElementsIn(expected);
+ assertThat(Defaults.defaultMap.keySet()).containsExactlyElementsIn(allCaches);
}
}