kadirozde commented on code in PR #2274:
URL: https://github.com/apache/phoenix/pull/2274#discussion_r2347792999
##########
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:
This should be a filed in the HA Store record in Zookeeper. This field is
updated when the cluster switches from ACTIVE_IN_SYNC to ACTIVE_NOT_IN_SYNC.
When a region server of the standby cluster starts and the active cluster is in
ACTIVE_NOT_IN_SYNC, the region server needs to know lastSyncTimeInMs for
establishing the consistency point for the standby cluster.
--
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]