Skip to content

perf(disttae): index tombstone object ranges - #26476

Merged
XuPeng-SH merged 4 commits into
matrixorigin:mainfrom
gouhongshen:codex/index-tombstone-ranges
Jul 31, 2026
Merged

XuPeng-SH merged 4 commits into
matrixorigin:mainfrom
gouhongshen:codex/index-tombstone-ranges

Conversation

@gouhongshen

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • Improvement

Which issue(s) this PR fixes:

Related to #26465

What this PR does / why we need it:

After #26470 removed the per-object allocation, large table scans still test
every visible tombstone object for every data block. The QA workload in #26465
has system tables with roughly 700 visible tombstone objects and scans roughly
132 data blocks per statement, resulting in about 92,000 object-level Rowid
zone-map checks per scan.

This PR builds a per-data-source interval index from each tombstone object's
Rowid zone-map block range:

  • ranges are sorted by minimum block ID and carry a cumulative maximum;
  • each data block queries only intervals that can contain its block ID;
  • candidate objects are restored to the original visible-object order before
    the existing tombstone reader is called, preserving read and error order;
  • objects without an initialized Rowid zone map remain unconditional
    candidates because they cannot be safely excluded;
  • scans below 32 blocks keep the existing allocation-free linear iterator to
    avoid paying the index construction cost for small reads;
  • the index and candidate scratch space are released when the data source is
    closed.

The existing object/block zone-map checks remain in place. This changes only
candidate selection, not tombstone visibility or deletion semantics.

Validation:

  • go test ./pkg/vm/engine/disttae -count=1
  • go test -race ./pkg/vm/engine/disttae -run '^TestTombstoneObjectIndex' -count=1
  • exhaustive equivalence test over 701 objects and 1,100 block IDs
  • QA-shape benchmark (700 tombstone objects, 132 data blocks, 5 iterations):
    • linear scan: about 501 us/op
    • index build: about 72 us/op, 57,344 B/op, 1 alloc/op
    • indexed block queries: about 11.8 us/op, 0 B/op
    • build plus queries is about 6x faster than the linear scan

This is intentionally separate from the cgroup pressure handling in #26471.
It reduces the work generated by the workload but does not claim to solve all
sources of CN memory pressure by itself.

@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 →

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed exact head 4bb4fc7. The interval query is equivalent to the existing object-level RowidPrefixEq check, retains unindexed objects conservatively, restores visible-object order before I/O, and is scoped to the fixed data-source snapshot/lifetime. Focused equivalence, integration, iterator, and race tests pass. No actionable issues found.

@mergify mergify Bot added the queued label Jul 31, 2026
@mergify mergify Bot removed the queued label Jul 31, 2026
@mergify

mergify Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-07-31 05:32 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-07-31 06:03 UTC · at 20c23bb4f5a78b2335bb49ece1e9d60a88cfc365

This pull request spent 31 minutes 9 seconds in the queue, with no time running CI.

Waiting for
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
    • check-success = Matrixone Utils CI / Coverage
All conditions
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
    • check-success = Matrixone Utils CI / Coverage
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / SCA Test on Linux/arm64
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86

Reason

Pull request #26476 has been dequeued

Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.

The author needs to enable "Allow edits from maintainers" on this pull request.

Failing checks:

Hint

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

@XuPeng-SH
XuPeng-SH merged commit 3f2b8fc into matrixorigin:main Jul 31, 2026
24 of 25 checks passed
@mergify mergify Bot added dequeued and removed queued labels Jul 31, 2026
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [x] Improvement

## Which issue(s) this PR fixes:

Related to matrixorigin#26465

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

After matrixorigin#26470 removed the per-object allocation, large table scans still
test
every visible tombstone object for every data block. The QA workload in
matrixorigin#26465
has system tables with roughly 700 visible tombstone objects and scans
roughly
132 data blocks per statement, resulting in about 92,000 object-level
Rowid
zone-map checks per scan.

This PR builds a per-data-source interval index from each tombstone
object's
Rowid zone-map block range:

- ranges are sorted by minimum block ID and carry a cumulative maximum;
- each data block queries only intervals that can contain its block ID;
- candidate objects are restored to the original visible-object order
before
the existing tombstone reader is called, preserving read and error
order;
- objects without an initialized Rowid zone map remain unconditional
  candidates because they cannot be safely excluded;
- scans below 32 blocks keep the existing allocation-free linear
iterator to
  avoid paying the index construction cost for small reads;
- the index and candidate scratch space are released when the data
source is
  closed.

The existing object/block zone-map checks remain in place. This changes
only
candidate selection, not tombstone visibility or deletion semantics.

Validation:

- `go test ./pkg/vm/engine/disttae -count=1`
- `go test -race ./pkg/vm/engine/disttae -run
'^TestTombstoneObjectIndex' -count=1`
- exhaustive equivalence test over 701 objects and 1,100 block IDs
- QA-shape benchmark (700 tombstone objects, 132 data blocks, 5
iterations):
  - linear scan: about 501 us/op
  - index build: about 72 us/op, 57,344 B/op, 1 alloc/op
  - indexed block queries: about 11.8 us/op, 0 B/op
  - build plus queries is about 6x faster than the linear scan

This is intentionally separate from the cgroup pressure handling in
matrixorigin#26471.
It reduces the work generated by the workload but does not claim to
solve all
sources of CN memory pressure by itself.

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [x] Improvement

## Which issue(s) this PR fixes:

Related to matrixorigin#26465

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

After matrixorigin#26470 removed the per-object allocation, large table scans still
test
every visible tombstone object for every data block. The QA workload in
matrixorigin#26465
has system tables with roughly 700 visible tombstone objects and scans
roughly
132 data blocks per statement, resulting in about 92,000 object-level
Rowid
zone-map checks per scan.

This PR builds a per-data-source interval index from each tombstone
object's
Rowid zone-map block range:

- ranges are sorted by minimum block ID and carry a cumulative maximum;
- each data block queries only intervals that can contain its block ID;
- candidate objects are restored to the original visible-object order
before
the existing tombstone reader is called, preserving read and error
order;
- objects without an initialized Rowid zone map remain unconditional
  candidates because they cannot be safely excluded;
- scans below 32 blocks keep the existing allocation-free linear
iterator to
  avoid paying the index construction cost for small reads;
- the index and candidate scratch space are released when the data
source is
  closed.

The existing object/block zone-map checks remain in place. This changes
only
candidate selection, not tombstone visibility or deletion semantics.

Validation:

- `go test ./pkg/vm/engine/disttae -count=1`
- `go test -race ./pkg/vm/engine/disttae -run
'^TestTombstoneObjectIndex' -count=1`
- exhaustive equivalence test over 701 objects and 1,100 block IDs
- QA-shape benchmark (700 tombstone objects, 132 data blocks, 5
iterations):
  - linear scan: about 501 us/op
  - index build: about 72 us/op, 57,344 B/op, 1 alloc/op
  - indexed block queries: about 11.8 us/op, 0 B/op
  - build plus queries is about 6x faster than the linear scan

This is intentionally separate from the cgroup pressure handling in
matrixorigin#26471.
It reduces the work generated by the workload but does not claim to
solve all
sources of CN memory pressure by itself.

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [x] Improvement

## Which issue(s) this PR fixes:

Related to matrixorigin#26465

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

After matrixorigin#26470 removed the per-object allocation, large table scans still
test
every visible tombstone object for every data block. The QA workload in
matrixorigin#26465
has system tables with roughly 700 visible tombstone objects and scans
roughly
132 data blocks per statement, resulting in about 92,000 object-level
Rowid
zone-map checks per scan.

This PR builds a per-data-source interval index from each tombstone
object's
Rowid zone-map block range:

- ranges are sorted by minimum block ID and carry a cumulative maximum;
- each data block queries only intervals that can contain its block ID;
- candidate objects are restored to the original visible-object order
before
the existing tombstone reader is called, preserving read and error
order;
- objects without an initialized Rowid zone map remain unconditional
  candidates because they cannot be safely excluded;
- scans below 32 blocks keep the existing allocation-free linear
iterator to
  avoid paying the index construction cost for small reads;
- the index and candidate scratch space are released when the data
source is
  closed.

The existing object/block zone-map checks remain in place. This changes
only
candidate selection, not tombstone visibility or deletion semantics.

Validation:

- `go test ./pkg/vm/engine/disttae -count=1`
- `go test -race ./pkg/vm/engine/disttae -run
'^TestTombstoneObjectIndex' -count=1`
- exhaustive equivalence test over 701 objects and 1,100 block IDs
- QA-shape benchmark (700 tombstone objects, 132 data blocks, 5
iterations):
  - linear scan: about 501 us/op
  - index build: about 72 us/op, 57,344 B/op, 1 alloc/op
  - indexed block queries: about 11.8 us/op, 0 B/op
  - build plus queries is about 6x faster than the linear scan

This is intentionally separate from the cgroup pressure handling in
matrixorigin#26471.
It reduces the work generated by the workload but does not claim to
solve all
sources of CN memory pressure by itself.

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants