Repository navigation
fix(disttae): tie insert logtail buffers to snapshot lifetime - #33128
Conversation
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? |
|
Queue requested — the merge queue status continues in this comment ↓. |
|
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: 197a9443e5c35251312339fabb40dd259ac1d880
Assessment: approve
Insert replay now lets snapshot references govern the lifetime of decoded logtail buffers. Local callers copy mutable inputs when replay retains row data, and both paths share the same replay implementation. The regression test verified that retirement leaves the replay pool at zero while an older snapshot can still read the original values.
Model: gpt-6.2-sol / xhigh
Session: 01a20682-9189-75a0-839a-f36d8b2372a5 · slot 1 · generation 3
Validation:
-
Verified the frozen patch, pinned policy, native build inputs, and isolated test runtime.
-
The logtailreplay package passed under the race detector. All 100 repetitions of the lifetime regression passed for received, local, and keys-only inserts. See checks/1795495436053310016-2.json and checks/1795495470504565352-2.json.
-
TestClusterByRealLogtailIntegration passed under the race detector. The TAE allocator started and ended at zero bytes. See checks/1795495484292538891-2.json.
Limitations:
-
The historical TKE OOM attribution and benchmark figures rely on supplied reports.
-
One existing tombstone test skipped because its fixture requires real tombstone object files.
❌ Left the queue ·
|
What type of PR is this?
Which issue(s) this PR fixes
Fixes #33118. Regression introduced by #33052.
What changed
Insert replay passed the engine mpool to protobuf decoding. This copied column data/area into native vectors, but retiring a row removes the row and index entries without owning the last reference to that batch. Multiple partition snapshots may still read it. Consequently, freeing on row removal would be unsafe; leaving the copy as-is leaks it.
Use a read-only view of the received logtail instead: the client unmarshals each response into fresh Go buffers, and a snapshot keeps exactly the referenced buffers alive. Direct/local insert callers (notably catalog bootstrap) can supply a protobuf view over mutable engine vectors, so detach those inputs on the Go heap when retaining row data. Both entry points use the same replay implementation. No per-row release, finalizer, background task, or wire/SQL format change.
Validation
07d7baa32a: after actual object retirement the replay pool retained 67 B (received), 67 B (local), and 103 B (keys-only). The fix returns all three to zero and an older snapshot still returns the original key and out-of-line varchar.-race. Real TAETestClusterByRealLogtailIntegrationpasses; its allocator ends at its initial balance. Package vet and the configured incremental SCA (molint and golangci-lint) pass.The historical TKE run is the operational witness, not a run of this patch. A post-merge Weekly should check the native replay stack and the AP restart count during no-PK bulk insert.