hsahu-ksolves123 commented on code in PR #4207:
URL: https://github.com/apache/cassandra/pull/4207#discussion_r2162534419
##########
src/java/org/apache/cassandra/db/commitlog/CommitLogReader.java:
##########
@@ -120,14 +120,25 @@ static List<File> filterCommitLogFiles(File[] toFilter)
/**
* Reads all passed in files with minPosition, no start, and no mutation
limit.
*/
- public void readAllFiles(CommitLogReadHandler handler, File[] files,
CommitLogPosition minPosition) throws IOException
- {
+ public void readAllFiles(CommitLogReadHandler handler, File[] files,
CommitLogPosition minPosition) throws IOException {
List<File> filteredLogs = filterCommitLogFiles(files);
int i = 0;
- for (File file: filteredLogs)
- {
+ for (File file : filteredLogs) {
i++;
- readCommitLogSegment(handler, file, minPosition, ALL_MUTATIONS, i
== filteredLogs.size());
+ boolean success = false;
+ try {
+ readCommitLogSegment(handler, file, minPosition,
ALL_MUTATIONS, i == filteredLogs.size());
+ success = true;
+ } catch (Throwable t) {
+ handler.handleError(file,
CommitLogReadErrorReason.UNRECOVERABLE_UNKNOWN_ERROR, t);
+ logger.warn("Skipping commit log file {} due to error: {}",
file.name(), t.getMessage(), t);
+ }
+
+ // 🔴 Fix: If unsuccessful, skip to next without retrying
+ if (!success) {
+ logger.info("File {} was not processed successfully. Skipping
to next.", file.name());
+ continue;
Review Comment:
Thanks for the question. The idea behind the `continue` here is to ensure
that if a particular commit log file cannot be processed (e.g., due to
corruption or unreadable format), we skip that file and move to the next one
instead of retrying or entering an infinite loop.
Without this `continue`, the system might retry the same unreadable file
endlessly, which was the original issue described in CASSANDRA-20664. The goal
is to fail fast for that file and proceed with the rest of the logs safely.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]