Skip to content

fix: propagate bitmap allocation errors in result conversion and dedup - #33240

Merged
XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
XuPeng-SH:fix/33144-bitmap-allocation-errors
Nov 25, 2026
Merged

XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
XuPeng-SH:fix/33144-bitmap-allocation-errors

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • BUG
  • Improvement
  • Test and CI

Which issue(s) this PR fixes:

Related to #33030. Follow-up to #33144 and #33231.

What this PR does / why we need it:

After bitmap allocations moved into mpool, converting frontend results with NULLs could exhaust the pool while copying the temporary bitmap. That copy panicked and bypassed cleanup of the partial batch. Set NULLs on the destination vector and return allocation errors through the existing batch cleanup. Extend the bitmap only through the word containing the NULL row so rows in the same word can be marked without another growth call. The physical word requirement is unchanged from growing to the row itself. Columns without NULLs allocate no bitmap, and an early isolated NULL does not reserve bitmap storage for the whole column.

Workspace tombstone lookup returned probe errors from its lower layer, but the caller ignored them and could classify a deleted primary key as a live duplicate. Return the original error before dedup continues. Propagate allocation failures while marking or publishing a deleted candidate and release persisted block data and selection storage on failure. Preserve partial filtering for the existing write-write conflict path when candidate copyback succeeds.

Regression coverage includes pool limits and cleanup, word boundaries, NULL versus empty values, a persisted workspace tombstone, cancellation and missing objects, and the error returned when copying a delete back during a write-write conflict.

Pinned local frontend microbenchmarks against the PR base (4096 rows, six samples per revision, median):

NULL distribution INT64 time delta VARCHAR time delta
None -0.4% -3.4%
1 in 97 +3.7% -1.8%
Half -4.2% -1.0%
All -9.4% -8.0%

These are result conversion microbenchmarks. They do not measure end-to-end query latency.

Validation:

  • Frontend conversion regressions and the full frontend package passed with -race -tags matrixone_test.
  • TAE workspace tombstone/dedup regressions and full txnimpl race passed. The optimization only touched frontend files.
  • Incremental gofmt, go vet, molint, and golangci-lint passed for frontend and txnimpl.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@mergify

mergify Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@XuPeng-SH

XuPeng-SH commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · superseded

Commit: 6ab2d812ee60d1cfe5f49659d167d1e1ea5eb437

"interrupted"

@XuPeng-SH

XuPeng-SH commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: 79b352e552fc7a40aa99ac54e9ca1e546e09f375

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

mo-bot review · mo-bot-local · review

Commit: 79b352e552fc7a40aa99ac54e9ca1e546e09f375

Assessment: approve

The result converter now marks NULLs in the vector-owned bitmap and returns allocation errors through existing batch cleanup. Workspace tombstone probing and candidate copyback propagate failures through the dedup callers while preserving the established partial-filtering behavior for write-write conflicts. The change reuses the existing bitmap and transaction owners without adding persistent state or a parallel cleanup mechanism.

Model: gpt-6.1-terra / max

Session: 01a2110f-4081-7e00-8415-e36a337ad118 · slot 0 · generation 12

Validation:

  • Private /tmp and loopback preflight passed (checks/1795597771700497976-3.json; preflight.log).

  • The candidate cgo and third-party inputs matched the frozen checkout and native prerequisites, including jemalloc, built successfully in the diagnostic directory (checks/1795598076601432246-5.json, checks/1795598076684992335-31.json, checks/1795598093597487652-57.json, checks/1795598104191966326-2.json and checks/1795598215796010434-2.json; native input and build logs).

  • Focused TAE tests passed, including workspace deletion boundaries, missing and cancelled tombstone reads, allocation failure and write-write-conflict copyback (checks/1795600720767077190-2.json; txnimpl-test.log).

  • Focused frontend tests passed for pool-capacity cleanup, NULL and empty values, bitmap word boundaries, temporal and other conversion controls, and the saved-query-result handler (checks/1795601557604346526-2.json; frontend-test.log). Both successful test commands used the assigned isolated executor, matrixone_test tag, one build worker and vet disabled.

Limitations:

  • The initial local-Go command stopped before compilation because Go 1.26.6 was selected instead of the required 1.27.1. Two subsequent combined builds timed out during compilation or linking without completing tests; their logs and receipts are retained. Separate package runs with the correct toolchain passed.

  • The preflight receipt did not capture a source fingerprint because git enumeration timed out; the successful test and native-input receipts identify the assigned head and clean source fingerprint.

  • The full race suites and frontend microbenchmarks reported by the author were not independently rerun. The frozen CI snapshot showed the main build and UT checks still in progress.

XuPeng-SH added a commit that referenced this pull request Nov 25, 2026
## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

Closes #33243

## What this PR does / why we need it:

Committed tombstone matching marked candidate RowIDs through an
infallible NULL bitmap update. When bitmap growth failed, the allocator
error became a panic. This change adds a fallible `containers.MarkNull`
helper and uses it for in-memory and persisted committed tombstone
matches, preserving existing miss, visibility, and write-write conflict
behavior.

The transaction candidate boundary now returns unexpected scan errors
before copying partial filtering results back. On success or WW,
copyback reports bitmap allocation failures to the caller. This is
needed so a committed-match allocation error cannot be hidden or
converted into a panic during copyback. The small consumer guard
overlaps the same correctness boundary in #33240; the workspace and
frontend changes remain in that PR.

Deterministic capped-pool tests reproduce the old panic and verify
`ErrMPoolCapacity`, unchanged failed candidates, normal matching after
capacity is restored, no publication of partial results after an
unexpected error, and allocation-error precedence over WW during
copyback.

Validation passed:

- Full tests for `pkg/vm/engine/tae/index/indexwrapper`,
`pkg/vm/engine/tae/tables`, and `pkg/vm/engine/tae/txn/txnimpl`
- Targeted tests for those packages under `-race`
- `go vet`, `molint check`, and `golangci-lint` for all changed Go
packages
@XuPeng-SH
XuPeng-SH force-pushed the fix/33144-bitmap-allocation-errors branch from 79b352e to f6aafdc Compare November 25, 2026 12:39
@XuPeng-SH

XuPeng-SH commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: f6aafdcdc109b1c7022908bc8c097087dfe35959

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

mo-bot review · mo-bot-local · review

Commit: f6aafdcdc109b1c7022908bc8c097087dfe35959

Assessment: approve

The change reuses the vector-owned NULL bitmap and existing transaction error handling. Allocation and tombstone-probe failures propagate through cleanup and dedup callers, while write-write conflict copyback retains partial filtering. No actionable defects were found.

Model: gpt-6.1-terra / max

Session: 01a2110f-4081-7e00-8415-e36a337ad118 · slot 0 · generation 12

Validation:

  • At the assigned head, isolation preflight and git diff --check passed; receipts checks/1795611544133235595-2.json and checks/1795611544076572158-2.json, with preflight.log and diff-check.log.

  • A retained focused frontend run passed at the previous same-PR head 79b352e. The converter and its test fixtures are unchanged at this head. Receipt: /home/xupeng/.local/state/mo-bot-55/jobs/6602f269a215ce81eb399383/attempt-1/checks/1795601557604346526-2.json; log: /home/xupeng/.local/state/mo-bot-55/jobs/6602f269a215ce81eb399383/attempt-1/frontend-test.log.

  • A retained focused workspace-delete and error-propagation run passed at 79b352e; the exercised workspace paths and fixtures are unchanged. Receipt: /home/xupeng/.local/state/mo-bot-55/jobs/6602f269a215ce81eb399383/attempt-1/checks/1795600720767077190-2.json; log: /home/xupeng/.local/state/mo-bot-55/jobs/6602f269a215ce81eb399383/attempt-1/txnimpl-test.log.

  • Reviewed the rebased copyback helper, its allocation-error test, and affected transaction callers against the current source. The supplied CI snapshot reports a successful shared build.

Limitations:

  • No Go tests were run at the assigned head. The retained copyback test predates the rebase and does not exercise the current shared helper or the added allocation-error subtest.

  • The supplied snapshot shows UT and multi-CN jobs in progress. The author's full race suites and frontend microbenchmarks were not independently rerun.

This branch had an error being deployed

1 failed deployment
ci — 6ceb40b5 Deployed Nov 25, 2026 by XuPeng-SH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working kind/enhancement kind/test-ci size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants