Repository navigation
cdc: bound sink writes and use safe upserts - #28336
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? |
aptend
left a comment
There was a problem hiding this comment.
Deep re-review of exact head d24248a07654b365ca0b45e7bf044d8c3b2777db against base/merge-base 040356c3aba7c38e54778af701eaf0cb6f1745d2 and the previous reviewed head 8bc6a1991b3af9b1d0d4d9080a8fb323c934b97b. I read the complete review/comment/thread history (one prior review, no inline threads or author replies), checked issues #27863/#26949, reviewed the incremental and full five-file diff, and traced SQL generation through transaction execution, rollback, watermark ownership, batch cleanup, identifier quoting, size arithmetic, split ownership, PK/composite-PK handling, and secondary-unique conflict behavior.
The previous identifier blocker is closed: schema/table/index/column identifiers now double embedded backticks, split execution has exact expectations, delete-before-insert and rollback/watermark ownership have concrete assertions, and the PR body correctly scopes rather than claiming the two broader incidents are resolved. I found no remaining functional or lifecycle blocker in these paths.
[P2][CI] Exact-head SCA fails on two new preallocation findings
The current Matrixone CI / SCA Test on Linux/arm64 check fails with:
pkg/cdc/sinker_v2_sql_builder.go:74: preallocateinsertColNames.pkg/cdc/sinker_v2_sql_builder.go:155: preallocatesuffix.
This is deterministic on every SCA run, not runner noise. I reproduced it locally with the repository golangci configuration and --enable-only prealloc; the command reports exactly those two issues and exits 2. Preallocate insertColNames from the known visible-column upper bound and give suffix a reasonable/exact capacity, then rerun SCA. Because the exact head does not pass the repository static-analysis gate, I am requesting changes rather than approving it.
Validation on the exact head with required local thirdparties/CGO artifacts: complete ./pkg/cdc passed with -count=1; focused statement-builder, insert/delete handler, and sink-creation tests passed with -race -count=3; git diff --check passed. At submission time the GitHub Ubuntu UT job is still in progress; coverage and BVT checks are green.
aptend
left a comment
There was a problem hiding this comment.
Deep re-review of exact head 792abde2488a61316da245b31905408adf44ffdd against base 040356c3aba7c38e54778af701eaf0cb6f1745d2: APPROVE. I read both historical reviews and the issue comment (there are no inline threads), reviewed the incremental change from my prior exact head d24248a07654b365ca0b45e7bf044d8c3b2777db, and rechecked the complete five-file diff. The new commit only preallocates the two slices reported by SCA; it does not change generated SQL or ownership. The previous identifier-quoting blocker remains closed, and the full diff still preserves exact statement-size accounting, all-or-error assembly, delete-before-insert order, rollback/watermark ownership, primary-key-only upsert, and REPLACE fallback for secondary unique conflicts.\n\nThe prior CI blocker is closed: golangci-lint run --enable-only prealloc ./pkg/cdc/... reports 0 issues and the current exact-head GitHub SCA check passes. With the required native/CGo setup, complete ./pkg/cdc passed once and the focused builder, insert/delete handler, sink-creation, boundary, composite-key, and ownership set passed under -race -count=3; git diff --check passes. Required Ubuntu UT and compose jobs were still running at review time and are not claimed as completed, but I found no remaining code/review blocker.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep re-review of exact head 792abde2488a61316da245b31905408adf44ffdd against base 040356c3aba7c38e54778af701eaf0cb6f1745d2: APPROVE.
I read the complete five-file changed-hunk set and prior reviews, then traced builder output through snapshot/tail handlers and executor transaction ownership. The prior backtick-column blocker is closed by one identifier-quoting convention across cached stems/suffixes and setup SQL. PK-only schemas use an all-visible-column upsert; source secondary-unique schemas conservatively retain REPLACE. This relies on the existing source-created sink schema contract, not arbitrary independently added target constraints.
Size accounting includes the reserved driver header, timestamp prefix, separators and complete suffix on every statement, including the first row after a flush. Zero/tiny limits reject nonempty rows; uint64 limits no longer become eager allocation sizes. Completed statements have independent buffers and build errors return no partial SQL list. Immutable metadata/cache plus call-local assembly introduces no shared mutable build state. Existing delete-before-insert, active-transaction execution, rollback/watermark ownership and command/iterator cleanup remain intact. This bounds individual generated SQL, not total CDC backlog or every transient allocation.
Tests now check exact split count/content and mock expectations, quoted/composite identifiers, null/escaping, exact-minus-one and huge limits, post-flush errors, independent buffers, atomic order/dedup, and delete-success/insert-failure rollback with unchanged watermark; fixture ownership has explicit mpool accounting. No verified correctness, lifecycle or performance blocker remains. The scoped design avoids changing transaction/retry policy and removes max-limit-sized eager allocation; it is not evidence that broader snapshot-progress or tail-lag incidents are resolved.
Evidence: my independent exact-object source review and git diff --check pass; current exact-head CI run https://github.com/matrixorigin/matrixone/actions/runs/34196270380 has successful Ubuntu UT, SCA, coverage, proxy and pessimistic compose checks. I reuse aptend's explicitly reported exact-head complete CDC test pass and focused -race -count=3 evidence; these are not local reruns by this reviewer. Author-reported real-sink SQL/benchmark exercises are supporting evidence, not fresh full-daemon deployment acceptance. Keep #27863/#26949 incident closure and comparable end-to-end CDC acceptance separate from this bounded sink-write approval.
|
Queued — the merge queue status continues in this comment ↓. |
Merge Queue Status
This pull request spent 48 minutes 28 seconds in the queue, with no time running CI. ReasonThe pull request can't be updated
HintYou should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. Tick the box to put this pull request back in the merge queue (same as
|
What type of PR is this?
Which issue(s) this PR fixes:
issue #27863 #26949
What this PR does / why we need it:
CDC batch writes could emit an oversized statement when a large row followed a flushed statement, allocate the entire configured SQL limit for a single row, and generate invalid SQL for quoted identifiers. Unconditional upsert also changes secondary-unique conflict semantics and is rejected by MO for relevant schemas.
Validation
pkg/cdcpackage passed with-count=1; no test exclusions.make build-with-prebuilt-nativepassed.The existing source-to-created-sink schema correspondence is retained. Independently adding unique indexes to a target remains outside that contract. The public SQL checks validate the generator and sink semantics; they are not a full CDC daemon deployment test.