This is an automated email from the ASF dual-hosted git repository.
gtully pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
The following commit(s) were added to refs/heads/main by this push:
new c6b85ea ARTEMIS-1925 - fix test regression - isHighAcceptPriority
does not need to check for off_with_redistribution
c6b85ea is described below
commit c6b85ea4e3fc7e28b932cd30f7aa49da5d468a4e
Author: gtully <[email protected]>
AuthorDate: Mon Nov 1 12:33:50 2021 +0000
ARTEMIS-1925 - fix test regression - isHighAcceptPriority does not need to
check for off_with_redistribution
---
.../cluster/impl/RemoteQueueBindingImpl.java | 2 +-
.../distribution/MessageRedistributionTest.java | 30 ++++++++++++++++++++++
.../cluster/impl/RemoteQueueBindImplTest.java | 7 ++++-
3 files changed, 37 insertions(+), 2 deletions(-)
diff --git
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/RemoteQueueBindingImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/RemoteQueueBindingImpl.java
index 8a2f88c..e87ded4 100644
---
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/RemoteQueueBindingImpl.java
+++
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/RemoteQueueBindingImpl.java
@@ -154,7 +154,7 @@ public class RemoteQueueBindingImpl implements
RemoteQueueBinding {
@Override
public synchronized boolean isHighAcceptPriority(final Message message) {
- if (consumerCount == 0 ||
messageLoadBalancingType.equals(MessageLoadBalancingType.OFF) ||
messageLoadBalancingType.equals(MessageLoadBalancingType.OFF_WITH_REDISTRIBUTION))
{
+ if (consumerCount == 0 ||
messageLoadBalancingType.equals(MessageLoadBalancingType.OFF)) {
return false;
}
diff --git
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageRedistributionTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageRedistributionTest.java
index 01293db..01292e9 100644
---
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageRedistributionTest.java
+++
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageRedistributionTest.java
@@ -765,6 +765,36 @@ public class MessageRedistributionTest extends
ClusterTestBase {
}
@Test
+ public void testRedistributionOnlyWhenLocalRemovedLbOffWithRedistribution()
throws Exception {
+ setupCluster(MessageLoadBalancingType.OFF_WITH_REDISTRIBUTION);
+
+ startServers(0, 1);
+
+ setupSessionFactory(0, isNetty());
+ setupSessionFactory(1, isNetty());
+
+ createQueue(0, "queues.testaddress", "queue0", null, false);
+ createQueue(1, "queues.testaddress", "queue0", null, false);
+
+ addConsumer(0, 0, "queue0", null);
+ addConsumer(1, 1, "queue0", null);
+
+ waitForBindings(0, "queues.testaddress", 1, 1, true);
+ waitForBindings(1, "queues.testaddress", 1, 1, true);
+
+ waitForBindings(0, "queues.testaddress", 1, 1, false);
+ waitForBindings(1, "queues.testaddress", 1, 1, false);
+
+ send(0, "queues.testaddress", 2, false, null);
+
+ verifyNotReceive(1);
+
+ removeConsumer(0);
+
+ verifyReceiveAll(2, 1);
+ }
+
+ @Test
public void testBackAndForth() throws Exception {
for (int i = 0; i < 10; i++) {
setupCluster(MessageLoadBalancingType.ON_DEMAND);
diff --git
a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/cluster/impl/RemoteQueueBindImplTest.java
b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/cluster/impl/RemoteQueueBindImplTest.java
index 82f5239..cdeb4e4 100644
---
a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/cluster/impl/RemoteQueueBindImplTest.java
+++
b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/cluster/impl/RemoteQueueBindImplTest.java
@@ -93,9 +93,14 @@ public class RemoteQueueBindImplTest extends
ActiveMQTestBase {
final SimpleString bridgeName = RandomUtil.randomSimpleString();
final int distance = 0;
RemoteQueueBindingImpl bindingOff = new RemoteQueueBindingImpl(id,
address, uniqueName, routingName, remoteQueueID, filterString,
storeAndForwardQueue, bridgeName, distance, MessageLoadBalancingType.OFF);
+ bindingOff.addConsumer(null);
assertFalse(bindingOff.isHighAcceptPriority(null));
RemoteQueueBindingImpl bindingOffWithRedistribution = new
RemoteQueueBindingImpl(id, address, uniqueName, routingName, remoteQueueID,
filterString, storeAndForwardQueue, bridgeName, distance,
MessageLoadBalancingType.OFF_WITH_REDISTRIBUTION);
- assertFalse(bindingOffWithRedistribution.isHighAcceptPriority(null));
+ bindingOffWithRedistribution.addConsumer(null);
+ // not really intuitive, but via getNextBinding (initial routing)
BindingsImpl.matchBinding() traps remote bindings
+ // with OFF_WITH_REDISTRIBUTION which makes the need for change in
isHighAcceptPriority redundant
+ // and ensures that redistribution can occur as isHighAcceptPriority is
invoked from redistribute
+ assertTrue(bindingOffWithRedistribution.isHighAcceptPriority(null));
}
}