shuwenwei opened a new pull request, #18304:
URL: https://github.com/apache/iotdb/pull/18304

   ## 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 `CorruptedTsFileException` to carry the corrupted TsFile 
path and the stage at which corruption was detected.
   
   ### Key design decisions:
   - **RuntimeException**: so operator-layer `catch (IOException)` don't 
intercept it
   - **`super(message) + addSuppressed(cause)`**: prevents `getRootCause()` 
from penetrating to the original IOException, allowing `AbstractDriverThread` 
to match it by `instanceof`
   - **Staged error reporting**: 5 stages: READ_TIMESERIES_METADATA, 
READ_CHUNK_DATA, LOAD_PAGE_READER, DECODE_PAGE_DATA, READ_METADATA_INDEX_NODE
   - **Differentiated messages**: normal queries mention corruption without 
file path (tell user to check logs); read_tsfile queries include the full path
   - **File references** (not String paths) for memory efficiency
   
   ### Files changed:
   - New: `CorruptedTsFileException.java` — exception with Stage enum and File 
reference
   - `ErrorHandlingUtils.java` — handle CorruptedTsFileException with 
TSFILE_PROCESSOR_ERROR
   - `AbstractDriverThread.java` — match CorruptedTsFileException as abort cause
   - `FileLoaderUtils.java` — wrap IOException at READ_TIMESERIES_METADATA, 
READ_CHUNK_DATA, LOAD_PAGE_READER stages
   - `SeriesScanUtil.java` — wrap IOException at DECODE_PAGE_DATA stage
   - `DiskChunkLoader.java` / `DiskAlignedChunkLoader.java` — expose 
getTsFile() for File reference
   - `ExternalTsFileQueryResource.java` — wrap at READ_METADATA_INDEX_NODE stage
   - i18n: `DataNodeQueryMessages.java` (en + zh) — EXCEPTION_ constants for 
all 5 stages
   - IT: `IoTDBQueryWithCorruptedTsFileIT.java` — 3 test cases (metadata index 
+ page data corruption for read_tsfile, page data for normal query)


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