Stop broadcasting accounts cache eviction

Since the introduction of CachedAccountDetails (I61ae5780), the sha1 of
the refs/users/<shared-id> is used as part of the cache key for the
accounts cache.

An effect of this is that explicit cache invalidations are not required
anymore, since changing account details generates a new sha1,
effectively invalidating the previous entry.

Accounts cache invalidation could still be achieved by explicitly
flushing caches, but the effects of this operation should not be
propagated to all nodes, since this would make all nodes cold,
potentially affecting gerrit performance across all sites.

Stop accounts cache evictions from being propagated to the broker.

Bug: Issue 13820
Change-Id: I9cd1c95693c9d542ffe2871637619068eeed233c
diff --git a/src/main/java/com/googlesource/gerrit/plugins/multisite/cache/CachePatternMatcher.java b/src/main/java/com/googlesource/gerrit/plugins/multisite/cache/CachePatternMatcher.java
index acf8df0..b8521a3 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/multisite/cache/CachePatternMatcher.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/multisite/cache/CachePatternMatcher.java
@@ -26,8 +26,7 @@
 @Singleton
 class CachePatternMatcher {
   private static final List<String> DEFAULT_PATTERNS =
-      ImmutableList.of(
-          "accounts", "^groups.*", "ldap_groups", "ldap_usernames", "projects", "sshkeys");
+      ImmutableList.of("^groups.*", "ldap_groups", "ldap_usernames", "projects", "sshkeys");
 
   private final Pattern pattern;
 
diff --git a/src/test/java/com/googlesource/gerrit/plugins/multisite/cache/CacheEvictionHandlerTest.java b/src/test/java/com/googlesource/gerrit/plugins/multisite/cache/CacheEvictionHandlerTest.java
new file mode 100644
index 0000000..67be583
--- /dev/null
+++ b/src/test/java/com/googlesource/gerrit/plugins/multisite/cache/CacheEvictionHandlerTest.java
@@ -0,0 +1,48 @@
+// Copyright (C) 2020 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.
+
+package com.googlesource.gerrit.plugins.multisite.cache;
+
+import static org.mockito.Mockito.verifyZeroInteractions;
+
+import com.google.common.cache.RemovalCause;
+import com.google.common.cache.RemovalNotification;
+import com.google.gerrit.extensions.registration.DynamicSet;
+import com.googlesource.gerrit.plugins.multisite.Configuration;
+import java.util.concurrent.Executor;
+import org.eclipse.jgit.lib.Config;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class CacheEvictionHandlerTest {
+
+  @Mock private Executor executorMock;
+  private CachePatternMatcher defaultCacheMatcher =
+      new CachePatternMatcher(new Configuration(new Config(), new Config()));
+
+  @Test
+  public void shouldNotPublishAccountsCacheEvictions() {
+
+    final CacheEvictionHandler<String, String> handler =
+        new CacheEvictionHandler<>(DynamicSet.emptySet(), executorMock, defaultCacheMatcher);
+
+    handler.onRemoval(
+        "test", "accounts", RemovalNotification.create("test", "accounts", RemovalCause.EXPLICIT));
+
+    verifyZeroInteractions(executorMock);
+  }
+}
diff --git a/src/test/java/com/googlesource/gerrit/plugins/multisite/cache/CachePattenMatcherTest.java b/src/test/java/com/googlesource/gerrit/plugins/multisite/cache/CachePattenMatcherTest.java
index 052a9ae..b35e862 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/multisite/cache/CachePattenMatcherTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/multisite/cache/CachePattenMatcherTest.java
@@ -37,7 +37,6 @@
     CachePatternMatcher matcher = new CachePatternMatcher(configurationMock);
     for (String cache :
         ImmutableList.of(
-            "accounts",
             "groups",
             "groups_byinclude",
             "groups_byname",
@@ -55,6 +54,7 @@
     }
     for (String cache :
         ImmutableList.of(
+            "accounts",
             "adv_bases",
             "change_kind",
             "change_notes",