Merge branch 'stable-3.2' into stable-3.3 * stable-3.2: Fix merge issue for ForwardedIndexGroupHandlerTest class Add 'Forwarded-BatchIndex-Event' to events skipped from high-availability Do not forward events from high-availability Honour index retries when indexing groups Change-Id: I2ea08641f4e42ec1e21bb7ddb69decfaf73093f4
diff --git a/src/main/java/com/googlesource/gerrit/plugins/multisite/forwarder/broker/BrokerForwarder.java b/src/main/java/com/googlesource/gerrit/plugins/multisite/forwarder/broker/BrokerForwarder.java index da19fed..3522731 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/multisite/forwarder/broker/BrokerForwarder.java +++ b/src/main/java/com/googlesource/gerrit/plugins/multisite/forwarder/broker/BrokerForwarder.java
@@ -23,6 +23,8 @@ public abstract class BrokerForwarder { private static final CharSequence HIGH_AVAILABILITY_PLUGIN = "/plugins/high-availability/"; private static final CharSequence HIGH_AVAILABILITY_FORWARDER = "Forwarded-Index-Event"; + private static final CharSequence HIGH_AVAILABILITY_BATCH_FORWARDER = + "Forwarded-BatchIndex-Event"; private final BrokerApiWrapper broker; private final Configuration cfg; @@ -36,7 +38,8 @@ String currentThreadName = task.getCallerThread().getName(); return currentThreadName.contains(HIGH_AVAILABILITY_PLUGIN) - || currentThreadName.contains(HIGH_AVAILABILITY_FORWARDER); + || currentThreadName.contains(HIGH_AVAILABILITY_FORWARDER) + || currentThreadName.contains(HIGH_AVAILABILITY_BATCH_FORWARDER); } protected boolean send(ForwarderTask task, EventTopic eventTopic, MultiSiteEvent event) {
diff --git a/src/test/java/com/googlesource/gerrit/plugins/multisite/forwarder/BrokerForwarderTest.java b/src/test/java/com/googlesource/gerrit/plugins/multisite/forwarder/BrokerForwarderTest.java index 5e2fc05..e3d1ae0 100644 --- a/src/test/java/com/googlesource/gerrit/plugins/multisite/forwarder/BrokerForwarderTest.java +++ b/src/test/java/com/googlesource/gerrit/plugins/multisite/forwarder/BrokerForwarderTest.java
@@ -40,6 +40,7 @@ public class BrokerForwarderTest { private static final String HIGH_AVAILABILITY_PLUGIN = "/plugins/high-availability/"; private static final String HIGH_AVAILABILITY_FORWARDED = "Forwarded-Index-Event"; + private static final String HIGH_AVAILABILITY_BATCH_FORWARDED = "Forwarded-BatchIndex-Event"; private static final long TEST_TIMEOUT_SEC = 5L; @Mock private BrokerApiWrapper brokerMock; @@ -108,6 +109,13 @@ verifyZeroInteractions(brokerMock); } + @Test + public void shouldSkipEventFromHighAvailabilityPluginBatchForwardedThread() { + brokerForwarder.send(newForwarderTask(HIGH_AVAILABILITY_BATCH_FORWARDED), testTopic, testEvent); + + verifyZeroInteractions(brokerMock); + } + private ForwarderTask newForwarderTask(String threadName) { try { return executor