Skip to content

feat(incrservice): add transactional offset resets#26085

Merged
mergify[bot] merged 4 commits into
matrixorigin:mainfrom
VioletQwQ-0:codex/issue-23143-transactional-auto-increment-reset
Jul 24, 2026
Merged

feat(incrservice): add transactional offset resets#26085
mergify[bot] merged 4 commits into
matrixorigin:mainfrom
VioletQwQ-0:codex/issue-23143-transactional-auto-increment-reset

Conversation

@VioletQwQ-0

@VioletQwQ-0 VioletQwQ-0 commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

What type of PR is this?

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

Which issue(s) this PR fixes:

issue #23143

What this PR does / why we need it:

This is the next prerequisite after #26027. It does not expose ALTER TABLE ... AUTO_INCREMENT=N yet.

The invariant in this PR is that an AUTO_INCREMENT offset reset and its allocator-cache transition belong to the same transaction:

  • the resetting transaction sees its pending offset without publishing it to other transactions;
  • statement or transaction rollback retires the private reset cache;
  • commit publishes a cache for the allocation epoch actually used by the write;
  • stale builders and old cache generations cannot become active after reset/reload/close;
  • accepted allocator actions drain during close, while a canceled queued reset cannot mutate the store.

The shared service interface now carries autoIncrEpoch and TxnOperator through both production allocation callers. memStore and sqlStore gain monotonic SetOffset plus DDL-constrained ForceSetOffset; all implementations and mocks are updated atomically.

Out of scope for this PR:

  • planner/compiler support for the user-facing ALTER syntax;
  • COPY/CLONE allocator reconciliation;
  • rolling-upgrade enablement for mixed-version TNs;
  • end-to-end BVT for the final SQL behavior.

Diff size, separated for reviewability:

  • production: +1303 / -86
  • tests: +1832 / -8
  • mocks: +292 / -18

Validation:

  • go test -race ./pkg/incrservice -count=1
  • go test ./pkg/sql/colexec/preinsert ./pkg/sql/colexec/table_clone ./pkg/frontend/test ./pkg/vm/engine/test/testutil -count=1
  • go test ./pkg/... -run '^$'
  • git diff --check
  • exact-head mo-pr-preflight-review: PASS at 891781d3a927b80b54d38e381ebee0d749c1c589

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

@VioletQwQ-0
VioletQwQ-0 force-pushed the codex/issue-23143-transactional-auto-increment-reset branch from 75b265e to 5dfb480 Compare July 23, 2026 14:59
@VioletQwQ-0
VioletQwQ-0 force-pushed the codex/issue-23143-transactional-auto-increment-reset branch from 5dfb480 to 28d8664 Compare July 24, 2026 02:58
@mergify

mergify Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-07-24 07:39 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • Checks passed · in-place
  • Merged2026-07-24 10:32 UTC · at 0b5540411601ed63ca4d48f5c35642ec9944d15e · squash

This pull request spent 2 hours 52 minutes 48 seconds in the queue, including 1 hour 8 minutes 19 seconds running CI.

Required conditions to merge
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection] (documentation)
  • github-review-decision = APPROVED [🛡 GitHub branch protection] (documentation)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-neutral = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-skipped = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • 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)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Utils CI / Coverage
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
  • 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

@gouhongshen gouhongshen 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.

Codex automated review

No findings. The prior lifecycle and memStore transactionality findings are fixed on this head. The epoch/private-cache transitions, rollback/commit cleanup, allocator shutdown, callers, and boundary handling are consistent. Diff/format checks and moerr tests passed; the incrservice race suite could not run because the required local libmo.dylib artifact is absent.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants