From 576622571a839720d83d800b12a7f2b2448b30d9 Mon Sep 17 00:00:00 2001 From: Justin Bertram Date: Mon, 25 Dec 2023 19:46:22 -0600 Subject: [PATCH] ARTEMIS-4559 refactor HA docs & code/module naming This commit does the following: - Updates HA docs including the chapter on network isolation (i.e. split brain). The network isolation chapter is now more about high-level explanation and the HA doc now has all the configuration parameters. - Changes references to "pluggable quorum voting" to "pluggable lock manager." The pluggable functionality really isn't about voting. Conceptually is much more like the functionality you'd get from a distributed lock so this naming is more clear. Both the docs and the code have been changed. - Reorganize lock manager modules as sub-modules. The API and RI modules are renamed, but that should be OK based on the "experimental" tag that's been on this feature up to this point. - Remove the "experimental" tag from the lock manager. These changes will not break folks using the standalone broker. However, they will break folks embedding the broker *if* they are using the artemis-quorum-ri or artemis-quorum-api modules or the o.a.a.a.c.c.h.DistributedPrimitiveManagerConfiguration class. There are no functional changes here. Renaming these modules is more a conceptual change to facilitate better documentation and increased adoption. --- artemis-bom/pom.xml | 4 +- artemis-cli/pom.xml | 2 +- .../activation/ActivationSequenceList.java | 12 +- .../activation/ActivationSequenceSet.java | 12 +- .../config/ActiveMQDefaultConfiguration.java | 4 +- artemis-distribution/pom.xml | 4 +- .../src/main/resources/features.xml | 2 +- .../artemis-lockmanager-api}/pom.xml | 10 +- .../artemis/lockmanager}/DistributedLock.java | 2 +- .../lockmanager/DistributedLockManager.java | 8 +- .../artemis/lockmanager}/MutableLong.java | 2 +- .../UnavailableStateException.java | 2 +- .../artemis-lockmanager-ri}/pom.xml | 13 +- .../file/FileBasedLockManager.java | 16 +- .../file/FileDistributedLock.java | 4 +- .../zookeeper/CuratorDistributedLock.java | 10 +- .../CuratorDistributedLockManager.java | 28 +- .../CuratorDistributedPrimitive.java | 12 +- .../zookeeper/CuratorMutableLong.java | 10 +- .../CuratorDistributedPrimitiveManager.java | 31 + .../lockmanager}/DistributedLockTest.java | 58 +- .../file/FileDistributedLockTest.java | 14 +- .../CuratorDistributedLockManagerTest.java | 16 +- .../zookeeper/CuratorDistributedLockTest.java | 52 +- artemis-lockmanager/pom.xml | 37 + artemis-server/pom.xml | 2 +- .../core/config/ConfigurationUtils.java | 8 +- .../core/config/HAPolicyConfiguration.java | 8 +- ... DistributedLockManagerConfiguration.java} | 8 +- .../config/ha/ReplicaPolicyConfiguration.java | 2 +- .../ha/ReplicatedPolicyConfiguration.java | 2 +- .../ReplicationBackupPolicyConfiguration.java | 8 +- ...ReplicationPrimaryPolicyConfiguration.java | 8 +- .../core/config/impl/ConfigurationImpl.java | 39 +- .../impl/FileConfigurationParser.java | 12 +- .../impl/wireformat/QuorumVoteMessage.java | 4 +- .../wireformat/QuorumVoteReplyMessage.java | 4 +- .../core/replication/ReplicationManager.java | 2 +- .../core/server/ActiveMQServerLogger.java | 4 +- .../server/cluster/ClusterController.java | 2 +- .../core/server/cluster/ClusterManager.java | 2 +- .../cluster/ha/ReplicationBackupPolicy.java | 10 +- .../cluster/ha/ReplicationPrimaryPolicy.java | 10 +- .../{qourum => quorum}/BooleanVote.java | 2 +- .../cluster/{qourum => quorum}/Quorum.java | 2 +- .../{qourum => quorum}/QuorumManager.java | 18 +- .../{qourum => quorum}/QuorumVote.java | 12 +- .../{qourum => quorum}/QuorumVoteHandler.java | 2 +- .../QuorumVoteServerConnect.java | 2 +- .../{qourum => quorum}/ServerConnectVote.java | 2 +- .../SharedNothingBackupQuorum.java | 2 +- .../cluster/{qourum => quorum}/Vote.java | 2 +- .../core/server/impl/ActiveMQServerImpl.java | 2 +- .../core/server/impl/ColocatedActivation.java | 6 +- .../impl/ReplicationBackupActivation.java | 14 +- .../impl/ReplicationPrimaryActivation.java | 12 +- .../server/impl/ServerConnectVoteHandler.java | 8 +- .../impl/SharedNothingBackupActivation.java | 8 +- .../impl/SharedNothingPrimaryActivation.java | 2 +- .../ActivationSequenceStateMachine.java | 16 +- .../config/impl/ConfigurationImplTest.java | 8 +- .../impl/HAPolicyConfigurationTest.java | 28 +- .../impl/BackupActivationNoReconnectTest.java | 8 +- .../test/resources/backup-hapolicy-config.xml | 2 +- .../resources/primary-hapolicy-config.xml | 2 +- docs/user-manual/activation-tools.adoc | 2 +- docs/user-manual/ha.adoc | 839 +++++++++--------- docs/user-manual/network-isolation.adoc | 172 ++-- docs/user-manual/versions.adoc | 1 + pom.xml | 3 +- .../backup/broker.xml | 2 +- .../backup/management.xml | 0 .../primary/broker.xml | 2 +- .../primary/management.xml | 0 .../GCPauseSimulationTests.java | 4 +- .../LockManagerTestBase.java} | 4 +- tests/integration-tests/pom.xml | 4 +- .../cli/ActivationSequenceCommandsTest.java | 27 +- ...=> LockManagerInfiniteRedeliveryTest.java} | 14 +- .../cluster/distribution/ClusterTestBase.java | 12 +- .../cluster/failover/FailoverTestBase.java | 10 +- .../MultipleServerFailoverTestBase.java | 10 +- .../failover/QuorumVoteServerConnectTest.java | 4 +- .../LockManagerBackupAuthenticationTest.java} | 4 +- .../LockManagerBackupSyncJournalTest.java} | 4 +- ...ockManagerBackupSyncLargeMessageTest.java} | 4 +- .../LockManagerBackupSyncPagingTest.java} | 4 +- ...gerExtraBackupReplicatedFailoverTest.java} | 4 +- ...nagerGroupingFailoverReplicationTest.java} | 4 +- ...ttyNoGroupNameReplicatedFailoverTest.java} | 14 +- .../LockManagerNettyReplicationStopTest.java} | 4 +- ...erPageCleanupWhileReplicaCatchupTest.java} | 4 +- .../LockManagerReplicaTimeoutTest.java} | 10 +- ...ockManagerReplicatedDistributionTest.java} | 4 +- ...erReplicatedLargeMessageFailoverTest.java} | 6 +- ...tedLargeMessageWithDelayFailoverTest.java} | 4 +- ...kManagerReplicatedPagingFailoverTest.java} | 4 +- ...ockManagerReplicationFlowControlTest.java} | 10 +- ...a => LockManagerReplicationOrderTest.java} | 2 +- ...t.java => LockManagerReplicationTest.java} | 49 +- .../replication/ReplicationTest.java | 10 +- ...agerBasicSecurityManagerFailoverTest.java} | 12 +- .../tests/util/ReplicatedBackupUtils.java | 6 +- .../servers/zkReplicationBackup/broker.xml | 2 +- .../servers/zkReplicationPrimary/broker.xml | 2 +- .../zkReplicationPrimaryPeerA/broker.xml | 2 +- .../zkReplicationPrimaryPeerB/broker.xml | 2 +- .../LockManagerSinglePairTest.java} | 6 +- .../ZookeeperLockManagerPeerTest.java} | 6 +- .../ZookeeperLockManagerSinglePairTest.java} | 6 +- 110 files changed, 1016 insertions(+), 943 deletions(-) rename {artemis-quorum-api => artemis-lockmanager/artemis-lockmanager-api}/pom.xml (82%) rename {artemis-quorum-api/src/main/java/org/apache/activemq/artemis/quorum => artemis-lockmanager/artemis-lockmanager-api/src/main/java/org/apache/activemq/artemis/lockmanager}/DistributedLock.java (98%) rename artemis-quorum-api/src/main/java/org/apache/activemq/artemis/quorum/DistributedPrimitiveManager.java => artemis-lockmanager/artemis-lockmanager-api/src/main/java/org/apache/activemq/artemis/lockmanager/DistributedLockManager.java (82%) rename {artemis-quorum-api/src/main/java/org/apache/activemq/artemis/quorum => artemis-lockmanager/artemis-lockmanager-api/src/main/java/org/apache/activemq/artemis/lockmanager}/MutableLong.java (97%) rename {artemis-quorum-api/src/main/java/org/apache/activemq/artemis/quorum => artemis-lockmanager/artemis-lockmanager-api/src/main/java/org/apache/activemq/artemis/lockmanager}/UnavailableStateException.java (96%) rename {artemis-quorum-ri => artemis-lockmanager/artemis-lockmanager-ri}/pom.xml (93%) rename artemis-quorum-ri/src/main/java/org/apache/activemq/artemis/quorum/file/FileBasedPrimitiveManager.java => artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/lockmanager/file/FileBasedLockManager.java (91%) rename {artemis-quorum-ri/src/main/java/org/apache/activemq/artemis/quorum => artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/lockmanager}/file/FileDistributedLock.java (97%) rename {artemis-quorum-ri/src/main/java/org/apache/activemq/artemis/quorum => artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/lockmanager}/zookeeper/CuratorDistributedLock.java (92%) rename artemis-quorum-ri/src/main/java/org/apache/activemq/artemis/quorum/zookeeper/CuratorDistributedPrimitiveManager.java => artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/lockmanager/zookeeper/CuratorDistributedLockManager.java (93%) rename {artemis-quorum-ri/src/main/java/org/apache/activemq/artemis/quorum => artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/lockmanager}/zookeeper/CuratorDistributedPrimitive.java (89%) rename {artemis-quorum-ri/src/main/java/org/apache/activemq/artemis/quorum => artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/lockmanager}/zookeeper/CuratorMutableLong.java (83%) create mode 100644 artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/quorum/zookeeper/CuratorDistributedPrimitiveManager.java rename {artemis-quorum-ri/src/test/java/org/apache/activemq/artemis/quorum => artemis-lockmanager/artemis-lockmanager-ri/src/test/java/org/apache/activemq/artemis/lockmanager}/DistributedLockTest.java (82%) rename {artemis-quorum-ri/src/test/java/org/apache/activemq/artemis/quorum => artemis-lockmanager/artemis-lockmanager-ri/src/test/java/org/apache/activemq/artemis/lockmanager}/file/FileDistributedLockTest.java (76%) rename artemis-quorum-ri/src/test/java/org/apache/activemq/artemis/quorum/zookeeper/CuratorDistributedPrimitiveManagerTest.java => artemis-lockmanager/artemis-lockmanager-ri/src/test/java/org/apache/activemq/artemis/lockmanager/zookeeper/CuratorDistributedLockManagerTest.java (86%) rename {artemis-quorum-ri/src/test/java/org/apache/activemq/artemis/quorum => artemis-lockmanager/artemis-lockmanager-ri/src/test/java/org/apache/activemq/artemis/lockmanager}/zookeeper/CuratorDistributedLockTest.java (86%) create mode 100644 artemis-lockmanager/pom.xml rename artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ha/{DistributedPrimitiveManagerConfiguration.java => DistributedLockManagerConfiguration.java} (80%) rename artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/{qourum => quorum}/BooleanVote.java (96%) rename artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/{qourum => quorum}/Quorum.java (96%) rename artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/{qourum => quorum}/QuorumManager.java (97%) rename artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/{qourum => quorum}/QuorumVote.java (86%) rename artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/{qourum => quorum}/QuorumVoteHandler.java (95%) rename artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/{qourum => quorum}/QuorumVoteServerConnect.java (98%) rename artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/{qourum => quorum}/ServerConnectVote.java (97%) rename artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/{qourum => quorum}/SharedNothingBackupQuorum.java (99%) rename artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/{qourum => quorum}/Vote.java (95%) rename tests/e2e-tests/src/main/resources/servers/ha/replication/{pluggablequorumvote => lockmanager}/backup/broker.xml (99%) rename tests/e2e-tests/src/main/resources/servers/ha/replication/{pluggablequorumvote => lockmanager}/backup/management.xml (100%) rename tests/e2e-tests/src/main/resources/servers/ha/replication/{pluggablequorumvote => lockmanager}/primary/broker.xml (99%) rename tests/e2e-tests/src/main/resources/servers/ha/replication/{pluggablequorumvote => lockmanager}/primary/management.xml (100%) rename tests/e2e-tests/src/test/java/org/apache/activemq/artemis/tests/e2e/ha/replication/{pluggablequorumvote => lockmanager}/GCPauseSimulationTests.java (99%) rename tests/e2e-tests/src/test/java/org/apache/activemq/artemis/tests/e2e/ha/replication/{pluggablequorumvote/PluggableQuorumVoteTestBase.java => lockmanager/LockManagerTestBase.java} (95%) rename tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/{PluggableQuorumInfiniteRedeliveryTest.java => LockManagerInfiniteRedeliveryTest.java} (76%) rename tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/{quorum/PluggableQuorumBackupAuthenticationTest.java => lockmanager/LockManagerBackupAuthenticationTest.java} (98%) rename tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/{quorum/PluggableQuorumBackupSyncJournalTest.java => lockmanager/LockManagerBackupSyncJournalTest.java} (93%) rename tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/{quorum/PluggableQuorumBackupSyncLargeMessageTest.java => lockmanager/LockManagerBackupSyncLargeMessageTest.java} (92%) rename tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/{quorum/PluggableQuorumBackupSyncPagingTest.java => lockmanager/LockManagerBackupSyncPagingTest.java} (93%) rename tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/{quorum/PluggableQuorumExtraBackupReplicatedFailoverTest.java => lockmanager/LockManagerExtraBackupReplicatedFailoverTest.java} (97%) rename tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/{quorum/PluggableQuorumGroupingFailoverReplicationTest.java => lockmanager/LockManagerGroupingFailoverReplicationTest.java} (91%) rename tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/{quorum/PluggableQuorumNettyNoGroupNameReplicatedFailoverTest.java => lockmanager/LockManagerNettyNoGroupNameReplicatedFailoverTest.java} (93%) rename tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/{quorum/PluggableQuorumNettyReplicationStopTest.java => lockmanager/LockManagerNettyReplicationStopTest.java} (93%) rename tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/{quorum/PluggableQuorumPageCleanupWhileReplicaCatchupTest.java => lockmanager/LockManagerPageCleanupWhileReplicaCatchupTest.java} (91%) rename tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/{quorum/PluggableQuorumReplicaTimeoutTest.java => lockmanager/LockManagerReplicaTimeoutTest.java} (84%) rename tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/{quorum/PluggableQuorumReplicatedDistributionTest.java => lockmanager/LockManagerReplicatedDistributionTest.java} (90%) rename tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/{quorum/PluggableQuorumReplicatedLargeMessageFailoverTest.java => lockmanager/LockManagerReplicatedLargeMessageFailoverTest.java} (92%) rename tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/{quorum/PluggableQuorumReplicatedLargeMessageWithDelayFailoverTest.java => lockmanager/LockManagerReplicatedLargeMessageWithDelayFailoverTest.java} (94%) rename tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/{quorum/PluggableQuorumReplicatedPagingFailoverTest.java => lockmanager/LockManagerReplicatedPagingFailoverTest.java} (93%) rename tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/{PluggableQuorumReplicationFlowControlTest.java => LockManagerReplicationFlowControlTest.java} (77%) rename tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/{PluggableQuorumReplicationOrderTest.java => LockManagerReplicationOrderTest.java} (96%) rename tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/{PluggableQuorumReplicationTest.java => LockManagerReplicationTest.java} (92%) rename tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/{PluggableQuorumBasicSecurityManagerFailoverTest.java => LockManagerBasicSecurityManagerFailoverTest.java} (90%) rename tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/{quorum/PluggableQuorumSinglePairTest.java => lockmanager/LockManagerSinglePairTest.java} (99%) rename tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/{quorum/ZookeeperPluggableQuorumPeerTest.java => lockmanager/ZookeeperLockManagerPeerTest.java} (97%) rename tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/{quorum/ZookeeperPluggableQuorumSinglePairTest.java => lockmanager/ZookeeperLockManagerSinglePairTest.java} (94%) diff --git a/artemis-bom/pom.xml b/artemis-bom/pom.xml index a44ffac759..922f81f42c 100644 --- a/artemis-bom/pom.xml +++ b/artemis-bom/pom.xml @@ -185,12 +185,12 @@ org.apache.activemq - artemis-quorum-api + artemis-lockmanager-api ${project.version} org.apache.activemq - artemis-quorum-ri + artemis-lockmanager-ri ${project.version} diff --git a/artemis-cli/pom.xml b/artemis-cli/pom.xml index 13b182dfc4..c1aa23f5d9 100644 --- a/artemis-cli/pom.xml +++ b/artemis-cli/pom.xml @@ -60,7 +60,7 @@ org.apache.activemq - artemis-quorum-api + artemis-lockmanager-api org.apache.activemq diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/activation/ActivationSequenceList.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/activation/ActivationSequenceList.java index 79420496b2..054f0c77f1 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/activation/ActivationSequenceList.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/activation/ActivationSequenceList.java @@ -24,14 +24,14 @@ import org.apache.activemq.artemis.cli.commands.ActionContext; import org.apache.activemq.artemis.cli.commands.tools.LockAbstract; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.HAPolicyConfiguration; -import org.apache.activemq.artemis.core.config.ha.DistributedPrimitiveManagerConfiguration; +import org.apache.activemq.artemis.core.config.ha.DistributedLockManagerConfiguration; import org.apache.activemq.artemis.core.config.ha.ReplicationBackupPolicyConfiguration; import org.apache.activemq.artemis.core.config.ha.ReplicationPrimaryPolicyConfiguration; import org.apache.activemq.artemis.core.server.NodeManager; import org.apache.activemq.artemis.core.server.impl.FileLockNodeManager; -import org.apache.activemq.artemis.quorum.DistributedLock; -import org.apache.activemq.artemis.quorum.DistributedPrimitiveManager; -import org.apache.activemq.artemis.quorum.MutableLong; +import org.apache.activemq.artemis.lockmanager.DistributedLock; +import org.apache.activemq.artemis.lockmanager.DistributedLockManager; +import org.apache.activemq.artemis.lockmanager.MutableLong; import picocli.CommandLine.Command; import picocli.CommandLine.Option; @@ -84,7 +84,7 @@ public class ActivationSequenceList extends LockAbstract { throw new IllegalArgumentException("--node-id must be used just with --remote"); } final HAPolicyConfiguration policyConfig = config.getHAPolicyConfiguration(); - final DistributedPrimitiveManagerConfiguration managerConfiguration; + final DistributedLockManagerConfiguration managerConfiguration; String coordinationId = null; if (policyConfig instanceof ReplicationBackupPolicyConfiguration) { ReplicationBackupPolicyConfiguration backupPolicyConfig = (ReplicationBackupPolicyConfiguration) policyConfig; @@ -135,7 +135,7 @@ public class ActivationSequenceList extends LockAbstract { } Long coordinatedSequence = null; if (!local) { - try (DistributedPrimitiveManager manager = DistributedPrimitiveManager.newInstanceOf( + try (DistributedLockManager manager = DistributedLockManager.newInstanceOf( managerConfiguration.getClassName(), managerConfiguration.getProperties())) { if (!manager.start(MANAGER_START_TIMEOUT_SECONDS, TimeUnit.SECONDS)) { throw new IllegalStateException("distributed manager isn't started in " + MANAGER_START_TIMEOUT_SECONDS + " seconds"); diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/activation/ActivationSequenceSet.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/activation/ActivationSequenceSet.java index 26c39663a1..227170a63e 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/activation/ActivationSequenceSet.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/activation/ActivationSequenceSet.java @@ -24,14 +24,14 @@ import org.apache.activemq.artemis.cli.commands.ActionContext; import org.apache.activemq.artemis.cli.commands.tools.LockAbstract; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.HAPolicyConfiguration; -import org.apache.activemq.artemis.core.config.ha.DistributedPrimitiveManagerConfiguration; +import org.apache.activemq.artemis.core.config.ha.DistributedLockManagerConfiguration; import org.apache.activemq.artemis.core.config.ha.ReplicationBackupPolicyConfiguration; import org.apache.activemq.artemis.core.config.ha.ReplicationPrimaryPolicyConfiguration; import org.apache.activemq.artemis.core.server.NodeManager; import org.apache.activemq.artemis.core.server.impl.FileLockNodeManager; -import org.apache.activemq.artemis.quorum.DistributedLock; -import org.apache.activemq.artemis.quorum.DistributedPrimitiveManager; -import org.apache.activemq.artemis.quorum.MutableLong; +import org.apache.activemq.artemis.lockmanager.DistributedLock; +import org.apache.activemq.artemis.lockmanager.DistributedLockManager; +import org.apache.activemq.artemis.lockmanager.MutableLong; import picocli.CommandLine.Command; import picocli.CommandLine.Option; @@ -78,7 +78,7 @@ public class ActivationSequenceSet extends LockAbstract { throw new IllegalArgumentException("--to must be >= 0"); } final HAPolicyConfiguration policyConfig = config.getHAPolicyConfiguration(); - final DistributedPrimitiveManagerConfiguration managerConfiguration; + final DistributedLockManagerConfiguration managerConfiguration; String coordinationId = nodeId; if (policyConfig instanceof ReplicationBackupPolicyConfiguration) { ReplicationBackupPolicyConfiguration backupPolicyConfig = (ReplicationBackupPolicyConfiguration) policyConfig; @@ -118,7 +118,7 @@ public class ActivationSequenceSet extends LockAbstract { } } if (!local) { - try (DistributedPrimitiveManager manager = DistributedPrimitiveManager.newInstanceOf( + try (DistributedLockManager manager = DistributedLockManager.newInstanceOf( managerConfiguration.getClassName(), managerConfiguration.getProperties())) { if (!manager.start(MANAGER_START_TIMEOUT_SECONDS, TimeUnit.SECONDS)) { throw new IllegalStateException("distributed manager isn't started in " + MANAGER_START_TIMEOUT_SECONDS + " seconds"); diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java index 0fe9cd90bb..10e074142b 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java @@ -659,7 +659,7 @@ public final class ActiveMQDefaultConfiguration { public static final String DEFAULT_TEMPORARY_QUEUE_NAMESPACE = ""; - private static final String DEFAULT_DISTRIBUTED_PRIMITIVE_MANAGER_CLASS_NAME = "org.apache.activemq.artemis.quorum.zookeeper.CuratorDistributedPrimitiveManager"; + private static final String DEFAULT_DISTRIBUTED_PRIMITIVE_MANAGER_CLASS_NAME = "org.apache.activemq.artemis.lockmanager.zookeeper.CuratorDistributedLockManager"; // Number of concurrent workers for a core bridge public static int DEFAULT_BRIDGE_CONCURRENCY = 1; @@ -1832,7 +1832,7 @@ public final class ActiveMQDefaultConfiguration { return DEFAULT_TEMPORARY_QUEUE_NAMESPACE; } - public static String getDefaultDistributedPrimitiveManagerClassName() { + public static String getDefaultDistributedLockManagerClassName() { return DEFAULT_DISTRIBUTED_PRIMITIVE_MANAGER_CLASS_NAME; } diff --git a/artemis-distribution/pom.xml b/artemis-distribution/pom.xml index dc5f63fa68..9b6ef6a3b5 100644 --- a/artemis-distribution/pom.xml +++ b/artemis-distribution/pom.xml @@ -130,11 +130,11 @@ org.apache.activemq - artemis-quorum-api + artemis-lockmanager-api org.apache.activemq - artemis-quorum-ri + artemis-lockmanager-ri diff --git a/artemis-features/src/main/resources/features.xml b/artemis-features/src/main/resources/features.xml index d707033160..d26ee3cc16 100644 --- a/artemis-features/src/main/resources/features.xml +++ b/artemis-features/src/main/resources/features.xml @@ -80,7 +80,7 @@ mvn:org.apache.activemq/activemq-artemis-native/${activemq-artemis-native-version} - mvn:org.apache.activemq/artemis-quorum-api/${pom.version} + mvn:org.apache.activemq/artemis-lockmanager-api/${pom.version} mvn:org.apache.activemq/artemis-server-osgi/${pom.version} diff --git a/artemis-quorum-api/pom.xml b/artemis-lockmanager/artemis-lockmanager-api/pom.xml similarity index 82% rename from artemis-quorum-api/pom.xml rename to artemis-lockmanager/artemis-lockmanager-api/pom.xml index 26f255c99e..5834481ac5 100644 --- a/artemis-quorum-api/pom.xml +++ b/artemis-lockmanager/artemis-lockmanager-api/pom.xml @@ -19,13 +19,15 @@ org.apache.activemq - artemis-pom + artemis-lockmanager 2.33.0-SNAPSHOT - ../artemis-pom/pom.xml - artemis-quorum-api + artemis-lockmanager-api bundle - ActiveMQ Artemis Quorum API + ActiveMQ Artemis Lock Manager API + + ${project.basedir}/../.. + diff --git a/artemis-quorum-api/src/main/java/org/apache/activemq/artemis/quorum/DistributedLock.java b/artemis-lockmanager/artemis-lockmanager-api/src/main/java/org/apache/activemq/artemis/lockmanager/DistributedLock.java similarity index 98% rename from artemis-quorum-api/src/main/java/org/apache/activemq/artemis/quorum/DistributedLock.java rename to artemis-lockmanager/artemis-lockmanager-api/src/main/java/org/apache/activemq/artemis/lockmanager/DistributedLock.java index ac83a2c859..11f73ebdd2 100644 --- a/artemis-quorum-api/src/main/java/org/apache/activemq/artemis/quorum/DistributedLock.java +++ b/artemis-lockmanager/artemis-lockmanager-api/src/main/java/org/apache/activemq/artemis/lockmanager/DistributedLock.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.quorum; +package org.apache.activemq.artemis.lockmanager; import java.util.Objects; import java.util.concurrent.TimeUnit; diff --git a/artemis-quorum-api/src/main/java/org/apache/activemq/artemis/quorum/DistributedPrimitiveManager.java b/artemis-lockmanager/artemis-lockmanager-api/src/main/java/org/apache/activemq/artemis/lockmanager/DistributedLockManager.java similarity index 82% rename from artemis-quorum-api/src/main/java/org/apache/activemq/artemis/quorum/DistributedPrimitiveManager.java rename to artemis-lockmanager/artemis-lockmanager-api/src/main/java/org/apache/activemq/artemis/lockmanager/DistributedLockManager.java index 049971a881..d58ddea790 100644 --- a/artemis-quorum-api/src/main/java/org/apache/activemq/artemis/quorum/DistributedPrimitiveManager.java +++ b/artemis-lockmanager/artemis-lockmanager-api/src/main/java/org/apache/activemq/artemis/lockmanager/DistributedLockManager.java @@ -14,17 +14,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.quorum; +package org.apache.activemq.artemis.lockmanager; import java.util.Map; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -public interface DistributedPrimitiveManager extends AutoCloseable { +public interface DistributedLockManager extends AutoCloseable { - static DistributedPrimitiveManager newInstanceOf(String className, Map properties) throws Exception { - return (DistributedPrimitiveManager) Class.forName(className).getDeclaredConstructor(Map.class).newInstance(properties); + static DistributedLockManager newInstanceOf(String className, Map properties) throws Exception { + return (DistributedLockManager) Class.forName(className).getDeclaredConstructor(Map.class).newInstance(properties); } @FunctionalInterface diff --git a/artemis-quorum-api/src/main/java/org/apache/activemq/artemis/quorum/MutableLong.java b/artemis-lockmanager/artemis-lockmanager-api/src/main/java/org/apache/activemq/artemis/lockmanager/MutableLong.java similarity index 97% rename from artemis-quorum-api/src/main/java/org/apache/activemq/artemis/quorum/MutableLong.java rename to artemis-lockmanager/artemis-lockmanager-api/src/main/java/org/apache/activemq/artemis/lockmanager/MutableLong.java index d66530daca..2d9dd08b24 100644 --- a/artemis-quorum-api/src/main/java/org/apache/activemq/artemis/quorum/MutableLong.java +++ b/artemis-lockmanager/artemis-lockmanager-api/src/main/java/org/apache/activemq/artemis/lockmanager/MutableLong.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.quorum; +package org.apache.activemq.artemis.lockmanager; public interface MutableLong extends AutoCloseable { diff --git a/artemis-quorum-api/src/main/java/org/apache/activemq/artemis/quorum/UnavailableStateException.java b/artemis-lockmanager/artemis-lockmanager-api/src/main/java/org/apache/activemq/artemis/lockmanager/UnavailableStateException.java similarity index 96% rename from artemis-quorum-api/src/main/java/org/apache/activemq/artemis/quorum/UnavailableStateException.java rename to artemis-lockmanager/artemis-lockmanager-api/src/main/java/org/apache/activemq/artemis/lockmanager/UnavailableStateException.java index 2ae88c657f..fa06521332 100644 --- a/artemis-quorum-api/src/main/java/org/apache/activemq/artemis/quorum/UnavailableStateException.java +++ b/artemis-lockmanager/artemis-lockmanager-api/src/main/java/org/apache/activemq/artemis/lockmanager/UnavailableStateException.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.quorum; +package org.apache.activemq.artemis.lockmanager; public final class UnavailableStateException extends Exception { diff --git a/artemis-quorum-ri/pom.xml b/artemis-lockmanager/artemis-lockmanager-ri/pom.xml similarity index 93% rename from artemis-quorum-ri/pom.xml rename to artemis-lockmanager/artemis-lockmanager-ri/pom.xml index 8dffce8498..45b14686f4 100644 --- a/artemis-quorum-ri/pom.xml +++ b/artemis-lockmanager/artemis-lockmanager-ri/pom.xml @@ -19,14 +19,17 @@ org.apache.activemq - artemis-pom + artemis-lockmanager 2.33.0-SNAPSHOT - ../artemis-pom/pom.xml - artemis-quorum-ri + artemis-lockmanager-ri jar - ActiveMQ Artemis Quorum RI + ActiveMQ Artemis Lock Manager RI + + + ${project.basedir}/../.. + @@ -86,7 +89,7 @@ org.apache.activemq - artemis-quorum-api + artemis-lockmanager-api diff --git a/artemis-quorum-ri/src/main/java/org/apache/activemq/artemis/quorum/file/FileBasedPrimitiveManager.java b/artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/lockmanager/file/FileBasedLockManager.java similarity index 91% rename from artemis-quorum-ri/src/main/java/org/apache/activemq/artemis/quorum/file/FileBasedPrimitiveManager.java rename to artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/lockmanager/file/FileBasedLockManager.java index 2195d5a585..a8092b5b5d 100644 --- a/artemis-quorum-ri/src/main/java/org/apache/activemq/artemis/quorum/file/FileBasedPrimitiveManager.java +++ b/artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/lockmanager/file/FileBasedLockManager.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.quorum.file; +package org.apache.activemq.artemis.lockmanager.file; import java.io.File; import java.io.IOException; @@ -26,27 +26,27 @@ import java.util.Objects; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; -import org.apache.activemq.artemis.quorum.DistributedLock; -import org.apache.activemq.artemis.quorum.DistributedPrimitiveManager; -import org.apache.activemq.artemis.quorum.MutableLong; -import org.apache.activemq.artemis.quorum.UnavailableStateException; +import org.apache.activemq.artemis.lockmanager.DistributedLock; +import org.apache.activemq.artemis.lockmanager.DistributedLockManager; +import org.apache.activemq.artemis.lockmanager.MutableLong; +import org.apache.activemq.artemis.lockmanager.UnavailableStateException; /** * This is an implementation suitable to be used just on unit tests and it won't attempt * to manage nor purge existing stale locks files. It's part of the tests life-cycle to properly * set-up and tear-down the environment. */ -public class FileBasedPrimitiveManager implements DistributedPrimitiveManager { +public class FileBasedLockManager implements DistributedLockManager { private final File locksFolder; private final Map locks; private boolean started; - public FileBasedPrimitiveManager(Map args) { + public FileBasedLockManager(Map args) { this(new File(args.get("locks-folder"))); } - public FileBasedPrimitiveManager(File locksFolder) { + public FileBasedLockManager(File locksFolder) { Objects.requireNonNull(locksFolder); if (!locksFolder.exists()) { throw new IllegalStateException(locksFolder + " is supposed to already exists"); diff --git a/artemis-quorum-ri/src/main/java/org/apache/activemq/artemis/quorum/file/FileDistributedLock.java b/artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/lockmanager/file/FileDistributedLock.java similarity index 97% rename from artemis-quorum-ri/src/main/java/org/apache/activemq/artemis/quorum/file/FileDistributedLock.java rename to artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/lockmanager/file/FileDistributedLock.java index 13a9e78a9d..60ac64f235 100644 --- a/artemis-quorum-ri/src/main/java/org/apache/activemq/artemis/quorum/file/FileDistributedLock.java +++ b/artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/lockmanager/file/FileDistributedLock.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.quorum.file; +package org.apache.activemq.artemis.lockmanager.file; import java.io.File; import java.io.IOException; @@ -24,7 +24,7 @@ import java.nio.channels.OverlappingFileLockException; import java.nio.file.StandardOpenOption; import java.util.function.Consumer; -import org.apache.activemq.artemis.quorum.DistributedLock; +import org.apache.activemq.artemis.lockmanager.DistributedLock; final class FileDistributedLock implements DistributedLock { diff --git a/artemis-quorum-ri/src/main/java/org/apache/activemq/artemis/quorum/zookeeper/CuratorDistributedLock.java b/artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/lockmanager/zookeeper/CuratorDistributedLock.java similarity index 92% rename from artemis-quorum-ri/src/main/java/org/apache/activemq/artemis/quorum/zookeeper/CuratorDistributedLock.java rename to artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/lockmanager/zookeeper/CuratorDistributedLock.java index 206529862b..eaaa6aa189 100644 --- a/artemis-quorum-ri/src/main/java/org/apache/activemq/artemis/quorum/zookeeper/CuratorDistributedLock.java +++ b/artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/lockmanager/zookeeper/CuratorDistributedLock.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.quorum.zookeeper; +package org.apache.activemq.artemis.lockmanager.zookeeper; import java.nio.charset.StandardCharsets; import java.util.Arrays; @@ -22,9 +22,9 @@ import java.util.UUID; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.TimeUnit; -import org.apache.activemq.artemis.quorum.DistributedLock; -import org.apache.activemq.artemis.quorum.UnavailableStateException; -import org.apache.activemq.artemis.quorum.zookeeper.CuratorDistributedPrimitiveManager.PrimitiveId; +import org.apache.activemq.artemis.lockmanager.DistributedLock; +import org.apache.activemq.artemis.lockmanager.UnavailableStateException; +import org.apache.activemq.artemis.lockmanager.zookeeper.CuratorDistributedLockManager.PrimitiveId; import org.apache.curator.framework.recipes.locks.InterProcessSemaphoreV2; import org.apache.curator.framework.recipes.locks.Lease; @@ -35,7 +35,7 @@ final class CuratorDistributedLock extends CuratorDistributedPrimitive implement private Lease lease; private byte[] leaseVersion; - CuratorDistributedLock(PrimitiveId id, CuratorDistributedPrimitiveManager manager, InterProcessSemaphoreV2 ipcSem) { + CuratorDistributedLock(PrimitiveId id, CuratorDistributedLockManager manager, InterProcessSemaphoreV2 ipcSem) { super(id, manager); this.ipcSem = ipcSem; this.listeners = new CopyOnWriteArrayList<>(); diff --git a/artemis-quorum-ri/src/main/java/org/apache/activemq/artemis/quorum/zookeeper/CuratorDistributedPrimitiveManager.java b/artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/lockmanager/zookeeper/CuratorDistributedLockManager.java similarity index 93% rename from artemis-quorum-ri/src/main/java/org/apache/activemq/artemis/quorum/zookeeper/CuratorDistributedPrimitiveManager.java rename to artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/lockmanager/zookeeper/CuratorDistributedLockManager.java index bd26873c44..d366858f5d 100644 --- a/artemis-quorum-ri/src/main/java/org/apache/activemq/artemis/quorum/zookeeper/CuratorDistributedPrimitiveManager.java +++ b/artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/lockmanager/zookeeper/CuratorDistributedLockManager.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.quorum.zookeeper; +package org.apache.activemq.artemis.lockmanager.zookeeper; import java.util.HashMap; import java.util.Map; @@ -27,9 +27,9 @@ import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; -import org.apache.activemq.artemis.quorum.DistributedLock; -import org.apache.activemq.artemis.quorum.DistributedPrimitiveManager; -import org.apache.activemq.artemis.quorum.MutableLong; +import org.apache.activemq.artemis.lockmanager.DistributedLock; +import org.apache.activemq.artemis.lockmanager.DistributedLockManager; +import org.apache.activemq.artemis.lockmanager.MutableLong; import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.CuratorFrameworkFactory; import org.apache.curator.framework.recipes.atomic.DistributedAtomicLong; @@ -43,7 +43,7 @@ import org.apache.curator.utils.DebugUtils; import static java.util.Objects.requireNonNull; import static java.util.stream.Collectors.joining; -public class CuratorDistributedPrimitiveManager implements DistributedPrimitiveManager, ConnectionStateListener { +public class CuratorDistributedLockManager implements DistributedLockManager, ConnectionStateListener { enum PrimitiveType { lock, mutableLong; @@ -154,11 +154,11 @@ public class CuratorDistributedPrimitiveManager implements DistributedPrimitiveM } } - public CuratorDistributedPrimitiveManager(Map config) { + public CuratorDistributedLockManager(Map config) { this(validateParameters(config), true); } - private CuratorDistributedPrimitiveManager(Map config, boolean ignore) { + private CuratorDistributedLockManager(Map config, boolean ignore) { this(config.get(CONNECT_STRING_PARAM), config.get(NAMESPACE_PARAM), Integer.parseInt(config.getOrDefault(SESSION_MS_PARAM, DEFAULT_SESSION_TIMEOUT_MS)), @@ -168,13 +168,13 @@ public class CuratorDistributedPrimitiveManager implements DistributedPrimitiveM Integer.parseInt(config.getOrDefault(RETRIES_MS_PARAM, DEFAULT_RETRIES_MS))); } - private CuratorDistributedPrimitiveManager(String connectString, - String namespace, - int sessionMs, - int sessionPercent, - int connectionMs, - int retries, - int retriesMs) { + private CuratorDistributedLockManager(String connectString, + String namespace, + int sessionMs, + int sessionPercent, + int connectionMs, + int retries, + int retriesMs) { curatorBuilder = CuratorFrameworkFactory.builder() .connectString(connectString) .namespace(namespace) diff --git a/artemis-quorum-ri/src/main/java/org/apache/activemq/artemis/quorum/zookeeper/CuratorDistributedPrimitive.java b/artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/lockmanager/zookeeper/CuratorDistributedPrimitive.java similarity index 89% rename from artemis-quorum-ri/src/main/java/org/apache/activemq/artemis/quorum/zookeeper/CuratorDistributedPrimitive.java rename to artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/lockmanager/zookeeper/CuratorDistributedPrimitive.java index 24fdd88648..7240dfc992 100644 --- a/artemis-quorum-ri/src/main/java/org/apache/activemq/artemis/quorum/zookeeper/CuratorDistributedPrimitive.java +++ b/artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/lockmanager/zookeeper/CuratorDistributedPrimitive.java @@ -14,23 +14,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.quorum.zookeeper; +package org.apache.activemq.artemis.lockmanager.zookeeper; -import org.apache.activemq.artemis.quorum.UnavailableStateException; -import org.apache.activemq.artemis.quorum.zookeeper.CuratorDistributedPrimitiveManager.PrimitiveId; +import org.apache.activemq.artemis.lockmanager.UnavailableStateException; +import org.apache.activemq.artemis.lockmanager.zookeeper.CuratorDistributedLockManager.PrimitiveId; -import static org.apache.activemq.artemis.quorum.zookeeper.CuratorDistributedPrimitiveManager.PrimitiveType.validatePrimitiveInstance; +import static org.apache.activemq.artemis.lockmanager.zookeeper.CuratorDistributedLockManager.PrimitiveType.validatePrimitiveInstance; public abstract class CuratorDistributedPrimitive implements AutoCloseable { // this is used to prevent deadlocks on close - private final CuratorDistributedPrimitiveManager manager; + private final CuratorDistributedLockManager manager; private final PrimitiveId id; private boolean unavailable; private boolean closed; - protected CuratorDistributedPrimitive(PrimitiveId id, CuratorDistributedPrimitiveManager manager) { + protected CuratorDistributedPrimitive(PrimitiveId id, CuratorDistributedLockManager manager) { this.id = id; this.manager = manager; this.closed = false; diff --git a/artemis-quorum-ri/src/main/java/org/apache/activemq/artemis/quorum/zookeeper/CuratorMutableLong.java b/artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/lockmanager/zookeeper/CuratorMutableLong.java similarity index 83% rename from artemis-quorum-ri/src/main/java/org/apache/activemq/artemis/quorum/zookeeper/CuratorMutableLong.java rename to artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/lockmanager/zookeeper/CuratorMutableLong.java index 83cceb26f2..382321a480 100644 --- a/artemis-quorum-ri/src/main/java/org/apache/activemq/artemis/quorum/zookeeper/CuratorMutableLong.java +++ b/artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/lockmanager/zookeeper/CuratorMutableLong.java @@ -14,11 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.quorum.zookeeper; +package org.apache.activemq.artemis.lockmanager.zookeeper; -import org.apache.activemq.artemis.quorum.MutableLong; -import org.apache.activemq.artemis.quorum.UnavailableStateException; -import org.apache.activemq.artemis.quorum.zookeeper.CuratorDistributedPrimitiveManager.PrimitiveId; +import org.apache.activemq.artemis.lockmanager.MutableLong; +import org.apache.activemq.artemis.lockmanager.UnavailableStateException; +import org.apache.activemq.artemis.lockmanager.zookeeper.CuratorDistributedLockManager.PrimitiveId; import org.apache.curator.framework.recipes.atomic.AtomicValue; import org.apache.curator.framework.recipes.atomic.DistributedAtomicLong; @@ -26,7 +26,7 @@ final class CuratorMutableLong extends CuratorDistributedPrimitive implements Mu private final DistributedAtomicLong atomicLong; - CuratorMutableLong(PrimitiveId id, CuratorDistributedPrimitiveManager manager, DistributedAtomicLong atomicLong) { + CuratorMutableLong(PrimitiveId id, CuratorDistributedLockManager manager, DistributedAtomicLong atomicLong) { super(id, manager); this.atomicLong = atomicLong; } diff --git a/artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/quorum/zookeeper/CuratorDistributedPrimitiveManager.java b/artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/quorum/zookeeper/CuratorDistributedPrimitiveManager.java new file mode 100644 index 0000000000..b4f008313a --- /dev/null +++ b/artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/quorum/zookeeper/CuratorDistributedPrimitiveManager.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.activemq.artemis.quorum.zookeeper; + +import java.util.Map; + +import org.apache.activemq.artemis.lockmanager.zookeeper.CuratorDistributedLockManager; + +/** + * This is for backwards compatibility + */ +@Deprecated(forRemoval = true) +public class CuratorDistributedPrimitiveManager extends CuratorDistributedLockManager { + public CuratorDistributedPrimitiveManager(Map config) { + super(config); + } +} diff --git a/artemis-quorum-ri/src/test/java/org/apache/activemq/artemis/quorum/DistributedLockTest.java b/artemis-lockmanager/artemis-lockmanager-ri/src/test/java/org/apache/activemq/artemis/lockmanager/DistributedLockTest.java similarity index 82% rename from artemis-quorum-ri/src/test/java/org/apache/activemq/artemis/quorum/DistributedLockTest.java rename to artemis-lockmanager/artemis-lockmanager-ri/src/test/java/org/apache/activemq/artemis/lockmanager/DistributedLockTest.java index 14186dddc8..0e13198e90 100644 --- a/artemis-quorum-ri/src/test/java/org/apache/activemq/artemis/quorum/DistributedLockTest.java +++ b/artemis-lockmanager/artemis-lockmanager-ri/src/test/java/org/apache/activemq/artemis/lockmanager/DistributedLockTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.quorum; +package org.apache.activemq.artemis.lockmanager; import java.util.ArrayList; import java.util.HashMap; @@ -54,17 +54,17 @@ public abstract class DistributedLockTest { }); } - protected DistributedPrimitiveManager createManagedDistributeManager() { + protected DistributedLockManager createManagedDistributeManager() { return createManagedDistributeManager(stringStringMap -> { }); } - protected DistributedPrimitiveManager createManagedDistributeManager(Consumer> defaultConfiguration) { + protected DistributedLockManager createManagedDistributeManager(Consumer> defaultConfiguration) { try { final HashMap config = new HashMap<>(); configureManager(config); defaultConfiguration.accept(config); - final DistributedPrimitiveManager manager = DistributedPrimitiveManager.newInstanceOf(managerClassName(), config); + final DistributedLockManager manager = DistributedLockManager.newInstanceOf(managerClassName(), config); closeables.add(manager); return manager; } catch (Exception e) { @@ -74,14 +74,14 @@ public abstract class DistributedLockTest { @Test public void managerReturnsSameLockIfNotClosed() throws ExecutionException, InterruptedException, TimeoutException { - DistributedPrimitiveManager manager = createManagedDistributeManager(); + DistributedLockManager manager = createManagedDistributeManager(); manager.start(); Assert.assertSame(manager.getDistributedLock("a"), manager.getDistributedLock("a")); } @Test public void managerReturnsDifferentLocksIfClosed() throws ExecutionException, InterruptedException, TimeoutException { - DistributedPrimitiveManager manager = createManagedDistributeManager(); + DistributedLockManager manager = createManagedDistributeManager(); manager.start(); DistributedLock closedLock = manager.getDistributedLock("a"); closedLock.close(); @@ -90,7 +90,7 @@ public abstract class DistributedLockTest { @Test public void managerReturnsDifferentLocksOnRestart() throws ExecutionException, InterruptedException, TimeoutException { - DistributedPrimitiveManager manager = createManagedDistributeManager(); + DistributedLockManager manager = createManagedDistributeManager(); manager.start(); DistributedLock closedLock = manager.getDistributedLock("a"); manager.stop(); @@ -100,20 +100,20 @@ public abstract class DistributedLockTest { @Test(expected = IllegalStateException.class) public void managerCannotGetLockIfNotStarted() throws ExecutionException, InterruptedException, TimeoutException { - DistributedPrimitiveManager manager = createManagedDistributeManager(); + DistributedLockManager manager = createManagedDistributeManager(); manager.getDistributedLock("a"); } @Test(expected = NullPointerException.class) public void managerCannotGetLockWithNullLockId() throws ExecutionException, InterruptedException, TimeoutException { - DistributedPrimitiveManager manager = createManagedDistributeManager(); + DistributedLockManager manager = createManagedDistributeManager(); manager.start(); manager.getDistributedLock(null); } @Test public void closingLockUnlockIt() throws ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { - DistributedPrimitiveManager manager = createManagedDistributeManager(); + DistributedLockManager manager = createManagedDistributeManager(); manager.start(); DistributedLock closedLock = manager.getDistributedLock("a"); Assert.assertTrue(closedLock.tryLock()); @@ -123,7 +123,7 @@ public abstract class DistributedLockTest { @Test public void managerStopUnlockLocks() throws ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { - DistributedPrimitiveManager manager = createManagedDistributeManager(); + DistributedLockManager manager = createManagedDistributeManager(); manager.start(); Assert.assertTrue(manager.getDistributedLock("a").tryLock()); Assert.assertTrue(manager.getDistributedLock("b").tryLock()); @@ -135,7 +135,7 @@ public abstract class DistributedLockTest { @Test public void acquireAndReleaseLock() throws ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { - DistributedPrimitiveManager manager = createManagedDistributeManager(); + DistributedLockManager manager = createManagedDistributeManager(); manager.start(); DistributedLock lock = manager.getDistributedLock("a"); Assert.assertFalse(lock.isHeldByCaller()); @@ -147,7 +147,7 @@ public abstract class DistributedLockTest { @Test(expected = IllegalStateException.class) public void cannotAcquireSameLockTwice() throws ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { - DistributedPrimitiveManager manager = createManagedDistributeManager(); + DistributedLockManager manager = createManagedDistributeManager(); manager.start(); DistributedLock lock = manager.getDistributedLock("a"); Assert.assertTrue(lock.tryLock()); @@ -156,8 +156,8 @@ public abstract class DistributedLockTest { @Test public void heldLockIsVisibleByDifferentManagers() throws ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { - DistributedPrimitiveManager ownerManager = createManagedDistributeManager(); - DistributedPrimitiveManager observerManager = createManagedDistributeManager(); + DistributedLockManager ownerManager = createManagedDistributeManager(); + DistributedLockManager observerManager = createManagedDistributeManager(); ownerManager.start(); observerManager.start(); Assert.assertTrue(ownerManager.getDistributedLock("a").tryLock()); @@ -167,8 +167,8 @@ public abstract class DistributedLockTest { @Test public void unlockedLockIsVisibleByDifferentManagers() throws ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { - DistributedPrimitiveManager ownerManager = createManagedDistributeManager(); - DistributedPrimitiveManager observerManager = createManagedDistributeManager(); + DistributedLockManager ownerManager = createManagedDistributeManager(); + DistributedLockManager observerManager = createManagedDistributeManager(); ownerManager.start(); observerManager.start(); Assert.assertTrue(ownerManager.getDistributedLock("a").tryLock()); @@ -180,8 +180,8 @@ public abstract class DistributedLockTest { @Test public void cannotAcquireSameLockFromDifferentManagers() throws ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { - DistributedPrimitiveManager ownerManager = createManagedDistributeManager(); - DistributedPrimitiveManager notOwnerManager = createManagedDistributeManager(); + DistributedLockManager ownerManager = createManagedDistributeManager(); + DistributedLockManager notOwnerManager = createManagedDistributeManager(); ownerManager.start(); notOwnerManager.start(); Assert.assertTrue(ownerManager.getDistributedLock("a").tryLock()); @@ -190,8 +190,8 @@ public abstract class DistributedLockTest { @Test public void cannotUnlockFromNotOwnerManager() throws ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { - DistributedPrimitiveManager ownerManager = createManagedDistributeManager(); - DistributedPrimitiveManager notOwnerManager = createManagedDistributeManager(); + DistributedLockManager ownerManager = createManagedDistributeManager(); + DistributedLockManager notOwnerManager = createManagedDistributeManager(); ownerManager.start(); notOwnerManager.start(); Assert.assertTrue(ownerManager.getDistributedLock("a").tryLock()); @@ -202,7 +202,7 @@ public abstract class DistributedLockTest { @Test public void timedTryLockSucceedWithShortTimeout() throws ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { - DistributedPrimitiveManager manager = createManagedDistributeManager(); + DistributedLockManager manager = createManagedDistributeManager(); manager.start(); DistributedLock backgroundLock = manager.getDistributedLock("a"); Assert.assertTrue(backgroundLock.tryLock(1, TimeUnit.NANOSECONDS)); @@ -210,9 +210,9 @@ public abstract class DistributedLockTest { @Test public void timedTryLockFailAfterTimeout() throws ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { - DistributedPrimitiveManager manager = createManagedDistributeManager(); + DistributedLockManager manager = createManagedDistributeManager(); manager.start(); - DistributedPrimitiveManager otherManager = createManagedDistributeManager(); + DistributedLockManager otherManager = createManagedDistributeManager(); otherManager.start(); Assert.assertTrue(otherManager.getDistributedLock("a").tryLock()); final long start = System.nanoTime(); @@ -224,9 +224,9 @@ public abstract class DistributedLockTest { @Test public void timedTryLockSuccess() throws ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { - DistributedPrimitiveManager manager = createManagedDistributeManager(); + DistributedLockManager manager = createManagedDistributeManager(); manager.start(); - DistributedPrimitiveManager otherManager = createManagedDistributeManager(); + DistributedLockManager otherManager = createManagedDistributeManager(); otherManager.start(); Assert.assertTrue(otherManager.getDistributedLock("a").tryLock()); DistributedLock backgroundLock = manager.getDistributedLock("a"); @@ -252,9 +252,9 @@ public abstract class DistributedLockTest { @Test public void interruptStopTimedTryLock() throws ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { - DistributedPrimitiveManager manager = createManagedDistributeManager(); + DistributedLockManager manager = createManagedDistributeManager(); manager.start(); - DistributedPrimitiveManager otherManager = createManagedDistributeManager(); + DistributedLockManager otherManager = createManagedDistributeManager(); otherManager.start(); Assert.assertTrue(otherManager.getDistributedLock("a").tryLock()); DistributedLock backgroundLock = manager.getDistributedLock("a"); @@ -281,7 +281,7 @@ public abstract class DistributedLockTest { @Test public void lockAndMutableLongWithSameIdCanExistsTogether() throws ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { - DistributedPrimitiveManager manager = createManagedDistributeManager(); + DistributedLockManager manager = createManagedDistributeManager(); manager.start(); final String id = "a"; Assert.assertTrue(manager.getDistributedLock(id).tryLock()); diff --git a/artemis-quorum-ri/src/test/java/org/apache/activemq/artemis/quorum/file/FileDistributedLockTest.java b/artemis-lockmanager/artemis-lockmanager-ri/src/test/java/org/apache/activemq/artemis/lockmanager/file/FileDistributedLockTest.java similarity index 76% rename from artemis-quorum-ri/src/test/java/org/apache/activemq/artemis/quorum/file/FileDistributedLockTest.java rename to artemis-lockmanager/artemis-lockmanager-ri/src/test/java/org/apache/activemq/artemis/lockmanager/file/FileDistributedLockTest.java index c565c6b411..953b028c97 100644 --- a/artemis-quorum-ri/src/test/java/org/apache/activemq/artemis/quorum/file/FileDistributedLockTest.java +++ b/artemis-lockmanager/artemis-lockmanager-ri/src/test/java/org/apache/activemq/artemis/lockmanager/file/FileDistributedLockTest.java @@ -14,15 +14,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.quorum.file; +package org.apache.activemq.artemis.lockmanager.file; import java.io.File; import java.lang.reflect.InvocationTargetException; import java.util.Collections; import java.util.Map; -import org.apache.activemq.artemis.quorum.DistributedLockTest; -import org.apache.activemq.artemis.quorum.DistributedPrimitiveManager; +import org.apache.activemq.artemis.lockmanager.DistributedLockTest; +import org.apache.activemq.artemis.lockmanager.DistributedLockManager; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -49,22 +49,22 @@ public class FileDistributedLockTest extends DistributedLockTest { @Override protected String managerClassName() { - return FileBasedPrimitiveManager.class.getName(); + return FileBasedLockManager.class.getName(); } @Test public void reflectiveManagerCreation() throws Exception { - DistributedPrimitiveManager.newInstanceOf(managerClassName(), Collections.singletonMap("locks-folder", locksFolder.toString())); + DistributedLockManager.newInstanceOf(managerClassName(), Collections.singletonMap("locks-folder", locksFolder.toString())); } @Test(expected = InvocationTargetException.class) public void reflectiveManagerCreationFailWithoutLocksFolder() throws Exception { - DistributedPrimitiveManager.newInstanceOf(managerClassName(), Collections.emptyMap()); + DistributedLockManager.newInstanceOf(managerClassName(), Collections.emptyMap()); } @Test(expected = InvocationTargetException.class) public void reflectiveManagerCreationFailIfLocksFolderIsNotFolder() throws Exception { - DistributedPrimitiveManager.newInstanceOf(managerClassName(), Collections.singletonMap("locks-folder", tmpFolder.newFile().toString())); + DistributedLockManager.newInstanceOf(managerClassName(), Collections.singletonMap("locks-folder", tmpFolder.newFile().toString())); } } diff --git a/artemis-quorum-ri/src/test/java/org/apache/activemq/artemis/quorum/zookeeper/CuratorDistributedPrimitiveManagerTest.java b/artemis-lockmanager/artemis-lockmanager-ri/src/test/java/org/apache/activemq/artemis/lockmanager/zookeeper/CuratorDistributedLockManagerTest.java similarity index 86% rename from artemis-quorum-ri/src/test/java/org/apache/activemq/artemis/quorum/zookeeper/CuratorDistributedPrimitiveManagerTest.java rename to artemis-lockmanager/artemis-lockmanager-ri/src/test/java/org/apache/activemq/artemis/lockmanager/zookeeper/CuratorDistributedLockManagerTest.java index ecfa7f1906..1b7070fc4a 100644 --- a/artemis-quorum-ri/src/test/java/org/apache/activemq/artemis/quorum/zookeeper/CuratorDistributedPrimitiveManagerTest.java +++ b/artemis-lockmanager/artemis-lockmanager-ri/src/test/java/org/apache/activemq/artemis/lockmanager/zookeeper/CuratorDistributedLockManagerTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.quorum.zookeeper; +package org.apache.activemq.artemis.lockmanager.zookeeper; import java.util.ArrayList; import java.util.HashMap; @@ -23,7 +23,7 @@ import java.util.List; import java.util.Map; import java.util.function.Consumer; -import org.apache.activemq.artemis.quorum.DistributedPrimitiveManager; +import org.apache.activemq.artemis.lockmanager.DistributedLockManager; import org.apache.curator.framework.CuratorFramework; import org.apache.curator.test.InstanceSpec; import org.apache.curator.test.TestingCluster; @@ -38,7 +38,7 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -public class CuratorDistributedPrimitiveManagerTest { +public class CuratorDistributedLockManagerTest { private final ArrayList autoCloseables = new ArrayList<>(); @@ -88,12 +88,12 @@ public class CuratorDistributedPrimitiveManagerTest { config.put("retries-ms", Integer.toString(RETRIES_MS)); } - protected DistributedPrimitiveManager createManagedDistributeManager(Consumer> defaultConfiguration) { + protected DistributedLockManager createManagedDistributeManager(Consumer> defaultConfiguration) { try { final HashMap config = new HashMap<>(); configureManager(config); defaultConfiguration.accept(config); - final DistributedPrimitiveManager manager = DistributedPrimitiveManager.newInstanceOf(managerClassName(), config); + final DistributedLockManager manager = DistributedLockManager.newInstanceOf(managerClassName(), config); autoCloseables.add(manager); return manager; } catch (Exception e) { @@ -102,19 +102,19 @@ public class CuratorDistributedPrimitiveManagerTest { } protected String managerClassName() { - return CuratorDistributedPrimitiveManager.class.getName(); + return CuratorDistributedLockManager.class.getName(); } @Test public void verifyLayoutInZK() throws Exception { - final DistributedPrimitiveManager manager = createManagedDistributeManager(config -> config.put("namespace", "activemq-artemis")); + final DistributedLockManager manager = createManagedDistributeManager(config -> config.put("namespace", "activemq-artemis")); manager.start(); Assert.assertTrue(manager.getDistributedLock("journal-identity-000-111").tryLock()); Assert.assertTrue(manager.getMutableLong("journal-identity-000-111").compareAndSet(0, 1)); - CuratorFramework curatorFramework = ((CuratorDistributedPrimitiveManager)manager).getCurator(); + CuratorFramework curatorFramework = ((CuratorDistributedLockManager)manager).getCurator(); List entries = new LinkedList<>(); dumpZK(curatorFramework.getZookeeperClient().getZooKeeper(), "/", entries); diff --git a/artemis-quorum-ri/src/test/java/org/apache/activemq/artemis/quorum/zookeeper/CuratorDistributedLockTest.java b/artemis-lockmanager/artemis-lockmanager-ri/src/test/java/org/apache/activemq/artemis/lockmanager/zookeeper/CuratorDistributedLockTest.java similarity index 86% rename from artemis-quorum-ri/src/test/java/org/apache/activemq/artemis/quorum/zookeeper/CuratorDistributedLockTest.java rename to artemis-lockmanager/artemis-lockmanager-ri/src/test/java/org/apache/activemq/artemis/lockmanager/zookeeper/CuratorDistributedLockTest.java index e04edb7f83..316d045353 100644 --- a/artemis-quorum-ri/src/test/java/org/apache/activemq/artemis/quorum/zookeeper/CuratorDistributedLockTest.java +++ b/artemis-lockmanager/artemis-lockmanager-ri/src/test/java/org/apache/activemq/artemis/lockmanager/zookeeper/CuratorDistributedLockTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.quorum.zookeeper; +package org.apache.activemq.artemis.lockmanager.zookeeper; import java.io.IOException; import java.util.Arrays; @@ -28,14 +28,14 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; -import org.apache.activemq.artemis.quorum.DistributedLock; -import org.apache.activemq.artemis.quorum.DistributedPrimitiveManager; -import org.apache.activemq.artemis.quorum.UnavailableStateException; +import org.apache.activemq.artemis.lockmanager.DistributedLock; +import org.apache.activemq.artemis.lockmanager.DistributedLockManager; +import org.apache.activemq.artemis.lockmanager.UnavailableStateException; import org.apache.activemq.artemis.utils.Wait; import org.apache.curator.test.InstanceSpec; import org.apache.curator.test.TestingCluster; -import org.apache.activemq.artemis.quorum.DistributedLockTest; +import org.apache.activemq.artemis.lockmanager.DistributedLockTest; import org.apache.curator.test.TestingZooKeeperServer; import org.junit.Assert; import org.junit.Assume; @@ -102,19 +102,19 @@ public class CuratorDistributedLockTest extends DistributedLockTest { @Override protected String managerClassName() { - return CuratorDistributedPrimitiveManager.class.getName(); + return CuratorDistributedLockManager.class.getName(); } @Test(expected = RuntimeException.class) public void cannotCreateManagerWithNotValidParameterNames() { - final DistributedPrimitiveManager manager = createManagedDistributeManager(config -> config.put("_", "_")); + final DistributedLockManager manager = createManagedDistributeManager(config -> config.put("_", "_")); } @Test public void canAcquireLocksFromDifferentNamespace() throws ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { - final DistributedPrimitiveManager manager1 = createManagedDistributeManager(config -> config.put("namespace", "1")); + final DistributedLockManager manager1 = createManagedDistributeManager(config -> config.put("namespace", "1")); manager1.start(); - final DistributedPrimitiveManager manager2 = createManagedDistributeManager(config -> config.put("namespace", "2")); + final DistributedLockManager manager2 = createManagedDistributeManager(config -> config.put("namespace", "2")); manager2.start(); Assert.assertTrue(manager1.getDistributedLock("a").tryLock()); Assert.assertTrue(manager2.getDistributedLock("a").tryLock()); @@ -122,14 +122,14 @@ public class CuratorDistributedLockTest extends DistributedLockTest { @Test public void cannotStartManagerWithDisconnectedServer() throws IOException, ExecutionException, InterruptedException { - final DistributedPrimitiveManager manager = createManagedDistributeManager(); + final DistributedLockManager manager = createManagedDistributeManager(); testingServer.close(); Assert.assertFalse(manager.start(1, TimeUnit.SECONDS)); } @Test(expected = UnavailableStateException.class) public void cannotAcquireLockWithDisconnectedServer() throws IOException, ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { - final DistributedPrimitiveManager manager = createManagedDistributeManager(); + final DistributedLockManager manager = createManagedDistributeManager(); manager.start(); final DistributedLock lock = manager.getDistributedLock("a"); final CountDownLatch notAvailable = new CountDownLatch(1); @@ -142,7 +142,7 @@ public class CuratorDistributedLockTest extends DistributedLockTest { @Test(expected = UnavailableStateException.class) public void cannotTryLockWithDisconnectedServer() throws IOException, ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { - final DistributedPrimitiveManager manager = createManagedDistributeManager(); + final DistributedLockManager manager = createManagedDistributeManager(); manager.start(); final DistributedLock lock = manager.getDistributedLock("a"); testingServer.close(); @@ -151,7 +151,7 @@ public class CuratorDistributedLockTest extends DistributedLockTest { @Test(expected = UnavailableStateException.class) public void cannotCheckLockStatusWithDisconnectedServer() throws IOException, ExecutionException, InterruptedException, TimeoutException, UnavailableStateException { - final DistributedPrimitiveManager manager = createManagedDistributeManager(); + final DistributedLockManager manager = createManagedDistributeManager(); manager.start(); final DistributedLock lock = manager.getDistributedLock("a"); Assert.assertFalse(lock.isHeldByCaller()); @@ -162,7 +162,7 @@ public class CuratorDistributedLockTest extends DistributedLockTest { @Test(expected = UnavailableStateException.class) public void looseLockAfterServerStop() throws ExecutionException, InterruptedException, TimeoutException, UnavailableStateException, IOException { - final DistributedPrimitiveManager manager = createManagedDistributeManager(); + final DistributedLockManager manager = createManagedDistributeManager(); manager.start(); final DistributedLock lock = manager.getDistributedLock("a"); Assert.assertTrue(lock.tryLock()); @@ -179,7 +179,7 @@ public class CuratorDistributedLockTest extends DistributedLockTest { @Test public void canAcquireLockOnMajorityRestart() throws Exception { Assume.assumeTrue(zkNodes + " <= 1", zkNodes > 1); - final DistributedPrimitiveManager manager = createManagedDistributeManager(); + final DistributedLockManager manager = createManagedDistributeManager(); manager.start(); final DistributedLock lock = manager.getDistributedLock("a"); Assert.assertTrue(lock.tryLock()); @@ -192,7 +192,7 @@ public class CuratorDistributedLockTest extends DistributedLockTest { notAvailable.await(); manager.stop(); restartMajorityNodes(true); - final DistributedPrimitiveManager otherManager = createManagedDistributeManager(); + final DistributedLockManager otherManager = createManagedDistributeManager(); otherManager.start(); // await more then the expected value, that depends by how curator session expiration is configured TimeUnit.MILLISECONDS.sleep(SESSION_MS + SERVER_TICK_MS); @@ -202,7 +202,7 @@ public class CuratorDistributedLockTest extends DistributedLockTest { @Test public void cannotStartManagerWithoutQuorum() throws Exception { Assume.assumeTrue(zkNodes + " <= 1", zkNodes > 1); - DistributedPrimitiveManager manager = createManagedDistributeManager(); + DistributedLockManager manager = createManagedDistributeManager(); stopMajority(true); Assert.assertFalse(manager.start(2, TimeUnit.SECONDS)); Assert.assertFalse(manager.isStarted()); @@ -211,7 +211,7 @@ public class CuratorDistributedLockTest extends DistributedLockTest { @Test(expected = UnavailableStateException.class) public void cannotAcquireLockWithoutQuorum() throws Exception { Assume.assumeTrue(zkNodes + " <= 1", zkNodes > 1); - DistributedPrimitiveManager manager = createManagedDistributeManager(); + DistributedLockManager manager = createManagedDistributeManager(); manager.start(); stopMajority(true); DistributedLock lock = manager.getDistributedLock("a"); @@ -221,7 +221,7 @@ public class CuratorDistributedLockTest extends DistributedLockTest { @Test public void cannotCheckLockWithoutQuorum() throws Exception { Assume.assumeTrue(zkNodes + " <= 1", zkNodes > 1); - DistributedPrimitiveManager manager = createManagedDistributeManager(); + DistributedLockManager manager = createManagedDistributeManager(); manager.start(); stopMajority(true); DistributedLock lock = manager.getDistributedLock("a"); @@ -237,7 +237,7 @@ public class CuratorDistributedLockTest extends DistributedLockTest { @Test public void canGetLockWithoutQuorum() throws Exception { Assume.assumeTrue(zkNodes + " <= 1", zkNodes > 1); - DistributedPrimitiveManager manager = createManagedDistributeManager(); + DistributedLockManager manager = createManagedDistributeManager(); manager.start(); stopMajority(true); DistributedLock lock = manager.getDistributedLock("a"); @@ -247,7 +247,7 @@ public class CuratorDistributedLockTest extends DistributedLockTest { @Test public void notifiedAsUnavailableWhileLoosingQuorum() throws Exception { Assume.assumeTrue(zkNodes + " <= 1", zkNodes > 1); - DistributedPrimitiveManager manager = createManagedDistributeManager(); + DistributedLockManager manager = createManagedDistributeManager(); manager.start(); DistributedLock lock = manager.getDistributedLock("a"); CountDownLatch unavailable = new CountDownLatch(1); @@ -259,7 +259,7 @@ public class CuratorDistributedLockTest extends DistributedLockTest { @Test public void beNotifiedOnce() throws Exception { Assume.assumeTrue(zkNodes + " <= 1", zkNodes > 1); - DistributedPrimitiveManager manager = createManagedDistributeManager(); + DistributedLockManager manager = createManagedDistributeManager(); manager.start(); DistributedLock lock = manager.getDistributedLock("a"); final AtomicInteger unavailableManager = new AtomicInteger(0); @@ -275,14 +275,14 @@ public class CuratorDistributedLockTest extends DistributedLockTest { @Test public void beNotifiedOfUnavailabilityWhileBlockedOnTimedLock() throws Exception { Assume.assumeTrue(zkNodes + " <= 1", zkNodes > 1); - DistributedPrimitiveManager manager = createManagedDistributeManager(); + DistributedLockManager manager = createManagedDistributeManager(); manager.start(); DistributedLock lock = manager.getDistributedLock("a"); final AtomicInteger unavailableManager = new AtomicInteger(0); final AtomicInteger unavailableLock = new AtomicInteger(0); manager.addUnavailableManagerListener(unavailableManager::incrementAndGet); lock.addListener(unavailableLock::incrementAndGet); - final DistributedPrimitiveManager otherManager = createManagedDistributeManager(); + final DistributedLockManager otherManager = createManagedDistributeManager(); otherManager.start(); Assert.assertTrue(otherManager.getDistributedLock("a").tryLock()); final CountDownLatch startedTimedLock = new CountDownLatch(1); @@ -311,10 +311,10 @@ public class CuratorDistributedLockTest extends DistributedLockTest { @Test public void beNotifiedOfAlreadyUnavailableManagerAfterAddingListener() throws Exception { Assume.assumeTrue(zkNodes + " <= 1", zkNodes > 1); - DistributedPrimitiveManager manager = createManagedDistributeManager(); + DistributedLockManager manager = createManagedDistributeManager(); manager.start(); final AtomicBoolean unavailable = new AtomicBoolean(false); - DistributedPrimitiveManager.UnavailableManagerListener managerListener = () -> { + DistributedLockManager.UnavailableManagerListener managerListener = () -> { unavailable.set(true); }; manager.addUnavailableManagerListener(managerListener); diff --git a/artemis-lockmanager/pom.xml b/artemis-lockmanager/pom.xml new file mode 100644 index 0000000000..bc88f3c7a8 --- /dev/null +++ b/artemis-lockmanager/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + + org.apache.activemq + artemis-pom + 2.33.0-SNAPSHOT + ../artemis-pom/pom.xml + + + artemis-lockmanager + pom + ActiveMQ Artemis Lock Manager + + + artemis-lockmanager-api + artemis-lockmanager-ri + + + diff --git a/artemis-server/pom.xml b/artemis-server/pom.xml index 81014b3e95..e57adc4952 100644 --- a/artemis-server/pom.xml +++ b/artemis-server/pom.xml @@ -88,7 +88,7 @@ org.apache.activemq - artemis-quorum-api + artemis-lockmanager-api org.jctools diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ConfigurationUtils.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ConfigurationUtils.java index dd495b9e5a..05eb177a3a 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ConfigurationUtils.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ConfigurationUtils.java @@ -75,18 +75,18 @@ public final class ConfigurationUtils { PrimaryOnlyPolicyConfiguration pc = (PrimaryOnlyPolicyConfiguration) conf; return new PrimaryOnlyPolicy(getScaleDownPolicy(pc.getScaleDownConfiguration())); } - case REPLICATED: { + case REPLICATION_PRIMARY_QUORUM_VOTING: { ReplicatedPolicyConfiguration pc = (ReplicatedPolicyConfiguration) conf; return new ReplicatedPolicy(pc.isCheckForActiveServer(), pc.getGroupName(), pc.getClusterName(), pc.getMaxSavedReplicatedJournalsSize(), pc.getInitialReplicationSyncTimeout(), server.getNetworkHealthCheck(), pc.getVoteOnReplicationFailure(), pc.getQuorumSize(), pc.getVoteRetries(), pc.getVoteRetryWait(), pc.getQuorumVoteWait(), pc.getRetryReplicationWait()); } - case REPLICA: { + case REPLICATION_BACKUP_QUORUM_VOTING: { ReplicaPolicyConfiguration pc = (ReplicaPolicyConfiguration) conf; return new ReplicaPolicy(pc.getClusterName(), pc.getMaxSavedReplicatedJournalsSize(), pc.getGroupName(), pc.isRestartBackup(), pc.isAllowFailBack(), pc.getInitialReplicationSyncTimeout(), getScaleDownPolicy(pc.getScaleDownConfiguration()), server.getNetworkHealthCheck(), pc.getVoteOnReplicationFailure(), pc.getQuorumSize(), pc.getVoteRetries(), pc.getVoteRetryWait(), pc.getQuorumVoteWait(), pc.getRetryReplicationWait()); } - case REPLICATION_PRIMARY: { + case REPLICATION_PRIMARY_LOCK_MANAGER: { return ReplicationPrimaryPolicy.with((ReplicationPrimaryPolicyConfiguration) conf); } - case REPLICATION_BACKUP: { + case REPLICATION_BACKUP_LOCK_MANAGER: { return ReplicationBackupPolicy.with((ReplicationBackupPolicyConfiguration) conf); } case SHARED_STORE_PRIMARY: { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/HAPolicyConfiguration.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/HAPolicyConfiguration.java index baae2a33f1..b72b047daa 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/HAPolicyConfiguration.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/HAPolicyConfiguration.java @@ -22,13 +22,13 @@ public interface HAPolicyConfiguration extends Serializable { enum TYPE { PRIMARY_ONLY("Primary Only"), - REPLICATED("Replicated"), - REPLICA("Replica"), + REPLICATION_PRIMARY_QUORUM_VOTING("Replication Primary w/quorum voting"), + REPLICATION_BACKUP_QUORUM_VOTING("Replication Backup w/quorum voting"), SHARED_STORE_PRIMARY("Shared Store Primary"), SHARED_STORE_BACKUP("Shared Store Backup"), COLOCATED("Colocated"), - REPLICATION_PRIMARY("Replication Primary w/pluggable quorum voting"), - REPLICATION_BACKUP("Replication Backup w/pluggable quorum voting"); + REPLICATION_PRIMARY_LOCK_MANAGER("Replication Primary w/lock manager"), + REPLICATION_BACKUP_LOCK_MANAGER("Replication Backup w/lock manager"); private String name; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ha/DistributedPrimitiveManagerConfiguration.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ha/DistributedLockManagerConfiguration.java similarity index 80% rename from artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ha/DistributedPrimitiveManagerConfiguration.java rename to artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ha/DistributedLockManagerConfiguration.java index 6d2823a1fd..0c74bd90e5 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ha/DistributedPrimitiveManagerConfiguration.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ha/DistributedLockManagerConfiguration.java @@ -20,16 +20,16 @@ import java.io.Serializable; import java.util.HashMap; import java.util.Map; -public class DistributedPrimitiveManagerConfiguration implements Serializable { +public class DistributedLockManagerConfiguration implements Serializable { private String className; private final Map properties; - public DistributedPrimitiveManagerConfiguration() { + public DistributedLockManagerConfiguration() { properties = new HashMap<>(); } - public DistributedPrimitiveManagerConfiguration(String className, Map properties) { + public DistributedLockManagerConfiguration(String className, Map properties) { this.className = className; this.properties = properties; } @@ -38,7 +38,7 @@ public class DistributedPrimitiveManagerConfiguration implements Serializable { return className; } - public DistributedPrimitiveManagerConfiguration setClassName(String className) { + public DistributedLockManagerConfiguration setClassName(String className) { this.className = className; return this; } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ha/ReplicaPolicyConfiguration.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ha/ReplicaPolicyConfiguration.java index 721771cb2f..b02ace5c3a 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ha/ReplicaPolicyConfiguration.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ha/ReplicaPolicyConfiguration.java @@ -57,7 +57,7 @@ public class ReplicaPolicyConfiguration implements HAPolicyConfiguration { @Override public TYPE getType() { - return TYPE.REPLICA; + return TYPE.REPLICATION_BACKUP_QUORUM_VOTING; } public ScaleDownConfiguration getScaleDownConfiguration() { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ha/ReplicatedPolicyConfiguration.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ha/ReplicatedPolicyConfiguration.java index c300b89698..cd6bd0bf3a 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ha/ReplicatedPolicyConfiguration.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ha/ReplicatedPolicyConfiguration.java @@ -49,7 +49,7 @@ public class ReplicatedPolicyConfiguration implements HAPolicyConfiguration { @Override public TYPE getType() { - return TYPE.REPLICATED; + return TYPE.REPLICATION_PRIMARY_QUORUM_VOTING; } public boolean isCheckForActiveServer() { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ha/ReplicationBackupPolicyConfiguration.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ha/ReplicationBackupPolicyConfiguration.java index 76fc625d03..2b47948128 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ha/ReplicationBackupPolicyConfiguration.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ha/ReplicationBackupPolicyConfiguration.java @@ -36,7 +36,7 @@ public class ReplicationBackupPolicyConfiguration implements HAPolicyConfigurati private long retryReplicationWait = ActiveMQDefaultConfiguration.getDefaultRetryReplicationWait(); - private DistributedPrimitiveManagerConfiguration distributedManagerConfiguration = null; + private DistributedLockManagerConfiguration distributedManagerConfiguration = null; public static final ReplicationBackupPolicyConfiguration withDefault() { return new ReplicationBackupPolicyConfiguration(); @@ -47,7 +47,7 @@ public class ReplicationBackupPolicyConfiguration implements HAPolicyConfigurati @Override public HAPolicyConfiguration.TYPE getType() { - return TYPE.REPLICATION_BACKUP; + return TYPE.REPLICATION_BACKUP_LOCK_MANAGER; } public String getClusterName() { @@ -104,12 +104,12 @@ public class ReplicationBackupPolicyConfiguration implements HAPolicyConfigurati return this; } - public ReplicationBackupPolicyConfiguration setDistributedManagerConfiguration(DistributedPrimitiveManagerConfiguration configuration) { + public ReplicationBackupPolicyConfiguration setDistributedManagerConfiguration(DistributedLockManagerConfiguration configuration) { this.distributedManagerConfiguration = configuration; return this; } - public DistributedPrimitiveManagerConfiguration getDistributedManagerConfiguration() { + public DistributedLockManagerConfiguration getDistributedManagerConfiguration() { return distributedManagerConfiguration; } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ha/ReplicationPrimaryPolicyConfiguration.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ha/ReplicationPrimaryPolicyConfiguration.java index f2b8d4cc56..69204a794e 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ha/ReplicationPrimaryPolicyConfiguration.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ha/ReplicationPrimaryPolicyConfiguration.java @@ -29,7 +29,7 @@ public class ReplicationPrimaryPolicyConfiguration implements HAPolicyConfigurat private Long retryReplicationWait = ActiveMQDefaultConfiguration.getDefaultRetryReplicationWait(); - private DistributedPrimitiveManagerConfiguration distributedManagerConfiguration = null; + private DistributedLockManagerConfiguration distributedManagerConfiguration = null; private String coordinationId = null; @@ -44,7 +44,7 @@ public class ReplicationPrimaryPolicyConfiguration implements HAPolicyConfigurat @Override public TYPE getType() { - return TYPE.REPLICATION_PRIMARY; + return TYPE.REPLICATION_PRIMARY_LOCK_MANAGER; } public String getGroupName() { @@ -82,12 +82,12 @@ public class ReplicationPrimaryPolicyConfiguration implements HAPolicyConfigurat return retryReplicationWait; } - public ReplicationPrimaryPolicyConfiguration setDistributedManagerConfiguration(DistributedPrimitiveManagerConfiguration configuration) { + public ReplicationPrimaryPolicyConfiguration setDistributedManagerConfiguration(DistributedLockManagerConfiguration configuration) { this.distributedManagerConfiguration = configuration; return this; } - public DistributedPrimitiveManagerConfiguration getDistributedManagerConfiguration() { + public DistributedLockManagerConfiguration getDistributedManagerConfiguration() { return distributedManagerConfiguration; } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java index 1e552f65a2..4e7ecf87c1 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java @@ -29,6 +29,7 @@ import java.io.ObjectOutputStream; import java.io.PrintWriter; import java.io.Serializable; import java.io.StringWriter; +import java.lang.invoke.MethodHandles; import java.lang.reflect.Array; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -51,6 +52,8 @@ import java.util.Set; import java.util.Stack; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.TimeUnit; +import java.util.zip.Adler32; +import java.util.zip.Checksum; import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration; @@ -60,16 +63,6 @@ import org.apache.activemq.artemis.api.core.Pair; import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; -import org.apache.activemq.artemis.core.config.TransformerConfiguration; -import org.apache.activemq.artemis.core.config.ha.ColocatedPolicyConfiguration; -import org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration; -import org.apache.activemq.artemis.core.config.ha.ReplicationBackupPolicyConfiguration; -import org.apache.activemq.artemis.core.config.ha.ReplicationPrimaryPolicyConfiguration; -import org.apache.activemq.artemis.core.config.ha.SharedStoreBackupPolicyConfiguration; -import org.apache.activemq.artemis.core.config.ha.SharedStorePrimaryPolicyConfiguration; -import org.apache.activemq.artemis.core.config.routing.ConnectionRouterConfiguration; -import org.apache.activemq.artemis.core.config.amqpBrokerConnectivity.AMQPBrokerConnectConfiguration; -import org.apache.activemq.artemis.core.config.amqpBrokerConnectivity.AMQPFederationBrokerPlugin; import org.apache.activemq.artemis.core.config.BridgeConfiguration; import org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration; import org.apache.activemq.artemis.core.config.Configuration; @@ -82,16 +75,26 @@ import org.apache.activemq.artemis.core.config.FederationConfiguration; import org.apache.activemq.artemis.core.config.HAPolicyConfiguration; import org.apache.activemq.artemis.core.config.MetricsConfiguration; import org.apache.activemq.artemis.core.config.StoreConfiguration; +import org.apache.activemq.artemis.core.config.TransformerConfiguration; import org.apache.activemq.artemis.core.config.WildcardConfiguration; +import org.apache.activemq.artemis.core.config.amqpBrokerConnectivity.AMQPBrokerConnectConfiguration; +import org.apache.activemq.artemis.core.config.amqpBrokerConnectivity.AMQPFederationBrokerPlugin; +import org.apache.activemq.artemis.core.config.ha.ColocatedPolicyConfiguration; +import org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration; import org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration; import org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration; +import org.apache.activemq.artemis.core.config.ha.ReplicationBackupPolicyConfiguration; +import org.apache.activemq.artemis.core.config.ha.ReplicationPrimaryPolicyConfiguration; +import org.apache.activemq.artemis.core.config.ha.SharedStoreBackupPolicyConfiguration; +import org.apache.activemq.artemis.core.config.ha.SharedStorePrimaryPolicyConfiguration; +import org.apache.activemq.artemis.core.config.routing.ConnectionRouterConfiguration; import org.apache.activemq.artemis.core.config.routing.NamedPropertyConfiguration; import org.apache.activemq.artemis.core.config.storage.DatabaseStorageConfiguration; import org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory; import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory; import org.apache.activemq.artemis.core.security.Role; -import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle; +import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; import org.apache.activemq.artemis.core.server.JournalType; import org.apache.activemq.artemis.core.server.NetworkHealthCheck; import org.apache.activemq.artemis.core.server.SecuritySettingPlugin; @@ -130,13 +133,9 @@ import org.apache.commons.beanutils.MappedPropertyDescriptor; import org.apache.commons.beanutils.MethodUtils; import org.apache.commons.beanutils.PropertyUtilsBean; import org.apache.commons.beanutils.expression.DefaultResolver; +import org.apache.commons.beanutils.expression.Resolver; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.lang.invoke.MethodHandles; -import java.util.zip.Adler32; -import java.util.zip.Checksum; - -import org.apache.commons.beanutils.expression.Resolver; public class ConfigurationImpl implements Configuration, Serializable { @@ -884,9 +883,9 @@ public class ConfigurationImpl implements Configuration, Serializable { switch (haPolicyType) { case PRIMARY_ONLY: return (T) new LiveOnlyPolicyConfiguration(); - case REPLICATED: + case REPLICATION_PRIMARY_QUORUM_VOTING: return (T) new ReplicatedPolicyConfiguration(); - case REPLICA: + case REPLICATION_BACKUP_QUORUM_VOTING: return (T) new ReplicaPolicyConfiguration(); case SHARED_STORE_PRIMARY: return (T) new SharedStorePrimaryPolicyConfiguration(); @@ -894,9 +893,9 @@ public class ConfigurationImpl implements Configuration, Serializable { return (T) new SharedStoreBackupPolicyConfiguration(); case COLOCATED: return (T) new ColocatedPolicyConfiguration(); - case REPLICATION_PRIMARY: + case REPLICATION_PRIMARY_LOCK_MANAGER: return (T) ReplicationPrimaryPolicyConfiguration.withDefault(); - case REPLICATION_BACKUP: + case REPLICATION_BACKUP_LOCK_MANAGER: return (T) ReplicationBackupPolicyConfiguration.withDefault(); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java index 527afd5f37..7808df5187 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java @@ -71,7 +71,7 @@ import org.apache.activemq.artemis.core.config.federation.FederationStreamConfig import org.apache.activemq.artemis.core.config.federation.FederationTransformerConfiguration; import org.apache.activemq.artemis.core.config.federation.FederationUpstreamConfiguration; import org.apache.activemq.artemis.core.config.ha.ColocatedPolicyConfiguration; -import org.apache.activemq.artemis.core.config.ha.DistributedPrimitiveManagerConfiguration; +import org.apache.activemq.artemis.core.config.ha.DistributedLockManagerConfiguration; import org.apache.activemq.artemis.core.config.ha.PrimaryOnlyPolicyConfiguration; import org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration; import org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration; @@ -1823,7 +1823,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { configuration.setClusterName(getString(policyNode, "cluster-name", configuration.getClusterName(), NO_CHECK)); configuration.setInitialReplicationSyncTimeout(getLong(policyNode, "initial-replication-sync-timeout", configuration.getInitialReplicationSyncTimeout(), GT_ZERO)); configuration.setRetryReplicationWait(getLong(policyNode, "retry-replication-wait", configuration.getRetryReplicationWait(), GT_ZERO)); - configuration.setDistributedManagerConfiguration(createDistributedPrimitiveManagerConfiguration(policyNode)); + configuration.setDistributedManagerConfiguration(createDistributedLockManagerConfiguration(policyNode)); configuration.setCoordinationId(getString(policyNode, "coordination-id", configuration.getCoordinationId(), NOT_NULL_OR_EMPTY)); configuration.setMaxSavedReplicatedJournalsSize(getInteger(policyNode, "max-saved-replicated-journals-size", configuration.getMaxSavedReplicatedJournalsSize(), MINUS_ONE_OR_GE_ZERO)); return configuration; @@ -1837,14 +1837,14 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { configuration.setClusterName(getString(policyNode, "cluster-name", configuration.getClusterName(), NO_CHECK)); configuration.setMaxSavedReplicatedJournalsSize(getInteger(policyNode, "max-saved-replicated-journals-size", configuration.getMaxSavedReplicatedJournalsSize(), MINUS_ONE_OR_GE_ZERO)); configuration.setRetryReplicationWait(getLong(policyNode, "retry-replication-wait", configuration.getRetryReplicationWait(), GT_ZERO)); - configuration.setDistributedManagerConfiguration(createDistributedPrimitiveManagerConfiguration(policyNode)); + configuration.setDistributedManagerConfiguration(createDistributedLockManagerConfiguration(policyNode)); return configuration; } - private DistributedPrimitiveManagerConfiguration createDistributedPrimitiveManagerConfiguration(Element policyNode) { + private DistributedLockManagerConfiguration createDistributedLockManagerConfiguration(Element policyNode) { final Element managerNode = (Element) policyNode.getElementsByTagName("manager").item(0); final String className = getString(managerNode, "class-name", - ActiveMQDefaultConfiguration.getDefaultDistributedPrimitiveManagerClassName(), + ActiveMQDefaultConfiguration.getDefaultDistributedLockManagerClassName(), NO_CHECK); final Map properties; if (parameterExists(managerNode, "properties")) { @@ -1860,7 +1860,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { } else { properties = new HashMap<>(1); } - return new DistributedPrimitiveManagerConfiguration(className, properties); + return new DistributedLockManagerConfiguration(className, properties); } private SharedStorePrimaryPolicyConfiguration createSharedStorePrimaryHaPolicy(Element policyNode) { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/QuorumVoteMessage.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/QuorumVoteMessage.java index 3e09fda467..cedeae8262 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/QuorumVoteMessage.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/QuorumVoteMessage.java @@ -20,8 +20,8 @@ import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.api.core.ActiveMQBuffers; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl; -import org.apache.activemq.artemis.core.server.cluster.qourum.QuorumVoteHandler; -import org.apache.activemq.artemis.core.server.cluster.qourum.Vote; +import org.apache.activemq.artemis.core.server.cluster.quorum.QuorumVoteHandler; +import org.apache.activemq.artemis.core.server.cluster.quorum.Vote; public class QuorumVoteMessage extends PacketImpl { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/QuorumVoteReplyMessage.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/QuorumVoteReplyMessage.java index 8a4f091328..8a93bfc833 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/QuorumVoteReplyMessage.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/QuorumVoteReplyMessage.java @@ -20,8 +20,8 @@ import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.api.core.ActiveMQBuffers; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl; -import org.apache.activemq.artemis.core.server.cluster.qourum.QuorumVoteHandler; -import org.apache.activemq.artemis.core.server.cluster.qourum.Vote; +import org.apache.activemq.artemis.core.server.cluster.quorum.QuorumVoteHandler; +import org.apache.activemq.artemis.core.server.cluster.quorum.Vote; public class QuorumVoteReplyMessage extends PacketImpl { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationManager.java index 478dfc259b..db1696f2c4 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationManager.java @@ -80,7 +80,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; import org.apache.activemq.artemis.core.server.cluster.ClusterManager; -import org.apache.activemq.artemis.core.server.cluster.qourum.QuorumManager; +import org.apache.activemq.artemis.core.server.cluster.quorum.QuorumManager; import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection; import org.apache.activemq.artemis.spi.core.remoting.Connection; import org.apache.activemq.artemis.spi.core.remoting.ReadyListener; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java index feb9c10d30..d3320883e2 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java @@ -44,7 +44,7 @@ import org.apache.activemq.artemis.core.server.routing.targets.Target; import org.apache.activemq.artemis.core.server.cluster.Bridge; import org.apache.activemq.artemis.core.server.cluster.impl.BridgeImpl; import org.apache.activemq.artemis.core.server.cluster.impl.ClusterConnectionImpl; -import org.apache.activemq.artemis.core.server.cluster.qourum.ServerConnectVote; +import org.apache.activemq.artemis.core.server.cluster.quorum.ServerConnectVote; import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl; import org.apache.activemq.artemis.core.server.impl.ServerSessionImpl; import org.apache.activemq.artemis.core.server.management.Notification; @@ -68,7 +68,7 @@ public interface ActiveMQServerLogger { @LogMessage(id = 223001, value = "Ignored quorum vote due to quorum reached or vote casted: {}", level = LogMessage.Level.DEBUG) void ignoredQuorumVote(ServerConnectVote vote); - @LogMessage(id = 221000, value = "{} Message Broker is starting with configuration {}", level = LogMessage.Level.INFO) + @LogMessage(id = 221000, value = "{} message broker is starting with configuration {}", level = LogMessage.Level.INFO) void serverStarting(String type, Configuration configuration); @LogMessage(id = 221001, value = "Apache ActiveMQ Artemis Message Broker version {} [{}, nodeID={}] {}", level = LogMessage.Level.INFO) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterController.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterController.java index 8292b23f5b..8b8269ff09 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterController.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterController.java @@ -49,7 +49,7 @@ import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ScaleDownA import org.apache.activemq.artemis.core.server.ActiveMQComponent; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; -import org.apache.activemq.artemis.core.server.cluster.qourum.QuorumManager; +import org.apache.activemq.artemis.core.server.cluster.quorum.QuorumManager; import org.apache.activemq.artemis.core.server.impl.Activation; import org.apache.activemq.artemis.spi.core.remoting.Acceptor; import org.slf4j.Logger; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java index 2ffe42d44e..e2117758f4 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java @@ -57,7 +57,7 @@ import org.apache.activemq.artemis.core.server.cluster.ha.HAManager; import org.apache.activemq.artemis.core.server.cluster.impl.BridgeImpl; import org.apache.activemq.artemis.core.server.cluster.impl.BroadcastGroupImpl; import org.apache.activemq.artemis.core.server.cluster.impl.ClusterConnectionImpl; -import org.apache.activemq.artemis.core.server.cluster.qourum.QuorumManager; +import org.apache.activemq.artemis.core.server.cluster.quorum.QuorumManager; import org.apache.activemq.artemis.core.server.impl.Activation; import org.apache.activemq.artemis.core.server.management.ManagementService; import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ReplicationBackupPolicy.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ReplicationBackupPolicy.java index f2b370c281..50080d2e09 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ReplicationBackupPolicy.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ReplicationBackupPolicy.java @@ -20,11 +20,11 @@ import java.util.Map; import java.util.Objects; import org.apache.activemq.artemis.core.config.ha.ReplicationBackupPolicyConfiguration; -import org.apache.activemq.artemis.core.config.ha.DistributedPrimitiveManagerConfiguration; +import org.apache.activemq.artemis.core.config.ha.DistributedLockManagerConfiguration; import org.apache.activemq.artemis.core.io.IOCriticalErrorListener; import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl; import org.apache.activemq.artemis.core.server.impl.ReplicationBackupActivation; -import org.apache.activemq.artemis.quorum.DistributedPrimitiveManager; +import org.apache.activemq.artemis.lockmanager.DistributedLockManager; public class ReplicationBackupPolicy implements HAPolicy { @@ -33,7 +33,7 @@ public class ReplicationBackupPolicy implements HAPolicy activationParams, IOCriticalErrorListener shutdownOnCriticalIO) throws Exception { - return new ReplicationBackupActivation(server, DistributedPrimitiveManager.newInstanceOf( + return new ReplicationBackupActivation(server, DistributedLockManager.newInstanceOf( managerConfiguration.getClassName(), managerConfiguration.getProperties()), this); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ReplicationPrimaryPolicy.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ReplicationPrimaryPolicy.java index 62a1580d0d..1de2dee57f 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ReplicationPrimaryPolicy.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ReplicationPrimaryPolicy.java @@ -20,11 +20,11 @@ import java.util.Map; import java.util.Objects; import org.apache.activemq.artemis.core.config.ha.ReplicationPrimaryPolicyConfiguration; -import org.apache.activemq.artemis.core.config.ha.DistributedPrimitiveManagerConfiguration; +import org.apache.activemq.artemis.core.config.ha.DistributedLockManagerConfiguration; import org.apache.activemq.artemis.core.io.IOCriticalErrorListener; import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl; import org.apache.activemq.artemis.core.server.impl.ReplicationPrimaryActivation; -import org.apache.activemq.artemis.quorum.DistributedPrimitiveManager; +import org.apache.activemq.artemis.lockmanager.DistributedLockManager; public class ReplicationPrimaryPolicy implements HAPolicy { @@ -32,7 +32,7 @@ public class ReplicationPrimaryPolicy implements HAPolicy activationParams, IOCriticalErrorListener shutdownOnCriticalIO) throws Exception { return new ReplicationPrimaryActivation(server, - DistributedPrimitiveManager.newInstanceOf( + DistributedLockManager.newInstanceOf( distributedManagerConfiguration.getClassName(), distributedManagerConfiguration.getProperties()), this); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/BooleanVote.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/BooleanVote.java similarity index 96% rename from artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/BooleanVote.java rename to artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/BooleanVote.java index 90f55ed498..8bd961e722 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/BooleanVote.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/BooleanVote.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.core.server.cluster.qourum; +package org.apache.activemq.artemis.core.server.cluster.quorum; import java.util.Map; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/Quorum.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/Quorum.java similarity index 96% rename from artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/Quorum.java rename to artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/Quorum.java index d3db6e70c4..494ae23c40 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/Quorum.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/Quorum.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.core.server.cluster.qourum; +package org.apache.activemq.artemis.core.server.cluster.quorum; import org.apache.activemq.artemis.core.client.impl.Topology; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/QuorumManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/QuorumManager.java similarity index 97% rename from artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/QuorumManager.java rename to artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/QuorumManager.java index 6fc44a2bd4..6c1f1bdbf1 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/QuorumManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/QuorumManager.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.core.server.cluster.qourum; +package org.apache.activemq.artemis.core.server.cluster.quorum; import java.util.ArrayList; import java.util.HashMap; @@ -45,8 +45,8 @@ import org.apache.activemq.artemis.core.server.cluster.ClusterController; import static org.apache.activemq.artemis.utils.Preconditions.checkNotNull; /** - * A QourumManager can be used to register a {@link org.apache.activemq.artemis.core.server.cluster.qourum.Quorum} to receive notifications - * about changes to the cluster. A {@link org.apache.activemq.artemis.core.server.cluster.qourum.Quorum} can then issue a vote to the + * A QourumManager can be used to register a {@link org.apache.activemq.artemis.core.server.cluster.quorum.Quorum} to receive notifications + * about changes to the cluster. A {@link org.apache.activemq.artemis.core.server.cluster.quorum.Quorum} can then issue a vote to the * remaining nodes in a cluster for a specific outcome */ public final class QuorumManager implements ClusterTopologyListener, ActiveMQComponent { @@ -56,7 +56,7 @@ public final class QuorumManager implements ClusterTopologyListener, ActiveMQCom private final ClusterController clusterController; /** - * all the current registered {@link org.apache.activemq.artemis.core.server.cluster.qourum.Quorum}'s + * all the current registered {@link org.apache.activemq.artemis.core.server.cluster.quorum.Quorum}'s */ private final Map quorums = new HashMap<>(); @@ -128,7 +128,7 @@ public final class QuorumManager implements ClusterTopologyListener, ActiveMQCom } /** - * registers a {@link org.apache.activemq.artemis.core.server.cluster.qourum.Quorum} so that it can be notified of changes in the cluster. + * registers a {@link org.apache.activemq.artemis.core.server.cluster.quorum.Quorum} so that it can be notified of changes in the cluster. * * @param quorum */ @@ -138,7 +138,7 @@ public final class QuorumManager implements ClusterTopologyListener, ActiveMQCom } /** - * unregisters a {@link org.apache.activemq.artemis.core.server.cluster.qourum.Quorum}. + * unregisters a {@link org.apache.activemq.artemis.core.server.cluster.quorum.Quorum}. * * @param quorum */ @@ -148,7 +148,7 @@ public final class QuorumManager implements ClusterTopologyListener, ActiveMQCom /** * called by the {@link org.apache.activemq.artemis.core.client.impl.ServerLocatorInternal} when the topology changes. we update the - * {@code maxClusterSize} if needed and inform the {@link org.apache.activemq.artemis.core.server.cluster.qourum.Quorum}'s. + * {@code maxClusterSize} if needed and inform the {@link org.apache.activemq.artemis.core.server.cluster.quorum.Quorum}'s. * * @param topologyMember the topolgy changed * @param last if the whole cluster topology is being transmitted (after adding the listener to @@ -164,7 +164,7 @@ public final class QuorumManager implements ClusterTopologyListener, ActiveMQCom } /** - * notify the {@link org.apache.activemq.artemis.core.server.cluster.qourum.Quorum} of a topology change. + * notify the {@link org.apache.activemq.artemis.core.server.cluster.quorum.Quorum} of a topology change. * * @param eventUID * @param nodeID the id of the node leaving the cluster @@ -367,7 +367,7 @@ public final class QuorumManager implements ClusterTopologyListener, ActiveMQCom /** * this will connect to a node and then cast a vote. whether or not this vote is asked of the target node is dependent - * on {@link org.apache.activemq.artemis.core.server.cluster.qourum.Vote#isRequestServerVote()} + * on {@link org.apache.activemq.artemis.core.server.cluster.quorum.Vote#isRequestServerVote()} */ private final class VoteRunnable implements Runnable { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/QuorumVote.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/QuorumVote.java similarity index 86% rename from artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/QuorumVote.java rename to artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/QuorumVote.java index 896c9ac88f..0c974413b0 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/QuorumVote.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/QuorumVote.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.core.server.cluster.qourum; +package org.apache.activemq.artemis.core.server.cluster.quorum; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.client.impl.Topology; @@ -31,7 +31,7 @@ public abstract class QuorumVote { } /** - * called by the {@link org.apache.activemq.artemis.core.server.cluster.qourum.QuorumManager} when one of the nodes in the quorum is + * called by the {@link org.apache.activemq.artemis.core.server.cluster.quorum.QuorumManager} when one of the nodes in the quorum is * successfully connected to. The QuorumVote can then decide whether or not a decision can be made with just that information. * * @return the vote to use @@ -39,7 +39,7 @@ public abstract class QuorumVote { public abstract Vote connected(); /** - * called by the {@link org.apache.activemq.artemis.core.server.cluster.qourum.QuorumManager} fails to connect to a node in the quorum. + * called by the {@link org.apache.activemq.artemis.core.server.cluster.quorum.QuorumManager} fails to connect to a node in the quorum. * The QuorumVote can then decide whether or not a decision can be made with just that information however the node * cannot cannot be asked. * @@ -48,7 +48,7 @@ public abstract class QuorumVote { public abstract Vote notConnected(); /** - * called by the {@link org.apache.activemq.artemis.core.server.cluster.qourum.QuorumManager} when a vote can be made, either from the + * called by the {@link org.apache.activemq.artemis.core.server.cluster.quorum.QuorumManager} when a vote can be made, either from the * cluster or decided by itself. * * @param vote the vote to make. @@ -63,14 +63,14 @@ public abstract class QuorumVote { public abstract T getDecision(); /** - * called by the {@link org.apache.activemq.artemis.core.server.cluster.qourum.QuorumManager} when all the votes have been cast and received. + * called by the {@link org.apache.activemq.artemis.core.server.cluster.quorum.QuorumManager} when all the votes have been cast and received. * * @param voteTopology the topology of where the votes were sent. */ public abstract void allVotesCast(Topology voteTopology); /** - * the name of this quorum vote, used for identifying the correct {@link org.apache.activemq.artemis.core.server.cluster.qourum.QuorumVoteHandler} + * the name of this quorum vote, used for identifying the correct {@link org.apache.activemq.artemis.core.server.cluster.quorum.QuorumVoteHandler} * * @return the name of the wuorum vote */ diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/QuorumVoteHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/QuorumVoteHandler.java similarity index 95% rename from artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/QuorumVoteHandler.java rename to artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/QuorumVoteHandler.java index 3bac81f3a3..c989a43c88 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/QuorumVoteHandler.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/QuorumVoteHandler.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.core.server.cluster.qourum; +package org.apache.activemq.artemis.core.server.cluster.quorum; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.api.core.SimpleString; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/QuorumVoteServerConnect.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/QuorumVoteServerConnect.java similarity index 98% rename from artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/QuorumVoteServerConnect.java rename to artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/QuorumVoteServerConnect.java index 8eeb52c85d..5ba9be143c 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/QuorumVoteServerConnect.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/QuorumVoteServerConnect.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.core.server.cluster.qourum; +package org.apache.activemq.artemis.core.server.cluster.quorum; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/ServerConnectVote.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/ServerConnectVote.java similarity index 97% rename from artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/ServerConnectVote.java rename to artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/ServerConnectVote.java index 61b4a1a4aa..0383a8540c 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/ServerConnectVote.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/ServerConnectVote.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.core.server.cluster.qourum; +package org.apache.activemq.artemis.core.server.cluster.quorum; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/SharedNothingBackupQuorum.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/SharedNothingBackupQuorum.java similarity index 99% rename from artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/SharedNothingBackupQuorum.java rename to artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/SharedNothingBackupQuorum.java index 077ebd1246..0a5607d407 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/SharedNothingBackupQuorum.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/SharedNothingBackupQuorum.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.core.server.cluster.qourum; +package org.apache.activemq.artemis.core.server.cluster.quorum; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ScheduledExecutorService; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/Vote.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/Vote.java similarity index 95% rename from artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/Vote.java rename to artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/Vote.java index b41af2bfa8..295b0fda58 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/Vote.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/Vote.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.core.server.cluster.qourum; +package org.apache.activemq.artemis.core.server.cluster.quorum; import java.util.HashMap; import java.util.Map; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java index 6813bee2d6..e15e7c7513 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java @@ -718,7 +718,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { throw e; } - ActiveMQServerLogger.LOGGER.serverStarting((haPolicy.isBackup() ? "backup" : "primary"), configuration); + ActiveMQServerLogger.LOGGER.serverStarting((haPolicy.isBackup() ? "Backup" : "Primary"), configuration); final boolean wasPrimary = !haPolicy.isBackup(); if (!haPolicy.isBackup()) { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ColocatedActivation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ColocatedActivation.java index b092274fcc..19eb131bcd 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ColocatedActivation.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ColocatedActivation.java @@ -39,9 +39,9 @@ import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; import org.apache.activemq.artemis.core.server.cluster.ha.ColocatedHAManager; import org.apache.activemq.artemis.core.server.cluster.ha.ColocatedPolicy; import org.apache.activemq.artemis.core.server.cluster.ha.HAManager; -import org.apache.activemq.artemis.core.server.cluster.qourum.QuorumVote; -import org.apache.activemq.artemis.core.server.cluster.qourum.QuorumVoteHandler; -import org.apache.activemq.artemis.core.server.cluster.qourum.Vote; +import org.apache.activemq.artemis.core.server.cluster.quorum.QuorumVote; +import org.apache.activemq.artemis.core.server.cluster.quorum.QuorumVoteHandler; +import org.apache.activemq.artemis.core.server.cluster.quorum.Vote; import org.apache.activemq.artemis.spi.core.remoting.Acceptor; public class ColocatedActivation extends PrimaryActivation { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ReplicationBackupActivation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ReplicationBackupActivation.java index 2ba6cad2d4..44a93837d3 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ReplicationBackupActivation.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ReplicationBackupActivation.java @@ -36,9 +36,9 @@ import org.apache.activemq.artemis.core.server.NodeManager; import org.apache.activemq.artemis.core.server.cluster.ClusterControl; import org.apache.activemq.artemis.core.server.cluster.ClusterController; import org.apache.activemq.artemis.core.server.cluster.ha.ReplicationBackupPolicy; -import org.apache.activemq.artemis.quorum.DistributedLock; -import org.apache.activemq.artemis.quorum.DistributedPrimitiveManager; -import org.apache.activemq.artemis.quorum.UnavailableStateException; +import org.apache.activemq.artemis.lockmanager.DistributedLock; +import org.apache.activemq.artemis.lockmanager.DistributedLockManager; +import org.apache.activemq.artemis.lockmanager.UnavailableStateException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.lang.invoke.MethodHandles; @@ -52,7 +52,7 @@ import static org.apache.activemq.artemis.core.server.impl.quorum.ActivationSequ * This activation can be used by a primary while trying to fail-back ie {@code failback == true} or * by a natural-born backup ie {@code failback == false}.
*/ -public final class ReplicationBackupActivation extends Activation implements DistributedPrimitiveManager.UnavailableManagerListener { +public final class ReplicationBackupActivation extends Activation implements DistributedLockManager.UnavailableManagerListener { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); @@ -62,7 +62,7 @@ public final class ReplicationBackupActivation extends Activation implements Dis private final String expectedNodeID; @GuardedBy("this") private boolean closed; - private final DistributedPrimitiveManager distributedManager; + private final DistributedLockManager distributedManager; // Used for monitoring purposes private volatile ReplicationObserver replicationObserver; // Used for testing purposes @@ -73,7 +73,7 @@ public final class ReplicationBackupActivation extends Activation implements Dis private final AtomicBoolean stopping; public ReplicationBackupActivation(final ActiveMQServerImpl activeMQServer, - final DistributedPrimitiveManager distributedManager, + final DistributedLockManager distributedManager, final ReplicationBackupPolicy policy) { this.activeMQServer = activeMQServer; if (policy.isTryFailback()) { @@ -101,7 +101,7 @@ public final class ReplicationBackupActivation extends Activation implements Dis /** * used for testing purposes. */ - public DistributedPrimitiveManager getDistributedManager() { + public DistributedLockManager getDistributedManager() { return distributedManager; } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ReplicationPrimaryActivation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ReplicationPrimaryActivation.java index 1f62503243..502aac86ee 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ReplicationPrimaryActivation.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ReplicationPrimaryActivation.java @@ -43,9 +43,9 @@ import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; import org.apache.activemq.artemis.core.server.NodeManager; import org.apache.activemq.artemis.core.server.cluster.ClusterConnection; import org.apache.activemq.artemis.core.server.cluster.ha.ReplicationPrimaryPolicy; -import org.apache.activemq.artemis.quorum.DistributedLock; -import org.apache.activemq.artemis.quorum.DistributedPrimitiveManager; -import org.apache.activemq.artemis.quorum.UnavailableStateException; +import org.apache.activemq.artemis.lockmanager.DistributedLock; +import org.apache.activemq.artemis.lockmanager.DistributedLockManager; +import org.apache.activemq.artemis.lockmanager.UnavailableStateException; import org.apache.activemq.artemis.spi.core.remoting.Acceptor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -77,12 +77,12 @@ public class ReplicationPrimaryActivation extends PrimaryActivation implements D private final Object replicationLock; - private final DistributedPrimitiveManager distributedManager; + private final DistributedLockManager distributedManager; private final AtomicBoolean stoppingServer; public ReplicationPrimaryActivation(final ActiveMQServerImpl activeMQServer, - final DistributedPrimitiveManager distributedManager, + final DistributedLockManager distributedManager, final ReplicationPrimaryPolicy policy) { this.activeMQServer = activeMQServer; this.policy = policy; @@ -94,7 +94,7 @@ public class ReplicationPrimaryActivation extends PrimaryActivation implements D /** * used for testing purposes. */ - public DistributedPrimitiveManager getDistributedManager() { + public DistributedLockManager getDistributedManager() { return distributedManager; } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConnectVoteHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConnectVoteHandler.java index eadcc82a81..48d52642ba 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConnectVoteHandler.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConnectVoteHandler.java @@ -20,10 +20,10 @@ import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.client.impl.TopologyMemberImpl; import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; -import org.apache.activemq.artemis.core.server.cluster.qourum.QuorumVoteHandler; -import org.apache.activemq.artemis.core.server.cluster.qourum.QuorumVoteServerConnect; -import org.apache.activemq.artemis.core.server.cluster.qourum.ServerConnectVote; -import org.apache.activemq.artemis.core.server.cluster.qourum.Vote; +import org.apache.activemq.artemis.core.server.cluster.quorum.QuorumVoteHandler; +import org.apache.activemq.artemis.core.server.cluster.quorum.QuorumVoteServerConnect; +import org.apache.activemq.artemis.core.server.cluster.quorum.ServerConnectVote; +import org.apache.activemq.artemis.core.server.cluster.quorum.Vote; public class ServerConnectVoteHandler implements QuorumVoteHandler { private final ActiveMQServerImpl server; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingBackupActivation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingBackupActivation.java index 094c27c98e..619f494ed7 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingBackupActivation.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingBackupActivation.java @@ -45,7 +45,7 @@ import org.apache.activemq.artemis.core.server.cluster.ClusterControl; import org.apache.activemq.artemis.core.server.cluster.ClusterController; import org.apache.activemq.artemis.core.server.cluster.ha.ReplicaPolicy; import org.apache.activemq.artemis.core.server.cluster.ha.ScaleDownPolicy; -import org.apache.activemq.artemis.core.server.cluster.qourum.SharedNothingBackupQuorum; +import org.apache.activemq.artemis.core.server.cluster.quorum.SharedNothingBackupQuorum; import org.apache.activemq.artemis.core.server.group.GroupingHandler; import org.apache.activemq.artemis.core.server.management.ManagementService; import org.apache.activemq.artemis.utils.ReusableLatch; @@ -53,9 +53,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.lang.invoke.MethodHandles; -import static org.apache.activemq.artemis.core.server.cluster.qourum.SharedNothingBackupQuorum.BACKUP_ACTIVATION.FAILURE_REPLICATING; -import static org.apache.activemq.artemis.core.server.cluster.qourum.SharedNothingBackupQuorum.BACKUP_ACTIVATION.FAIL_OVER; -import static org.apache.activemq.artemis.core.server.cluster.qourum.SharedNothingBackupQuorum.BACKUP_ACTIVATION.STOP; +import static org.apache.activemq.artemis.core.server.cluster.quorum.SharedNothingBackupQuorum.BACKUP_ACTIVATION.FAILURE_REPLICATING; +import static org.apache.activemq.artemis.core.server.cluster.quorum.SharedNothingBackupQuorum.BACKUP_ACTIVATION.FAIL_OVER; +import static org.apache.activemq.artemis.core.server.cluster.quorum.SharedNothingBackupQuorum.BACKUP_ACTIVATION.STOP; public final class SharedNothingBackupActivation extends Activation implements ReplicationEndpointEventListener { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingPrimaryActivation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingPrimaryActivation.java index b4427a0ac7..f82d5abac8 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingPrimaryActivation.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingPrimaryActivation.java @@ -58,7 +58,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; import org.apache.activemq.artemis.core.server.NodeManager; import org.apache.activemq.artemis.core.server.cluster.ClusterConnection; import org.apache.activemq.artemis.core.server.cluster.ha.ReplicatedPolicy; -import org.apache.activemq.artemis.core.server.cluster.qourum.QuorumManager; +import org.apache.activemq.artemis.core.server.cluster.quorum.QuorumManager; import org.apache.activemq.artemis.spi.core.remoting.Acceptor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/quorum/ActivationSequenceStateMachine.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/quorum/ActivationSequenceStateMachine.java index a253d626f3..9b39710339 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/quorum/ActivationSequenceStateMachine.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/quorum/ActivationSequenceStateMachine.java @@ -24,14 +24,14 @@ import java.util.concurrent.TimeoutException; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.core.server.NodeManager; -import org.apache.activemq.artemis.quorum.DistributedLock; -import org.apache.activemq.artemis.quorum.DistributedPrimitiveManager; -import org.apache.activemq.artemis.quorum.MutableLong; -import org.apache.activemq.artemis.quorum.UnavailableStateException; +import org.apache.activemq.artemis.lockmanager.DistributedLock; +import org.apache.activemq.artemis.lockmanager.DistributedLockManager; +import org.apache.activemq.artemis.lockmanager.MutableLong; +import org.apache.activemq.artemis.lockmanager.UnavailableStateException; import org.slf4j.Logger; /** - * This class contains the activation sequence logic of the pluggable quorum vote: + * This class contains the activation sequence logic of the pluggable lock manager: * it should be used by {@link org.apache.activemq.artemis.core.server.impl.ReplicationBackupActivation} * and {@link org.apache.activemq.artemis.core.server.impl.ReplicationPrimaryActivation} to coordinate * for replication. @@ -60,7 +60,7 @@ public final class ActivationSequenceStateMachine { * the activation and guarantee the initial not-replicated ownership of data. */ public static DistributedLock tryActivate(final NodeManager nodeManager, - final DistributedPrimitiveManager distributedManager, + final DistributedLockManager distributedManager, final Logger logger) throws InterruptedException, ExecutionException, TimeoutException, UnavailableStateException { Objects.requireNonNull(nodeManager); Objects.requireNonNull(distributedManager); @@ -199,7 +199,7 @@ public final class ActivationSequenceStateMachine { /** * It wait until {@code timeoutMillis ms} has passed or the coordinated activation sequence has progressed enough */ - public static boolean awaitNextCommittedActivationSequence(final DistributedPrimitiveManager distributedManager, + public static boolean awaitNextCommittedActivationSequence(final DistributedLockManager distributedManager, final String coordinatedLockAndNodeId, final long activationSequence, final long timeoutMills, @@ -262,7 +262,7 @@ public final class ActivationSequenceStateMachine { */ public static void ensureSequentialAccessToNodeData(final String serverDescription, final NodeManager nodeManager, - final DistributedPrimitiveManager distributedManager, + final DistributedLockManager distributedManager, final Logger logger) throws ActiveMQException, InterruptedException, UnavailableStateException, ExecutionException, TimeoutException { Objects.requireNonNull(serverDescription); diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java index 0617297150..52419e3f4a 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java @@ -1135,7 +1135,7 @@ public class ConfigurationImplTest extends ServerTestBase { @Test public void testReplicatedPolicyConfiguration() throws Throwable { Properties properties = new ConfigurationImpl.InsertionOrderedProperties(); - properties.put("HAPolicyConfiguration", "REPLICATED"); + properties.put("HAPolicyConfiguration", "REPLICATION_PRIMARY_QUORUM_VOTING"); properties.put("HAPolicyConfiguration.checkForActiveServer", "true"); properties.put("HAPolicyConfiguration.groupName", "g0"); properties.put("HAPolicyConfiguration.clusterName", "c0"); @@ -1170,7 +1170,7 @@ public class ConfigurationImplTest extends ServerTestBase { @Test public void testReplicaPolicyConfiguration() throws Throwable { Properties properties = new ConfigurationImpl.InsertionOrderedProperties(); - properties.put("HAPolicyConfiguration", "REPLICA"); + properties.put("HAPolicyConfiguration", "REPLICATION_BACKUP_QUORUM_VOTING"); properties.put("HAPolicyConfiguration.clusterName", "c0"); properties.put("HAPolicyConfiguration.maxSavedReplicatedJournalsSize", "3"); properties.put("HAPolicyConfiguration.groupName", "g0"); @@ -1288,7 +1288,7 @@ public class ConfigurationImplTest extends ServerTestBase { @Test public void testReplicationPrimaryPolicyConfiguration() throws Throwable { Properties properties = new ConfigurationImpl.InsertionOrderedProperties(); - properties.put("HAPolicyConfiguration", "REPLICATION_PRIMARY"); + properties.put("HAPolicyConfiguration", "REPLICATION_PRIMARY_LOCK_MANAGER"); properties.put("HAPolicyConfiguration.groupName", "g0"); properties.put("HAPolicyConfiguration.clusterName", "c0"); properties.put("HAPolicyConfiguration.initialReplicationSyncTimeout", "5"); @@ -1319,7 +1319,7 @@ public class ConfigurationImplTest extends ServerTestBase { @Test public void testReplicationBackupPolicyConfiguration() throws Throwable { Properties properties = new ConfigurationImpl.InsertionOrderedProperties(); - properties.put("HAPolicyConfiguration", "REPLICATION_BACKUP"); + properties.put("HAPolicyConfiguration", "REPLICATION_BACKUP_LOCK_MANAGER"); properties.put("HAPolicyConfiguration.clusterName", "c0"); properties.put("HAPolicyConfiguration.maxSavedReplicatedJournalsSize", "3"); properties.put("HAPolicyConfiguration.groupName", "g0"); diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/HAPolicyConfigurationTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/HAPolicyConfigurationTest.java index 991d503814..c448fecdd1 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/HAPolicyConfigurationTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/HAPolicyConfigurationTest.java @@ -46,10 +46,10 @@ import org.apache.activemq.artemis.core.server.impl.SharedNothingBackupActivatio import org.apache.activemq.artemis.core.server.impl.SharedNothingPrimaryActivation; import org.apache.activemq.artemis.core.server.impl.SharedStoreBackupActivation; import org.apache.activemq.artemis.core.server.impl.SharedStorePrimaryActivation; -import org.apache.activemq.artemis.quorum.DistributedLock; -import org.apache.activemq.artemis.quorum.DistributedPrimitiveManager; -import org.apache.activemq.artemis.quorum.MutableLong; -import org.apache.activemq.artemis.quorum.UnavailableStateException; +import org.apache.activemq.artemis.lockmanager.DistributedLock; +import org.apache.activemq.artemis.lockmanager.DistributedLockManager; +import org.apache.activemq.artemis.lockmanager.MutableLong; +import org.apache.activemq.artemis.lockmanager.UnavailableStateException; import org.apache.activemq.artemis.tests.util.ServerTestBase; import org.junit.After; import org.junit.Test; @@ -142,13 +142,13 @@ public class HAPolicyConfigurationTest extends ServerTestBase { primaryOnlyTest("primary-only-hapolicy-config5.xml"); } - public static class FakeDistributedPrimitiveManager implements DistributedPrimitiveManager { + public static class FakeDistributedLockManager implements DistributedLockManager { private final Map config; private boolean started; private DistributedLock lock; - public FakeDistributedPrimitiveManager(Map config) { + public FakeDistributedLockManager(Map config) { this.config = config; this.started = false; } @@ -333,11 +333,11 @@ public class HAPolicyConfigurationTest extends ServerTestBase { assertNull(failbackPolicy.getScaleDownClustername()); assertNull(failbackPolicy.getScaleDownGroupName()); // validate manager - DistributedPrimitiveManager manager = ((ReplicationPrimaryActivation) activation).getDistributedManager(); + DistributedLockManager manager = ((ReplicationPrimaryActivation) activation).getDistributedManager(); assertNotNull(manager); - assertEquals(FakeDistributedPrimitiveManager.class.getName(), manager.getClass().getName()); - assertTrue(manager + " is not an instance of FakeDistributedPrimitiveManager", manager instanceof FakeDistributedPrimitiveManager); - FakeDistributedPrimitiveManager forwardingManager = (FakeDistributedPrimitiveManager) manager; + assertEquals(FakeDistributedLockManager.class.getName(), manager.getClass().getName()); + assertTrue(manager + " is not an instance of FakeDistributedLockManager", manager instanceof FakeDistributedLockManager); + FakeDistributedLockManager forwardingManager = (FakeDistributedLockManager) manager; // validate manager config validateManagerConfig(forwardingManager.getConfig()); } finally { @@ -389,11 +389,11 @@ public class HAPolicyConfigurationTest extends ServerTestBase { assertNull(failoverPrimaryPolicy.getScaleDownClustername()); assertNull(failoverPrimaryPolicy.getScaleDownGroupName()); // validate manager - DistributedPrimitiveManager manager = ((ReplicationBackupActivation) activation).getDistributedManager(); + DistributedLockManager manager = ((ReplicationBackupActivation) activation).getDistributedManager(); assertNotNull(manager); - assertEquals(FakeDistributedPrimitiveManager.class.getName(), manager.getClass().getName()); - assertTrue(manager instanceof FakeDistributedPrimitiveManager); - FakeDistributedPrimitiveManager forwardingManager = (FakeDistributedPrimitiveManager) manager; + assertEquals(FakeDistributedLockManager.class.getName(), manager.getClass().getName()); + assertTrue(manager instanceof FakeDistributedLockManager); + FakeDistributedLockManager forwardingManager = (FakeDistributedLockManager) manager; // validate manager config validateManagerConfig(forwardingManager.getConfig()); } finally { diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/BackupActivationNoReconnectTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/BackupActivationNoReconnectTest.java index 1a9035d7a1..4e6363bed1 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/BackupActivationNoReconnectTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/BackupActivationNoReconnectTest.java @@ -54,11 +54,11 @@ import org.apache.activemq.artemis.core.server.cluster.ha.HAPolicy; import org.apache.activemq.artemis.core.server.cluster.ha.ReplicaPolicy; import org.apache.activemq.artemis.core.server.cluster.ha.ReplicationBackupPolicy; import org.apache.activemq.artemis.core.server.cluster.ha.ReplicationPrimaryPolicy; -import org.apache.activemq.artemis.core.server.cluster.qourum.QuorumManager; -import org.apache.activemq.artemis.core.server.cluster.qourum.SharedNothingBackupQuorum; +import org.apache.activemq.artemis.core.server.cluster.quorum.QuorumManager; +import org.apache.activemq.artemis.core.server.cluster.quorum.SharedNothingBackupQuorum; import org.apache.activemq.artemis.core.server.management.ManagementService; import org.apache.activemq.artemis.core.version.Version; -import org.apache.activemq.artemis.quorum.DistributedPrimitiveManager; +import org.apache.activemq.artemis.lockmanager.DistributedLockManager; import org.apache.activemq.artemis.spi.core.remoting.ClientProtocolManager; import org.apache.activemq.artemis.utils.ExecutorFactory; import org.apache.activemq.artemis.utils.ThreadDumpUtil; @@ -86,7 +86,7 @@ public class BackupActivationNoReconnectTest { when(policy.getPrimaryPolicy()).thenReturn(replicationPrimaryPolicy); ActiveMQServerImpl server = Mockito.mock(ActiveMQServerImpl.class); - DistributedPrimitiveManager distributedManager = Mockito.mock(DistributedPrimitiveManager.class); + DistributedLockManager distributedManager = Mockito.mock(DistributedLockManager.class); ReplicationBackupActivation replicationBackupActivation = new ReplicationBackupActivation(server, distributedManager, policy); verifySingleAttemptToLocatePrimary(server, replicationBackupActivation); diff --git a/artemis-server/src/test/resources/backup-hapolicy-config.xml b/artemis-server/src/test/resources/backup-hapolicy-config.xml index 070c5672b4..f549778440 100644 --- a/artemis-server/src/test/resources/backup-hapolicy-config.xml +++ b/artemis-server/src/test/resources/backup-hapolicy-config.xml @@ -33,7 +33,7 @@ false - org.apache.activemq.artemis.core.config.impl.HAPolicyConfigurationTest$FakeDistributedPrimitiveManager + org.apache.activemq.artemis.core.config.impl.HAPolicyConfigurationTest$FakeDistributedLockManager diff --git a/artemis-server/src/test/resources/primary-hapolicy-config.xml b/artemis-server/src/test/resources/primary-hapolicy-config.xml index 5d00f324a3..b76397495e 100644 --- a/artemis-server/src/test/resources/primary-hapolicy-config.xml +++ b/artemis-server/src/test/resources/primary-hapolicy-config.xml @@ -30,7 +30,7 @@ 73 - org.apache.activemq.artemis.core.config.impl.HAPolicyConfigurationTest$FakeDistributedPrimitiveManager + org.apache.activemq.artemis.core.config.impl.HAPolicyConfigurationTest$FakeDistributedLockManager diff --git a/docs/user-manual/activation-tools.adoc b/docs/user-manual/activation-tools.adoc index 655808772b..697f18f53f 100644 --- a/docs/user-manual/activation-tools.adoc +++ b/docs/user-manual/activation-tools.adoc @@ -2,7 +2,7 @@ :idprefix: :idseparator: - -You can use the Artemis CLI to execute activation sequence maintenance/recovery tools for xref:ha.adoc#high-availability-and-failover[Pluggable Quorum Replication]. +You can use the Artemis CLI to execute activation sequence maintenance/recovery tools for xref:ha.adoc#replication[Replication] with Pluggable Lock Manager. The 2 main commands are `activation list` and `activation set`, that can be used together to recover some disaster happened to local/coordinated activation sequences. diff --git a/docs/user-manual/ha.adoc b/docs/user-manual/ha.adoc index 288e8b4836..2a7abdee89 100644 --- a/docs/user-manual/ha.adoc +++ b/docs/user-manual/ha.adoc @@ -2,23 +2,25 @@ :idprefix: :idseparator: - -We define high availability as the _ability for the system to continue functioning after failure of one or more of the servers_. +We define high availability (HA) as the _ability for the system to continue functioning after failure of one or more of the servers_. A part of high availability is _failover_ which we define as the _ability for client connections to migrate from one server to another in event of server failure so client applications can continue to operate_. == Terminology -In order to discuss both configuration and runtime behavior consistently we need to define a pair of nouns and adjectives. +In order to discuss both configuration and runtime behavior consistently we need to define a couple nouns and adjectives. These terms will be used throughout the documentation, configuration, source code, and runtime logs. === Configuration -These nouns identify how the broker is _configured_, e.g. in `broker.xml`. +These nouns identify how the broker is _configured_, e.g. in `broker.xml`. The configuration allows brokers to be paired together as a _primary/backup_ group (i.e. an _HA pair_ of brokers. primary:: This identifies the main broker in the high availability configuration. Oftentimes the hardware on this broker will be higher performance than the hardware on the backup broker. Typically, this broker is started before the backup and is active most of the time. +Each primary server can have 1 or more backup servers. +However, only one backup will take over the primary server's work. backup:: This identifies the broker that should take over when the primary broker fails in a high availability configuration. @@ -40,72 +42,89 @@ For example, consider the scenario where the primary broker was started and then The backup broker would be _passive_ since it is not accepting remote connections. It is waiting for the primary to fail before it activates and begins accepting remote connections. -== Primary/Backup Groups +== HA Policies -Apache ActiveMQ Artemis allows servers to be linked together as _primary/backup_ groups where each primary server can have 1 or more backup servers. -A backup server is owned by only one primary server. -Backup servers are not operational until failover occurs. -However, one chosen backup, which will be passive, announces its status and waits to take over the primary server's work. +Apache ActiveMQ Artemis supports two main policies for backing up a server: -Before failover, only the primary server is active, serving clients while the backup servers remain passive, awaiting to become active when the primary fails. -When a primary server crashes or is brought down in the correct mode the backup server currently in passive mode will activate. -If a primary server restarts after a failover then it will be passive and have priority and be the next server to become active when the current active backup server goes down. -If the active backup server is configured to allow automatic failback then it will detect the primary server coming back up and automatically stop. +* *shared store* +* *replication* -=== HA Policies - -Apache ActiveMQ Artemis supports two different strategies for backing up a server: - -* shared store -* replication - -These are configured via the `ha-policy` configuration element, e.g.: - -[,xml] ----- - - - ----- - -or - -[,xml] ----- - - - ----- - -As well as these 2 strategies there is also a 3rd called `primary-only`. -This of course means there will be no Backup Strategy and is the default if none is provided, however this is used to configure `scale-down` which we will cover in a later chapter. +These are configured via the `ha-policy` configuration element. [NOTE] +.What is Backed Up? ==== -The `ha-policy` configurations replaces any current HA configuration in the root of the `broker.xml` configuration. -All old configuration is now deprecated although best efforts will be made to honour it if configured this way. +Only message data *written to storage* will survive failover. +Any message data not written to storage will not be available after failover. ==== [NOTE] +.Clustering is Required ==== -Only persistent message data will survive failover. -Any non persistent message data will not be available after failover. +A proper xref:clusters.adoc#clusters[cluster] configuration is required as a pre-requisite for an HA configuration. +The cluster configuration allows the server to announce its presence to its primary/backup (or any other nodes in the cluster). ==== -The `ha-policy` type configures which strategy a cluster should use to provide the backing up of a server's data. -Within this configuration element we configure how a server should behave within the cluster, either as a primary (active), backup (passive) or colocated (both active and passive). -This would look something like: +There is technically a third policy called `primary-only` which omits the backup entirely. +This is used to configure xref:#scaling-down[`scale-down`]. +This is the default policy if none is provided. + +=== Shared Store + +When using a shared store both primary and backup servers share the _same_ entire data directory using a shared file system. +This includes the paging directory, journal directory, large messages, and bindings journal. + +When the primary server fails it will release its lock on the shared journal and allow the backup server to activate. +The backup will then load the data from the shared file system and accept remote connections from clients. + +Typically, this will be some kind of high performance Storage Area Network (SAN). +Network Attached Storage (NAS), like an <>, is viable but won't provide optimal performance. + +One main advantage of a shared store configuration is that no replication occurs between the primary and backup nodes which means it does not suffer any performance penalties due to the overhead of replication during normal operation. + +One potentially significant disadvantage of shared store versus replication is that it requires a shared file system, and when the backup server activates it needs to load the journal from the shared store which can take some time depending on the amount of data in the store and the speed of the store. + +If you require the highest performance during normal operation then acquire access to a fast SAN and deal with a slightly slower failover (depending on amount of data). + +[TIP] +.What About Split Brain? +==== +Shared store configurations are naturally immune to xref:network-isolation.adoc#network-isolation-split-brain[split-brain]. +==== + +==== Shared Store Configuration + +Both primary & backup servers must configure the location of journal directories to the _same shared location_ (as explained in xref:persistence.adoc#persistence[persistence documentation]). + +===== Primary + +The primary broker needs this basic configuration in `broker.xml`: [,xml] ---- - + - + ---- -or +====== Additional parameters + +failover-on-shutdown:: +Whether the graceful shutdown of this primary broker will cause the backup to activate. +Default is `false` which means that only a broker crash or forceful shutdown (e.g. using ctrl-c) will trigger the backup to activate. + +wait-for-activation:: +This setting is only for *embedded* use cases where the primary broker has failed, the backup has activated, and the primary has been restarted. +By default, when `org.apache.activemq.artemis.core.server.ActiveMQServer.start()` is invoked the broker will block until the primary broker actually takes over from the backup (i.e. either via failback or by the backup actually stopping). +Setting `wait-for-activation` to `false` prevents `start()` from blocking so that control is returned to the caller. +The caller can use `waitForActivation()` to wait until broker activates or just check the current status using `getState()`. +Default is `true`. + +===== Backup + +The backup needs this basic configuration in `broker.xml`: [,xml] ---- @@ -116,97 +135,100 @@ or ---- -or +====== Additional parameters -[,xml] ----- - - - - - ----- +allow-failback:: +Whether this backup will automatically stop when its primary is restarted and requests to take over its place. +The use case is when a primary server stops and its backup takes over its duties, later the primary server restarts and requests the now-active backup to stop so the primary can take over again. +Default is `true`. -_Replication_ allows the configuration of two new roles to enable _pluggable quorum_ provider configuration, by using: +failover-on-shutdown:: +Whether the graceful shutdown of this primary broker will cause the backup to activate. +Default is `false` which means that only a broker crash or forceful shutdown (e.g. using ctrl-c) will trigger the backup to activate. +This only applies when this backup has activated due to its primary failing. -[,xml] ----- - - - - - ----- +scale-down:: +If provided then this backup will scale down rather than becoming active after fail over. +This really only applies to colocated configurations where the backup will scale-down its messages to the primary broker in the same JVM. -to configure the classic _primary_ role, and +restart-backup:: +Will this backup restart after being stopped due to failback or scaling down. +Default is `false`. -[,xml] ----- - - - - - ----- +===== NFS Mount Recommendations -for the classic _backup_ one. +If you choose to implement your shared store configuration with NFS here are some recommended configuration options. +These settings are designed for reliability and to help the broker detect problems with NFS quickly and shut itself down so that clients can failover to a working broker. -If _replication_ is configured using such new roles some additional element are required to complete configuration as detailed later. +sync:: +Specifies that all changes are immediately flushed to disk. +intr:: +Allows NFS requests to be interrupted if the server is shut down or cannot be reached. +noac:: +Disables attribute caching. This behavior is needed to achieve attribute cache coherence among multiple clients. +soft:: +Specifies that if the NFS server is unavailable the error should be reported rather than waiting for the server to come back online. +lookupcache=none:: +Disables lookup caching. +timeo=n:: +The time, in deciseconds (i.e. tenths of a second), that the NFS client (i.e. the broker) waits for a response from the NFS server before it retries a request. For NFS over TCP the default `timeo` value is `600` (60 seconds). For NFS over UDP the client uses an adaptive algorithm to estimate an appropriate timeout value for frequently used request types, such as read and write requests. +retrans=n:: +The number of times that the NFS client retries a request before it attempts further recovery action. -=== IMPORTANT NOTE ON PLUGGABLE QUORUM VOTE FEATURE +[TIP] +==== +Use reasonable values when you configure `timeo` and `retrans`. A default `timeo` wait time of 600 deciseconds (60 seconds) combined with a `retrans` value of 5 retries can result in a five-minute wait for the broker to detect an NFS disconnection. You likely don't want all store-related operations on the broker to be blocked for that long while clients wait for responses. Tune these values to balance latency and reliability in your environment. +==== -This feature is still *EXPERIMENTAL*. -Extra testing should be done before running this feature into production. -Please raise issues eventually found to the ActiveMQ Artemis Mail Lists. +=== Replication -It means: +When using replication, the primary and the backup servers do not share the same data directories. +All data synchronization is done over the network. +Therefore, all (durable) data received by the primary server will be duplicated to the backup. -* it's configuration can change until declared as *officially stable* - -=== Data Replication - -When using replication, the primary and the backup servers do not share the same data directories, all data synchronization is done over the network. -Therefore all (persistent) data received by the primary server will be duplicated to the backup. - -Notice that upon start-up the backup server will first need to synchronize all existing data from the primary server before becoming capable of replacing the primary server should it fail. -So unlike when using shared storage, a replicating backup will not be a fully operational backup right after start-up, but only after it finishes synchronizing the data with its primary server. -The time it will take for this to happen will depend on the amount of data to be synchronized and the connection speed. +Note that upon start-up the backup server will first need to synchronize all existing data from the primary server before becoming capable of replacing the primary server should it fail. +Therefore, unlike when using shared storage, a backup will not be _fully operational_ until after it finishes synchronizing the data with its primary server. +The time it takes for this to happen depends on the amount of data to be synchronized and the connection speed. [NOTE] ==== -In general, synchronization occurs in parallel with current network traffic so this won't cause any blocking on current clients. -However, there is a critical moment at the end of this process where the replicating server must complete the synchronization and ensure the replica acknowledges this completion. -This exchange between the replicating server and replica will block any journal related operations. +In general, synchronization occurs in parallel with current network traffic so this won't cause any blocking for current clients. +However, there is a critical moment at the end of this process where the replicating server must complete the synchronization and ensure the backup acknowledges this completion. +This exchange between the replicating server and backup will block any journal related operations. The maximum length of time that this exchange will block is controlled by the `initial-replication-sync-timeout` configuration element. ==== -Replication will create a copy of the data at the backup. -One issue to be aware of is: in case of a successful fail-over, the backup's data will be newer than the primary's data. +Since replication will create a copy of the data at the backup then in case of a successful fail-over, the backup's data will be newer than the primary's data. If you configure your backup to allow failback to the primary then when the primary is restarted it will be passive and the active backup will synchronize its data with the passive primary before stopping to allow the passive primary to become active again. If both servers are shutdown then the administrator will have to determine which one has the latest data. -The replicating primary and backup pair must be part of a cluster. -The Cluster Connection also defines how backup servers will find the remote primary servers to pair with. -Refer to xref:clusters.adoc#clusters[Clusters] for details on how this is done, and how to configure a cluster connection. -Notice that: +[NOTE] +.An Important Difference From Shared Store +==== +If a shared-store backup *does not* find a primary then it will just activate and service client requests like it is a primary. -* Both primary and backup servers must be part of the same cluster. -Notice that even a simple primary/backup replicating pair will require a cluster configuration. -* Their cluster user and password must match. +However, in the replication case, the backup just keeps waiting for a primary to pair with because the backup does not know whether its data is up-to-date. +It cannot unilaterally decide to activate. +To activate a replicating backup using its current data the administrator must change its configuration to make it a primary server by changing `backup` to `primary`. +==== -Within a cluster, there are two ways that a backup server will locate a primary server to replicate from. These are: +==== Split Brain -specifying a node group:: -You can specify a group of primary servers that a backup server can connect to. -This is done by configuring `group-name` in either the `primary` or the `backup` element of the `broker.xml`. +"Split Brain" is a potential issue that is important to understand. +xref:network-isolation.adoc[A whole chapter] has been devoted to explaining what it is and how it can be mitigated at a high level. +Once you read it you will understand the main differences between **quorum voting** and **pluggable lock manager** configurations which will be referenced in later sections. + +==== Replication Configuration + +In a shared-store configuration brokers pair with each other based on their shared storage device. +However, since replication configurations have no such shared storage device they must find each other another way. +Servers can be grouped together explicitly using the same `group-name` in both the `primary` or the `backup` elements. A backup will only connect to a primary that shares the same node group name. -connecting to any live:: -This will be the behaviour if `group-name` is not configured allowing a backup server to connect to any primary server. - [NOTE] +.A `group-name` Example ==== -A `group-name` example: suppose you have 5 primary servers and 6 backup servers: +Suppose you have 5 primary servers and 6 backup servers: * `primary1`, `primary2`, `primary3`: with `group-name=fish` * `primary4`, `primary5`: with `group-name=bird` @@ -219,165 +241,105 @@ Since there is one backup too many, the `fish` will remain with one spare backup The 2 backups with `group-name=bird` (`backup5` and `backup6`) will pair with primary servers `primary4` and `primary5`. ==== -The backup will search for any primary server that it is configured to connect to. -It then tries to replicate with each primary server in turn until it finds a primary server that has no current backup configured. -If no primary server is available it will wait until the cluster topology changes and repeats the process. - -[NOTE] -==== -This is an important distinction from a shared-store backup, if a backup starts and does not find a primary server, the server will just activate and start to serve client requests. -In the replication case, the backup just keeps waiting for a primary server to pair with. -Note that in replication the backup server does not know whether any data it might have is up to date, so it really cannot decide to activate automatically. -To activate a replicating backup server using the data it has, the administrator must change its configuration to make it a primary server by changing `backup` to `primary`. -==== - -Much like in the shared-store case, when the primary server stops or crashes, its backup will become active and take over its duties. -Specifically, the backup will become active when it loses connection to its primary server. -This can be problematic because it can also happen as the result of temporary network problem. - -The issue can be solved in two different ways, depending on which replication roles are configured: - -* *non-pluggable replication*: backup will try to determine whether it still can connect to the other servers in the cluster. -If it can connect to more than half the servers, it will become active. If more than half the servers also disappeared with the primary, the backup will wait and try reconnecting with the primary. -This avoids a split brain situation. -* *pluggable replication*: backup relies on a pluggable quorum provider (configurable via `manager` xml element) to detect if there's any active primary. - -[NOTE] -==== -A backup in the *pluggable replication* still needs to carefully configure xref:connection-ttl.adoc#detecting-dead-connections[connection-ttl] in order to promptly send a request to the quorum manager to become active before failing-over. -==== - -==== Configuration - -To configure a non-pluggable replication's primary and backup servers to be a replicating pair, configure the primary server in ' `broker.xml` to have: - -[,xml] ----- - - - - - -... - - - ... - - ----- - -The backup server must be similarly configured but as a `backup` - -[,xml] ----- - - - - - ----- - -To configure a pluggable quorum replication's primary and backup use: - -[,xml] ----- - - - - - -... - - - ... - - ----- - -and - -[,xml] ----- - - - - - ----- - -==== All Replication Configuration +If `group-name` is not configured then the backup will search for any primary that it can find the cluster. +It tries to replicate with each primary until it finds a primary that has no current backup configured. +If no primary server is available it will wait until the cluster topology changes and repeat the process. ===== Primary -The following table lists all the `ha-policy` configuration elements for HA strategy Replication for `primary`: +The primary broker needs this basic configuration in `broker.xml`: -check-for-active-server:: -Whether to check the cluster for a (live) server using our own server ID when starting up. -This is an important option to avoid split-brain when failover happens and the primary is restarted. -Default is `false`. +[,xml] +---- + + + + + +---- -cluster-name:: -Name of the cluster configuration to use for replication. -This setting is only necessary if you configure multiple cluster connections. -If configured then the connector configuration of the cluster configuration with this name will be used when connecting to the cluster to discover if an active server is already running, see `check-for-active-server`. -If unset then the default cluster connections configuration is used (the first one configured). +====== Additional parameters group-name:: -If set, backup servers will only pair with primary servers with matching `group-name`. - -initial-replication-sync-timeout:: -The amount of time the replicating server will wait at the completion of the initial replication process for the replica to acknowledge it has received all the necessary data. -The default is 30,000 milliseconds. -+ -NOTE: during this interval any journal related operations will be blocked. - -===== Backup - -The following table lists all the `ha-policy` configuration elements for HA strategy Replication for `backup`: +If set, backup servers will only pair with primary servers with matching group-name. +See <> for more details. +Valid for both quorum voting and pluggable lock manager. cluster-name:: -Name of the cluster configuration to use for replication. +Name of the `cluster-connection` to use for replication. This setting is only necessary if you configure multiple cluster connections. If configured then the connector configuration of the cluster configuration with this name will be used when connecting to the cluster to discover if an active server is already running, see `check-for-active-server`. -If unset then the default cluster connections configuration is used (the first one configured). - -group-name:: -If set, backup servers will only pair with primary servers with matching group-name +If unset then the default cluster connections configuration is used (i.e. the first one configured). +Valid for both quorum voting and pluggable lock manager. max-saved-replicated-journals-size:: -This option specifies how many replication backup directories will be kept when server starts as replica. -Every time when server starts as replica all former data moves to 'oldreplica.\{id}' directory, where id is growing backup index, this parameter sets the maximum number of such directories kept on disk. +This option specifies how many replication backup directories will be kept when server starts as a passive backup. +Every time when server starts as such all former data moves to `oldreplica.\{id}` directory, where `{id}` is a growing backup index. +This parameter sets the maximum number of such directories kept on disk. +Valid for both quorum voting and pluggable lock manager. -allow-failback:: -Whether a server will automatically stop when another places a request to take over its place. -The use case is when the backup has failed over. +check-for-active-server:: +Whether to check the cluster for an active server using our own server ID when starting up. +This is an important option to avoid split-brain when failover happens and the primary is restarted. +Default is `false`. +Only valid for quorum voting. initial-replication-sync-timeout:: -After failover and the backup has become active, this is set on the new active server. -It represents the amount of time the replicating server will wait at the completion of the initial replication process for the replica to acknowledge it has received all the necessary data. -The default is 30,000 milliseconds. +The amount of time the replicating server will wait at the completion of the initial replication process for the backup to acknowledge it has received all the necessary data. +The default is `30000`; measured in milliseconds. +Valid for both quorum voting and pluggable lock manager. + NOTE: During this interval any journal related operations will be blocked. -==== Pluggable Quorum Vote Replication configurations +vote-on-replication-failure:: +Whether this primary broker should vote to remain active if replication is lost. +Default is `false`. +Only valid for quorum voting. -Pluggable Quorum Vote replication configuration options are a bit different from classic replication, mostly because of its customizable nature. +quorum-size:: +The quorum size used for voting after replication loss, -1 means use the current cluster size +Default is `-1`. +Only valid for quorum voting. -https://curator.apache.org/[Apache curator] is used by the default quorum provider. +vote-retries:: +If we start as a backup and lose connection to the primary, how many times should we attempt to vote for quorum before restarting +Default is `12`. +Only valid for quorum voting. -Below some example configurations to show how it works. +vote-retry-wait:: +How long to wait (in milliseconds) between each vote attempt. +Default is `5000`. +Only valid for quorum voting. -For `primary`: +quorum-vote-wait:: +How long to wait (in seconds) for vote results. +Default is `30`. +Only valid for quorum voting. +retry-replication-wait:: +If we start as a backup how long to wait (in milliseconds) before trying to replicate again after failing to find a primary. +Default is `2000`. +Valid for both quorum voting and pluggable lock manager. + +manager:: +This element controls and is required for pluggable lock manager configuration. +It has two sub-elements: +* `class-name` - the name of the class implementing `org.apache.activemq.artemis.lockmanager.DistributedLockManager`. +Default is `org.apache.activemq.artemis.lockmanager.zookeeper.CuratorDistributedLockManager` which <>. +* `properties` - a list of `property` elements each with `key` and `value` attributes for configuring the plugin. ++ +Here's a simple example: ++ [,xml] ---- - org.apache.activemq.artemis.quorum.zookeeper.CuratorDistributedPrimitiveManager + org.foo.MyQuorumVotingPlugin - + + @@ -385,17 +347,114 @@ For `primary`: ---- -And `backup`: +coordination-id:: +This is for <>. +Only valid when using pluggable lock manager. +===== Backup + +The backup needs this basic configuration in `broker.xml`: + +[,xml] +---- + + + + + +---- + +====== Additional parameters + +group-name:: +If set, backup servers will only pair with primary servers with matching group-name. +See <> for more details. +Valid for both quorum voting and pluggable lock manager. + +cluster-name:: +Name of the `cluster-connection` to use for replication. +This setting is only necessary if you configure multiple cluster connections. +If configured then the connector configuration of the cluster configuration with this name will be used when connecting to the cluster to discover if an active server is already running, see `check-for-active-server`. +If unset then the default cluster connections configuration is used (i.e. the first one configured). +Valid for both quorum voting and pluggable lock manager. + +max-saved-replicated-journals-size:: +This option specifies how many replication backup directories will be kept when server starts as a passive backup. +Every time when server starts as such all former data moves to `oldreplica.\{id}` directory, where `{id}` is a growing backup index. +This parameter sets the maximum number of such directories kept on disk. +Valid for both quorum voting and pluggable lock manager. + +scale-down:: +If provided then this backup will scale down rather than becoming active after fail over. +This really only applies to colocated configurations where the backup will scale-down its messages to the primary broker in the same JVM. + +restart-backup:: +Will this server, if a backup, restart once it has been stopped because of failback or scaling down. +Default is `false`. + +allow-failback:: +Whether this backup will automatically stop when its primary is restarted and requests to take over its place. +The use case is when a primary server stops and its backup takes over its duties, later the primary server restarts and requests the now-active backup to stop so the primary can take over again. +Default is `true`. +Valid for both quorum voting and pluggable lock manager. + +initial-replication-sync-timeout:: +After failover when the backup has activated this is enforced when the primary is restarted and connects as a backup (e.g. for failback). +The amount of time the replicating server will wait at the completion of the initial replication process for the backup to acknowledge it has received all the necessary data. +The default is `30000`; measured in milliseconds. +Valid for both quorum voting and pluggable lock manager. ++ +NOTE: during this interval any journal related operations will be blocked. + +vote-on-replication-failure:: +Whether this primary broker should vote to remain active if replication is lost. +Default is `false`. +Only valid for quorum voting. + +quorum-size:: +The quorum size used for voting after replication loss, -1 means use the current cluster size +Default is `-1`. +Only valid for quorum voting. + +vote-retries:: +If we start as a backup and lose connection to the primary, how many times should we attempt to vote for quorum before restarting. +Default is `12`. +Only valid for quorum voting. + +vote-retry-wait:: +How long to wait (in milliseconds) between each vote attempt. +Default is `5000`. +Only valid for quorum voting. + +quorum-vote-wait:: +How long to wait (in seconds) for vote results. +Default is `30`. +Only valid for quorum voting. + +retry-replication-wait:: +If we start as a backup how long to wait (in milliseconds) before trying to replicate again after failing to find a primary. +Default is `2000`. +Valid for both quorum voting and pluggable lock manager. + +manager:: +This element controls and is required for pluggable lock manager configuration. +It has two sub-elements: +* `class-name` - the name of the class implementing `org.apache.activemq.artemis.lockmanager.DistributedLockManager`. +Default is `org.apache.activemq.artemis.lockmanager.zookeeper.CuratorDistributedLockManager` which <>. +* `properties` - a list of `property` elements each with `key` and `value` attributes for configuring the plugin. ++ +Here's a simple example: ++ [,xml] ---- - org.apache.activemq.artemis.quorum.zookeeper.CuratorDistributedPrimitiveManager + org.foo.MyQuorumVotingPlugin - + + true @@ -404,78 +463,13 @@ And `backup`: ---- -The configuration of `class-name` as follows +==== Apache ZooKeeper Integration -[,xml] ----- -org.apache.activemq.artemis.quorum.zookeeper.CuratorDistributedPrimitiveManager ----- +The default pluggable lock manager implementation uses https://curator.apache.org/[Apache Curator] to integrate with https://zookeeper.apache.org/[Apache ZooKeeper]. -isn't really needed, because Apache Curator is the default provider, but has been shown for completeness. +===== ZooKeeper Plugin Configuration -The `properties` element: - -[,xml] ----- - - - ----- - -can specify a list of `property` elements in the form of key-value pairs, appropriate to what is supported by the specified `class-name` provider. - -Apache Curator's provider allows the following properties: - -* https://curator.apache.org/apidocs/org/apache/curator/framework/CuratorFrameworkFactory.Builder.html#connectString(java.lang.String)[`connect-string`]: (no default) -* https://curator.apache.org/apidocs/org/apache/curator/framework/CuratorFrameworkFactory.Builder.html#sessionTimeoutMs(int)[`session-ms`]: (default is 18000 ms) -* https://curator.apache.org/apidocs/org/apache/curator/framework/CuratorFrameworkFactory.Builder.html#simulatedSessionExpirationPercent(int)[`session-percent`]: (default is 33); -should be \<= default, see https://cwiki.apache.org/confluence/display/CURATOR/TN14 for more info -* https://curator.apache.org/apidocs/org/apache/curator/framework/CuratorFrameworkFactory.Builder.html#connectionTimeoutMs(int)[`connection-ms`]: (default is 8000 ms) -* https://curator.apache.org/apidocs/org/apache/curator/retry/RetryNTimes.html#%3Cinit%3E(int,int)[`retries`]: (default is 1) -* https://curator.apache.org/apidocs/org/apache/curator/retry/RetryNTimes.html#%3Cinit%3E(int,int)[`retries-ms`]: (default is 1000 ms) -* https://curator.apache.org/apidocs/org/apache/curator/framework/CuratorFrameworkFactory.Builder.html#namespace(java.lang.String)[`namespace`]: (no default) - -Configuration of the https://zookeeper.apache.org/[Apache ZooKeeper] ensemble is the responsibility of the user, but there are few *suggestions to improve the reliability of the quorum service*: - -* broker `session_ms` must be `>= 2 * server tick time` and `+<= 20 * server tick time+` as by https://zookeeper.apache.org/doc/r3.6.3/zookeeperAdmin.html[ZooKeeper 3.6.3 admin guide]: it directly impacts how fast a backup can failover to an isolated/killed/unresponsive live; -the higher, the slower. -* GC on broker machine should allow keeping GC pauses within 1/3 of `session_ms` in order to let the ZooKeeper heartbeat protocol work reliably. -If that is not possible, it is better to increase `session_ms`, accepting a slower failover. -* ZooKeeper must have enough resources to keep GC (and OS) pauses much smaller than server tick time: please consider carefully if broker and ZooKeeper node should share the same physical machine, depending on the expected load of the broker -* network isolation protection requires configuring >=3 ZooKeeper nodes - -.Important Notes on pluggable quorum replication configuration -**** -There are some classic replication configuration options which are no longer needed, i.e.: - -* `vote-on-replication-failure` -* `quorum-vote-wait` -* `vote-retries` -* `vote-retries-wait` -* `check-for-active-server` - -*Regarding replication configuration with the https://curator.apache.org/[Apache curator] quorum provider...* - -As noted previously, `session-ms` affects the failover duration. The passive broker can activate after `session-ms` expires or if the active broker voluntary gives up its role e.g. during a fail-back/manual broker stop, it happens immediately. - -For the former case (session expiration with active broker no longer present), the passive broker can detect an unresponsive active broker by using: - -. cluster connection PINGs (affected by xref:connection-ttl.adoc#detecting-dead-connections[connection-ttl] tuning) -. closed TCP connection notification (depends on TCP configuration and networking stack/topology) - -The suggestion is to tune `connection-ttl` low enough to attempt failover as soon as possible, while taking in consideration that the whole fail-over duration cannot last less than the configured `session-ms`. -**** - -===== Peer or Multi Primary - -With coordination delegated to the quorum service, roles are less important. -It is possible to have two peer servers compete for activation; -the winner activating as live, the looser taking up a backup role. -On restart, 'any' peer server with the most up to date journal can activate. -The instances need to know in advance, what identity they will coordinate on. -In the replication 'primary' ha policy we can explicitly set the 'coordination-id' to a common value for all peers in a cluster. - -For `multi primary`: +Here's a basic configuration example: [,xml] ---- @@ -483,7 +477,84 @@ For `multi primary`: - org.apache.activemq.artemis.quorum.zookeeper.CuratorDistributedPrimitiveManager + org.apache.activemq.artemis.lockmanager.zookeeper.CuratorDistributedLockManager + + + + + + + +---- ++ +NOTE: The `class-name` isn't technically required here since the default value is being used, but it is included for clarity. + +====== Available Properties + +https://curator.apache.org/apidocs/org/apache/curator/framework/CuratorFrameworkFactory.Builder.html#connectString(java.lang.String)[`connect-string`]:: +(no default) + +https://curator.apache.org/apidocs/org/apache/curator/framework/CuratorFrameworkFactory.Builder.html#sessionTimeoutMs(int)[`session-ms`]:: +(default is 18000 ms) + +https://curator.apache.org/apidocs/org/apache/curator/framework/CuratorFrameworkFactory.Builder.html#simulatedSessionExpirationPercent(int)[`session-percent`]:: +(default is 33); should be ≤ default (see https://cwiki.apache.org/confluence/display/CURATOR/TN14[TN14] for more info) + +https://curator.apache.org/apidocs/org/apache/curator/framework/CuratorFrameworkFactory.Builder.html#connectionTimeoutMs(int)[`connection-ms`]:: +(default is 8000 ms) + +https://curator.apache.org/apidocs/org/apache/curator/retry/RetryNTimes.html#%3Cinit%3E(int,int)[`retries`]:: +(default is 1) + +https://curator.apache.org/apidocs/org/apache/curator/retry/RetryNTimes.html#%3Cinit%3E(int,int)[`retries-ms`]:: +(default is 1000 ms) + +https://curator.apache.org/apidocs/org/apache/curator/framework/CuratorFrameworkFactory.Builder.html#namespace(java.lang.String)[`namespace`]:: +(no default) + +===== Improving Reliability + +Configuration of the ZooKeeper ensemble is the responsibility of the user, but here are few *suggestions to improve the reliability of the quorum service*: + +* Broker `session_ms` must be `≥ 2 * server tick time` and `≤ 20 * server tick time` as by https://zookeeper.apache.org/doc/r3.6.3/zookeeperAdmin.html[ZooKeeper 3.6.3 admin guide]. +This directly impacts how fast a backup can failover to an isolated/killed/unresponsive primary. +The higher, the slower. +* GC on broker machine should allow keeping GC pauses within 1/3 of `session_ms` in order to let the ZooKeeper heartbeat protocol work reliably. +If that is not possible, it is better to increase `session_ms`, accepting a slower failover. +* ZooKeeper must have enough resources to keep GC (and OS) pauses much smaller than server tick time. +Please consider carefully if a broker and ZooKeeper node should share the same physical machine depending on the expected load of the broker. +* Network isolation protection requires configuring ≥3 ZooKeeper nodes + +As noted previously, `session-ms` affects the failover duration. +The passive broker can activate after `session-ms` expires or if the active broker voluntary gives up its role (e.g. during a failback/manual broker stop, it happens immediately). + +For the former case (session expiration with active broker no longer present), the passive broker can detect an unresponsive active broker by using: + +. cluster connection PINGs (affected by xref:connection-ttl.adoc#detecting-dead-connections[connection-ttl] tuning) +. closed TCP connection notification (depends on TCP configuration and networking stack/topology) + +The suggestion is to tune `connection-ttl` low enough to attempt failover as soon as possible, while taking in consideration that the whole fail-over duration cannot last less than the configured `session-ms`. + +[NOTE] +==== +A backup still needs to carefully configure xref:connection-ttl.adoc#detecting-dead-connections[connection-ttl] in order to promptly send a request to the quorum manager to become active before failing-over. +==== + +==== Competing Primary Brokers + +When delegating quorum to pluggable implementation roles of primary & backup are less important. +It is possible to have two brokers _compete_ for activation with the winner activating as primary and the loser taking the backup role. +On restart, any peer server with the most up-to-date journal can activate. +The key is that the brokers need to know in advance what identity they will coordinate on. +In the replication `primary` `ha-policy` we can explicitly set the `coordination-id` to a common value for all peers in a cluster. + +[,xml] +---- + + + + + org.apache.activemq.artemis.lockmanager.zookeeper.CuratorDistributedLockManager @@ -494,79 +565,19 @@ For `multi primary`: ---- -NOTE: the string value provided will be converted internally into a 16 byte UUID, so it may not be immediately recognisable or human-readable, however it will ensure that all 'peers' coordinate. +NOTE: The string value provided as the `coordination-id` will be converted internally into a 16-byte UUID so it may not be immediately recognisable or human-readable. However, it will ensure that all "peers" coordinate. -=== Shared Store - -When using a shared store both primary and backup servers share the _same_ entire data directory using a shared file system. -This means the paging directory, journal directory, large messages and binding journal. - -When failover occurs and a backup server takes over, it will load the persistent storage from the shared file system and clients can connect to it. - -This style of high availability differs from data replication in that it requires a shared file system which is accessible by both the primary and backup nodes. -Typically this will be some kind of high performance Storage Area Network (SAN). -We do not recommend you use Network Attached Storage (NAS), e.g. NFS mounts to store any shared journal (NFS is slow). - -The advantage of shared-store high availability is that no replication occurs between the primary and backup nodes. This means it does not suffer any performance penalties due to the overhead of replication during normal operation. - -The disadvantage of shared store replication is that it requires a shared file system, and when the backup server activates it needs to load the journal from the shared store which can take some time depending on the amount of data in the store. - -If you require the highest performance during normal operation then acquire access to a fast SAN and deal with a slightly slower failover (depending on amount of data). - -image::images/ha-shared-store.png[] - -==== Configuration - -To configure the primary and backup servers to share their store use the `ha-policy` configuration in `broker.xml`: - -[,xml] ----- - - - - - -... - - - ... - - ----- - -The backup server must also be configured as a backup. - -[,xml] ----- - - - - - ----- - -In order for primary/backup groups to operate properly with a shared store, both servers must have configured the location of journal directory to point to the _same shared location_ (as explained in xref:persistence.adoc#persistence[Configuring the message journal]) - -[NOTE] -==== -todo write something about GFS -==== - -Also each node, primary and backups, will need to have a cluster connection defined even if not part of a cluster. -The Cluster Connection info defines how backup servers announce there presence to its primary server or any other nodes in the cluster. -Refer to xref:clusters.adoc#clusters[Clusters] for details on how this is done. - -=== Failing Back to Primary Server +== Failing Back to Primary Server After a primary server has failed and a backup taken has taken over its duties, you may want to restart the primary server and have clients fail back. -==== Shared Store +=== Failback with Shared Store -In case of "shared disk" you have a couple of options: +In case of shared storage you have a couple of options: . Simply restart the primary and kill the backup. You can do this by killing the process itself. -. Alternatively you can set `allow-fail-back` to `true` on the backup which will force the backup that has become active to automatically stop. +. Alternatively you can set `allow-failback` to `true` on the backup which will force the backup that has become active to automatically stop. This configuration would look like: + [,xml] @@ -608,11 +619,11 @@ You can also force the active backup to shutdown when the primary comes back up ---- -==== Replication +=== Failback with Replication -As with shared storage the `allow-failback` option can be set for both non-pluggable and pluggable replication. +As with shared storage the `allow-failback` option can be set for both quorum voting and pluggable lock manager replication configurations. -===== Non-Pluggable +==== Quorum Voting [,xml] ---- @@ -625,9 +636,9 @@ As with shared storage the `allow-failback` option can be set for both non-plugg ---- -With non-pluggable replication you need to set an extra property `check-for-active-server` to `true` in the `primary` configuration. +With quorum voting replication you need to set an extra property `check-for-active-server` to `true` in the `primary` configuration. If set to `true` then during start-up the primary server will first search the cluster for another active server using its nodeID. -If it finds one it will contact this server and try to "fail-back". +If it finds one it will contact this server and try to "failback". Since this is a remote replication scenario the primary will have to synchronize its data with the backup server running with its ID. Once they are in sync it will request the other server (which it assumes it is a backup that has assumed its duties) to shutdown in order for it to take over. This is necessary because otherwise the primary server has no means to know whether there was a fail-over or not, and if there was, if the server that took its duties is still running or not. To configure this option at your `broker.xml` configuration file as follows: @@ -644,19 +655,18 @@ To configure this option at your `broker.xml` configuration file as follows: ---- [WARNING] -.For Non-Pluggable Replication ==== -Be aware that if you restart a primary server after failover has occurred then `check-for-active-server` must be set to `true`. -If not the primary server will restart and serve the same messages that the backup has already handled causing duplicates. +Be aware that if you restart a primary server after failover has occurred then `check-for-active-server` *must* be `true`. +If not then the primary server will restart and serve the same messages that the backup has already handled causing duplicates. ==== -===== Pluggable +==== Pluggable Lock Manager -One key difference between pluggable replication and non-pluggable replication is that with non-pluggable replication if the primary cannot reach any active server with its nodeID then it activates unilaterally. -With pluggable replication the responsibilities of coordination are delegated to the quorum provider. There are no unilateral decisions. -The primary will only activate when it knows that it has the most up to date version of the journal identified by its nodeID. +One key difference between replication with quorum voting and replication with a lock manager is that with quorum voting if the primary cannot reach any active server with its nodeID then it activates unilaterally. +With a pluggable lock manager the responsibilities of coordination are delegated to 3rd party. There are no unilateral decisions. +The primary will only activate when it knows that it has the most up-to-date version of the journal identified by its nodeID. -In short: *a primary cannot become active without consensus when using pluggable replication*. +In short: *a primary cannot activate without permission when using a pluggable lock manager*. Here's an example configuration: @@ -674,9 +684,9 @@ Here's an example configuration: ---- -==== All Shared Store Configuration +=== All Shared Store Configuration -===== Primary +==== Primary The following lists all the `ha-policy` configuration elements for HA strategy shared store for `primary`: @@ -690,7 +700,7 @@ If set to true then server startup will wait until it is activated. If set to false then server startup will be done in the background. Default is `true`. -===== Backup +==== Backup The following lists all the `ha-policy` configuration elements for HA strategy Shared Store for `backup`: @@ -733,7 +743,7 @@ the above example is configured to use replication, in this case the `primary` a image::images/ha-colocated.png[ActiveMQ Artemis ha-colocated.png] -==== Configuring Connectors and Acceptors +=== Configuring Connectors and Acceptors If the HA Policy is `colocated` then `connectors` and `acceptors` will be inherited from the primary server creating it and offset depending on the setting of `backup-port-offset` configuration element. If this is set to say 100 (which is the default) and a connector is using port 61616 then this will be set to 61716 for the first server created, 61816 for the second, and so on. @@ -743,7 +753,7 @@ If this is set to say 100 (which is the default) and a connector is using port 6 for INVM connectors and Acceptors the id will have `colocated_backup_n` appended, where n is the backup server number. ==== -==== Remote Connectors +=== Remote Connectors It may be that some of the Connectors configured are for external servers and hence should be excluded from the offset. for instance a connector used by the cluster connection to do quorum voting for a replicated backup server, these can be omitted from being offset by adding them to the `ha-policy` configuration like so: @@ -763,7 +773,7 @@ for instance a connector used by the cluster connection to do quorum voting for ---- -==== Configuring Directories +=== Configuring Directories Directories for the Journal, Large messages and Paging will be set according to what the HA strategy is. If shared store the requesting server will notify the target server of which directories to use. @@ -786,7 +796,7 @@ How many backups a primary server can create backup-port-offset:: The offset to use for the Connectors and Acceptors when creating a new backup server. -=== Scaling Down +== Scaling Down An alternative to using primary/backup groups is to configure _scaledown_. When configured for scale down a server can copy all its messages and transaction state to another active server. @@ -827,7 +837,7 @@ It is also possible to use discovery to scale down, this would look like: ---- -==== Scale Down with groups +=== Scale Down with groups It is also possible to configure servers to only scale down to servers that belong in the same group. This is done by configuring the group like so: @@ -846,7 +856,7 @@ This is done by configuring the group like so: In this scenario only servers that belong to the group `my-group` will be scaled down to -==== Scale Down and Backups +=== Scale Down and Backups It is also possible to mix scale down with HA via backup servers. If a backup is configured to scale down then after failover has occurred, instead of starting fully the backup server will immediately scale down to another active server. @@ -886,7 +896,7 @@ A typical configuration would look like: ---- -==== Scale Down and Clients +=== Scale Down and Clients When a server is stopping and preparing to scale down it will send a message to all its clients informing them which server it is scaling down to before disconnecting them. At this point the client will reconnect however this will only succeed once the server has completed the scaledown process. @@ -899,23 +909,24 @@ Apache ActiveMQ Artemis clients can be configured to receive knowledge of all pr The backup server will then automatically recreate any sessions and consumers that existed on each connection before failover, thus saving the user from having to hand-code manual reconnection logic. For further details see xref:client-failover.adoc#core-client-failover[Client Failover] -.A Note on Server Replication +.A Note on Seamless Failover **** -Apache ActiveMQ Artemis does not replicate full server state between active and passive servers. -When the new session is automatically recreated on the backup it won't have any knowledge of messages already sent or acknowledged in that session. -Any in-flight sends or acknowledgements at the time of failover might also be lost. +Apache ActiveMQ Artemis does not reproduce _full_ server state between active and passive servers. +When a core client automatically creates a new session on the backup that session won't contain any information about messages already sent or acknowledged in the previous session. +Any in-flight sends or acknowledgements at the time of failover will also be lost if they weren't written to storage. -By replicating full server state, theoretically we could provide a 100% transparent seamless failover, which would avoid any lost messages or acknowledgements, however this comes at a great cost: replicating the full server state (including the queues, session, etc.). -This would require replication of the entire server state machine; every operation on the primary server would have to replicated on the replica server(s) in the exact same global order to ensure a consistent replica state. -This is extremely hard to do in a performant and scalable way, especially when one considers that multiple threads are changing the active's server state concurrently. +Theoretically we could provide a 100% transparent, seamless failover which would avoid any lost messages or acknowledgements. +However, this comes at a great cost: reproducing the full server state (including the queues, session, etc.). +This would require every operation on the primary server to be reproduced on the backup server in the exact same global order to ensure a consistent state. +This is extremely hard to do in a performant and scalable way, especially when one considers that multiple threads are changing the active server's state concurrently. -It is possible to provide full state machine replication using techniques such as _virtual synchrony_, but this does not scale well and effectively serializes all operations to a single thread, dramatically reducing concurrency. +It is possible to provide reproduce the full state machine using techniques such as _virtual synchrony_, but this does not scale well and effectively serializes all operations to a single thread, dramatically reducing concurrency. -Other techniques for multi-threaded active replication exist such as replicating lock states or replicating thread scheduling but this is very hard to achieve at a Java level. +Other techniques for multi-threaded use-cases exist such as reproducing lock states or thread scheduling, but this is very hard to achieve at a Java level. -Consequently it has been decided that it worth not worth massively reducing performance and concurrency for the sake of 100% transparent failover. +Consequently, it has been decided that it worth not worth massively reducing performance and concurrency for the sake of 100% transparent failover. Even without 100% transparent failover, it is simple to guarantee _once and only once_ delivery, even in the case of failure, by using a combination of duplicate detection and retrying of transactions. -However this is not 100% transparent to the client code. +However, this is not 100% transparent to the client code. **** === Handling Blocking Calls During Failover @@ -973,7 +984,7 @@ By catching the rollback exceptions and retrying, catching unblocked calls and e If the session is non transactional, messages or acknowledgements can be lost in the event of a failover. -If you wish to provide _once and only once_ delivery guarantees for non transacted sessions too, enable duplicate detection, and catch unblock exceptions as described in xref:ha.adoc#handling-blocking-calls-during-failover[Handling Blocking Calls During Failover] +If you wish to provide _once and only once_ delivery guarantees for non transacted sessions too, enable duplicate detection, and catch unblock exceptions as described in <> ==== Use client connectors to fail over diff --git a/docs/user-manual/network-isolation.adoc b/docs/user-manual/network-isolation.adoc index a1b666fd1f..986faad767 100644 --- a/docs/user-manual/network-isolation.adoc +++ b/docs/user-manual/network-isolation.adoc @@ -2,132 +2,123 @@ :idprefix: :idseparator: - -It is possible that if a primary or backup configured for replication becomes isolated in a network that failover will occur and you will end up with 2 active brokers serving messages. This we call _split brain_. -There are different configurations you can choose from that will help mitigate this problem. +A _split brain_ is a condition that occurs when two different brokers are serving the same messages at the same time. +When this happens instead of client applications all sharing the _same_ broker as they ought, they may become divided between the two split brain brokers. +This is problematic because it can lead to: + +* *Duplicate messages* e.g. when multiple consumers on the same JMS queue split between both brokers and receive the same message(s) +* *Missed messages* e.g. when multiple consumers on the same JMS topic split between both brokers and producers are only sending messages to one broker + +Split brain most commonly happens when a pair of brokers in an HA *replication* configuration lose the replication connection linking them together. +When this connection is lost the backup assumes that the primary has died and therefore activates. +At this point there are two brokers on the network which are isolated from each other and since the backup has a copy of all the messages from the primary they are each serving the same messages. + +[IMPORTANT] +.What about shared store configurations? +==== +While it is technically possible for split brain to happen with a pair of brokers in an HA _shared store_ configuration it would require a failure in the file-locking mechanism of the storage device which the brokers are sharing. + +One of the benefits of using a shared store is that the storage device itself acts as an arbiter to ensure consistency and mitigate split brain. +==== + +Recovering from a split brain may be as simple as stopping the broker which activated by mistake. +However, this solution is only viable *if* no client application connected to it and performed messaging operations. +The longer client applications are allowed to interact with split brain brokers the more difficult it will be to understand and remediate the resulting problems. + +There are several different configurations you can choose from that will help mitigate split brain. + +== Pluggable Lock Manager + +A pluggable lock manager configuration requires a 3rd party to establish a shared lock between primary and backup brokers. +The shared lock ensures that either the primary or backup is active at any given point in time, similar to how the file lock functions in the shared storage use-case. + +The _plugin_ decides what 3rd party implementation is used. +It could be something as simple as a shared file on a network file system that supports locking (e.g. NFS) or it could be something more complex like https://etcd.io/[etcd]. + +The broker ships with a xref:ha.adoc#apache-zookeeper-integration[reference plugin implementation] based on https://zookeeper.apache.org/[Apache ZooKeeper] - a common implementation used for this kind of task. + +The main benefit of a pluggable lock manager is that is releases the broker from the responsibility of establishing a reliable vote. +This means that a _single_ HA pair of brokers can be reliably protected against split-brain. == Quorum Voting -Quorum voting is used by both the primary and the backup to decide what to do if a replication connection is disconnected. -Basically the server will request each active server in the cluster to vote as to whether it thinks the server it is replicating to or from is still alive. -You can also configure the time for which the quorum manager will wait for the quorum vote response. -The default time is 30 seconds you can configure like so for primary and also for the backup: +Quorum voting is a process by which one node in a cluster can determine whether another node in the cluster is active without directly communicating with that node. +Then the broker initiating the vote can take action based on the result (e.g. shutting itself down to avoid split-brain). -[,xml] ----- - - - - 12 - - - ----- +Quorum voting requires the participation of the other _active_ brokers in the cluster. +Of course this requires that there are, in fact, other active brokers in the cluster which means quorum voting won't work with a single HA pair of brokers. +Furthermore, it also won't work with just two HA pairs of brokers either because that's still not enough for a legitimate quorum. +There must be at least three HA pairs to establish a proper quorum with quorum voting. -This being the case the minimum number of live/backup pairs needed is 3. -If less than 3 pairs are used then the only option is to use a Network Pinger which is explained later in this chapter or choose how you want each server to react which the following details: +=== Voting Mechanics -=== Backup Voting +When the replication connection between a primary and backup is lost the backup and/or the primary may initiate a vote. -By default if a backup loses its replication connection to its primary it makes a decision as to whether to start or not with a quorum vote. -This of course requires that there be at least 3 pairs of primary/backup nodes in the cluster. -For a 3 node cluster it will start if it gets 2 votes back saying that its primary server is no longer available, for 4 nodes this would be 3 votes and so on. -When a backup loses connection to the primary it will keep voting for a quorum until it either receives a vote allowing it to start or it detects that the primary is still active. -for the latter it will then restart as a backup. -How many votes and how long between each vote the backup should wait is configured like so: +[IMPORTANT] +==== +For a vote to pass a _majority_ of affirmative responses is required. +For example, in a 3 node cluster a vote will pass with 2 affirmatives. +For a 4 node cluster this would be 3 affirmatives and so on. +==== -[,xml] ----- - - - - 12 - 5000 - - - ----- +==== Backup Voting -It's also possible to statically set the quorum size that should be used for the case where the cluster size is known up front, this is done on the Replica Policy like so: +By default, if a backup loses its replication connection to its primary it will activate automatically. +However, it can be configured via the `vote-on-replication-failure` property to initiate a quorum vote in order to decide whether to activate or not. +If this is done then the backup will keep voting until it either receives a vote allowing it to start or it detects that the primary is still active. +In the latter case it will then restart as a backup. -[,xml] ----- - - - - 2 - - - ----- +See the section on xref:ha.adoc#replication-configuration[Replication Configuration] for more details on configuration. -In this example the quorum size is set to 2 so if you were using a single pair and the backup lost connectivity it would never start. +==== Primary Voting -=== Primary Voting +By default, if the primary server loses its replication connection to the backup then it will just carry on and wait for a backup to reconnect and start replicating again. +However, this may mean that the primary remains active even though the backup has activated so this behavior is configurable via the `vote-on-replication-failure` property. -By default, if the primary server loses its replication connection then it will just carry on and wait for a backup to reconnect and start replicating again. -In the event of a possible split brain scenario this may mean that the primary stays active even though the backup has been activated. -It is possible to configure the primary server to vote for a quorum if this happens, in this way if the primary server does not receive a majority vote then it will shutdown. -This is done by setting the _vote-on-replication-failure_ to `true`. - -[,xml] ----- - - - - true - 2 - - - ----- - -As in the backup policy it is also possible to statically configure the quorum size. +See the section on xref:ha.adoc#replication-configuration[Replication Configuration] for more details on configuration. == Pinging the network -You may configure one more addresses on the broker.xml that are part of your network topology, that will be pinged through the life cycle of the server. +You may configure one more addresses in `broker.xml` that that will be pinged throughout the life of the server. The server will stop itself if it can't ping one or more of the addresses in the list. -The server will stop itself until the network is back on such case. - -If you execute the create command passing a -ping argument, you will create a default xml that is ready to be used with network checks: +If you execute the `create` command using the `--ping` argument you will create a default XML that is ready to be used with network checks: +[,console] ---- -./artemis create /myDir/myServer --ping 10.0.0.1 +$ ./artemis create /myDir/myServer --ping 10.0.0.1 ---- -This XML part will be added to your broker.xml: +This XML will be added to your `broker.xml`: [,xml] ---- + You can verify the network health of a particular NIC by specifying the element. + theNicName + --> + Use this to use an HTTP server to validate the network + http://www.apache.org --> 10000 1000 + Warning: Make sure you understand your network topology as this is meant to check if your network is up. + Using IPs that could eventually disappear or be partially visible may defeat the purpose. + You can use a list of multiple IPs, any successful ping will make the server OK to continue running --> 10.0.0.1 ping -c 1 -t %d %s - + ping6 -c 1 %2$s ---- - -Once you lose connectivity towards 10.0.0.1 on the given example, you will see see this output at the server: - +Once you lose connectivity towards `10.0.0.1` on the given example the broker will log something like this: ---- 09:49:24,562 WARN [org.apache.activemq.artemis.core.server.NetworkHealthCheck] Ping Address /10.0.0.1 wasn't reacheable 09:49:36,577 INFO [org.apache.activemq.artemis.core.server.NetworkHealthCheck] Network is unhealthy, stopping service ActiveMQServerImpl::serverUUID=04fd5dd8-b18c-11e6-9efe-6a0001921ad0 @@ -151,12 +142,11 @@ Once you lose connectivity towards 10.0.0.1 on the given example, you will see s at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_73] ---- -Once you re establish your network connections towards the configured check list: +Once you reestablish your network connections towards the configured check-list: ---- - 09:53:23,461 INFO [org.apache.activemq.artemis.core.server.NetworkHealthCheck] Network is healthy, starting service ActiveMQServerImpl:: -09:53:23,462 INFO [org.apache.activemq.artemis.core.server] AMQ221000: live Message Broker is starting with configuration Broker Configuration (clustered=false,journalDirectory=./data/journal,bindingsDirectory=./data/bindings,largeMessagesDirectory=./data/large-messages,pagingDirectory=./data/paging) +09:53:23,462 INFO [org.apache.activemq.artemis.core.server] AMQ221000: primary Message Broker is starting with configuration Broker Configuration (clustered=false,journalDirectory=./data/journal,bindingsDirectory=./data/bindings,largeMessagesDirectory=./data/large-messages,pagingDirectory=./data/paging) 09:53:23,462 INFO [org.apache.activemq.artemis.core.server] AMQ221013: Using NIO Journal 09:53:23,462 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-server]. Adding protocol support for: CORE 09:53:23,463 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-amqp-protocol]. Adding protocol support for: AMQP @@ -171,11 +161,11 @@ Once you re establish your network connections towards the configured check list 09:53:23,554 INFO [org.apache.activemq.artemis.core.server] AMQ221020: Started Acceptor at 0.0.0.0:5672 for protocols [AMQP] 09:53:23,555 INFO [org.apache.activemq.artemis.core.server] AMQ221020: Started Acceptor at 0.0.0.0:1883 for protocols [MQTT] 09:53:23,556 INFO [org.apache.activemq.artemis.core.server] AMQ221020: Started Acceptor at 0.0.0.0:61613 for protocols [STOMP] -09:53:23,556 INFO [org.apache.activemq.artemis.core.server] AMQ221007: Server is now live +09:53:23,556 INFO [org.apache.activemq.artemis.core.server] AMQ221007: Server is now active 09:53:23,556 INFO [org.apache.activemq.artemis.core.server] AMQ221001: Apache ActiveMQ Artemis Message Broker version 1.6.0 [0.0.0.0, nodeID=04fd5dd8-b18c-11e6-9efe-6a0001921ad0] ---- -[WARNING] +[IMPORTANT] ==== Make sure you understand your network topology as this is meant to validate your network. Using IPs that could eventually disappear or be partially visible may defeat the purpose. diff --git a/docs/user-manual/versions.adoc b/docs/user-manual/versions.adoc index 610d681c38..4cf96ddb6a 100644 --- a/docs/user-manual/versions.adoc +++ b/docs/user-manual/versions.adoc @@ -33,6 +33,7 @@ The dot (`.`) character here is part of the broker's wildcard syntax, and it is + In this case the characters from the broker's wildcard syntax that do not match the characters in the MQTT wildcard syntax will be escaped with a backslash (i.e. `\`). To avoid this conversion you can configure the broker to use the MQTT wildcard syntax or change the name of the MQTT topic name or filter. +* Due to https://issues.apache.org/jira/browse/ARTEMIS-4559[ARTEMIS-4559] folks embedding the broker and also depending on the `artemis-quorum-ri` and/or `artemis-quorum-api` modules and/or using `org.apache.activemq.artemis.core.config.ha.DistributedPrimitiveManagerConfiguration` will need to use `artemis-lockmanager-ri`, `artemis-lockmanager-api`, and `org.apache.activemq.artemis.core.config.ha.DistributedLockManagerConfiguration` respectively. Previously these were marked as "experimental" in the documentation and were changed strictly in name to clarify their use conceptually. Furthermore, the documentation around high availability and network isolation (i.e. split brain) was refactored significantly to be more clear and comprehensive. == 2.32.0 diff --git a/pom.xml b/pom.xml index 1c55a54413..c1e379acf6 100644 --- a/pom.xml +++ b/pom.xml @@ -66,8 +66,7 @@ artemis-unit-test-support tests artemis-features - artemis-quorum-api - artemis-quorum-ri + artemis-lockmanager artemis-image artemis-image/examples diff --git a/tests/e2e-tests/src/main/resources/servers/ha/replication/pluggablequorumvote/backup/broker.xml b/tests/e2e-tests/src/main/resources/servers/ha/replication/lockmanager/backup/broker.xml similarity index 99% rename from tests/e2e-tests/src/main/resources/servers/ha/replication/pluggablequorumvote/backup/broker.xml rename to tests/e2e-tests/src/main/resources/servers/ha/replication/lockmanager/backup/broker.xml index feae90d4b9..2e97f1f014 100644 --- a/tests/e2e-tests/src/main/resources/servers/ha/replication/pluggablequorumvote/backup/broker.xml +++ b/tests/e2e-tests/src/main/resources/servers/ha/replication/lockmanager/backup/broker.xml @@ -218,7 +218,7 @@ under the License. diff --git a/tests/e2e-tests/src/main/resources/servers/ha/replication/pluggablequorumvote/backup/management.xml b/tests/e2e-tests/src/main/resources/servers/ha/replication/lockmanager/backup/management.xml similarity index 100% rename from tests/e2e-tests/src/main/resources/servers/ha/replication/pluggablequorumvote/backup/management.xml rename to tests/e2e-tests/src/main/resources/servers/ha/replication/lockmanager/backup/management.xml diff --git a/tests/e2e-tests/src/main/resources/servers/ha/replication/pluggablequorumvote/primary/broker.xml b/tests/e2e-tests/src/main/resources/servers/ha/replication/lockmanager/primary/broker.xml similarity index 99% rename from tests/e2e-tests/src/main/resources/servers/ha/replication/pluggablequorumvote/primary/broker.xml rename to tests/e2e-tests/src/main/resources/servers/ha/replication/lockmanager/primary/broker.xml index 49c801795c..0d04a10ad1 100644 --- a/tests/e2e-tests/src/main/resources/servers/ha/replication/pluggablequorumvote/primary/broker.xml +++ b/tests/e2e-tests/src/main/resources/servers/ha/replication/lockmanager/primary/broker.xml @@ -216,7 +216,7 @@ under the License. diff --git a/tests/e2e-tests/src/main/resources/servers/ha/replication/pluggablequorumvote/primary/management.xml b/tests/e2e-tests/src/main/resources/servers/ha/replication/lockmanager/primary/management.xml similarity index 100% rename from tests/e2e-tests/src/main/resources/servers/ha/replication/pluggablequorumvote/primary/management.xml rename to tests/e2e-tests/src/main/resources/servers/ha/replication/lockmanager/primary/management.xml diff --git a/tests/e2e-tests/src/test/java/org/apache/activemq/artemis/tests/e2e/ha/replication/pluggablequorumvote/GCPauseSimulationTests.java b/tests/e2e-tests/src/test/java/org/apache/activemq/artemis/tests/e2e/ha/replication/lockmanager/GCPauseSimulationTests.java similarity index 99% rename from tests/e2e-tests/src/test/java/org/apache/activemq/artemis/tests/e2e/ha/replication/pluggablequorumvote/GCPauseSimulationTests.java rename to tests/e2e-tests/src/test/java/org/apache/activemq/artemis/tests/e2e/ha/replication/lockmanager/GCPauseSimulationTests.java index 60f4b85a97..fac5cddba8 100644 --- a/tests/e2e-tests/src/test/java/org/apache/activemq/artemis/tests/e2e/ha/replication/pluggablequorumvote/GCPauseSimulationTests.java +++ b/tests/e2e-tests/src/test/java/org/apache/activemq/artemis/tests/e2e/ha/replication/lockmanager/GCPauseSimulationTests.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.activemq.artemis.tests.e2e.ha.replication.pluggablequorumvote; +package org.apache.activemq.artemis.tests.e2e.ha.replication.lockmanager; import javax.jms.Connection; import javax.jms.DeliveryMode; @@ -41,7 +41,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; -public class GCPauseSimulationTests extends PluggableQuorumVoteTestBase { +public class GCPauseSimulationTests extends LockManagerTestBase { private static final String PRIMARY_LOCATION = E2ETestBase.basedir + "/target/ha/replication/pluggablequorumvote/primary"; private static final String BACKUP_LOCATION = E2ETestBase.basedir + "/target/ha/replication/pluggablequorumvote/backup"; diff --git a/tests/e2e-tests/src/test/java/org/apache/activemq/artemis/tests/e2e/ha/replication/pluggablequorumvote/PluggableQuorumVoteTestBase.java b/tests/e2e-tests/src/test/java/org/apache/activemq/artemis/tests/e2e/ha/replication/lockmanager/LockManagerTestBase.java similarity index 95% rename from tests/e2e-tests/src/test/java/org/apache/activemq/artemis/tests/e2e/ha/replication/pluggablequorumvote/PluggableQuorumVoteTestBase.java rename to tests/e2e-tests/src/test/java/org/apache/activemq/artemis/tests/e2e/ha/replication/lockmanager/LockManagerTestBase.java index 84f948eb3a..ec689bdbbf 100644 --- a/tests/e2e-tests/src/test/java/org/apache/activemq/artemis/tests/e2e/ha/replication/pluggablequorumvote/PluggableQuorumVoteTestBase.java +++ b/tests/e2e-tests/src/test/java/org/apache/activemq/artemis/tests/e2e/ha/replication/lockmanager/LockManagerTestBase.java @@ -15,13 +15,13 @@ * limitations under the License. */ -package org.apache.activemq.artemis.tests.e2e.ha.replication.pluggablequorumvote; +package org.apache.activemq.artemis.tests.e2e.ha.replication.lockmanager; import org.apache.activemq.artemis.tests.e2e.common.ContainerService; import org.junit.AfterClass; import org.junit.BeforeClass; -public abstract class PluggableQuorumVoteTestBase { +public abstract class LockManagerTestBase { protected static ContainerService service; protected static Object network; diff --git a/tests/integration-tests/pom.xml b/tests/integration-tests/pom.xml index 198cc8e4a3..231183533b 100644 --- a/tests/integration-tests/pom.xml +++ b/tests/integration-tests/pom.xml @@ -35,12 +35,12 @@ org.apache.activemq - artemis-quorum-api + artemis-lockmanager-api test org.apache.activemq - artemis-quorum-ri + artemis-lockmanager-ri test diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cli/ActivationSequenceCommandsTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cli/ActivationSequenceCommandsTest.java index f26fa068d7..8a17b848f4 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cli/ActivationSequenceCommandsTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cli/ActivationSequenceCommandsTest.java @@ -26,17 +26,17 @@ import org.apache.activemq.artemis.cli.commands.activation.ActivationSequenceSet import org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.HAPolicyConfiguration; -import org.apache.activemq.artemis.core.config.ha.DistributedPrimitiveManagerConfiguration; +import org.apache.activemq.artemis.core.config.ha.DistributedLockManagerConfiguration; import org.apache.activemq.artemis.core.config.ha.ReplicationBackupPolicyConfiguration; import org.apache.activemq.artemis.core.config.ha.ReplicationPrimaryPolicyConfiguration; import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServers; import org.apache.activemq.artemis.core.server.JournalType; -import org.apache.activemq.artemis.quorum.DistributedLock; -import org.apache.activemq.artemis.quorum.DistributedPrimitiveManager; -import org.apache.activemq.artemis.quorum.MutableLong; -import org.apache.activemq.artemis.quorum.file.FileBasedPrimitiveManager; +import org.apache.activemq.artemis.lockmanager.DistributedLock; +import org.apache.activemq.artemis.lockmanager.DistributedLockManager; +import org.apache.activemq.artemis.lockmanager.MutableLong; +import org.apache.activemq.artemis.lockmanager.file.FileBasedLockManager; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.tests.util.Wait; import org.junit.After; @@ -46,19 +46,21 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; +import static org.apache.activemq.artemis.lockmanager.DistributedLockManager.newInstanceOf; + public class ActivationSequenceCommandsTest extends ActiveMQTestBase { @Rule public TemporaryFolder brokersFolder = new TemporaryFolder(); - protected DistributedPrimitiveManagerConfiguration managerConfiguration; + protected DistributedLockManagerConfiguration managerConfiguration; @Before @Override public void setUp() throws Exception { super.setUp(); - managerConfiguration = new DistributedPrimitiveManagerConfiguration(FileBasedPrimitiveManager.class.getName(), - Collections.singletonMap("locks-folder", temporaryFolder.newFolder("manager").toString())); + managerConfiguration = new DistributedLockManagerConfiguration(FileBasedLockManager.class.getName(), + Collections.singletonMap("locks-folder", temporaryFolder.newFolder("manager").toString())); } @After @@ -209,11 +211,10 @@ public class ActivationSequenceCommandsTest extends ActiveMQTestBase { ActivationSequenceList.ListResult list = ActivationSequenceList.execute(sequenceList, primaryConfiguration, null); Assert.assertEquals(expectedStartCoordinatedSequence, list.coordinatedActivationSequence.longValue()); Assert.assertEquals(expectedStartCoordinatedSequence, list.localActivationSequence.longValue()); - try (DistributedPrimitiveManager distributedPrimitiveManager = DistributedPrimitiveManager - .newInstanceOf(managerConfiguration.getClassName(), managerConfiguration.getProperties())) { - distributedPrimitiveManager.start(); - try (DistributedLock lock = distributedPrimitiveManager.getDistributedLock(nodeID); - MutableLong coordinatedActivationSequence = distributedPrimitiveManager.getMutableLong(nodeID)) { + try (DistributedLockManager DistributedLockManager = newInstanceOf(managerConfiguration.getClassName(), managerConfiguration.getProperties())) { + DistributedLockManager.start(); + try (DistributedLock lock = DistributedLockManager.getDistributedLock(nodeID); + MutableLong coordinatedActivationSequence = DistributedLockManager.getMutableLong(nodeID)) { Assert.assertTrue(lock.tryLock()); final long activationSequence = coordinatedActivationSequence.get(); Assert.assertEquals(expectedStartCoordinatedSequence, activationSequence); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/PluggableQuorumInfiniteRedeliveryTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/LockManagerInfiniteRedeliveryTest.java similarity index 76% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/PluggableQuorumInfiniteRedeliveryTest.java rename to tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/LockManagerInfiniteRedeliveryTest.java index 47c2b6a6f0..a564e7b004 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/PluggableQuorumInfiniteRedeliveryTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/LockManagerInfiniteRedeliveryTest.java @@ -19,17 +19,17 @@ package org.apache.activemq.artemis.tests.integration.client; import java.util.Collections; import org.apache.activemq.artemis.api.core.TransportConfiguration; -import org.apache.activemq.artemis.core.config.ha.DistributedPrimitiveManagerConfiguration; +import org.apache.activemq.artemis.core.config.ha.DistributedLockManagerConfiguration; import org.apache.activemq.artemis.core.config.ha.ReplicationBackupPolicyConfiguration; -import org.apache.activemq.artemis.quorum.file.FileBasedPrimitiveManager; +import org.apache.activemq.artemis.lockmanager.file.FileBasedLockManager; import org.apache.activemq.artemis.tests.util.ReplicatedBackupUtils; import org.junit.Before; -public class PluggableQuorumInfiniteRedeliveryTest extends InfiniteRedeliveryTest { +public class LockManagerInfiniteRedeliveryTest extends InfiniteRedeliveryTest { - private DistributedPrimitiveManagerConfiguration managerConfiguration; + private DistributedLockManagerConfiguration managerConfiguration; - public PluggableQuorumInfiniteRedeliveryTest(String protocol, boolean useCLI) { + public LockManagerInfiniteRedeliveryTest(String protocol, boolean useCLI) { super(protocol, useCLI); } @@ -37,8 +37,8 @@ public class PluggableQuorumInfiniteRedeliveryTest extends InfiniteRedeliveryTes @Override public void setUp() throws Exception { super.setUp(); - this.managerConfiguration = new DistributedPrimitiveManagerConfiguration(FileBasedPrimitiveManager.class.getName(), - Collections.singletonMap("locks-folder", temporaryFolder.newFolder("manager").toString())); + this.managerConfiguration = new DistributedLockManagerConfiguration(FileBasedLockManager.class.getName(), + Collections.singletonMap("locks-folder", temporaryFolder.newFolder("manager").toString())); } @Override diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterTestBase.java index d650dc81fa..1464507ba7 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterTestBase.java @@ -57,7 +57,7 @@ import org.apache.activemq.artemis.core.client.impl.TopologyMemberImpl; import org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.HAPolicyConfiguration; -import org.apache.activemq.artemis.core.config.ha.DistributedPrimitiveManagerConfiguration; +import org.apache.activemq.artemis.core.config.ha.DistributedLockManagerConfiguration; import org.apache.activemq.artemis.core.config.ha.PrimaryOnlyPolicyConfiguration; import org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration; import org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration; @@ -84,12 +84,12 @@ import org.apache.activemq.artemis.core.server.cluster.impl.BridgeMetrics; import org.apache.activemq.artemis.core.server.cluster.impl.ClusterConnectionImpl; import org.apache.activemq.artemis.core.server.cluster.impl.ClusterConnectionMetrics; import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType; -import org.apache.activemq.artemis.core.server.cluster.qourum.SharedNothingBackupQuorum; +import org.apache.activemq.artemis.core.server.cluster.quorum.SharedNothingBackupQuorum; import org.apache.activemq.artemis.core.server.group.GroupingHandler; import org.apache.activemq.artemis.core.server.group.impl.GroupingHandlerConfiguration; import org.apache.activemq.artemis.core.server.impl.AddressInfo; import org.apache.activemq.artemis.core.server.impl.InVMNodeManager; -import org.apache.activemq.artemis.quorum.file.FileBasedPrimitiveManager; +import org.apache.activemq.artemis.lockmanager.file.FileBasedLockManager; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.utils.PortCheckRule; import org.junit.After; @@ -141,14 +141,14 @@ public abstract class ClusterTestBase extends ActiveMQTestBase { return true; } - private DistributedPrimitiveManagerConfiguration pluggableQuorumConfiguration = null; + private DistributedLockManagerConfiguration pluggableQuorumConfiguration = null; - private DistributedPrimitiveManagerConfiguration getOrCreatePluggableQuorumConfiguration() { + private DistributedLockManagerConfiguration getOrCreatePluggableQuorumConfiguration() { if (pluggableQuorumConfiguration != null) { return pluggableQuorumConfiguration; } try { - pluggableQuorumConfiguration = new DistributedPrimitiveManagerConfiguration(FileBasedPrimitiveManager.class.getName(), Collections.singletonMap("locks-folder", temporaryFolder.newFolder("manager").toString())); + pluggableQuorumConfiguration = new DistributedLockManagerConfiguration(FileBasedLockManager.class.getName(), Collections.singletonMap("locks-folder", temporaryFolder.newFolder("manager").toString())); } catch (IOException ioException) { logger.error(ioException.getMessage(), ioException); return null; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTestBase.java index d71d20ab4f..e7260800fa 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTestBase.java @@ -37,7 +37,7 @@ import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryInternal import org.apache.activemq.artemis.core.client.impl.ServerLocatorInternal; import org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration; import org.apache.activemq.artemis.core.config.Configuration; -import org.apache.activemq.artemis.core.config.ha.DistributedPrimitiveManagerConfiguration; +import org.apache.activemq.artemis.core.config.ha.DistributedLockManagerConfiguration; import org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration; import org.apache.activemq.artemis.core.config.ha.SharedStorePrimaryPolicyConfiguration; import org.apache.activemq.artemis.core.config.ha.SharedStoreBackupPolicyConfiguration; @@ -48,7 +48,7 @@ import org.apache.activemq.artemis.core.server.cluster.ha.HAPolicy; import org.apache.activemq.artemis.core.server.cluster.ha.ReplicatedPolicy; import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl; import org.apache.activemq.artemis.core.server.impl.InVMNodeManager; -import org.apache.activemq.artemis.quorum.file.FileBasedPrimitiveManager; +import org.apache.activemq.artemis.lockmanager.file.FileBasedLockManager; import org.apache.activemq.artemis.tests.integration.cluster.util.SameProcessActiveMQServer; import org.apache.activemq.artemis.tests.integration.cluster.util.TestableServer; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; @@ -83,7 +83,7 @@ public abstract class FailoverTestBase extends ActiveMQTestBase { protected NodeManager backupNodeManager; - protected DistributedPrimitiveManagerConfiguration managerConfiguration; + protected DistributedLockManagerConfiguration managerConfiguration; protected boolean startBackupServer = true; @@ -236,8 +236,8 @@ public abstract class FailoverTestBase extends ActiveMQTestBase { primaryConfig = createDefaultInVMConfig(); managerConfiguration = - new DistributedPrimitiveManagerConfiguration(FileBasedPrimitiveManager.class.getName(), - Collections.singletonMap("locks-folder", temporaryFolder.newFolder("manager").toString())); + new DistributedLockManagerConfiguration(FileBasedLockManager.class.getName(), + Collections.singletonMap("locks-folder", temporaryFolder.newFolder("manager").toString())); ReplicatedBackupUtils.configurePluggableQuorumReplicationPair(backupConfig, backupConnector, backupAcceptor, primaryConfig, primaryConnector, null, managerConfiguration, managerConfiguration); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/MultipleServerFailoverTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/MultipleServerFailoverTestBase.java index 64aabb8c80..c159eced3d 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/MultipleServerFailoverTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/MultipleServerFailoverTestBase.java @@ -29,7 +29,7 @@ import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.core.client.impl.ServerLocatorInternal; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.HAPolicyConfiguration; -import org.apache.activemq.artemis.core.config.ha.DistributedPrimitiveManagerConfiguration; +import org.apache.activemq.artemis.core.config.ha.DistributedLockManagerConfiguration; import org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration; import org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration; import org.apache.activemq.artemis.core.config.ha.ReplicationBackupPolicyConfiguration; @@ -39,7 +39,7 @@ import org.apache.activemq.artemis.core.config.ha.SharedStoreBackupPolicyConfigu import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.NodeManager; import org.apache.activemq.artemis.core.server.Queue; -import org.apache.activemq.artemis.quorum.file.FileBasedPrimitiveManager; +import org.apache.activemq.artemis.lockmanager.file.FileBasedLockManager; import org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase; import org.apache.activemq.artemis.tests.util.Wait; import org.apache.activemq.artemis.tests.integration.cluster.util.SameProcessActiveMQServer; @@ -54,14 +54,14 @@ import java.lang.invoke.MethodHandles; public abstract class MultipleServerFailoverTestBase extends ActiveMQTestBase { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - private DistributedPrimitiveManagerConfiguration pluggableQuorumConfiguration = null; + private DistributedLockManagerConfiguration pluggableQuorumConfiguration = null; - private DistributedPrimitiveManagerConfiguration getOrCreatePluggableQuorumConfiguration() { + private DistributedLockManagerConfiguration getOrCreatePluggableQuorumConfiguration() { if (pluggableQuorumConfiguration != null) { return pluggableQuorumConfiguration; } try { - pluggableQuorumConfiguration = new DistributedPrimitiveManagerConfiguration(FileBasedPrimitiveManager.class.getName(), Collections.singletonMap("locks-folder", temporaryFolder.newFolder("manager").toString())); + pluggableQuorumConfiguration = new DistributedLockManagerConfiguration(FileBasedLockManager.class.getName(), Collections.singletonMap("locks-folder", temporaryFolder.newFolder("manager").toString())); } catch (IOException ioException) { return null; } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/QuorumVoteServerConnectTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/QuorumVoteServerConnectTest.java index 2f404a84cb..c1130d0e23 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/QuorumVoteServerConnectTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/QuorumVoteServerConnectTest.java @@ -26,8 +26,8 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -import org.apache.activemq.artemis.core.server.cluster.qourum.QuorumVoteServerConnect; -import org.apache.activemq.artemis.core.server.cluster.qourum.ServerConnectVote; +import org.apache.activemq.artemis.core.server.cluster.quorum.QuorumVoteServerConnect; +import org.apache.activemq.artemis.core.server.cluster.quorum.ServerConnectVote; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.hamcrest.Matchers; import org.junit.Assert; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumBackupAuthenticationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerBackupAuthenticationTest.java similarity index 98% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumBackupAuthenticationTest.java rename to tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerBackupAuthenticationTest.java index 491c59ec2f..e4174afee6 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumBackupAuthenticationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerBackupAuthenticationTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.tests.integration.cluster.failover.quorum; +package org.apache.activemq.artemis.tests.integration.cluster.failover.lockmanager; import java.util.Arrays; import java.util.concurrent.CountDownLatch; @@ -39,7 +39,7 @@ import org.junit.runners.Parameterized; import static java.util.Arrays.asList; @RunWith(Parameterized.class) -public class PluggableQuorumBackupAuthenticationTest extends FailoverTestBase { +public class LockManagerBackupAuthenticationTest extends FailoverTestBase { private static CountDownLatch registrationStarted; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumBackupSyncJournalTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerBackupSyncJournalTest.java similarity index 93% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumBackupSyncJournalTest.java rename to tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerBackupSyncJournalTest.java index 1dad1a1362..3d93849918 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumBackupSyncJournalTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerBackupSyncJournalTest.java @@ -15,12 +15,12 @@ * limitations under the License. */ -package org.apache.activemq.artemis.tests.integration.cluster.failover.quorum; +package org.apache.activemq.artemis.tests.integration.cluster.failover.lockmanager; import org.apache.activemq.artemis.core.config.ha.ReplicationBackupPolicyConfiguration; import org.apache.activemq.artemis.tests.integration.cluster.failover.BackupSyncJournalTest; -public class PluggableQuorumBackupSyncJournalTest extends BackupSyncJournalTest { +public class LockManagerBackupSyncJournalTest extends BackupSyncJournalTest { @Override protected void createConfigs() throws Exception { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumBackupSyncLargeMessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerBackupSyncLargeMessageTest.java similarity index 92% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumBackupSyncLargeMessageTest.java rename to tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerBackupSyncLargeMessageTest.java index d2a4e83688..5b6e49f333 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumBackupSyncLargeMessageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerBackupSyncLargeMessageTest.java @@ -14,12 +14,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.tests.integration.cluster.failover.quorum; +package org.apache.activemq.artemis.tests.integration.cluster.failover.lockmanager; import org.apache.activemq.artemis.core.config.ha.ReplicationBackupPolicyConfiguration; import org.apache.activemq.artemis.tests.integration.cluster.failover.BackupSyncLargeMessageTest; -public class PluggableQuorumBackupSyncLargeMessageTest extends BackupSyncLargeMessageTest { +public class LockManagerBackupSyncLargeMessageTest extends BackupSyncLargeMessageTest { @Override protected void createConfigs() throws Exception { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumBackupSyncPagingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerBackupSyncPagingTest.java similarity index 93% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumBackupSyncPagingTest.java rename to tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerBackupSyncPagingTest.java index 6b9df714e6..960700e970 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumBackupSyncPagingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerBackupSyncPagingTest.java @@ -14,12 +14,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.tests.integration.cluster.failover.quorum; +package org.apache.activemq.artemis.tests.integration.cluster.failover.lockmanager; import org.apache.activemq.artemis.core.config.ha.ReplicationBackupPolicyConfiguration; import org.apache.activemq.artemis.tests.integration.cluster.failover.BackupSyncPagingTest; -public class PluggableQuorumBackupSyncPagingTest extends BackupSyncPagingTest { +public class LockManagerBackupSyncPagingTest extends BackupSyncPagingTest { @Override protected void createConfigs() throws Exception { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumExtraBackupReplicatedFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerExtraBackupReplicatedFailoverTest.java similarity index 97% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumExtraBackupReplicatedFailoverTest.java rename to tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerExtraBackupReplicatedFailoverTest.java index 3987ce0090..e7fb8e156b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumExtraBackupReplicatedFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerExtraBackupReplicatedFailoverTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.tests.integration.cluster.failover.quorum; +package org.apache.activemq.artemis.tests.integration.cluster.failover.lockmanager; import java.util.Arrays; @@ -33,7 +33,7 @@ import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @RunWith(Parameterized.class) -public class PluggableQuorumExtraBackupReplicatedFailoverTest extends FailoverTestBase { +public class LockManagerExtraBackupReplicatedFailoverTest extends FailoverTestBase { private static final String GROUP_NAME = "foo"; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumGroupingFailoverReplicationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerGroupingFailoverReplicationTest.java similarity index 91% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumGroupingFailoverReplicationTest.java rename to tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerGroupingFailoverReplicationTest.java index 80ea376470..36b4656216 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumGroupingFailoverReplicationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerGroupingFailoverReplicationTest.java @@ -14,12 +14,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.tests.integration.cluster.failover.quorum; +package org.apache.activemq.artemis.tests.integration.cluster.failover.lockmanager; import org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase; import org.apache.activemq.artemis.tests.integration.cluster.failover.GroupingFailoverTestBase; -public class PluggableQuorumGroupingFailoverReplicationTest extends GroupingFailoverTestBase { +public class LockManagerGroupingFailoverReplicationTest extends GroupingFailoverTestBase { @Override protected ClusterTestBase.HAType haType() { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumNettyNoGroupNameReplicatedFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerNettyNoGroupNameReplicatedFailoverTest.java similarity index 93% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumNettyNoGroupNameReplicatedFailoverTest.java rename to tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerNettyNoGroupNameReplicatedFailoverTest.java index 244d05beab..5b289ffd1c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumNettyNoGroupNameReplicatedFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerNettyNoGroupNameReplicatedFailoverTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.tests.integration.cluster.failover.quorum; +package org.apache.activemq.artemis.tests.integration.cluster.failover.lockmanager; import java.io.IOException; import java.io.OutputStream; @@ -30,7 +30,7 @@ import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.component.WebServerComponent; -import org.apache.activemq.artemis.core.config.ha.DistributedPrimitiveManagerConfiguration; +import org.apache.activemq.artemis.core.config.ha.DistributedLockManagerConfiguration; import org.apache.activemq.artemis.core.config.ha.ReplicationBackupPolicyConfiguration; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.NodeManager; @@ -38,8 +38,8 @@ import org.apache.activemq.artemis.core.server.ServiceComponent; import org.apache.activemq.artemis.dto.AppDTO; import org.apache.activemq.artemis.dto.BindingDTO; import org.apache.activemq.artemis.dto.WebServerDTO; -import org.apache.activemq.artemis.quorum.MutableLong; -import org.apache.activemq.artemis.quorum.file.FileBasedPrimitiveManager; +import org.apache.activemq.artemis.lockmanager.MutableLong; +import org.apache.activemq.artemis.lockmanager.file.FileBasedLockManager; import org.apache.activemq.artemis.tests.integration.cluster.failover.FailoverTest; import org.apache.activemq.artemis.tests.integration.cluster.util.TestableServer; import org.apache.activemq.artemis.tests.util.Wait; @@ -49,7 +49,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.lang.invoke.MethodHandles; -public class PluggableQuorumNettyNoGroupNameReplicatedFailoverTest extends FailoverTest { +public class LockManagerNettyNoGroupNameReplicatedFailoverTest extends FailoverTest { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); protected void beforeWaitForRemoteBackupSynchronization() { @@ -225,11 +225,11 @@ public class PluggableQuorumNettyNoGroupNameReplicatedFailoverTest extends Failo doDecrementActivationSequenceForForceRestartOf(logger, nodeManager, managerConfiguration); } - public static void doDecrementActivationSequenceForForceRestartOf(Logger log, NodeManager nodeManager, DistributedPrimitiveManagerConfiguration distributedPrimitiveManagerConfiguration) throws Exception { + public static void doDecrementActivationSequenceForForceRestartOf(Logger log, NodeManager nodeManager, DistributedLockManagerConfiguration DistributedLockManagerConfiguration) throws Exception { nodeManager.start(); long localActivation = nodeManager.readNodeActivationSequence(); // file based - FileBasedPrimitiveManager fileBasedPrimitiveManager = new FileBasedPrimitiveManager(distributedPrimitiveManagerConfiguration.getProperties()); + FileBasedLockManager fileBasedPrimitiveManager = new FileBasedLockManager(DistributedLockManagerConfiguration.getProperties()); fileBasedPrimitiveManager.start(); try { MutableLong mutableLong = fileBasedPrimitiveManager.getMutableLong(nodeManager.getNodeId().toString()); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumNettyReplicationStopTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerNettyReplicationStopTest.java similarity index 93% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumNettyReplicationStopTest.java rename to tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerNettyReplicationStopTest.java index a42547c6e7..7c9e431cb3 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumNettyReplicationStopTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerNettyReplicationStopTest.java @@ -14,12 +14,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.tests.integration.cluster.failover.quorum; +package org.apache.activemq.artemis.tests.integration.cluster.failover.lockmanager; import org.apache.activemq.artemis.core.config.ha.ReplicationBackupPolicyConfiguration; import org.apache.activemq.artemis.tests.integration.cluster.failover.NettyReplicationStopTest; -public class PluggableQuorumNettyReplicationStopTest extends NettyReplicationStopTest { +public class LockManagerNettyReplicationStopTest extends NettyReplicationStopTest { @Override protected void createConfigs() throws Exception { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumPageCleanupWhileReplicaCatchupTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerPageCleanupWhileReplicaCatchupTest.java similarity index 91% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumPageCleanupWhileReplicaCatchupTest.java rename to tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerPageCleanupWhileReplicaCatchupTest.java index b351706e43..f295a53dca 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumPageCleanupWhileReplicaCatchupTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerPageCleanupWhileReplicaCatchupTest.java @@ -14,12 +14,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.tests.integration.cluster.failover.quorum; +package org.apache.activemq.artemis.tests.integration.cluster.failover.lockmanager; import org.apache.activemq.artemis.core.config.ha.ReplicationBackupPolicyConfiguration; import org.apache.activemq.artemis.tests.integration.cluster.failover.PageCleanupWhileReplicaCatchupTest; -public class PluggableQuorumPageCleanupWhileReplicaCatchupTest extends PageCleanupWhileReplicaCatchupTest { +public class LockManagerPageCleanupWhileReplicaCatchupTest extends PageCleanupWhileReplicaCatchupTest { @Override protected void createConfigs() throws Exception { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumReplicaTimeoutTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerReplicaTimeoutTest.java similarity index 84% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumReplicaTimeoutTest.java rename to tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerReplicaTimeoutTest.java index 20dc13beda..a8264f24a0 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumReplicaTimeoutTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerReplicaTimeoutTest.java @@ -14,21 +14,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.tests.integration.cluster.failover.quorum; +package org.apache.activemq.artemis.tests.integration.cluster.failover.lockmanager; import java.io.IOException; import java.util.Collections; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.core.config.Configuration; -import org.apache.activemq.artemis.core.config.ha.DistributedPrimitiveManagerConfiguration; +import org.apache.activemq.artemis.core.config.ha.DistributedLockManagerConfiguration; import org.apache.activemq.artemis.core.config.ha.ReplicationBackupPolicyConfiguration; import org.apache.activemq.artemis.core.config.ha.ReplicationPrimaryPolicyConfiguration; -import org.apache.activemq.artemis.quorum.file.FileBasedPrimitiveManager; +import org.apache.activemq.artemis.lockmanager.file.FileBasedLockManager; import org.apache.activemq.artemis.tests.integration.cluster.failover.ReplicaTimeoutTest; import org.apache.activemq.artemis.tests.util.ReplicatedBackupUtils; -public class PluggableQuorumReplicaTimeoutTest extends ReplicaTimeoutTest { +public class LockManagerReplicaTimeoutTest extends ReplicaTimeoutTest { @Override protected void configureReplicationPair(Configuration backupConfig, @@ -36,7 +36,7 @@ public class PluggableQuorumReplicaTimeoutTest extends ReplicaTimeoutTest { TransportConfiguration backupConnector, TransportConfiguration backupAcceptor, TransportConfiguration primaryConnector) throws IOException { - DistributedPrimitiveManagerConfiguration managerConfiguration = new DistributedPrimitiveManagerConfiguration(FileBasedPrimitiveManager.class.getName(), Collections.singletonMap("locks-folder", temporaryFolder.newFolder("manager").toString())); + DistributedLockManagerConfiguration managerConfiguration = new DistributedLockManagerConfiguration(FileBasedLockManager.class.getName(), Collections.singletonMap("locks-folder", temporaryFolder.newFolder("manager").toString())); ReplicatedBackupUtils.configurePluggableQuorumReplicationPair(backupConfig, backupConnector, backupAcceptor, primaryConfig, primaryConnector, null, diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumReplicatedDistributionTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerReplicatedDistributionTest.java similarity index 90% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumReplicatedDistributionTest.java rename to tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerReplicatedDistributionTest.java index afbd01e9e6..7331f469aa 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumReplicatedDistributionTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerReplicatedDistributionTest.java @@ -14,11 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.tests.integration.cluster.failover.quorum; +package org.apache.activemq.artemis.tests.integration.cluster.failover.lockmanager; import org.apache.activemq.artemis.tests.integration.cluster.failover.ReplicatedDistributionTest; -public class PluggableQuorumReplicatedDistributionTest extends ReplicatedDistributionTest { +public class LockManagerReplicatedDistributionTest extends ReplicatedDistributionTest { @Override protected HAType haType() { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumReplicatedLargeMessageFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerReplicatedLargeMessageFailoverTest.java similarity index 92% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumReplicatedLargeMessageFailoverTest.java rename to tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerReplicatedLargeMessageFailoverTest.java index d8b692a903..7380b093a9 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumReplicatedLargeMessageFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerReplicatedLargeMessageFailoverTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.tests.integration.cluster.failover.quorum; +package org.apache.activemq.artemis.tests.integration.cluster.failover.lockmanager; import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.core.config.ha.ReplicationBackupPolicyConfiguration; @@ -24,9 +24,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.lang.invoke.MethodHandles; -import static org.apache.activemq.artemis.tests.integration.cluster.failover.quorum.PluggableQuorumNettyNoGroupNameReplicatedFailoverTest.doDecrementActivationSequenceForForceRestartOf; +import static org.apache.activemq.artemis.tests.integration.cluster.failover.lockmanager.LockManagerNettyNoGroupNameReplicatedFailoverTest.doDecrementActivationSequenceForForceRestartOf; -public class PluggableQuorumReplicatedLargeMessageFailoverTest extends LargeMessageFailoverTest { +public class LockManagerReplicatedLargeMessageFailoverTest extends LargeMessageFailoverTest { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); @Override diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumReplicatedLargeMessageWithDelayFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerReplicatedLargeMessageWithDelayFailoverTest.java similarity index 94% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumReplicatedLargeMessageWithDelayFailoverTest.java rename to tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerReplicatedLargeMessageWithDelayFailoverTest.java index 5ab1d09b03..0060714981 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumReplicatedLargeMessageWithDelayFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerReplicatedLargeMessageWithDelayFailoverTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.tests.integration.cluster.failover.quorum; +package org.apache.activemq.artemis.tests.integration.cluster.failover.lockmanager; import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.core.config.ha.ReplicationBackupPolicyConfiguration; @@ -22,7 +22,7 @@ import org.apache.activemq.artemis.tests.integration.cluster.util.BackupSyncDela import org.junit.After; import org.junit.Before; -public class PluggableQuorumReplicatedLargeMessageWithDelayFailoverTest extends PluggableQuorumReplicatedLargeMessageFailoverTest { +public class LockManagerReplicatedLargeMessageWithDelayFailoverTest extends LockManagerReplicatedLargeMessageFailoverTest { private BackupSyncDelay syncDelay; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumReplicatedPagingFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerReplicatedPagingFailoverTest.java similarity index 93% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumReplicatedPagingFailoverTest.java rename to tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerReplicatedPagingFailoverTest.java index 9c4d60004f..3a7002d6a1 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/quorum/PluggableQuorumReplicatedPagingFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/lockmanager/LockManagerReplicatedPagingFailoverTest.java @@ -14,12 +14,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.tests.integration.cluster.failover.quorum; +package org.apache.activemq.artemis.tests.integration.cluster.failover.lockmanager; import org.apache.activemq.artemis.core.config.ha.ReplicationBackupPolicyConfiguration; import org.apache.activemq.artemis.tests.integration.cluster.failover.PagingFailoverTest; -public class PluggableQuorumReplicatedPagingFailoverTest extends PagingFailoverTest { +public class LockManagerReplicatedPagingFailoverTest extends PagingFailoverTest { @Override protected void createConfigs() throws Exception { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/PluggableQuorumReplicationFlowControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/LockManagerReplicationFlowControlTest.java similarity index 77% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/PluggableQuorumReplicationFlowControlTest.java rename to tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/LockManagerReplicationFlowControlTest.java index 467a3d3fdd..ec89ecd9b8 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/PluggableQuorumReplicationFlowControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/LockManagerReplicationFlowControlTest.java @@ -20,19 +20,19 @@ import java.io.IOException; import java.util.Collections; import org.apache.activemq.artemis.core.config.HAPolicyConfiguration; -import org.apache.activemq.artemis.core.config.ha.DistributedPrimitiveManagerConfiguration; +import org.apache.activemq.artemis.core.config.ha.DistributedLockManagerConfiguration; import org.apache.activemq.artemis.core.config.ha.ReplicationBackupPolicyConfiguration; import org.apache.activemq.artemis.core.config.ha.ReplicationPrimaryPolicyConfiguration; -import org.apache.activemq.artemis.quorum.file.FileBasedPrimitiveManager; +import org.apache.activemq.artemis.lockmanager.file.FileBasedLockManager; import org.junit.Before; -public class PluggableQuorumReplicationFlowControlTest extends SharedNothingReplicationFlowControlTest { +public class LockManagerReplicationFlowControlTest extends SharedNothingReplicationFlowControlTest { - private DistributedPrimitiveManagerConfiguration managerConfiguration; + private DistributedLockManagerConfiguration managerConfiguration; @Before public void init() throws IOException { - managerConfiguration = new DistributedPrimitiveManagerConfiguration(FileBasedPrimitiveManager.class.getName(), Collections.singletonMap("locks-folder", temporaryFolder.newFolder("manager").toString())); + managerConfiguration = new DistributedLockManagerConfiguration(FileBasedLockManager.class.getName(), Collections.singletonMap("locks-folder", temporaryFolder.newFolder("manager").toString())); } @Override diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/PluggableQuorumReplicationOrderTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/LockManagerReplicationOrderTest.java similarity index 96% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/PluggableQuorumReplicationOrderTest.java rename to tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/LockManagerReplicationOrderTest.java index 8d71a57e4e..7bfaed8aff 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/PluggableQuorumReplicationOrderTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/LockManagerReplicationOrderTest.java @@ -24,7 +24,7 @@ import org.junit.runners.Parameterized; import static java.util.Arrays.asList; @RunWith(Parameterized.class) -public class PluggableQuorumReplicationOrderTest extends ReplicationOrderTest { +public class LockManagerReplicationOrderTest extends ReplicationOrderTest { @Parameterized.Parameter public boolean useNetty; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/PluggableQuorumReplicationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/LockManagerReplicationTest.java similarity index 92% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/PluggableQuorumReplicationTest.java rename to tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/LockManagerReplicationTest.java index 614ac22bc2..45e099bb13 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/PluggableQuorumReplicationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/LockManagerReplicationTest.java @@ -33,29 +33,29 @@ import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.HAPolicyConfiguration; -import org.apache.activemq.artemis.core.config.ha.DistributedPrimitiveManagerConfiguration; +import org.apache.activemq.artemis.core.config.ha.DistributedLockManagerConfiguration; import org.apache.activemq.artemis.core.config.ha.ReplicationBackupPolicyConfiguration; import org.apache.activemq.artemis.core.config.ha.ReplicationPrimaryPolicyConfiguration; import org.apache.activemq.artemis.core.server.ActivateCallback; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServers; import org.apache.activemq.artemis.core.server.impl.FileLockNodeManager; -import org.apache.activemq.artemis.quorum.DistributedLock; -import org.apache.activemq.artemis.quorum.DistributedPrimitiveManager; -import org.apache.activemq.artemis.quorum.MutableLong; -import org.apache.activemq.artemis.quorum.file.FileBasedPrimitiveManager; +import org.apache.activemq.artemis.lockmanager.DistributedLock; +import org.apache.activemq.artemis.lockmanager.DistributedLockManager; +import org.apache.activemq.artemis.lockmanager.MutableLong; +import org.apache.activemq.artemis.lockmanager.file.FileBasedLockManager; import org.apache.activemq.artemis.tests.util.Wait; import org.junit.Assert; import org.junit.Before; import org.junit.Test; -public class PluggableQuorumReplicationTest extends SharedNothingReplicationTest { +public class LockManagerReplicationTest extends SharedNothingReplicationTest { - private DistributedPrimitiveManagerConfiguration managerConfiguration; + private DistributedLockManagerConfiguration managerConfiguration; @Before public void init() throws IOException { - managerConfiguration = new DistributedPrimitiveManagerConfiguration(FileBasedPrimitiveManager.class.getName(), Collections.singletonMap("locks-folder", temporaryFolder.newFolder("manager").toString())); + managerConfiguration = new DistributedLockManagerConfiguration(FileBasedLockManager.class.getName(), Collections.singletonMap("locks-folder", temporaryFolder.newFolder("manager").toString())); } @Override @@ -370,11 +370,11 @@ public class PluggableQuorumReplicationTest extends SharedNothingReplicationTest // backup can get lock but does not have the sequence to start, will try and be a backup // to verify it can short circuit with a dirty read we grab the lock for a little while - DistributedPrimitiveManager distributedPrimitiveManager = DistributedPrimitiveManager.newInstanceOf( + DistributedLockManager distributedLockManager = DistributedLockManager.newInstanceOf( managerConfiguration.getClassName(), managerConfiguration.getProperties()); - distributedPrimitiveManager.start(); - final DistributedLock lock = distributedPrimitiveManager.getDistributedLock(coordinatedId); + distributedLockManager.start(); + final DistributedLock lock = distributedLockManager.getDistributedLock(coordinatedId); assertTrue(lock.tryLock()); CountDownLatch preActivate = new CountDownLatch(1); backupServer.registerActivateCallback(new ActivateCallback() { @@ -390,7 +390,7 @@ public class PluggableQuorumReplicationTest extends SharedNothingReplicationTest assertTrue(preActivate.await(1, TimeUnit.SECONDS)); // release the lock - distributedPrimitiveManager.stop(); + distributedLockManager.stop(); // primary server should be active primaryServer.start(); @@ -419,19 +419,18 @@ public class PluggableQuorumReplicationTest extends SharedNothingReplicationTest // backup can get lock but does not have the sequence to start, will try and be a backup // to verify it can short circuit with a dirty read we grab the lock for a little while - DistributedPrimitiveManager distributedPrimitiveManager = DistributedPrimitiveManager - .newInstanceOf(managerConfiguration.getClassName(), managerConfiguration.getProperties()); - distributedPrimitiveManager.start(); - try (DistributedLock lock = distributedPrimitiveManager.getDistributedLock(coordinatedId)) { + DistributedLockManager distributedLockManager = DistributedLockManager.newInstanceOf(managerConfiguration.getClassName(), managerConfiguration.getProperties()); + distributedLockManager.start(); + try (DistributedLock lock = distributedLockManager.getDistributedLock(coordinatedId)) { assertTrue(lock.tryLock()); - distributedPrimitiveManager.getMutableLong(coordinatedId).compareAndSet(2, -2); + distributedLockManager.getMutableLong(coordinatedId).compareAndSet(2, -2); } primaryServer.start(); Wait.waitFor(primaryServer::isStarted); Assert.assertEquals(3, primaryServer.getNodeManager().getNodeActivationSequence()); - Assert.assertEquals(3, distributedPrimitiveManager.getMutableLong(coordinatedId).get()); + Assert.assertEquals(3, distributedLockManager.getMutableLong(coordinatedId).get()); - distributedPrimitiveManager.stop(); + distributedLockManager.stop(); Configuration backupConfiguration = createBackupConfiguration(); ActiveMQServer backupServer = addServer(ActiveMQServers.newActiveMQServer(backupConfiguration)); @@ -570,9 +569,9 @@ public class PluggableQuorumReplicationTest extends SharedNothingReplicationTest // some manual intervention to force an unavailable // simulate primary failing in activation local sequence update on un replicated run when backup stops. - DistributedPrimitiveManager distributedPrimitiveManager = DistributedPrimitiveManager.newInstanceOf(managerConfiguration.getClassName(), managerConfiguration.getProperties()); - distributedPrimitiveManager.start(); - final MutableLong activationSequence = distributedPrimitiveManager.getMutableLong(coordinatedId); + DistributedLockManager distributedLockManager = DistributedLockManager.newInstanceOf(managerConfiguration.getClassName(), managerConfiguration.getProperties()); + distributedLockManager.start(); + final MutableLong activationSequence = distributedLockManager.getMutableLong(coordinatedId); Assert.assertTrue(activationSequence.compareAndSet(2, -2)); // primary server should activate after self healing its outstanding claim @@ -612,11 +611,11 @@ public class PluggableQuorumReplicationTest extends SharedNothingReplicationTest // some manual intervention to force an unavailable // simulate primary failing in activation local sequence update on un replicated run when backup stops. - DistributedPrimitiveManager distributedPrimitiveManager = DistributedPrimitiveManager.newInstanceOf( + DistributedLockManager distributedLockManager = DistributedLockManager.newInstanceOf( managerConfiguration.getClassName(), managerConfiguration.getProperties()); - distributedPrimitiveManager.start(); - final MutableLong coordinatedActivationSequence = distributedPrimitiveManager.getMutableLong(coordinatedId); + distributedLockManager.start(); + final MutableLong coordinatedActivationSequence = distributedLockManager.getMutableLong(coordinatedId); Assert.assertTrue(coordinatedActivationSequence.compareAndSet(2, -2)); // case: 2, the fail to write locally 2 but the write actually failing diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/ReplicationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/ReplicationTest.java index d6fd127ccc..dc23fa232c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/ReplicationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/ReplicationTest.java @@ -49,7 +49,7 @@ import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration; import org.apache.activemq.artemis.core.config.Configuration; -import org.apache.activemq.artemis.core.config.ha.DistributedPrimitiveManagerConfiguration; +import org.apache.activemq.artemis.core.config.ha.DistributedLockManagerConfiguration; import org.apache.activemq.artemis.core.config.ha.SharedStoreBackupPolicyConfiguration; import org.apache.activemq.artemis.core.io.IOCallback; import org.apache.activemq.artemis.core.io.SequentialFileFactory; @@ -87,7 +87,7 @@ import org.apache.activemq.artemis.core.server.cluster.ClusterController; import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl; import org.apache.activemq.artemis.core.settings.HierarchicalRepository; import org.apache.activemq.artemis.core.settings.impl.AddressSettings; -import org.apache.activemq.artemis.quorum.file.FileBasedPrimitiveManager; +import org.apache.activemq.artemis.lockmanager.file.FileBasedLockManager; import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.tests.util.ReplicatedBackupUtils; @@ -161,9 +161,9 @@ public final class ReplicationTest extends ActiveMQTestBase { if (!pluggableQuorum) { ReplicatedBackupUtils.configureReplicationPair(backupConfig, backupConnector, backupAcceptor, primaryConfig, primaryConnector, primaryAcceptor); } else { - DistributedPrimitiveManagerConfiguration managerConfiguration = - new DistributedPrimitiveManagerConfiguration(FileBasedPrimitiveManager.class.getName(), - Collections.singletonMap("locks-folder", temporaryFolder.newFolder("manager").toString())); + DistributedLockManagerConfiguration managerConfiguration = + new DistributedLockManagerConfiguration(FileBasedLockManager.class.getName(), + Collections.singletonMap("locks-folder", temporaryFolder.newFolder("manager").toString())); ReplicatedBackupUtils.configurePluggableQuorumReplicationPair(backupConfig, backupConnector, backupAcceptor, primaryConfig, primaryConnector, primaryAcceptor, managerConfiguration, managerConfiguration); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/PluggableQuorumBasicSecurityManagerFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LockManagerBasicSecurityManagerFailoverTest.java similarity index 90% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/PluggableQuorumBasicSecurityManagerFailoverTest.java rename to tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LockManagerBasicSecurityManagerFailoverTest.java index b4e9a60bac..d928acbad2 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/PluggableQuorumBasicSecurityManagerFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LockManagerBasicSecurityManagerFailoverTest.java @@ -22,9 +22,9 @@ import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; -import org.apache.activemq.artemis.core.config.ha.DistributedPrimitiveManagerConfiguration; +import org.apache.activemq.artemis.core.config.ha.DistributedLockManagerConfiguration; import org.apache.activemq.artemis.core.config.ha.ReplicationBackupPolicyConfiguration; -import org.apache.activemq.artemis.quorum.file.FileBasedPrimitiveManager; +import org.apache.activemq.artemis.lockmanager.file.FileBasedLockManager; import org.apache.activemq.artemis.spi.core.security.ActiveMQBasicSecurityManager; import org.apache.activemq.artemis.tests.integration.cluster.failover.FailoverTestBase; import org.apache.activemq.artemis.tests.util.ReplicatedBackupUtils; @@ -32,7 +32,7 @@ import org.apache.activemq.artemis.tests.util.TransportConfigurationUtils; import org.junit.Assert; import org.junit.Test; -public class PluggableQuorumBasicSecurityManagerFailoverTest extends FailoverTestBase { +public class LockManagerBasicSecurityManagerFailoverTest extends FailoverTestBase { @Override protected void createConfigs() throws Exception { @@ -48,9 +48,9 @@ public class PluggableQuorumBasicSecurityManagerFailoverTest extends FailoverTes backupConfig = createDefaultInVMConfig(); primaryConfig = createDefaultInVMConfig(); - DistributedPrimitiveManagerConfiguration managerConfiguration = - new DistributedPrimitiveManagerConfiguration(FileBasedPrimitiveManager.class.getName(), - Collections.singletonMap("locks-folder", + DistributedLockManagerConfiguration managerConfiguration = + new DistributedLockManagerConfiguration(FileBasedLockManager.class.getName(), + Collections.singletonMap("locks-folder", temporaryFolder.newFolder("manager").toString())); ReplicatedBackupUtils.configurePluggableQuorumReplicationPair(backupConfig, backupConnector, backupAcceptor, primaryConfig, primaryConnector, null, diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/ReplicatedBackupUtils.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/ReplicatedBackupUtils.java index 071e75f77b..e66979853a 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/ReplicatedBackupUtils.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/ReplicatedBackupUtils.java @@ -18,7 +18,7 @@ package org.apache.activemq.artemis.tests.util; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.core.config.Configuration; -import org.apache.activemq.artemis.core.config.ha.DistributedPrimitiveManagerConfiguration; +import org.apache.activemq.artemis.core.config.ha.DistributedLockManagerConfiguration; import org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration; import org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration; import org.apache.activemq.artemis.core.config.ha.ReplicationBackupPolicyConfiguration; @@ -59,8 +59,8 @@ public final class ReplicatedBackupUtils { Configuration primaryConfig, TransportConfiguration primaryConnector, TransportConfiguration primaryAcceptor, - DistributedPrimitiveManagerConfiguration primaryManagerConfiguration, - DistributedPrimitiveManagerConfiguration backupManagerConfiguration) { + DistributedLockManagerConfiguration primaryManagerConfiguration, + DistributedLockManagerConfiguration backupManagerConfiguration) { if (backupAcceptor != null) { backupConfig.clearAcceptorConfigurations().addAcceptorConfiguration(backupAcceptor); } diff --git a/tests/smoke-tests/src/main/resources/servers/zkReplicationBackup/broker.xml b/tests/smoke-tests/src/main/resources/servers/zkReplicationBackup/broker.xml index 9634984915..4c63f661e9 100644 --- a/tests/smoke-tests/src/main/resources/servers/zkReplicationBackup/broker.xml +++ b/tests/smoke-tests/src/main/resources/servers/zkReplicationBackup/broker.xml @@ -34,7 +34,7 @@ under the License. - org.apache.activemq.artemis.quorum.zookeeper.CuratorDistributedPrimitiveManager + org.apache.activemq.artemis.lockmanager.zookeeper.CuratorDistributedLockManager diff --git a/tests/smoke-tests/src/main/resources/servers/zkReplicationPrimary/broker.xml b/tests/smoke-tests/src/main/resources/servers/zkReplicationPrimary/broker.xml index 7bb332fd0e..1044bf5140 100644 --- a/tests/smoke-tests/src/main/resources/servers/zkReplicationPrimary/broker.xml +++ b/tests/smoke-tests/src/main/resources/servers/zkReplicationPrimary/broker.xml @@ -34,7 +34,7 @@ under the License. - org.apache.activemq.artemis.quorum.zookeeper.CuratorDistributedPrimitiveManager + org.apache.activemq.artemis.lockmanager.zookeeper.CuratorDistributedLockManager diff --git a/tests/smoke-tests/src/main/resources/servers/zkReplicationPrimaryPeerA/broker.xml b/tests/smoke-tests/src/main/resources/servers/zkReplicationPrimaryPeerA/broker.xml index a130f712a4..222f2f2f34 100644 --- a/tests/smoke-tests/src/main/resources/servers/zkReplicationPrimaryPeerA/broker.xml +++ b/tests/smoke-tests/src/main/resources/servers/zkReplicationPrimaryPeerA/broker.xml @@ -34,7 +34,7 @@ under the License. - org.apache.activemq.artemis.quorum.zookeeper.CuratorDistributedPrimitiveManager + org.apache.activemq.artemis.lockmanager.zookeeper.CuratorDistributedLockManager diff --git a/tests/smoke-tests/src/main/resources/servers/zkReplicationPrimaryPeerB/broker.xml b/tests/smoke-tests/src/main/resources/servers/zkReplicationPrimaryPeerB/broker.xml index 4e4b7e8831..d4efab6a95 100644 --- a/tests/smoke-tests/src/main/resources/servers/zkReplicationPrimaryPeerB/broker.xml +++ b/tests/smoke-tests/src/main/resources/servers/zkReplicationPrimaryPeerB/broker.xml @@ -34,7 +34,7 @@ under the License. - org.apache.activemq.artemis.quorum.zookeeper.CuratorDistributedPrimitiveManager + org.apache.activemq.artemis.lockmanager.zookeeper.CuratorDistributedLockManager diff --git a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/quorum/PluggableQuorumSinglePairTest.java b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/lockmanager/LockManagerSinglePairTest.java similarity index 99% rename from tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/quorum/PluggableQuorumSinglePairTest.java rename to tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/lockmanager/LockManagerSinglePairTest.java index 70eef40b3c..46183c3000 100644 --- a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/quorum/PluggableQuorumSinglePairTest.java +++ b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/lockmanager/LockManagerSinglePairTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.tests.smoke.quorum; +package org.apache.activemq.artemis.tests.smoke.lockmanager; import javax.management.remote.JMXServiceURL; import java.io.File; @@ -54,7 +54,7 @@ import static org.apache.activemq.artemis.tests.util.Jmx.withMembers; import static org.apache.activemq.artemis.tests.util.Jmx.withNodes; @RunWith(Parameterized.class) -public abstract class PluggableQuorumSinglePairTest extends SmokeTestBase { +public abstract class LockManagerSinglePairTest extends SmokeTestBase { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); @@ -156,7 +156,7 @@ public abstract class PluggableQuorumSinglePairTest extends SmokeTestBase { protected BrokerControl backup; protected List brokers; - public PluggableQuorumSinglePairTest(String brokerFolderPrefix) { + public LockManagerSinglePairTest(String brokerFolderPrefix) { primary = new BrokerControl("primary", JMX_PORT_PRIMARY, brokerFolderPrefix + PRIMARY_DATA_FOLDER, PRIMARY_PORT_OFFSET); backup = new BrokerControl("backup", JMX_PORT_BACKUP, brokerFolderPrefix + BACKUP_DATA_FOLDER, BACKUP_PORT_OFFSET); brokers = Arrays.asList(primary, backup); diff --git a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/quorum/ZookeeperPluggableQuorumPeerTest.java b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/lockmanager/ZookeeperLockManagerPeerTest.java similarity index 97% rename from tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/quorum/ZookeeperPluggableQuorumPeerTest.java rename to tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/lockmanager/ZookeeperLockManagerPeerTest.java index d7ef951270..eaec02a329 100644 --- a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/quorum/ZookeeperPluggableQuorumPeerTest.java +++ b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/lockmanager/ZookeeperLockManagerPeerTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.artemis.tests.smoke.quorum; +package org.apache.activemq.artemis.tests.smoke.lockmanager; import java.util.Arrays; import java.util.Objects; @@ -38,11 +38,11 @@ import static org.apache.activemq.artemis.tests.util.Jmx.withPrimary; import static org.apache.activemq.artemis.tests.util.Jmx.withMembers; import static org.apache.activemq.artemis.tests.util.Jmx.withNodes; -public class ZookeeperPluggableQuorumPeerTest extends ZookeeperPluggableQuorumSinglePairTest { +public class ZookeeperLockManagerPeerTest extends ZookeeperLockManagerSinglePairTest { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - public ZookeeperPluggableQuorumPeerTest() { + public ZookeeperLockManagerPeerTest() { super(); // accepting the primary/backup vars to reuse the test, for peers, these are interchangeable as either can take // both roles as both wish to be primary but will revert to backup diff --git a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/quorum/ZookeeperPluggableQuorumSinglePairTest.java b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/lockmanager/ZookeeperLockManagerSinglePairTest.java similarity index 94% rename from tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/quorum/ZookeeperPluggableQuorumSinglePairTest.java rename to tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/lockmanager/ZookeeperLockManagerSinglePairTest.java index 456a47de78..ee389166db 100644 --- a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/quorum/ZookeeperPluggableQuorumSinglePairTest.java +++ b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/lockmanager/ZookeeperLockManagerSinglePairTest.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.activemq.artemis.tests.smoke.quorum; +package org.apache.activemq.artemis.tests.smoke.lockmanager; import java.util.List; import java.util.concurrent.TimeUnit; @@ -31,7 +31,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.lang.invoke.MethodHandles; -public class ZookeeperPluggableQuorumSinglePairTest extends PluggableQuorumSinglePairTest { +public class ZookeeperLockManagerSinglePairTest extends LockManagerSinglePairTest { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final int BASE_SERVER_PORT = 6666; @@ -69,7 +69,7 @@ public class ZookeeperPluggableQuorumSinglePairTest extends PluggableQuorumSingl } } - public ZookeeperPluggableQuorumSinglePairTest() { + public ZookeeperLockManagerSinglePairTest() { super("zk"); }