Skip to content

fix data branch no-op update diff#25149

Open
gouhongshen wants to merge 5 commits into
matrixorigin:mainfrom
gouhongshen:codex/fix-data-branch-noop-diff
Open

fix data branch no-op update diff#25149
gouhongshen wants to merge 5 commits into
matrixorigin:mainfrom
gouhongshen:codex/fix-data-branch-noop-diff

Conversation

@gouhongshen

@gouhongshen gouhongshen commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Related to #23751

What this PR does / why we need it:

Fixes data branch diff reporting no-op updates after a row is updated and then restored to the LCA/snapshot value.

Root cause: findDeleteAndUpdateBat treated a tombstone plus a matching live row for the same PK as an UPDATE based only on PK matching. It did not compare the decoded replacement tuple with the LCA delete row, so rows whose visible values had returned to the LCA value still appeared in diff output.

Changes:

  • Compare the decoded live tuple with the LCA row before emitting an UPDATE, and suppress the update when all visible non-PK values are equal.
  • Reuse the existing vector comparison path by factoring value extraction/normalization helpers for vector-vs-vector and tuple-vs-vector comparison.
  • Keep fake-PK tables conservative by comparing the full visible row.
  • Add focused frontend unit tests for restored rows, real updates, and fake-PK behavior.
  • Add git4data/branch/diff_14 BVT coverage for restored-update diffs and merge direction semantics.

Validation:

  • ./run.sh -p /Users/ghs-mo/MOWorkSpace/matrixone-2nd/test/distributed/cases/ -m genrs -i diff_14
  • ./run.sh -p /Users/ghs-mo/MOWorkSpace/matrixone-2nd/test/distributed/cases/ -i diff_14 - 58/58 passed
  • CGO_CFLAGS="-I$PWD/cgo -I$PWD/thirdparties/install/include" CGO_LDFLAGS="-L$PWD/cgo -lmo -L$PWD/thirdparties/install/lib -Wl,-rpath,$PWD/lib" DYLD_LIBRARY_PATH="$PWD/lib:$PWD/cgo:$PWD/thirdparties/install/lib" go test ./pkg/frontend -run 'TestHashDiff_HasLCA|TestHashDiff_NoLCAWithStubHandles|TestDataBranchCompareSingleValInVector'

@mergify mergify Bot added kind/bug Something isn't working kind/test-ci labels Jun 25, 2026
@gouhongshen gouhongshen changed the title [codex] fix data branch no-op update diff fix data branch no-op update diff Jun 25, 2026
@matrix-meow matrix-meow added the size/L Denotes a PR that changes [500,999] lines label Jun 25, 2026
@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 →

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/test-ci size/XL Denotes a PR that changes [1000, 1999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants