sandeepvinayak commented on a change in pull request #2970:
URL: https://github.com/apache/hbase/pull/2970#discussion_r583799484



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java
##########
@@ -218,24 +218,44 @@ public void cleanOldLogs(String key, String id, boolean 
queueRecovered)
       }
     } else {
       synchronized (this.walsById) {
-        SortedSet<String> wals = walsById.get(id).get(logPrefix);
+        SortedSet<String> wals = getLogsWithPrefix(id, logPrefix);
         if (wals != null && !wals.first().equals(key)) {
           cleanOldLogs(wals, key, id);
         }
       }
     }
   }
 
-  private void cleanOldLogs(SortedSet<String> wals, String key, String id)
-      throws ReplicationSourceWithoutPeerException {
+  private void cleanOldLogs(SortedSet<String> wals, String key, String id) {
     SortedSet<String> walSet = wals.headSet(key);
     LOG.debug("Removing " + walSet.size() + " logs in the list: " + walSet);
-    for (String wal : walSet) {
-      this.replicationQueues.removeLog(id, wal);
+    try {
+      for (String wal : walSet) {
+        this.replicationQueues.removeLog(id, wal);
+      }
+    } catch (ReplicationSourceWithoutPeerException rspe) {
+      // This means the source is running and replication peer have been 
removed
+      // We should call the removePeer workflow to terminate the source 
gracefully
+      LOG.warn("Replication peer " + id + " has been removed and source is 
still running", rspe);
+      String peerId = id;
+      if (peerId.contains("-")) {
+        peerId = peerId.split("-")[0];
+      }
+      peerRemoved(peerId);

Review comment:
       this is the main change. 




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to