HBASE-27463 Reset sizeOfLogQueue when refresh replication source (#4863)
Co-authored-by: huiruan <huiruan@tencent.com> Signed-off-by: Duo Zhang <zhangduo@apache.org> Reviewed-by: Rushabh Shah <shahrs87@gmail.com>
This commit is contained in:
parent
a5ff289d7a
commit
bb9f43c6f9
|
@ -461,15 +461,16 @@ public class ReplicationSourceManager {
|
|||
String terminateMessage = "Peer " + peerId
|
||||
+ " state or config changed. Will close the previous replication source and open a new one";
|
||||
ReplicationPeer peer = replicationPeers.getPeer(peerId);
|
||||
ReplicationSourceInterface src = createSource(peerId, peer);
|
||||
ReplicationSourceInterface src;
|
||||
// synchronized on latestPaths to avoid missing the new log
|
||||
synchronized (this.latestPaths) {
|
||||
ReplicationSourceInterface toRemove = this.sources.put(peerId, src);
|
||||
ReplicationSourceInterface toRemove = this.sources.remove(peerId);
|
||||
if (toRemove != null) {
|
||||
LOG.info("Terminate replication source for " + toRemove.getPeerId());
|
||||
// Do not clear metrics
|
||||
toRemove.terminate(terminateMessage, null, false);
|
||||
toRemove.terminate(terminateMessage, null, true);
|
||||
}
|
||||
src = createSource(peerId, peer);
|
||||
this.sources.put(peerId, src);
|
||||
for (NavigableSet<String> walsByGroup : walsById.get(peerId).values()) {
|
||||
walsByGroup.forEach(wal -> src.enqueueLog(new Path(this.logDir, wal)));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue