Add CorruptedTsFileException for TsFile corruption errors with file path#18304
Open
shuwenwei wants to merge 4 commits into
Open
Add CorruptedTsFileException for TsFile corruption errors with file path#18304shuwenwei wants to merge 4 commits into
shuwenwei wants to merge 4 commits into
Conversation
…ath during query execution - Introduce CorruptedTsFileException extending RuntimeException with Stage enum (READ_TIMESERIES_METADATA, READ_CHUNK_DATA, LOAD_PAGE_READER, DECODE_PAGE_DATA, READ_METADATA_INDEX_NODE) - Uses super(message) + addSuppressed(cause) to prevent getRootCause penetration - Carries File reference and Stage for precise error reporting - Catch points in FileLoaderUtils, SeriesScanUtil, and DeviceCollector wrap IOException/RuntimeException as CorruptedTsFileException - Normal queries: message mentions corruption, tells user to check logs (no file path) - read_tsfile queries: message includes full TsFile path - DiskChunkLoader/DiskAlignedChunkLoader expose getTsFile() for File reference - ErrorHandlingUtils handles CorruptedTsFileException with TSFILE_PROCESSOR_ERROR - AbstractDriverThread matches CorruptedTsFileException by instanceof - AbstractDriverThread catch CorruptedTsFileException as abort cause - i18n: add EXCEPTION_ constants for all five stages (en + zh) - IT: IoTDBQueryWithCorruptedTsFileIT tests metadata index and page data corruption
CorruptedTsFileException is a RuntimeException and the DataNode handles it fine without wrapping, so the catch-and-rewrap block is redundant.
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #18304 +/- ##
============================================
+ Coverage 43.02% 43.03% +0.01%
Complexity 374 374
============================================
Files 5362 5363 +1
Lines 381599 381680 +81
Branches 49553 49567 +14
============================================
+ Hits 164192 164275 +83
+ Misses 217407 217405 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Description
When a TsFile is corrupted during query execution, the original IOException from the TsFile reader is wrapped as a generic RuntimeException without the corrupted file path, making it impossible for users to locate the problem file.
This PR introduces
CorruptedTsFileExceptionto carry the corrupted TsFile path and the stage at which corruption was detected.Key design decisions:
catch (IOException)don't intercept itsuper(message) + addSuppressed(cause): preventsgetRootCause()from penetrating to the original IOException, allowingAbstractDriverThreadto match it byinstanceofFiles changed:
CorruptedTsFileException.java— exception with Stage enum and File referenceErrorHandlingUtils.java— handle CorruptedTsFileException with TSFILE_PROCESSOR_ERRORAbstractDriverThread.java— match CorruptedTsFileException as abort causeFileLoaderUtils.java— wrap IOException at READ_TIMESERIES_METADATA, READ_CHUNK_DATA, LOAD_PAGE_READER stagesSeriesScanUtil.java— wrap IOException at DECODE_PAGE_DATA stageDiskChunkLoader.java/DiskAlignedChunkLoader.java— expose getTsFile() for File referenceExternalTsFileQueryResource.java— wrap at READ_METADATA_INDEX_NODE stageDataNodeQueryMessages.java(en + zh) — EXCEPTION_ constants for all 5 stagesIoTDBQueryWithCorruptedTsFileIT.java— 3 test cases (metadata index + page data corruption for read_tsfile, page data for normal query)