HBASE-20524 Need to clear metrics when ReplicationSourceManager refresh replication sources

This commit is contained in:
Guanghao Zhang 2018-05-03 16:45:06 +08:00
parent e92580e201
commit eaafdff761
4 changed files with 4 additions and 4 deletions

View File

@ -149,6 +149,7 @@ public class RecoveredReplicationSource extends ReplicationSource {
Threads.sleep(100);// wait a short while for other worker thread to fully exit Threads.sleep(100);// wait a short while for other worker thread to fully exit
boolean allTasksDone = workerThreads.values().stream().allMatch(w -> w.isFinished()); boolean allTasksDone = workerThreads.values().stream().allMatch(w -> w.isFinished());
if (allTasksDone) { if (allTasksDone) {
this.getSourceMetrics().clear();
manager.removeRecoveredSource(this); manager.removeRecoveredSource(this);
LOG.info("Finished recovering queue {} with the following stats: {}", queueId, getStats()); LOG.info("Finished recovering queue {} with the following stats: {}", queueId, getStats());
} }

View File

@ -519,6 +519,7 @@ public class ReplicationSource implements ReplicationSourceInterface {
} }
} }
} }
this.metrics.clear();
} }
@Override @Override

View File

@ -418,7 +418,6 @@ public class ReplicationSourceManager implements ReplicationListener {
*/ */
void removeRecoveredSource(ReplicationSourceInterface src) { void removeRecoveredSource(ReplicationSourceInterface src) {
LOG.info("Done with the recovered queue " + src.getQueueId()); LOG.info("Done with the recovered queue " + src.getQueueId());
src.getSourceMetrics().clear();
this.oldsources.remove(src); this.oldsources.remove(src);
// Delete queue from storage and memory // Delete queue from storage and memory
deleteQueue(src.getQueueId()); deleteQueue(src.getQueueId());
@ -431,7 +430,6 @@ public class ReplicationSourceManager implements ReplicationListener {
*/ */
void removeSource(ReplicationSourceInterface src) { void removeSource(ReplicationSourceInterface src) {
LOG.info("Done with the queue " + src.getQueueId()); LOG.info("Done with the queue " + src.getQueueId());
src.getSourceMetrics().clear();
this.sources.remove(src.getPeerId()); this.sources.remove(src.getPeerId());
// Delete queue from storage and memory // Delete queue from storage and memory
deleteQueue(src.getQueueId()); deleteQueue(src.getQueueId());

View File

@ -80,12 +80,12 @@ public class ReplicationSourceDummy implements ReplicationSourceInterface {
@Override @Override
public void terminate(String reason) { public void terminate(String reason) {
terminate(reason, null);
} }
@Override @Override
public void terminate(String reason, Exception e) { public void terminate(String reason, Exception e) {
this.metrics.clear();
} }
@Override @Override