tkhurana commented on code in PR #2577:
URL: https://github.com/apache/phoenix/pull/2577#discussion_r3633165459


##########
phoenix-core-server/src/main/java/org/apache/phoenix/replication/reader/ReplicationLogDiscoveryReplay.java:
##########
@@ -139,7 +150,15 @@ public void init() throws IOException {
           clusterType == ClusterType.LOCAL
             && HAGroupStoreRecord.HAGroupState.STANDBY.equals(toState)
         ) {
-          replicationReplayState.set(ReplicationReplayState.SYNCED_RECOVERY);
+          // compareAndSet from DEGRADED only, not an unconditional set(): 
DEGRADED is the only
+          // state whose lastRoundInSync lags lastRoundProcessed, hence the 
only state a recovery
+          // to STANDBY must rewind from. A STANDBY event that lands while 
already SYNC (e.g.
+          // ABORT_TO_STANDBY -> STANDBY after a prior rewind, or a 
cache-reconnect redelivery)
+          // would otherwise flip SYNC -> SYNCED_RECOVERY and needlessly 
re-process the frontier
+          // round. Symmetric with triggerFailoverListner below; contrast 
degradedListener above,
+          // whose unconditional fail-closed set() is intentional.
+          replicationReplayState.compareAndSet(ReplicationReplayState.DEGRADED,

Review Comment:
   The return value of compareAndSet is ignored ?



-- 
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]

Reply via email to