You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@artemis.apache.org by "MyLuk (via GitHub)" <gi...@apache.org> on 2026/07/21 06:20:21 UTC

[PR] ARTEMIS-6162 Only start lock coordinators once the broker is activated [artemis]

MyLuk opened a new pull request, #6590:
URL: https://github.com/apache/artemis/pull/6590

   Two commits, one per JIRA:
   
   **ARTEMIS-6162** - `internalStart()` started every configured lock coordinator right away, whatever the HA role of the node, so a passive backup contended for the lock along with the active primary. A passive backup that wins the lock holds it while none of its acceptors or broker connections exist yet, so the elements bound to that coordinator are down on every node of the group. And with brokers in different data centers sharing a lock, the backup of a failed primary needs a few seconds to activate while remote brokers keep polling every check-period, so the lock usually lands on a remote broker rather than on the backup taking over.
   
   The coordinators are still created in `internalStart()`, since acceptors and broker connections look them up by name while being created, but polling now starts in `completeActivation()`, right before the acceptors are started.
   
   **ARTEMIS-6163** - even then, all active brokers still race for the lock, and which of them may take a lock over on its own is a deployment decision. Adds an `auto-start` attribute on `lock-coordinator` (default `true`, no behaviour change) plus `startLockCoordinator`/`stopLockCoordinator` management operations, both audited, so a standby data center can be configured with `auto-start=false` and handed the lock only when somebody decides so.
   
   Both behaviours were suggested by @clebertsuconic on the users list ("Artemis Cluster with HA and with Mesh Mirror", May 2026).
   
   Tests: `LockCoordinatorHaActivationTest` (replicated pair, the passive backup stays out of the lock and takes it over once the primary is gone) and `LockCoordinatorAutoStartManagementTest` (full start/stop cycle through management on an acceptor bound to an `auto-start=false` coordinator), both failing without the respective fix, plus a unit test for the flag and parser coverage. The first commit compiles and its test passes on its own.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@artemis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@artemis.apache.org
For additional commands, e-mail: issues-help@artemis.apache.org


Re: [PR] ARTEMIS-6162 Only start lock coordinators once the broker is activated [artemis]

Posted by "MyLuk (via GitHub)" <gi...@apache.org>.
MyLuk commented on code in PR #6590:
URL: https://github.com/apache/artemis/pull/6590#discussion_r3643047846


##########
docs/user-manual/lock-coordination.adoc:
##########
@@ -135,6 +135,8 @@ The following elements are configured on every lock-coordinator regardless of im
 |How often to check if the lock is still valid, in milliseconds
 |===
 
+NOTE: A lock coordinator only starts polling for the lock once the broker has actually been activated (i.e. it is the live/primary server, or a backup that has taken over). On a passive HA backup the lock coordinator stays stopped, so it never contends for the lock with the currently active node; it starts polling only once that backup itself activates.

Review Comment:
   Good catch on the scope - the note read like a universal rule. Took your second wording verbatim, thanks. Fixed in 9fba7fc.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@artemis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@artemis.apache.org
For additional commands, e-mail: issues-help@artemis.apache.org


Re: [PR] ARTEMIS-6162 Only start lock coordinators once the broker is activated [artemis]

Posted by "clebertsuconic (via GitHub)" <gi...@apache.org>.
clebertsuconic commented on code in PR #6590:
URL: https://github.com/apache/artemis/pull/6590#discussion_r3638263201


##########
docs/user-manual/lock-coordination.adoc:
##########
@@ -135,6 +135,8 @@ The following elements are configured on every lock-coordinator regardless of im
 |How often to check if the lock is still valid, in milliseconds
 |===
 
+NOTE: A lock coordinator only starts polling for the lock once the broker has actually been activated (i.e. it is the live/primary server, or a backup that has taken over). On a passive HA backup the lock coordinator stays stopped, so it never contends for the lock with the currently active node; it starts polling only once that backup itself activates.

Review Comment:
   or even better:
   
   ```
   NOTE: In a journal HA setup with either shared storage or journal replication, lock coordinators will stay inactive and will not poll for the lock until the server is activated.```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@artemis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@artemis.apache.org
For additional commands, e-mail: issues-help@artemis.apache.org


Re: [PR] ARTEMIS-6162 Only start lock coordinators once the broker is activated [artemis]

Posted by "clebertsuconic (via GitHub)" <gi...@apache.org>.
clebertsuconic commented on code in PR #6590:
URL: https://github.com/apache/artemis/pull/6590#discussion_r3638263201


##########
docs/user-manual/lock-coordination.adoc:
##########
@@ -135,6 +135,8 @@ The following elements are configured on every lock-coordinator regardless of im
 |How often to check if the lock is still valid, in milliseconds
 |===
 
+NOTE: A lock coordinator only starts polling for the lock once the broker has actually been activated (i.e. it is the live/primary server, or a backup that has taken over). On a passive HA backup the lock coordinator stays stopped, so it never contends for the lock with the currently active node; it starts polling only once that backup itself activates.

Review Comment:
   or even better:
   
   ```
   NOTE: On a journal HA setup with either shared storage or journal replication, lock coordinators will stay inactive, meaning they won't poll for anything until a server is activated.```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@artemis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@artemis.apache.org
For additional commands, e-mail: issues-help@artemis.apache.org


Re: [PR] ARTEMIS-6162 Only start lock coordinators once the broker is activated [artemis]

Posted by "clebertsuconic (via GitHub)" <gi...@apache.org>.
clebertsuconic commented on PR #6590:
URL: https://github.com/apache/artemis/pull/6590#issuecomment-5096021708

   I added ./artemis lock stop <lock-name>   and ./artemis lock start <lock-name> to the CLI


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@artemis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@artemis.apache.org
For additional commands, e-mail: issues-help@artemis.apache.org


Re: [PR] ARTEMIS-6162 Only start lock coordinators once the broker is activated [artemis]

Posted by "MyLuk (via GitHub)" <gi...@apache.org>.
MyLuk commented on PR #6590:
URL: https://github.com/apache/artemis/pull/6590#issuecomment-5101658548

   > @MyLuk there's one feature in github.. the ability to push into a PR's contributor.
   > 
   > I pushed -f in your branch. if you do anything else on it.. please rebase against your origin.
   
   Got it, thanks for the merge - and for the heads-up.
   
   I have one more PR open - #6586 (ARTEMIS-6159, bounding the lock manager start so an unreachable ZooKeeper doesn't hang the broker).
   I've added Assisted-by: Claude to its commit message there as well, and rebased it onto current main.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@artemis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@artemis.apache.org
For additional commands, e-mail: issues-help@artemis.apache.org


Re: [PR] ARTEMIS-6162 Only start lock coordinators once the broker is activated [artemis]

Posted by "clebertsuconic (via GitHub)" <gi...@apache.org>.
clebertsuconic commented on PR #6590:
URL: https://github.com/apache/artemis/pull/6590#issuecomment-5059335512

   everything looks good to me.
   
   Question: did you use AI to write these test? the style of comments left in the test seems a bit Claude to me. 
   We usually recommend a word such as :
   
   ```
   assisted by: Claude```
   
   in the commit message.
   
   
   That's an apache recommendation.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@artemis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@artemis.apache.org
For additional commands, e-mail: issues-help@artemis.apache.org


Re: [PR] ARTEMIS-6162 Only start lock coordinators once the broker is activated [artemis]

Posted by "clebertsuconic (via GitHub)" <gi...@apache.org>.
clebertsuconic merged PR #6590:
URL: https://github.com/apache/artemis/pull/6590


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@artemis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@artemis.apache.org
For additional commands, e-mail: issues-help@artemis.apache.org


Re: [PR] ARTEMIS-6162 Only start lock coordinators once the broker is activated [artemis]

Posted by "clebertsuconic (via GitHub)" <gi...@apache.org>.
clebertsuconic commented on code in PR #6590:
URL: https://github.com/apache/artemis/pull/6590#discussion_r3638240456


##########
docs/user-manual/lock-coordination.adoc:
##########
@@ -135,6 +135,8 @@ The following elements are configured on every lock-coordinator regardless of im
 |How often to check if the lock is still valid, in milliseconds
 |===
 
+NOTE: A lock coordinator only starts polling for the lock once the broker has actually been activated (i.e. it is the live/primary server, or a backup that has taken over). On a passive HA backup the lock coordinator stays stopped, so it never contends for the lock with the currently active node; it starts polling only once that backup itself activates.

Review Comment:
   I foresee a not distant future where people only use mirroring for HA.
   
   Can we improve this note with:
   
   ```
   NOTE: Lock coordinators do not poll for the lock when the broker is configured as a backup using shared store or journal replication HA. Polling only begins once the backup activates as the live server.
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@artemis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@artemis.apache.org
For additional commands, e-mail: issues-help@artemis.apache.org


Re: [PR] ARTEMIS-6162 Only start lock coordinators once the broker is activated [artemis]

Posted by "MyLuk (via GitHub)" <gi...@apache.org>.
MyLuk commented on PR #6590:
URL: https://github.com/apache/artemis/pull/6590#issuecomment-5066375937

   Yes, these tests were written with Claude's assistance - I reviewed them and confirmed both fail without the respective fix. I wasn't aware of the Assisted-by recommendation, thanks for pointing it out - added Assisted-by: Claude to both commit messages and force-pushed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@artemis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@artemis.apache.org
For additional commands, e-mail: issues-help@artemis.apache.org


Re: [PR] ARTEMIS-6162 Only start lock coordinators once the broker is activated [artemis]

Posted by "clebertsuconic (via GitHub)" <gi...@apache.org>.
clebertsuconic commented on PR #6590:
URL: https://github.com/apache/artemis/pull/6590#issuecomment-5096015025

   @MyLuk there's one feature in github.. the ability to push into a PR's contributor.
   
   I pushed -f in your branch. if you do anything else on it.. please rebase against your origin.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@artemis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@artemis.apache.org
For additional commands, e-mail: issues-help@artemis.apache.org


Re: [PR] ARTEMIS-6162 Only start lock coordinators once the broker is activated [artemis]

Posted by "clebertsuconic (via GitHub)" <gi...@apache.org>.
clebertsuconic commented on code in PR #6590:
URL: https://github.com/apache/artemis/pull/6590#discussion_r3660661211


##########
artemis-cli/src/main/java/org/apache/activemq/artemis/cli/Artemis.java:
##########
@@ -239,6 +239,8 @@ public static Object internalExecute(boolean shellEnabled, File artemisHome, Fil
     and return it to the caller.
     */
    private static Object parseAction(CommandLine line, String[] args) {
+
+      System.out.println("line::" + line + ", args = " + Arrays.toString(args));

Review Comment:
   oops.... remove this



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@artemis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@artemis.apache.org
For additional commands, e-mail: issues-help@artemis.apache.org


Re: [PR] ARTEMIS-6162 Only start lock coordinators once the broker is activated [artemis]

Posted by "clebertsuconic (via GitHub)" <gi...@apache.org>.
clebertsuconic commented on code in PR #6590:
URL: https://github.com/apache/artemis/pull/6590#discussion_r3660682575


##########
pom.xml:
##########
@@ -90,7 +90,7 @@
       <modular.jdk.surefire.arg>--add-modules java.sql,jdk.unsupported </modular.jdk.surefire.arg>
 
       <activemq-artemis-native-version>2.0.0</activemq-artemis-native-version>
-      <artemis-console-version>1.8.0</artemis-console-version>
+      <artemis-console-version>1.9.0-SNAPSHOT</artemis-console-version>

Review Comment:
   I didn't mean to merge this.. sorry for another push to your branch



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@artemis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@artemis.apache.org
For additional commands, e-mail: issues-help@artemis.apache.org