Repository navigation
fix(#4806): stop gRPC insertStream after a mid-stream commit failure and stop mis-indexing the error - #4820
Conversation
|
Tick the box to add this pull request to the merge queue (same as
|
Up to standards ✅🟢 Issues
|
There was a problem hiding this comment.
Code Review
This pull request addresses issue #4806 by ensuring that ArcadeDbGrpcService.insertStream stops processing chunks and correctly records a transaction-level error (using rowIndex = -1) when a mid-stream commit failure occurs. It also adds a regression test to verify this behavior. The review feedback highlights two important improvements to prevent transaction leaks and release resources early: first, explicitly rolling back any active transaction in the catch block of onNext when a transaction-level failure is caught, and second, ensuring that any active transaction is bound and rolled back in onCompleted when streamFailed is true to avoid thread-local transaction pollution in the gRPC thread pool.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| if (!streamFailed.get()) { | ||
| try { | ||
| // Issue #4644: onCompleted may run on a different pool thread than the onNext that began | ||
| // the transaction; re-bind it to this thread so the deferred commit finds it. | ||
| ctx.bindToCurrentThread(); | ||
| ctx.flushCommit(true); // commit if not validate-only | ||
| } catch (Exception commitEx) { | ||
| recordCommitException(totals, commitEx); | ||
| } | ||
| } |
There was a problem hiding this comment.
When streamFailed is true, the deferred commit is skipped. However, if the transaction was not already rolled back by the engine during the mid-stream failure, it will remain active and bound to the current thread. Since gRPC threads are reused from a shared pool, this can lead to thread-local transaction pollution, causing subsequent unrelated requests on the same thread to inherit this broken transaction. To prevent transaction leaks, we should explicitly bind and roll back the transaction in the else block if it is still active.
if (!streamFailed.get()) {
try {
// Issue #4644: onCompleted may run on a different pool thread than the onNext that began
// the transaction; re-bind it to this thread so the deferred commit finds it.
ctx.bindToCurrentThread();
ctx.flushCommit(true); // commit if not validate-only
} catch (Exception commitEx) {
recordCommitException(totals, commitEx);
}
} else {
try {
ctx.bindToCurrentThread();
if (ctx.db != null && ctx.db.isTransactionActive()) {
ctx.db.rollback();
}
} catch (Exception rollbackEx) {
LogManager.instance().log(this, Level.WARNING, "Failed to rollback active transaction on stream failure", rollbackEx);
}
}| } catch (Exception e) { | ||
| // Register as an error on totals; keep stream alive unless you prefer to fail | ||
| // the call | ||
| totals.err(Math.max(0, (ctxRef.get() != null ? ctxRef.get().received : 0) - 1), "DB_ERROR", e.getMessage(), | ||
| ""); | ||
| // Issue #4806: per-row errors are handled row-by-row inside insertRows, so an exception | ||
| // reaching here is a transaction-level failure (typically a mid-stream PER_BATCH/PER_ROW | ||
| // commit that has already rolled the transaction back). Record it once at the transaction | ||
| // level (rowIndex -1) instead of mis-attributing it to a single row, and mark the stream | ||
| // failed so subsequent chunks are not inserted into the broken transaction. onCompleted | ||
| // delivers the summary. | ||
| streamFailed.set(true); | ||
| final String code = e instanceof DuplicatedKeyException ? "CONFLICT" : "COMMIT_FAILED"; | ||
| totals.err(-1, code, e.getMessage() != null ? e.getMessage() : e.getClass().getSimpleName(), ""); | ||
| } finally { |
There was a problem hiding this comment.
When a transaction-level failure occurs, the transaction might still be active (e.g., if the exception was not a commit failure or if the engine did not automatically roll it back). To release database locks and resources as early as possible (rather than waiting for all remaining inbound chunks to be drained and onCompleted to be called), we should explicitly roll back the transaction immediately in this catch block if it is still active.
| } catch (Exception e) { | |
| // Register as an error on totals; keep stream alive unless you prefer to fail | |
| // the call | |
| totals.err(Math.max(0, (ctxRef.get() != null ? ctxRef.get().received : 0) - 1), "DB_ERROR", e.getMessage(), | |
| ""); | |
| // Issue #4806: per-row errors are handled row-by-row inside insertRows, so an exception | |
| // reaching here is a transaction-level failure (typically a mid-stream PER_BATCH/PER_ROW | |
| // commit that has already rolled the transaction back). Record it once at the transaction | |
| // level (rowIndex -1) instead of mis-attributing it to a single row, and mark the stream | |
| // failed so subsequent chunks are not inserted into the broken transaction. onCompleted | |
| // delivers the summary. | |
| streamFailed.set(true); | |
| final String code = e instanceof DuplicatedKeyException ? "CONFLICT" : "COMMIT_FAILED"; | |
| totals.err(-1, code, e.getMessage() != null ? e.getMessage() : e.getClass().getSimpleName(), ""); | |
| } finally { | |
| } catch (Exception e) { | |
| // Issue #4806: per-row errors are handled row-by-row inside insertRows, so an exception | |
| // reaching here is a transaction-level failure (typically a mid-stream PER_BATCH/PER_ROW | |
| // commit that has already rolled the transaction back). Record it once at the transaction | |
| // level (rowIndex -1) instead of mis-attributing it to a single row, and mark the stream | |
| // failed so subsequent chunks are not inserted into the broken transaction. onCompleted | |
| // delivers the summary. | |
| streamFailed.set(true); | |
| final String code = e instanceof DuplicatedKeyException ? "CONFLICT" : "COMMIT_FAILED"; | |
| totals.err(-1, code, e.getMessage() != null ? e.getMessage() : e.getClass().getSimpleName(), ""); | |
| try { | |
| final InsertContext ctx = ctxRef.get(); | |
| if (ctx != null && ctx.db != null && ctx.db.isTransactionActive()) { | |
| ctx.db.rollback(); | |
| } | |
| } catch (Exception rollbackEx) { | |
| LogManager.instance().log(this, Level.WARNING, "Failed to rollback active transaction on mid-stream failure", rollbackEx); | |
| } | |
| } |
Review: fix(#4806) gRPC insertStream mid-stream commit failureSolid, well-scoped fix with excellent root-cause analysis. The code comments tying each change back to its issue number (#4198/#4644/#4806) make the streaming state machine much easier to follow, and the regression test reproduces the original 3-error symptom precisely. A few observations, mostly minor. Correctness / data consistency
Maintainability
Test coverage
Nits
Overall this is a correct, targeted fix that removes the mis-indexed error and the processing-on-a-dead-transaction bug. The |
|
Thanks for the reviews. Addressed in @gemini-code-assist (transaction leak on a non-commit failure): valid - a structural failure (e.g. "options changed mid-stream") leaves the transaction active and bound to the pooled gRPC thread. Added
All 23 insertStream ITs (2 new + 21 existing across #4198/#4214/#4644/#4656) pass with no regressions. |
|
The implementation of |
Review: fix(#4806) - stop gRPC
|
|
Thanks @claude, addressed in
All 23 insertStream ITs still pass. |
Review: PR #4820 - stop gRPC
|
|
Claude finished @robfrank's task in 1m 18s —— View job Review: fix(#4806) - final round (84f21e0)All four points are correctly addressed. Here is what I verified: Point 2 -
|
Review: PR #4820 - stop gRPC insertStream after a mid-stream commit failureReviewed the diff against Strengths
Minor / discussion points (non-blocking)
Test coverageGood coverage of both failure modes plus the "Charlie not inserted" / "buffered row rolled back" assertions. Two suggestions:
Overall a solid, correct fix with strong documentation and tests. The points above are minor and can be addressed in follow-ups. Nice work. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4820 +/- ##
============================================
+ Coverage 65.21% 65.24% +0.02%
Complexity 757 757
============================================
Files 1681 1681
Lines 133522 133603 +81
Branches 28514 28532 +18
============================================
+ Hits 87079 87165 +86
+ Misses 34482 34470 -12
- Partials 11961 11968 +7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…and stop mis-indexing the error A mid-stream commit failure in insertStream (e.g. a deferred unique-index violation surfacing at db.commit() in PER_BATCH/PER_ROW mode) escaped insertRows and was recorded against a single context-wide row index (ctx.received-1) with a generic DB_ERROR code, while the finally kept pulling more chunks against the now rolled-back transaction. Subsequent rows then operated on the broken transaction, producing spurious "Transaction not begun" errors. Mark the stream failed on a transaction-level exception, record it once at the transaction level (rowIndex -1, code CONFLICT/COMMIT_FAILED) instead of attributing it to a wrong row, skip inserting further chunks, and skip the deferred commit in onCompleted (the transaction is already gone). A structured InsertSummary is still delivered, consistent with #4198/#4214. Adds Issue4806InsertStreamMidStreamCommitFailureIT. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…re (review) Address review feedback: a transaction-level failure that is not a commit failure (e.g. an "options changed mid-stream" rejection or a schema error) leaves the PER_BATCH/PER_ROW transaction still active and bound to the pooled gRPC thread, leaking its locks and thread-local binding into a later request that reuses the thread. Add InsertContext.abortTransaction(): rolls back the transaction if still active on the calling thread (releasing locks and clearing the binding) and drops the captured handle so the dead transaction is never re-bound. Call it from the onNext catch (on the failing thread) and defensively in onCompleted when the stream already failed. abortTransaction does not re-bind, avoiding rebinding a dead transaction onto a pooled thread. Adds a regression test for the contract-change path proving the buffered row is rolled back rather than committed by the deferred onCompleted commit. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ssification (review) Address review feedback: - Count the failing chunk's rows as received when insertRows throws and discards its partial Counts, so the summary can no longer report failed > received. - Extract commitErrorCode()/exceptionMessage() helpers shared by the mid-stream onNext failure path and the deferred whole-stream recordCommitException path so the CONFLICT/COMMIT_FAILED classification stays in sync. - Clarify in comments that the mid-stream catch does not reclassify already-committed inserted/updated (unlike recordCommitException) and that skipping the deferred commit is an intentional all-or-nothing stance for structural failures. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…rollback (review) Address second review pass: - Classify a stream contract rejection (IllegalArgumentException, e.g. "options changed mid-stream") as CONTRACT_VIOLATION instead of the misleading COMMIT_FAILED; it is not a commit failure. Update the regression test. - Remove the defensive abortTransaction() in onCompleted: the onNext catch already aborts the transaction on the thread it was bound to, so the onCompleted call was redundant and could roll back an unrelated transaction left bound to a reused pooled thread. - Guard the streamFailed short-circuit call.request(1) with !cancelled.get() to mirror the finally drain path (cancellation is asynchronous). - Document the known partial-chunk inserted under-count limitation (server batch size smaller than a chunk) as an out-of-scope follow-up. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
84f21e0 to
a4d2592
Compare
Review: fix(#4806) gRPC insertStream mid-stream commit failureThanks for this - the root-cause analysis is excellent and the fix is well targeted. Distinguishing a transaction-level failure (anything that escapes A few observations, one of which I think is worth addressing before merge. 1. (Medium) Summary can over-report
|
…leak - #1 (medium): abortTransaction() now reports whether it rolled back an active tx; the mid-stream onNext catch reclassifies still-uncommitted inserted/updated as failed when it did (PER_STREAM/PER_REQUEST, or PER_BATCH with batch > chunk), so the summary no longer over-reports rows that were rolled back. Counts stand when nothing rolled back (PER_BATCH/PER_ROW already-committed batches). Contract-change test now asserts inserted==0, received==2, failed==2. - #5 (edge): InsertContext ctor rolls back its own just-begun transaction if construction fails after db.begin(), closing a leak the mid-stream path could not reach (ctxRef unset). - #4/#3 (docs): correct the stale 'COMMIT_FAILED' note (test asserts CONTRACT_VIOLATION) and document the full InsertError.code set.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Coverage variation | ✅ +24.39% coverage variation |
| Diff coverage | ✅ 79.07% diff coverage |
Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (6d1d611) 133572 56871 42.58% Head commit (7da6b89) 165406 (+31834) 110764 (+53893) 66.96% (+24.39%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>
Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#4820) 43 34 79.07% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Review: PR #4820 - stop gRPC
|
…io with 2 updates [skip ci] Bumps the build-tools group in /studio with 2 updates: [webpack](https://github.com/webpack/webpack) and [webpack-cli](https://github.com/webpack/webpack-cli). Updates `webpack` from 5.109.0 to 5.109.2 Release notes *Sourced from [webpack's releases](https://github.com/webpack/webpack/releases).* > v5.109.2 > -------- > > ### Patch Changes > > * Resolve aliases pointing at a package directory whose name ends with `.js` again. (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21542](https://redirect.github.com/webpack/webpack/pull/21542)) > * Name CSS sources in source maps by their resource path, without the `css` prefix. (by [`@bjohansebas`](https://github.com/bjohansebas) in [#21536](https://redirect.github.com/webpack/webpack/pull/21536)) > * Delete no longer referenced files from the filesystem cache directory after storing the cache, age them by recorded time so restored caches are cleaned too, and collect every fully expired pack in one store instead of one per build. (by [`@bjohansebas`](https://github.com/bjohansebas) in [#21528](https://redirect.github.com/webpack/webpack/pull/21528)) > * Report `"universal"` as the loader context target for the universal target. (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21540](https://redirect.github.com/webpack/webpack/pull/21540)) > * Skip `require().prop` in dead branches gated by inlined imported constants. (by [`@hai-x`](https://github.com/hai-x) in [#21517](https://redirect.github.com/webpack/webpack/pull/21517)) > * Annotate configuration options and public hooks in the generated types with the `@since` JSDoc tag. (by [`@bjohansebas`](https://github.com/bjohansebas) in [#21473](https://redirect.github.com/webpack/webpack/pull/21473)) > > v5.109.1 > -------- > > ### Patch Changes > > * Fix stray semicolon emitted before an imported call following a parenthesized sequence element. (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21533](https://redirect.github.com/webpack/webpack/pull/21533)) > * Make `require(esm)` `module.exports` re-export analysis independent of module processing order. (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21521](https://redirect.github.com/webpack/webpack/pull/21521)) > * Ignore ERR\_SERVER\_NOT\_RUNNING on lazy-compilation backend dispose so `compiler.close()` succeeds on Bun. (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21521](https://redirect.github.com/webpack/webpack/pull/21521)) > * Name the failing key when DefinePlugin fails to evaluate a `typeof` value. (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21503](https://redirect.github.com/webpack/webpack/pull/21503)) > * Improve Deno compatibility: guard `setNoDelay` and force-close connections on lazy-compilation backend dispose, and return a real `ArrayBuffer` from the Node async/sync wasm loader so `WebAssembly.instantiate` accepts it. (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21524](https://redirect.github.com/webpack/webpack/pull/21524)) > * Speed up the HTML parser and cut its peak memory: module-scope helpers/state and tokenizer callbacks, plus exact AST column pre-sizing. (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21492](https://redirect.github.com/webpack/webpack/pull/21492)) > * Track CommonJS build dependencies by parsing sources when `require.cache` children are unavailable (e.g. Bun). (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21531](https://redirect.github.com/webpack/webpack/pull/21531)) > * Cook common string-literal escapes on the JS parser fast path and own the tokenizer's cold-path readers. (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21500](https://redirect.github.com/webpack/webpack/pull/21500)) > * Build the CSS `parseA*` AST on the SoA store instead of node classes, cutting parse memory and time. (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21498](https://redirect.github.com/webpack/webpack/pull/21498)) > * Speed up and cut memory of the experimental CSS and HTML parsers: drop two derivable AST node columns, and scan long string, url, comment, and plaintext token bodies natively. (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21504](https://redirect.github.com/webpack/webpack/pull/21504)) > * Speed up non-modules CSS parsing: skip redundant token re-reads, drop selector-prelude tokens without materializing nodes, allocate rule preludes lazily, and fast-path empty list seals. (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21511](https://redirect.github.com/webpack/webpack/pull/21511)) > * Speed up stats generation and cut its peak memory: reuse cached sort comparators instead of thrashing the comparator caches on every sort, and drop redundant module-graph lookups and allocations in the extractors. (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21506](https://redirect.github.com/webpack/webpack/pull/21506)) > * Speed up CSS parsing: byte-range function-name checks, indexed sibling lookahead. (by [`@bjohansebas`](https://github.com/bjohansebas) in [#21520](https://redirect.github.com/webpack/webpack/pull/21520)) > * Reduce allocations and redundant work across the code-generation, module-concatenation, exports/usage-analysis, hashing, and chunk-splitting hot paths. (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21516](https://redirect.github.com/webpack/webpack/pull/21516)) > * Enable the Node.js compile cache in the webpack CLI entry point. (by [`@bjohansebas`](https://github.com/bjohansebas) in [#21523](https://redirect.github.com/webpack/webpack/pull/21523)) > * Encode the persistent cache with V8's value serializer. (by [`@avivkeller`](https://github.com/avivkeller) in [#21514](https://redirect.github.com/webpack/webpack/pull/21514)) ... (truncated) Changelog *Sourced from [webpack's changelog](https://github.com/webpack/webpack/blob/main/CHANGELOG.md).* > 5.109.2 > ------- > > ### Patch Changes > > * Resolve aliases pointing at a package directory whose name ends with `.js` again. (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21542](https://redirect.github.com/webpack/webpack/pull/21542)) > * Name CSS sources in source maps by their resource path, without the `css` prefix. (by [`@bjohansebas`](https://github.com/bjohansebas) in [#21536](https://redirect.github.com/webpack/webpack/pull/21536)) > * Delete no longer referenced files from the filesystem cache directory after storing the cache, age them by recorded time so restored caches are cleaned too, and collect every fully expired pack in one store instead of one per build. (by [`@bjohansebas`](https://github.com/bjohansebas) in [#21528](https://redirect.github.com/webpack/webpack/pull/21528)) > * Report `"universal"` as the loader context target for the universal target. (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21540](https://redirect.github.com/webpack/webpack/pull/21540)) > * Skip `require().prop` in dead branches gated by inlined imported constants. (by [`@hai-x`](https://github.com/hai-x) in [#21517](https://redirect.github.com/webpack/webpack/pull/21517)) > * Annotate configuration options and public hooks in the generated types with the `@since` JSDoc tag. (by [`@bjohansebas`](https://github.com/bjohansebas) in [#21473](https://redirect.github.com/webpack/webpack/pull/21473)) > > 5.109.1 > ------- > > ### Patch Changes > > * Fix stray semicolon emitted before an imported call following a parenthesized sequence element. (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21533](https://redirect.github.com/webpack/webpack/pull/21533)) > * Make `require(esm)` `module.exports` re-export analysis independent of module processing order. (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21521](https://redirect.github.com/webpack/webpack/pull/21521)) > * Ignore ERR\_SERVER\_NOT\_RUNNING on lazy-compilation backend dispose so `compiler.close()` succeeds on Bun. (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21521](https://redirect.github.com/webpack/webpack/pull/21521)) > * Name the failing key when DefinePlugin fails to evaluate a `typeof` value. (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21503](https://redirect.github.com/webpack/webpack/pull/21503)) > * Improve Deno compatibility: guard `setNoDelay` and force-close connections on lazy-compilation backend dispose, and return a real `ArrayBuffer` from the Node async/sync wasm loader so `WebAssembly.instantiate` accepts it. (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21524](https://redirect.github.com/webpack/webpack/pull/21524)) > * Speed up the HTML parser and cut its peak memory: module-scope helpers/state and tokenizer callbacks, plus exact AST column pre-sizing. (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21492](https://redirect.github.com/webpack/webpack/pull/21492)) > * Track CommonJS build dependencies by parsing sources when `require.cache` children are unavailable (e.g. Bun). (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21531](https://redirect.github.com/webpack/webpack/pull/21531)) > * Cook common string-literal escapes on the JS parser fast path and own the tokenizer's cold-path readers. (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21500](https://redirect.github.com/webpack/webpack/pull/21500)) > * Build the CSS `parseA*` AST on the SoA store instead of node classes, cutting parse memory and time. (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21498](https://redirect.github.com/webpack/webpack/pull/21498)) > * Speed up and cut memory of the experimental CSS and HTML parsers: drop two derivable AST node columns, and scan long string, url, comment, and plaintext token bodies natively. (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21504](https://redirect.github.com/webpack/webpack/pull/21504)) > * Speed up non-modules CSS parsing: skip redundant token re-reads, drop selector-prelude tokens without materializing nodes, allocate rule preludes lazily, and fast-path empty list seals. (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21511](https://redirect.github.com/webpack/webpack/pull/21511)) > * Speed up stats generation and cut its peak memory: reuse cached sort comparators instead of thrashing the comparator caches on every sort, and drop redundant module-graph lookups and allocations in the extractors. (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21506](https://redirect.github.com/webpack/webpack/pull/21506)) > * Speed up CSS parsing: byte-range function-name checks, indexed sibling lookahead. (by [`@bjohansebas`](https://github.com/bjohansebas) in [#21520](https://redirect.github.com/webpack/webpack/pull/21520)) > * Reduce allocations and redundant work across the code-generation, module-concatenation, exports/usage-analysis, hashing, and chunk-splitting hot paths. (by [`@alexander-akait`](https://github.com/alexander-akait) in [#21516](https://redirect.github.com/webpack/webpack/pull/21516)) > * Enable the Node.js compile cache in the webpack CLI entry point. (by [`@bjohansebas`](https://github.com/bjohansebas) in [#21523](https://redirect.github.com/webpack/webpack/pull/21523)) ... (truncated) Commits * [`6a24bd6`](webpack/webpack@6a24bd6) chore(release): new release ([#21534](https://redirect.github.com/webpack/webpack/issues/21534)) * [`d1b5b6d`](webpack/webpack@d1b5b6d) fix: resolve aliases pointing at a package directory ending in .js ([#21542](https://redirect.github.com/webpack/webpack/issues/21542)) * [`9cdcc57`](webpack/webpack@9cdcc57) fix(target): report "universal" as the loader target ([#21540](https://redirect.github.com/webpack/webpack/issues/21540)) * [`774e7e4`](webpack/webpack@774e7e4) feat: annotate schema options with added keywords ([#21473](https://redirect.github.com/webpack/webpack/issues/21473)) * [`ff07bdc`](webpack/webpack@ff07bdc) fix(css): name CSS sources in source maps by their resource path ([#21536](https://redirect.github.com/webpack/webpack/issues/21536)) * [`d56d82d`](webpack/webpack@d56d82d) fix(cache): reclaim stale filesystem cache files reliably ([#21539](https://redirect.github.com/webpack/webpack/issues/21539)) * [`ae67e2a`](webpack/webpack@ae67e2a) chore(readme): add codspeed ([#21497](https://redirect.github.com/webpack/webpack/issues/21497)) * [`964bbfa`](webpack/webpack@964bbfa) fix: delete no longer referenced files from the filesystem cache directory (#... * [`075d0cd`](webpack/webpack@075d0cd) feat: skip `require().prop` in dead branches ([#21517](https://redirect.github.com/webpack/webpack/issues/21517)) * [`ec39088`](webpack/webpack@ec39088) chore(release): new release ([#21493](https://redirect.github.com/webpack/webpack/issues/21493)) * Additional commits viewable in [compare view](webpack/webpack@v5.109.0...v5.109.2) Updates `webpack-cli` from 7.2.1 to 7.2.2 Release notes *Sourced from [webpack-cli's releases](https://github.com/webpack/webpack-cli/releases).* > webpack-cli@7.2.2 > ----------------- > > ### Patch Changes > > * perf: enable the Node.js compile cache (`module.enableCompileCache`, available on Node.js >= 22.8.0) to speed up CLI startup (by [`@bjohansebas`](https://github.com/bjohansebas) in [#4818](https://redirect.github.com/webpack/webpack-cli/pull/4818)) Changelog *Sourced from [webpack-cli's changelog](https://github.com/webpack/webpack-cli/blob/main/CHANGELOG.md).* > 7.2.2 > ----- > > ### Patch Changes > > * perf: enable the Node.js compile cache (`module.enableCompileCache`, available on Node.js >= 22.8.0) to speed up CLI startup (by [`@bjohansebas`](https://github.com/bjohansebas) in [#4818](https://redirect.github.com/webpack/webpack-cli/pull/4818)) Commits * [`191fa9f`](webpack/webpack-cli@191fa9f) chore(release): new release ([#4820](https://redirect.github.com/webpack/webpack-cli/issues/4820)) * [`1082235`](webpack/webpack-cli@1082235) chore(deps-dev): bump js-yaml from 5.2.1 to 5.2.2 ([#4821](https://redirect.github.com/webpack/webpack-cli/issues/4821)) * [`e36ae82`](webpack/webpack-cli@e36ae82) chore: add publish workflow and script for pkg.pr.new integration ([#4819](https://redirect.github.com/webpack/webpack-cli/issues/4819)) * [`b0a2024`](webpack/webpack-cli@b0a2024) perf: enable the Node.js compile cache ([#4818](https://redirect.github.com/webpack/webpack-cli/issues/4818)) * [`53f6d72`](webpack/webpack-cli@53f6d72) chore(deps): bump actions/checkout in the dependencies group ([#4816](https://redirect.github.com/webpack/webpack-cli/issues/4816)) * [`8856346`](webpack/webpack-cli@8856346) chore: add allowscripts to work with npm 12 ([#4811](https://redirect.github.com/webpack/webpack-cli/issues/4811)) * [`0b0f1ee`](webpack/webpack-cli@0b0f1ee) chore(deps): bump fast-uri from 3.1.2 to 3.1.4 ([#4815](https://redirect.github.com/webpack/webpack-cli/issues/4815)) * [`d60a777`](webpack/webpack-cli@d60a777) chore(deps-dev): bump postcss from 8.5.10 to 8.5.22 ([#4814](https://redirect.github.com/webpack/webpack-cli/issues/4814)) * [`8c1719a`](webpack/webpack-cli@8c1719a) chore(deps): bump shell-quote from 1.8.4 to 1.10.0 ([#4813](https://redirect.github.com/webpack/webpack-cli/issues/4813)) * [`8c2473c`](webpack/webpack-cli@8c2473c) chore(deps): bump immutable from 5.1.5 to 5.1.9 ([#4812](https://redirect.github.com/webpack/webpack-cli/issues/4812)) * Additional commits viewable in [compare view](https://github.com/webpack/webpack-cli/compare/webpack-cli@7.2.1...webpack-cli@7.2.2) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- Dependabot commands and options You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore ` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore ` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore ` will remove the ignore condition of the specified dependency and ignore conditions
Summary
Fixes #4806. A mid-stream commit failure in
ArcadeDbGrpcService.insertStream(e.g. a deferred unique-index violation surfacing atdb.commit()inPER_BATCH/PER_ROWmode) was mishandled:insertRows, since per-row errors are caught row-by-row inside it) was recorded against a single context-wide row index (ctx.received - 1) with a genericDB_ERRORcode, mis-attributing a transaction-level failure to one row.finallykept pulling more chunks (call.request(1)) against the already rolled-back transaction (the post-commitdb.begin()never ran). Subsequent rows then ran on the broken transaction, producing spurious"Transaction not begun"errors, andonCompletedre-raised the same on its deferred commit.Fix
In
insertStream:streamFailedflag, set when an exception escapesinsertRows(a transaction-level failure).rowIndex = -1, codeCONFLICTforDuplicatedKeyExceptionelseCOMMIT_FAILED) instead of mis-indexing it to a row.onNextchunks (drain inbound to reachonCompleted, but do not insert into the broken transaction).flushCommitinonCompletedwhen the stream already failed (nothing left to commit), still delivering a structuredInsertSummary(consistent with Bug:InsertStreamsurfaces commit-time constraint violations as a stream-levelINTERNALerror instead of populatingInsertSummary.errors#4198 / BUG: InsertStream ignores CONFLICT_IGNORE for commit-time unique-index violations under PER_STREAM #4214).Test
Issue4806InsertStreamMidStreamCommitFailureIT-PER_BATCH,server_batch_size = 1, UNIQUE index. A duplicate row triggers a mid-stream commit failure followed by a would-be-valid row.Before the fix the summary contained 3 errors (mis-indexed
DB_ERROR, a"Transaction not begun"DB_ERRORfrom processing the next row on the dead transaction, and aCOMMIT_FAILEDfromonCompleted). After the fix it contains exactly 1 transaction-level error (rowIndex == -1, codeCONFLICT) and the subsequent row is not inserted.Verification
Issue4198,Issue4214,Issue4644,Issue4656- 21 tests) pass with no regressions.grpcwmodule compiles cleanly.🤖 Generated with Claude Code