Add IT for DELETE TIMESERIES replica consistency under IoTConsensusV2#17332
Add IT for DELETE TIMESERIES replica consistency under IoTConsensusV2#17332Pengzna wants to merge 1 commit intoapache:masterfrom
Conversation
Add testDeleteTimeSeriesReplicaConsistency() to verify that DELETE TIMESERIES operations are properly replicated across all DataNode replicas in a 3C3D IoTConsensusV2 cluster. This test reproduces the scenario from the historical deletion replication bug where deletion events lacking replicateIndex were silently dropped by the Processor. The test inserts data with 3 measurements, leaves some data unflushed, deletes one timeseries, then verifies schema consistency on every DataNode — including after stopping and restarting each node in turn to trigger consensus pipe reconstruction and historical replay. Also unifies INSERTION constants to use 3 columns (speed, temperature, power) across all test methods, removing the prior 2-column variants. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds an integration test to ensure DELETE TIMESERIES is consistently replicated across replicas in a 3C3D IoTConsensusV2 cluster (stream + batch), targeting a historical deletion-replication inconsistency. Also standardizes test insertions to use 3 measurements (speed, temperature, power) and updates existing verification accordingly.
Changes:
- Add
testDeleteTimeSeriesReplicaConsistency()coverage in both stream and batch IoTConsensusV2 3C3D ITs via the shared base implementation. - Implement end-to-end replica schema verification after
DELETE TIMESERIES(including node stop/restart cycles) in the 3C3D base test class. - Unify insert/query constants and expected verification results to use 3 measurements instead of prior 2-measurement variants.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| integration-test/src/test/java/org/apache/iotdb/db/it/iotconsensusv2/stream/IoTDBIoTConsensusV2Stream3C3DBasicIT.java | Exposes the new delete-timeseries replica consistency test in stream mode. |
| integration-test/src/test/java/org/apache/iotdb/db/it/iotconsensusv2/batch/IoTDBIoTConsensusV2Batch3C3DBasicIT.java | Exposes the new delete-timeseries replica consistency test in batch mode. |
| integration-test/src/test/java/org/apache/iotdb/db/it/iotconsensusv2/IoTDBIoTConsensusV23C3DBasicITBase.java | Adds the shared delete-timeseries replication test logic and updates inserts/verification for 3 measurements. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| String stoppedDesc = "DataNode " + stoppedNode.getIp() + ":" + stoppedNode.getPort(); | ||
| LOGGER.info("Stopping {}", stoppedDesc); | ||
| stoppedNode.stopForcibly(); | ||
| Assert.assertFalse(stoppedDesc + " should be stopped", stoppedNode.isAlive()); |
There was a problem hiding this comment.
After calling stopForcibly(), the test immediately asserts !isAlive(). AbstractNodeWrapper.stopForcibly() only waits up to 10s and ignores the return value, so the process may still be alive and this assertion can be flaky. Prefer awaiting the node to actually stop (e.g., Awaitility.until(() -> !stoppedNode.isAlive())) before proceeding.
| Assert.assertFalse(stoppedDesc + " should be stopped", stoppedNode.isAlive()); | |
| Awaitility.await() | |
| .atMost(60, TimeUnit.SECONDS) | |
| .untilAsserted( | |
| () -> | |
| Assert.assertFalse( | |
| stoppedDesc + " should be stopped", stoppedNode.isAlive())); |
|
|
||
| // Step 7: Stop each DataNode one by one and verify remaining nodes still consistent | ||
| LOGGER.info( | ||
| "Step 7: Stopping each DataNode in turn and verifying remaining nodes show consistent schema..."); |
There was a problem hiding this comment.
This log message line is likely to exceed the project's 100-character Checkstyle limit once indentation is included. Please wrap/split the string (or use multiple LOGGER.info calls) to keep each line within the limit.
| "Step 7: Stopping each DataNode in turn and verifying remaining nodes show consistent schema..."); | |
| "Step 7: Stopping each DataNode in turn and verifying remaining nodes " | |
| + "show consistent schema..."); |
Summary
testDeleteTimeSeriesReplicaConsistency()integration test to verify thatDELETE TIMESERIESoperations are properly replicated across all DataNode replicas in a 3C3D IoTConsensusV2 clusterreplicateIndexwere silently dropped byIoTConsensusV2Processor, causing schema inconsistency across replicasINSERTIONconstants across all test methods to use 3 columns (speed,temperature,power), replacing the prior 2-column variantsTest Scenario
speed,temperature,power) and flushDELETE TIMESERIES root.sg.d1.speedSHOW TIMESERIESTest Plan
testDeleteTimeSeriesReplicaConsistencyadded in both stream and batch mode subclassesIoTDBIoTConsensusV2Stream3C3DBasicIT.testDeleteTimeSeriesReplicaConsistencyIoTDBIoTConsensusV2Batch3C3DBasicIT.testDeleteTimeSeriesReplicaConsistencytest3C3DWriteFlushAndQueryandtestReplicaConsistencyAfterLeaderStopstill pass with unified 3-column insertions🤖 Generated with Claude Code