Repository navigation
[coverage] Conformance findings: STATEMENT-022 (#472) - #564
peco-engineer-bot[bot] wants to merge 6 commits into
Conversation
Signed-off-by: peco-engineer-bot[bot] <3815206+peco-engineer-bot[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Verdict: 2 Low
Looks good. The cancel dedup is correct: each cancel() caller gets the same shared promise, the reset after the promise settles allows a retry after a failure, and promise.then(reset, reset) prevents an unhandled rejection. The unit tests cover the success path and the retry-after-failure path. I have two low-severity notes, about close() running during a cancel and about duplicated error telemetry.
Addresses: - #4476822036 at lib/DBSQLOperation.ts:210 - #4476822040 at lib/DBSQLOperation.ts:228 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Verdict: 1 Low
Looks good, with one low concern. Concurrent cancel() calls are correctly collapsed into one shared promise, which is set synchronously so the unit tests are meaningful. A failed cancel is cleared so a later call can retry, and error telemetry now fires once per failed RPC. The new close-waits-for-cancel guard covers only one ordering: a cancel() started while close() is in flight can still overlap with it.
Addresses: - #4476847147 at lib/DBSQLOperation.ts:243 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Verdict: 2 Low
The cancel dedup looks correct, and I traced the cancel/close ordering with no deadlock cycle: close only waits on a cancel already in flight when it starts, and cancel only waits on close when no cancel is in flight. The two low findings are that concurrent close() calls still aren't deduplicated, and that close() now waits on an in-flight cancel RPC, which could stall cleanup.
Addresses: - #4476877878 at lib/DBSQLOperation.ts:258 - #4476877883 at lib/DBSQLOperation.ts:275 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Verdict: 2 Low
Looks good. I traced the cancel/close dedup state machine through these cases: cancel→close, close→cancel, failure-then-retry, and multiple waiters resuming after a failed close. I found no deadlocks, no duplicate RPCs and no double onClose. My two low-severity notes are a weak e2e assertion and an undocumented change to how close() behaves.
Addresses: - #4476907538 at tests/e2e/cancel_concurrent.test.ts:46 - #4476907546 at lib/DBSQLOperation.ts:265 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Verdict: 1 Low
Looks good, with one low-severity documentation gap. The shared-promise dedup for cancel/close is correct: reset is registered before any caller awaits, so a retry after a failure sees a cleared promise. Errors are reported to telemetry once per shared request. Each wait (cancel on close, close on cancel) only starts when the other promise isn't already shared, so the two can't deadlock. The unit tests do exercise the concurrent paths, because the first call sets the shared promise synchronously.
Addresses: - #4476933041 at lib/DBSQLOperation.ts:215 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
|
Closing; not needed. See #472 (comment) |
Summary
Automated fix for #472 — [coverage] Conformance findings: STATEMENT-022.
DBSQLOperation.cancelInternal()now keeps the in-flight cancel promise and hands it to every concurrentcancel()call, so three simultaneous cancels on Thrift send exactly oneCancelOperationRPC. Once the cancel succeeds, thecancelledflag stops any further RPCs; if it fails, the promise is cleared so a latercancel()can try again. The new e2e spec passes against the live warehouse, the two new unit tests pass, andnpm test(1483 passing) and lint are clean;npm run type-checkfails only on fiveexamples/tokenFederation/*.tsfiles that can't resolve the@databricks/sqlimport, which my change doesn't touch.Root cause & plan
Root cause: DBSQLOperation.cancelInternal() only short-circuits once
this.cancelledis set, and it sets that flag only afterawait this.backend.cancel()resolves. Concurrent cancel() calls all pass the guard before the first RPC returns, so each one calls ThriftOperationBackend.cancel() → driver.cancelOperation(). Three simultaneous cancels therefore send three CancelOperation RPCs instead of one. The reference Go driver (databricks-sql-go#419) and the shared spec expect exactly one on Thrift.Files:
lib/DBSQLOperation.ts,tests/e2e/cancel_concurrent.test.ts,tests/unit/DBSQLOperation.test.tsPlanned coverage:
Files changed
tests/unit/DBSQLOperation.test.tstests/e2e/cancel_concurrent.test.tslib/DBSQLOperation.tsTest plan
tests/e2e/cancel_concurrent.test.ts: Concurrent cancel (STATEMENT-022) three simultaneous cancel() calls: no deadlock— fails (red) against the original code, passes (green) after the fixsingle CancelOperation [thrift]— fails (red) against the original code, passes (green) after the fixtests/unit/DBSQLOperation.test.ts: DBSQLOperation cancel should send a single CancelOperation for concurrent cancel() calls (STATEMENT-022)— fails (red) against the original code, passes (green) after the fixtests/unit/DBSQLOperation.test.ts: DBSQLOperation cancel should propagate in-flight cancel failure to all concurrent callers and allow retry— fails (red) against the original code, passes (green) after the fix🤖 Generated by engineer-bot (bug-fix flow) — review before merge.