Skip to content

Bump tsfile to 2.4.1-260806-SNAPSHOT and add COPY_TO_WRITE_ERROR for COPY TO write failures - #18414

Merged
JackieTien97 merged 3 commits into
masterfrom
update-tsfile-version-2.4.1
Aug 7, 2026
Merged

Bump tsfile to 2.4.1-260806-SNAPSHOT and add COPY_TO_WRITE_ERROR for COPY TO write failures#18414
JackieTien97 merged 3 commits into
masterfrom
update-tsfile-version-2.4.1

Conversation

@shuwenwei

@shuwenwei shuwenwei commented Aug 6, 2026

Copy link
Copy Markdown
Member

Summary

Two changes:

  1. Bump tsfile.version from 2.3.2-260731-SNAPSHOT to 2.4.1-260806-SNAPSHOT.
  2. Add COPY_TO_WRITE_ERROR handling for COPY TO write failures.

What it fixes

  • Disk space / target file write failures during COPY TO were silently reported as success.
    The previous tsfile AbstractTableModelTsFileWriter.close() swallowed IOException, so when the disk ran out of space during the final flush of a small COPY TO export, the statement returned success with row_count>0, device_count=0, size=0 and left a 0-byte .tsfile behind.
  • Upstream tsfile 2.4.1 fixes this by making the writer close() propagate IOException (fix(tsfile): propagate IOException on writer close instead of swallowing it tsfile#899). With the bump, the failure now surfaces during seal().
  • On the IoTDB side, that IOException used to degrade to a generic EXECUTE_STATEMENT_ERROR, so callers could not tell COPY TO write failures apart from other errors. This PR adds a dedicated COPY_TO_WRITE_ERROR(725) status code and translates the write IOException in TableCopyToOperator into an IoTDBRuntimeException carrying it.
  • The exception is thrown without a cause chain so the error code survives the query engine's getRootCause() unwrapping; the original IOException is logged with its full stack trace at the translation site for server-side debugging.
  • TsFileFormatCopyToWriter now nulls out its internal writer on failure, so operator teardown does not double-close and the residual 0-byte target file is cleaned up (isFinished stays false on failure).
  • The error message is intentionally format-agnostic ("target file") since COPY TO may support more output formats in the future.

New files/constants

  • TSStatusCode.COPY_TO_WRITE_ERROR(725)
  • i18n messages (en + zh) in DataNodeQueryMessages / UtilMessages, plus a StatusUtils mapping
  • TableCopyToOperator: translate write IOExceptionIoTDBRuntimeException(COPY_TO_WRITE_ERROR)
  • TsFileFormatCopyToWriter: null-out writer on failure (seal()/write())

@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 3.57143% with 27 lines in your changes missing coverage. Please review.
✅ Project coverage is 43.61%. Comparing base (c6afaf5) to head (b8036ac).
⚠️ Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
...n/operator/process/copyto/TableCopyToOperator.java 0.00% 14 Missing ⚠️
...rocess/copyto/tsfile/TsFileFormatCopyToWriter.java 0.00% 9 Missing ⚠️
.../org/apache/iotdb/db/utils/ErrorHandlingUtils.java 0.00% 2 Missing ⚠️
...va/org/apache/iotdb/commons/utils/StatusUtils.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #18414      +/-   ##
============================================
+ Coverage     43.59%   43.61%   +0.01%     
  Complexity      374      374              
============================================
  Files          5393     5393              
  Lines        385604   385978     +374     
  Branches      50201    50268      +67     
============================================
+ Hits         168095   168329     +234     
- Misses       217509   217649     +140     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

When the target file write fails during COPY TO (e.g. due to insufficient
disk space), the IOException thrown by the underlying writer used to surface
as a generic EXECUTE_STATEMENT_ERROR with no way for callers to distinguish
it from other failures.

Add a dedicated COPY_TO_WRITE_ERROR(725) status code and translate the write
IOException in TableCopyToOperator into an IoTDBRuntimeException carrying it.
The exception is thrown without a cause chain so the error code survives the
query engine's getRootCause() unwrapping; the original IOException is logged
with its full stack trace at the translation site for debuggability.

Also null out the internal writer in TsFileFormatCopyToWriter on failure so
operator teardown does not double-close and the residual target file is
cleaned up. Messages are kept format-agnostic ("target file") since COPY TO
may support more output formats in the future.
@shuwenwei shuwenwei changed the title Bump tsfile version to 2.4.1-260806-SNAPSHOT Bump tsfile to 2.4.1-260806-SNAPSHOT and add COPY_TO_WRITE_ERROR for COPY TO write failures Aug 7, 2026
COPY_TO_WRITE_ERROR is a known, expected failure already logged with its full
stack trace at the failure source (TableCopyToOperator). Log it at info level
without a stack trace in ErrorHandlingUtils.onQueryException to avoid
duplicating the stack in the RPC layer, consistent with CANNOT_READ_TSFILE.
@sonarqubecloud

sonarqubecloud Bot commented Aug 7, 2026

Copy link
Copy Markdown

@JackieTien97
JackieTien97 merged commit 81c2b05 into master Aug 7, 2026
44 checks passed
@JackieTien97
JackieTien97 deleted the update-tsfile-version-2.4.1 branch August 7, 2026 04:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants