lokiore commented on code in PR #2601:
URL: https://github.com/apache/phoenix/pull/2601#discussion_r3797998274
##########
phoenix-core-server/src/main/java/org/apache/phoenix/replication/ReplicationLogGroup.java:
##########
@@ -1017,20 +1029,31 @@ public void close() {
+ "proceeding with shutdown without the start gate", this, e);
Thread.currentThread().interrupt();
}
- // Remove every LOCAL state subscription registered in
subscribeToStateChanges().
- stateUnsubscribers.forEach(Runnable::run);
- stateUnsubscribers.clear();
-
try {
- disruptor.shutdown(shutdownTimeoutMs, TimeUnit.MILLISECONDS);
- } catch (com.lmax.disruptor.TimeoutException e) {
- LOG.warn("HAGroup {} shutdown timed out after {}ms, halting", this,
shutdownTimeoutMs);
- disruptor.halt();
- }
- shutdownDisruptorExecutor();
- logForwarder.stop();
- logForwarder.close();
- metrics.close();
+ // Remove every LOCAL state subscription registered in
subscribeToStateChanges().
+ stateUnsubscribers.forEach(Runnable::run);
+ stateUnsubscribers.clear();
+
+ try {
+ disruptor.shutdown(shutdownTimeoutMs, TimeUnit.MILLISECONDS);
Review Comment:
@tkhurana is this a possible scenario?
**stateUnsubscribers.forEach (:1034)** and **disruptor.shutdown() (:1038)**
— both of which can throw unchecked exception. An unchecked throw before
**shutdownDisruptorExecutor()** jumps directly to finally , empties the cache
while disruptor consumer + open writer + rotation executor are still alive,
which can lead to creation of double-writer on same shard?
##########
phoenix-core/src/test/java/org/apache/phoenix/replication/ReplicationLogGroupTest.java:
##########
@@ -1461,6 +1464,114 @@ public void
testReplicationLogGroupCacheRemovalOnClose() throws Exception {
g1_3.close();
}
+ /**
+ * A get() concurrent with a still-draining close() must NOT resurrect a
second live instance for
+ * the same group. close() sets the closed flag first but removes the
instance from the cache only
+ * after teardown, so a get() during that window returns the same (closing)
instance rather than
+ * minting a new one -- avoiding the double-writer against the same shard
observed in the
+ * 2026-08-13 abort log.
Review Comment:
Cluster testing comment can be removed
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]