Skip to content

Commit d0e30d5

Browse files
author
Tanuj Khurana
committed
Handle the case when a RS doesn't receive any file to process
1 parent 8eadb56 commit d0e30d5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

phoenix-core-server/src/main/java/org/apache/phoenix/replication/ReplicationLogDiscoveryForwarder.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,16 @@ protected void processNoMoreRoundsLeft() throws IOException {
181181
.getReplicationShardDirectoryManager()
182182
.getNextRound(getLastRoundProcessed())).isEmpty()) {
183183
LOG.info("Processed all the replication log files for {}", logGroup);
184+
// if this RS is still in STORE_AND_FORWARD mode like when it didn't process any file
185+
// move this RS to SYNC_AND_FORWARD
186+
if (logGroup.checkAndSetMode(STORE_AND_FORWARD, SYNC_AND_FORWARD)) {
187+
// replication mode switched, notify the event handler
188+
try {
189+
logGroup.sync();
190+
} catch (IOException e) {
191+
LOG.info("Failed to send sync event to {}", logGroup);
192+
}
193+
}
184194
// TODO ensure the mTime on the group store record is older than the wait sync timeout
185195
logGroup.setHAGroupStatusToSync();
186196
}

0 commit comments

Comments
 (0)