hzh0425 commented on code in PR #5798:
URL: https://github.com/apache/rocketmq/pull/5798#discussion_r1068001961
##########
store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAService.java:
##########
@@ -258,12 +269,38 @@ public void maybeExpandInSyncStateSet(final String
slaveAddress, final long slav
final EpochEntry currentLeaderEpoch = this.epochCache.lastEntry();
if (slaveMaxOffset >= currentLeaderEpoch.getStartOffset()) {
currentSyncStateSet.add(slaveAddress);
+ markSynchronizingSyncStateSet(currentSyncStateSet);
// Notify the upper layer that syncStateSet changed.
notifySyncStateSetChanged(currentSyncStateSet);
}
}
}
+ private void markSynchronizingSyncStateSet(final Set<String>
newSyncStateSet) {
+ this.writeLock.lock();
+ try {
+ this.isSynchronizingSyncStateSet = true;
+ this.remoteSyncStateSet.clear();
+ this.remoteSyncStateSet.addAll(newSyncStateSet);
+ } finally {
+ this.writeLock.unlock();
+ }
+ }
+
+ private void markSynchronizingSyncStateSetDone() {
+ this.writeLock.lock();
+ try {
+ this.isSynchronizingSyncStateSet = false;
+ this.remoteSyncStateSet.clear();
Review Comment:
Good idea
--
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]