Himanshu-g81 commented on code in PR #2607:
URL: https://github.com/apache/phoenix/pull/2607#discussion_r3924356051


##########
phoenix-core-server/src/main/java/org/apache/phoenix/replication/reader/ReplicationLogDiscoveryReplay.java:
##########
@@ -228,12 +228,85 @@ public void init() throws IOException {
   }
 
   @Override
-  protected void processFile(Path path) throws IOException {
-    LOG.info("Starting to process file {}", path);
+  protected void processFile(Path path, boolean firstClaim) throws IOException 
{
+    LOG.info("Starting to process file {} (firstClaim={})", path, firstClaim);
+    ReplicationLogTracker tracker = getReplicationLogFileTracker();
+    final long fileTimestamp;
+    try {
+      fileTimestamp = tracker.getFileTimestamp(path);
+    } catch (NumberFormatException e) {
+      // A malformed file name cannot be anchored to a round. getFileTimestamp 
is validated on the
+      // new-files path (getNewFilesForRound skips names that fail to parse) 
but not on the reclaim
+      // path, so convert the unchecked parse failure into the IOException 
that every other per-file
+      // failure uses. That keeps a single bad name isolated to 
processOneRandomFile's catch (marked
+      // failed and retry-counted) instead of escaping as a RuntimeException 
that aborts the whole
+      // in-progress sweep for the cycle.
+      throw new IOException("Cannot extract timestamp from replication log 
file name: " + path, e);

Review Comment:
   .plog whose leading segment isn't numeric can't reach processFile on the 
replay side through the normal file lifecycle, so there's no file that used to 
be replayed and is now marked failed.
   The catch is added as defensive check. It can only fire for a name 
introduced by on-disk corruption or manual placement. For that case, isolating 
the file as an ordinary per-file failure (marked failed, retry-counted, sweep 
continues) instead of replaying that file.



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

To unsubscribe, e-mail: [email protected]

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

Reply via email to