HBASE-23045 currentPath may be stitched in a loop in replication source code. (#1006)
Signed-off-by: stack <stack@apache.org>
Signed-off-by: Viraj Jasani <vjasani@apache.org>
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
index ff79976..b13f838 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
@@ -801,9 +801,9 @@
Path p = rs.getPath();
FileStatus[] logs = fs.listStatus(p);
for (FileStatus log : logs) {
- p = new Path(p, log.getPath().getName());
- if (p.getName().equals(currentPath.getName())) {
- currentPath = p;
+ String logName = log.getPath().getName();
+ if (logName.equals(currentPath.getName())) {
+ currentPath = new Path(p, logName);
LOG.info("Log " + currentPath.getName() + " found at " + currentPath);
// Open the log at the new location
this.openReader(sleepMultiplier);