Repository navigation
perf(kernel): read buffered result batches without a runtime hop - #600
Conversation
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
There was a problem hiding this comment.
🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).
Verdict: 1 Nit
Looks good, no blocking concerns. The header says try_next_batch leaves the Arrow outputs untouched while the batch is pending, so the fallback is safe, and error eviction and cancellation are unchanged. The new E2E test is already picked up by the nightly TestKernelE2E prefix filter.
Other findings
- ⚪ Nit — The kernelRows type doc (and the "next_batch does the per-batch network/decode work" line) names only kernel_result_stream_next_batch. nextBatch now tries kernel_result_stream_try_next_batch first and uses next_batch only as the blocking fallback. Update the comment to say so. (Found by Claude Opus 5.5 · confirmed by the judge)
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
|
Fixed the documentation nit in 207423b: the This comment was generated with GitHub MCP. |
There was a problem hiding this comment.
🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).
Verdict: 1 Nit
Looks good, no blocking findings. The non-blocking-first nextBatch keeps the existing error, eviction, EOF and import handling, and the tests cover the buffered, pending, error, cancel and close-during-fallback paths. I couldn't confirm that the pinned v1.5.0 bindings header exports try_next_batch, because the header isn't vendored here.
Other findings
- ⚪ Nit — TestKernelRowsTryNextError asserts the kernel's native message text ('try_next_batch: pointers must not be null'), so the test is tied to that upstream wording. Asserting only the code and the
kernel: next_batchwrapper would make it less brittle. (Found by Claude Opus 5.5 · the judge disputed it but couldn't back that up, so it's kept)
|
Keeping the native-message assertion intentionally: it was requested to distinguish the two C APIs. Both return InvalidArgument and the same This comment was generated with GitHub MCP. |
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Use the source-built kernel SIGPIPE fix merged in #606 instead of ignoring SIGPIPE process-wide in the kernel tests. Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com> Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
There was a problem hiding this comment.
🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).
Verdict: 1 Nit
Looks good, no blocking issues. In nextBatch, the call to try_next_batch only falls back to the blocking next_batch on Success with ready=false. That fallback stays inside the same call() wrapper, so eviction and error wrapping still apply. The pinned header declares the symbol, and the new E2E test matches the nightly TestKernelE2E filter.
Other findings
- ⚪ Nit — The CloudFetch test relies on a fixed 20ms sleep and a loose
blockingFetches <= chunks/2bound to wait for chunks to be decoded, so it is timing-sensitive on slow CI. Poll for decode readiness, or expose a hook that signals when the prefetch buffer is full. (Found by Claude Opus 5.5 · confirmed by the judge)
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
|
Fixed the readiness nit in 1d4d333. CloudFetch now polls the real try path with a 5s bound; the existing nil-in-production test hook can decline blocking fallback and report Pending. The decode sleep/count tolerance is removed; all eight chunks, values and EOF remain asserted. The source-pin matrix passes 24/24, 24-way race stress passes 1,920/1,920 with zero blocking fetches, and mutants a/b/c fail assertions. The separate TLS accept-quiet guard remains. This comment was generated with GitHub MCP. |
The kernel result path used a blocking runtime hop even when an Arrow batch was buffered. The boolean profile attributes .27s of 5.37s CPU samples to
nextBatch. Avoiding the hop cuts an 80M-row boolean scan (19,533 batches) by 11.8% live, versus 0.8% A/A drift. The buffered-batch benchmark saves ~28.5µs/batch, predicting ~.56s against the 6.79s main query.Try the non-blocking API first and block only when it reports pending. Both calls retain the existing thread-local error wrapper, eviction, cancellation, Arrow ownership, logging and telemetry. Kernel only; Thrift is untouched. Overlap: #599 adds a separate reset in
nextBatch; #514 changes the Arrow IPC surface.Verification: default/tagged unit suites, 20 native race repetitions, live result/lifecycle tests, typed row-count/multiset checksums, and default lint. Extra tagged-lint/generated-format findings match main. Live query+drain seconds use eight fresh processes per side, rotated ABBA, warmups excluded; p95=p99 at this sample size:
Boolean user/system CPU medians: 5.175/.280s → 4.800/.045s. Double is inconclusive; tiny/wide-query percentage changes are not attributable to this patch (one batch saves tens of µs; 1,132 wide batches predict ~32ms).
Test-review follow-up: fixture teardown waits for the statement DELETE, idle TLS connections, and 20ms without newly accepted connections before shutdown. The earlier local SIGPIPEs came from the fixture, not native code. Before main's #581 required a newer bindings release, published v1.5.0 passed 24/24 stability processes on a4417b9 and ten full-suite runs on aecafa9; c8113e4 also passed 24/24 with the quiet guard. Plain main independently fails to link the published archive's missing kernel_session_config_set_port symbol. The merged head retains main's header/pin unchanged; source pin 3b691d2 passes make test-kernel and 24/24 stability processes with zero closed-socket handshake errors. #581's binding compatibility is outside this PR.
Adversarial review: converged after two rounds; accepted test fixes are verified, with no open high findings.
This pull request and its description were written by Isaac.