JackieTien97 opened a new pull request, #19123:
URL: https://github.com/apache/iotdb/pull/19123
## Description
### Problem
`IoTDBDeletionTableIT.testMultiDeviceCompletelyDeleteTable` was seen timing
out in a CI run of the table 1C1D IT job: `ConditionTimeoutException ... was
not fulfilled within 5 minutes`. For the whole 5 minutes, the wait kept
reporting the same `sequence/deletion/<region>/0/*.tsfile` and `.resource` as
not deleted. `testCompletelyDeleteTable` uses the same pattern.
Both tests run `DROP TABLE vehicle1` and immediately `flush`, then wait
until every `.tsfile`, `.resource` and `.mods` under
`data/{sequence,unsequence}/deletion` is gone. Since #18806, DROP TABLE returns
as soon as the procedure is submitted, so the flush can run concurrently with
the procedure's `DELETE_DATA` step. The DataNode log of the failed run shows
the following:
1. The test's flush started 5 ms after the `DropTableProcedure` began,
before the procedure reached `PRE_DELETE`.
2. `DELETE_DATA_FOR_DROP_TABLE` reached a region while that region's
unsequence memtable was being flushed. The deletion was only recorded for the
flushing memtable (`in flushingMemTable`) and written to the file's `.mods2`
after the flush finished (`written when flush memtable`). Sealed files were
removed directly, as usual.
3. Insertion compaction moved the leftover file into the sequence space,
where it became the only file of its region.
Nothing removes such a file within the wait:
- Inner compaction needs more than one file.
- The settle selection that runs on every compaction schedule only picks
files whose mods are larger than
`inner_compaction_task_selection_mods_file_threshold` (128 KB).
- The settle selection that detects fully deleted files only runs every
`ttl_check_interval`, which is 2 hours by default.
The other region of the same run also ended up with two such files. Those
two files were merged by inner compaction into an empty target and disappeared,
so whether the test fails depends on timing and on where the data lands.
Before #18806, DROP TABLE returned only after `DELETE_DATA` had finished. In
these tests the deletion therefore only met working memtables, whose points are
deleted in memory and whose now-empty files the following flush removes, and
sealed files, which are removed directly.
### Fix
Both tests now call `TestUtils.dropTable` instead of a plain `DROP TABLE`,
as `testDeleteTable` already does. The helper waits until the procedure reaches
`SUCCESS` in `information_schema.drop_table_procedures`, so the flush starts
only after the drop has finished.
### Other DROP TABLE usages in tests
I checked every `DROP TABLE` in the repository's test code, including the
C++ session IT. None of the others depends on the drop having finished.
- **They already wait**, using `TestUtils.dropTable`, Awaitility, or
eventual assertions:
- `IoTDBTableIT`
- `IoTDBDropTableModProgressIT`
- `IoTDBTableDDLHAIT`
- `IoTDBSessionRelationalIT#dropTableOfTheSameNameTest`
- `IoTDBPipeMetaIT`
- `IoTDBPipeIdempotentIT`
- **They create a table with the same name next.** While a drop of that
table is running, the ConfigNode rejects CREATE TABLE with
`OVERLAP_WITH_EXISTING_TASK`, and `ClusterConfigTaskExecutor#createTable`
retries until the drop finishes, so the create already runs after the drop:
- `IoTDBAlterColumnTypeIT`
- `IoTDBInsertTableIT#testInsertWithChangedSchema`
- the auto-cast loops in `IoTDBSessionRelationalIT`
- `sessionRelationalIT.cpp`
- **They drop at the end of the test, and the cleanup tolerates a running
drop.** The cleanup either uses `dropDatabaseWithRetry` or a plain `DROP
DATABASE`, which waits on the ConfigNode for overlapping table tasks:
- `IoTDBInsertQueryIT`
- `IoTDBCteIT`
- `IoTExplainAnalyzeIT`
- `IoTExplainJsonFormatIT`
- `IoTDBAuditLogBasicIT`
- the remaining cases in `IoTDBDeletionTableIT` and
`IoTDBSessionRelationalIT`
- **No drop actually happens:** the statement is expected to fail, targets a
table that does not exist, or is in an `@Ignore`d class
(`IoTDBExecuteBatchTableIT`).
### Verification
I ran both tests on Windows 11 with JDK 21:
`mvn verify -DskipUTs
-Dit.test=IoTDBDeletionTableIT#testCompletelyDeleteTable+testMultiDeviceCompletelyDeleteTable
-DfailIfNoTests=false -Dfailsafe.failIfNoSpecifiedTests=false -pl
integration-test -am -P with-integration-tests`, with the Spotless, Checkstyle
and RAT checks skipped. `spotless:apply` on the module made no changes.
- `-PTableSimpleIT` (1C1D, clean build): 2 tests, 0 failures, 0 errors (5.1
s and 2.2 s). In the DataNode log, the drop's deletion ran against the working
memtables (`in workMemTable, 100 points deleted`) and removed the sealed files
directly, before the test's flush started. The flush then skipped the empty
memtables and removed their files.
- `-PTableClusterIT` (1C3D, 3 DataNodes, incremental build of the same
tree): 2 tests, 0 failures, 0 errors (7.7 s and 2.6 s).
The original failure needs the flush to overlap `DELETE_DATA`, which is
timing-dependent. I did not reproduce it locally.
<hr>
This PR has:
- [x] been self-reviewed.
- [x] added comments explaining the "why" and the intent of the code
wherever would not be obvious
for an unfamiliar reader.
- [x] been tested in a test IoTDB cluster (IT clusters, see Verification).
<hr>
##### Key changed/added classes (or packages if there are too many classes)
in this PR
-
`integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBDeletionTableIT.java`
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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]