Failed DDL batches hide durability timeouts
perfloop-oss/helix-db · Ignored Failure
https://perfloop.ai/t/oss/case_tw6jc88rjb
Verdict
VERIFIED · settled 2026-11-23 · pull request opened as HelixDB/helix-db#1323
What happened: The check fails before this change and passes with it.
Hypothesis
An index batch can apply one CREATE, fail a later CREATE, then report only the definition conflict after its durability wait times out. This hides the timeout signal that tells callers to reconcile applied writes. A two-CREATE public request reproduces the behavior; its frequency in customer workloads is unknown.
At revision 4b0982fdf0e0e8606ca5fee3bb6214ea09973bb1, Interpreter::run awaits the shared barrier for IndexDdl even after execute_steps fails. However, `result.and_then(|value| durable.map(|()| value))` discards the barrier's error whenever statement execution already returned an error. The explicit timeout contract in crates/db/src/transaction.rs:49-55 and docs/database/helix-db/query-guides/error-handling.mdx:233-236 says an applied write whose durability wait expires returns query_deadline_exceeded and must be reconciled. The conflicting uniqueness definitions used here are supported inputs documented in secondary-indexes.mdx:159-169.
A new integration test, crates/db-testkit/tests/hunt_native_ddl.rs::partial_create_failure_does_not_hide_durability_timeout, uses one writer, disabled secondary background work, two CREATE IF NOT EXISTS statements for User.email with different uniqueness flags, held WAL uploads, a 500 ms request deadline, and a 10 s watchdog. Command: `env CARGO_BUILD_JOBS=4 CARGO_PROFILE_DEV_DEBUG=0 CARGO_PROFILE_TEST_DEBUG=0 cargo test -p helix-db-testkit --test hunt_native_ddl partial_create_failure_does_not_hide_durability_timeout -- --exact --nocapture`. Bash run call_jxT5Nyt0EccQ59g9p2XJ9E5V exited 101 after running the assertion. It printed `visible_before=DatabaseSequence(23) visible_after=DatabaseSequence(24) uploads_before=23 uploads_after=23 elapsed=501.632008ms error_code=IndexDefinitionConflict`, then failed with `durability timeout was hidden by IndexDefinitionConflict: db error: Index definition conflicts in fields: uniqueness`. Cleanup released the upload before the assertion.
Merged upstream https://github.com/HelixDB/helix-db/pull/1297 introduced the applied CREATE commits and shared request barrier. Its implementation and final commit message deliberately keep the barrier within the request deadline to preserve no_op_index_ddl_stops_at_its_deadline. This finding does not repeat its batching optimization or request an unconditional wait beyond deadlines; it concerns the lost durability failure when both stages fail. The current open-PR page contained no competing implementation of this hand-off repair. Contribution documents name GitHub pull requests as the review venue.
The smallest Case check is to retain this deterministic witness and compare the public error before and after a hand-off repair. Also distinguish successful statement execution, a statement failure after an applied prefix, and no-op receipts when durability succeeds, expires, or storage closes. Confirm that a successful barrier preserves the original statement error and a failed barrier remains visible to the caller. This integration-test placement is provisional, not an added requirement for the final repair.
Change to test: Surface a failed shared durability hand-off even when a later DDL statement has failed, retaining the statement failure as context. Preserve the single batch barrier and the deadline-bounded behavior of no-op DDL.
Where it lives
perfloop-oss/helix-db · crates/db/src/query_service.rs
Evidence
The check fails before this change and passes with it: `With secondary background work disabled, a two-CREATE IF NOT EXISTS batch whose User.email uniqueness definitions conflict after an applied CREATE returns query_deadline_exceeded when its held WAL upload outlives the request deadline, or storage_error when that upload fails and closes the writer.`
Checks: 4 of 4 passed. Verification: no defect found.
Timeline
2026-11-14· Case opened2026-11-23· PR opened