LiebingYu commented on code in PR #1749:
URL: https://github.com/apache/fluss/pull/1749#discussion_r2492568036
##########
fluss-server/src/main/java/org/apache/fluss/server/log/LogLoader.java:
##########
@@ -155,8 +281,26 @@ private void loadSegmentFiles() throws IOException {
}
} else if (LocalLog.isLogFile(file)) {
long baseOffset = FlussPaths.offsetFromFile(file);
+ boolean timeIndexFileNewlyCreated =
+ !FlussPaths.timeIndexFile(logTabletDir,
baseOffset).exists();
LogSegment segment =
LogSegment.open(logTabletDir, baseOffset,
conf, true, 0, logFormat);
+
+ try {
+ segment.sanityCheck(timeIndexFileNewlyCreated);
+ } catch (Exception e) {
+ if (e instanceof NoSuchFieldException) {
+ if (isCleanShutdown
+ || segment.getBaseOffset() <
recoveryPointCheckpoint) {
+ LOG.error(
+ "Could not find offset index file
corresponding to log file {} "
+ + "for bucket {},
recovering segment and rebuilding index files...",
+ logSegments.getTableBucket(),
+
segment.getFileLogRecords().file().getAbsoluteFile());
+ }
+ recoverSegment(segment);
+ }
Review Comment:
1. Kafka throw `CorruptIndexException` because Kafka will do sanity check
for transaction file which may throw `CorruptIndexException`. But here in fluss
we don't do sanity check of index files in `segment.sanityCheck`. So I think we
don't need to catch `CorruptIndexException` here.
--
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]