Skip to content

Avoid tablet fallback after uncertain LOAD RPC failures - #19427

Merged
jt2594838 merged 9 commits into
apache:masterfrom
Caideyipi:codex/cp-load-rpc-retry-master
Dec 2, 2026
Merged

jt2594838 merged 9 commits into
apache:masterfrom
Caideyipi:codex/cp-load-rpc-retry-master

Conversation

@Caideyipi

Copy link
Copy Markdown
Collaborator

Summary

  • Preserve transport-failure classification across LOAD RPC and partition-fetch errors.
  • Retry consensus submissions under the existing bounded policy and prevent uncertain file outcomes from falling back to tablet insertion.
  • Add regression coverage for transport classification, retry exhaustion, scheduler failure, and fallback suppression.

Behavior example

For a LOAD of events.tsfile, a PIECE request may reach a DataNode while its response is lost, leaving the result uncertain. The loader retries within its bounded RPC policy; if uncertainty remains after retries, it fails the LOAD and does not re-import the file through tablet fallback.

Validation

  • Spotless formatting passed.
  • git diff --check passed.
  • Focused tests have not been rerun after fixing compilation issues found in two prior attempts; neither attempt executed tests.
  • Remote CI has not been checked.

@Caideyipi

Copy link
Copy Markdown
Collaborator Author

LOAD retry correctness update

  • Findings addressed: failed rollback/abort must not permit a new load path that could duplicate staged data; non-transport Thrift/application failures must not be classified as network instability.
  • Changes: failed abort after bounded retries marks the transaction unresolved and blocks tablet fallback. RPC instability classification is limited to transport exceptions, timeouts, and client-manager failures rather than generic Thrift exceptions.
  • Verification: focused DataNode tests passed (39/39); English and Chinese full-reactor clean test-compile -DskipTests passed; Spotless and git diff --check passed. Remote CI was not checked.
  • Reviewed parent: 2dd69d95e3314399c86afcd741ac409a258f1f3d. Final local and PR head: 184fa84399ab8bc1dd21f07ea06c59134645c868.

@Caideyipi

Copy link
Copy Markdown
Collaborator Author

Windows CI follow-up

  • Finding: the Windows shard failed only in IoTDBTableMetaLeaseIT.testDnRestartLogsFenceThreshold. The test waited 10 seconds for the expected log line after asynchronously restarting the DataNode; the restart had not emitted it before the deadline.
  • Fix: increased that bounded log wait to 30 seconds without changing the assertion.
  • Verification: the focused Windows TableSimpleIT run passed (1 test); Spotless and git diff --check passed.
  • Reviewed SHA: 184fa84399ab8bc1dd21f07ea06c59134645c868. Final local and confirmed PR source/head SHA: 95e6f3e4db1caffa9926aeac8e2c42a73fb37ea0.

@Caideyipi

Copy link
Copy Markdown
Collaborator Author

PR comment follow-up

  • Findings: a transport failure from a PIECE retry remained sticky after a fully successful pre-commit rollback; a partition lookup failure before dispatch incorrectly blocked tablet fallback.
  • Fixes: clear the transport-failure fallback block only after every pre-commit ABORT succeeds; classify caught failures through strategy.shouldSkipTabletFallback() only when a strategy exists.
  • Regression coverage: added rollback-after-transport-retry coverage and updated the partition-query failure test to verify it is not treated as an uncertain dispatched LOAD.
  • Verification: Spotless passed; the clean focused DataNode run passed 21 tests with 0 failures/errors/skips; git diff --check passed. Remote CI was not checked.
  • Reviewed comment head: 95e6f3e4db1caffa9926aeac8e2c42a73fb37ea0.
  • Final local and confirmed PR source/head SHA: e53128decf13987da58fc42c875578388bb9fbb8.

@Caideyipi

Copy link
Copy Markdown
Collaborator Author

CI failure follow-up

  • Reviewed the PR diff at e53128decf13987da58fc42c875578388bb9fbb8. The failed DataNode tests hit Java 17 reflective access to java.util.stream.ReferencePipeline$Head.forEach in the PowerMock test run.
  • Local correction: open java.base/java.util.stream to unnamed test modules. LoadFallbackHandlerTest passed locally: 6 tests, 0 failures, 0 errors, 0 skipped.
  • The PR source branch advanced to 1255cf3cf92abfde963de766328be902f629f785, which already contains the same module opening and a java.util.stream PowerMock ignore. I did not push the duplicate local change.
  • Local verification commit: cf6b122; confirmed PR/source head: 1255cf3. The Linux DataNode unit-test job for that head is still in progress; no remote pass is claimed.
  • No other actionable issues were found in the reviewed diff.

@Caideyipi

Copy link
Copy Markdown
Collaborator Author

PR comment follow-up

  • Finding: A failed COMMIT may have partially imported data; a successful ABORT cannot prove tablet fallback is safe.
  • Fix: Set unresolvedLoadTransaction before sending the terminal ABORT; a regression assertion verifies fallback remains blocked when ABORT succeeds.
  • Verification: Spotless passed. clean test -pl iotdb-core/datanode -am -Dtest=TwoPhaseConsensusLoadStrategyAbortTest -Dsurefire.failIfNoSpecifiedTests=false passed (12 tests, 0 failures/errors/skips). git diff --check passed.
  • Reviewed comment head: 1255cf3cf92abfde963de766328be902f629f785.
  • Final local and confirmed PR source/head SHA: 2c6172fb4aa259e59ac355689a30653c14e093d8.
  • Remote CI: not checked.

final TsFileLoadStrategy strategy = resolveStrategy(node, userName);
strategy = resolveStrategy(node, userName);
final boolean loadSuccess = strategy.execute(node);
if (!loadSuccess && strategy.shouldSkipTabletFallback()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/scheduler/load/LoadTsFileScheduler.java:447 — Fallback-suppression wiring in LoadTsFileScheduler has no regression test

Trigger: the new decision of the PR - recording the index from strategy.shouldSkipTabletFallback() (lines 447-449) and the catch branch (467-469). The only scheduler test (LoadTsFileSchedulerTest:188) covers the pre-dispatch partition failure where strategy == null, and the strategy/handler tests never go through the scheduler, so a regression (wrong index recorded, !loadSuccess flipped, catch branch dropped) passes every test.

Fix: Add a scheduler test where a stub strategy returns false with shouldSkipTabletFallback() true and assert the file is passed to LoadFallbackHandler as blocked and never converted to tablets.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added scheduler coverage with a stub strategy for both a false result and an exception while shouldSkipTabletFallback() is true. The tests assert the fallback handler reports the file as blocked instead of converting it to tablets. The focused scheduler and fallback test run passed (18 tests total).

@luoluoyuyu

Copy link
Copy Markdown
Member

minor iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/scheduler/load/LoadFallbackHandlerTest.java:88 — getFailedFilePathsString is PowerMock-suppressed, so the new blocked-node filter never runs

setUp() suppresses getFailedFilePathsString via PowerMock, so the newly added filter !tabletFallbackBlockedNodeIndexes.contains(index) (LoadFallbackHandler:291) is executed by no test; the initialFailedFiles != null guard added at LoadFallbackHandler:119 can only be false through that stub, since Collectors.joining never returns null, so neither the guard nor the filtered log path is verified.

Fix: Drop the PowerMock suppression of getFailedFilePathsString (the java.util.stream PowerMock ignore already covers JDK 17 instrumentation), remove the now-dead null check, and assert that blocked files are filtered out of the INFO line.

@Caideyipi

Copy link
Copy Markdown
Collaborator Author

Removed the PowerMock suppression so the real failed-file-path collector runs, removed the redundant null check, and added a Logback assertion that the fallback INFO entry includes the convertible file but omits the blocked file. This is covered by the focused 18-test pass.

@Caideyipi

Copy link
Copy Markdown
Collaborator Author

PR comment follow-up

  • Findings: the scheduler fallback-suppression wiring lacked regression coverage, and blocked files were not covered in the fallback INFO-log filter test.
  • Fixes: added scheduler tests for false-return and exception outcomes with fallback suppression; removed the PowerMock suppression of failed-file path collection, dropped the redundant null guard, and verified blocked files are excluded from the INFO entry.
  • Verification: mvn spotless:apply -pl iotdb-core/datanode and mvn test -pl iotdb-core/datanode -Dtest=LoadFallbackHandlerTest,LoadTsFileSchedulerTest passed (18 tests, 0 failures/errors/skips); git diff --check passed. Remote CI was not checked.
  • Comment head reviewed: 18771a022f58cb412439e658d665ea797128973b.
  • Final local and confirmed PR source/head SHA: f02943c67cd27b312bb43fc0110c8b7b9b6f4a81.

@jt2594838
jt2594838 merged commit 7b0cce4 into apache:master Dec 2, 2026
48 checks passed
@jt2594838
jt2594838 deleted the codex/cp-load-rpc-retry-master branch December 2, 2026 14:02
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.

3 participants