Repository navigation
perf(tae): index logtail append ranges on demand - #32031
Conversation
Avoid repeated full-history scans for incremental logtail collection. Retain physical row order and build a reader-owned timestamp index for completed append nodes when repeated reads have stable history or small changes. Keep writer-only histories unindexed, record completions outside PrepareCommit, and use the physical scan for small histories, dense intervals and large completion batches. Preserve transaction prepare-window waits, rollback information and alignment of row selections with commit and abort vectors. Release and account for all derived state with the owning append history. Add deterministic lifecycle and concurrency coverage together with isolated range, writer, collector and memory benchmarks.
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 2edc637600ead21207afa1ef4c978130d0078df3
Assessment: approve
The scoped optimization preserves physical-row alignment, prepare-window waits, replay and cleanup ownership. Reported component gains justify the documented metadata and reader-build costs. No actionable findings remain.
Model: gpt-6-astra / xhigh
Session: 01a1869d-999c-7481-b340-ae4a63e8cee4 · slot 1 · generation 2
Validation:
-
Reviewed all seven changed files, affected consumers, both discussion entries and linked issue context.
-
Verified all seven files and relevant dependencies remain unchanged from the author's validation head e1568b6; reused reported package, race, stress and benchmark evidence.
-
Frozen exact-head CI records 13 successes, including UT, build, SCA and active BVT groups; 14 skips and 2 neutral results are not counted as passes.
-
Static audit passed with matching receipt checks/1793619889260687099-2.json and retained static-audit.log. Review records are saved in the diagnostic directory.
Limitations:
-
No fresh Go tests or benchmarks were run; raw author execution logs were not supplied.
-
Warm benchmarks exclude initial index construction. This approval does not establish resolution of the broader HNSW/combined-load incident.
✅ Merged into
|
…stream claimed 97 as narrow_scan in matrixorigin#32034); take upstream narrow-scan prefetch, virtual-timestamp reads, temporal integer casts, vector shuffle ownership, JSON concat and logtail append-range changes GitHub reported the PR CONFLICTING (DIRTY): upstream matrixorigin#32034 added `plan.Node.narrow_scan = 97` while this branch's unmerged additive `ScanReadRole scan_read_role` sat on field 97. Semantic resolution, both sides kept: - upstream keeps `narrow_scan = 97` (shipped on main; `plan.pb.go` regenerated from the merged proto with the repository protoc/gogofast pipeline plus both postprocessors; toolchain verified byte-identical against upstream's committed bindings before use); - this branch's additive `scan_read_role` moves 97 -> 98; nothing ever persisted 97 as scan_read_role (unmerged field), provenance comment updated in proto/plan.proto; - `merged_descriptor_test.go` (upstream's merge-collision contract guard) extended to pin Node.narrow_scan=97 / Node.scan_read_role=98 so a future regeneration cannot silently renumber or drop either; - all other overlapping files auto-merged with both sides' hunks intact (upstream: table_scan/narrow-scan scope+operator plumbing, plan binder temporal/int-arg changes, disttae datasource, query_builder/types/ deepcopy/base_binder/apply_indices). Upstream batch: matrixorigin#31268 (virtual timestamp reads), matrixorigin#32001 (temporal integer casts), matrixorigin#32020 (vector shuffle ownership), matrixorigin#32031 (logtail append ranges), matrixorigin#32038 (python JSON-string concatenation; upstream's own change, no PR-side code), matrixorigin#32034 (narrow-scan prefetch).
What type of PR is this?
Which issue(s) this PR fixes:
Related to #31374. Addresses the measured append-range scanning regression, while leaving the HNSW resource-admission incident open for matched combined-load validation.
The earlier source-level report is in #31350.
What this PR does / why we need it:
Incremental logtail collection currently scans all retained AppendNodes to find transactions to wait for, construct the physical selection, and build commit/abort vectors. Small intervals therefore become expensive as an object's history grows, and visits to older objects with unknown append bounds amplify that work.
Keep physical rows authoritative and admit a reader-owned timestamp index for repeated large-history reads with stable history or small changes. Completed nodes have immutable timestamp keys; unfinished nodes retain the transaction prepare-window check. Commit/rollback only record membership changes after index activation, with no change to PrepareCommit or the AppendNode layout. Readers build and refresh the index, then emit selection and commit/abort vectors in physical row order.
Use the physical scan for small histories, dense intervals and large completion batches. This avoids transferring the read improvement into writer overhead or batched-write regressions. Empty and single-node selections need no pointer scratch; sparse multi-node selections allocate one exact-capacity pointer slice. Derived state is accounted for and released with the append history. Existing catalog creation, late older-object append coverage and bookmark semantics are preserved.
Validation
updates,tablesandlogtailpackages pass normally; owningupdates/tablesrace checks pass.e1568b6bc0: read-only package graph, pinned molint, license header/dependency checks and golangci-lint (0 issues). Mergify subsequently merged main; all seven PR files remain byte-identical to that reviewed head. Latest-head CI is running.Performance evidence
Local clean baseline/candidate worktrees, identical Go 1.27.1 SIMD/v3 and native inputs; six balanced process pairs. Warm setup and the first case/process sample are excluded. Profiles and forced-GC live-state measurements are separate from latency scoring. Benchmark scripts execute and drain; they perform no dataset, row, reference or checksum verification.
The concurrent unit's paired candidate/baseline ratio is 0.321, 95% bootstrap interval [0.285, 0.375]. Its collector p95/p99 and writer p95 also improve. Standalone writer controls at 64/1,024/8,192 nodes have ratios 1.007/1.017/1.013 with intervals [0.987,1.026]/[0.995,1.027]/[0.989,1.040]; those small differences are inconclusive. No confirmed regression remains in the scored warm read/writer/caller controls; this is not a universal zero-regression claim.
Separate CPU profiles attribute 76.8% of baseline one-row collection CPU to
PreparedIn; the candidate removes the full-history scans and spends its time in indexed lookup, vector allocation and output construction.Costs and limits