ritegarg commented on code in PR #2274:
URL: https://github.com/apache/phoenix/pull/2274#discussion_r2349822075


##########
phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/HAGroupStoreClient.java:
##########
@@ -293,10 +308,29 @@ public void 
setHAGroupStatusIfNeeded(HAGroupStoreRecord.HAGroupState haGroupStat
         }
         if (isUpdateNeeded(currentHAGroupStoreRecord.getHAGroupState(),
                 currentHAGroupStoreRecordStat.getMtime(), haGroupState)) {
+                // We maintain last sync time as the last time cluster was in 
sync state.
+                // If state changes from ACTIVE_IN_SYNC to ACTIVE_NOT_IN_SYNC, 
record that time
+                // Once state changes back to ACTIVE_IN_SYNC or the role is
+                // NOT ACTIVE or ACTIVE_TO_STANDBY
+                // set the time to null to mark that we are current(or we 
don't have any reader).
+                // TODO: Verify that for reader this is the correct approach.
+                Long lastSyncTimeInMs = currentHAGroupStoreRecord
+                        .getLastSyncStateTimeInMs();
+                ClusterRole clusterRole = haGroupState.getClusterRole();
+                if (currentHAGroupStoreRecord.getHAGroupState()
+                        == HAGroupStoreRecord.HAGroupState.ACTIVE_IN_SYNC
+                        && haGroupState == 
HAGroupStoreRecord.HAGroupState.ACTIVE_NOT_IN_SYNC) {
+                    lastSyncTimeInMs = System.currentTimeMillis();

Review Comment:
   Yes, I have added that new field 
   
https://github.com/apache/phoenix/pull/2274/files#diff-8d6c9a772a5a7947b4f4f3c98f460924658742acf4bbb22d53f45c6d241f3cdaR166
   It is updated here 
https://github.com/apache/phoenix/pull/2274/files#diff-61fd251b01270c601f6cc2851770e91d36d12eafec0aa709782649be2a286cfbR340



-- 
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-unsubscr...@phoenix.apache.org

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

Reply via email to