Skip to content

fix logservice stale replica truncation for 4.0 (#24983) - #25050

Merged
XuPeng-SH merged 2 commits into
matrixorigin:4.0-devfrom
LeftHandCold:logservice-clean-stale-replica-4.0
Jun 19, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:4.0-devfrom
LeftHandCold:logservice-clean-stale-replica-4.0

Conversation

@LeftHandCold

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 #24966

What this PR does / why we need it:

Why this is needed:

  • The upstream fix prevents imported snapshots from synthesizing Membership.ConfigChangeId from the snapshot index.
  • HAKeeper uses Dragonboat membership ConfigChangeId as the LogService shard epoch.
  • Without this fix, an old imported membership can be reported with a large fake epoch and be treated as newer than the live membership view.
  • The upstream fix also preserves online imported snapshot membership consistently and rejects invalid target membership before restore.

Validation:

  • git diff --check
  • GOTELEMETRY=off go mod download github.com/lni/dragonboat/v4
  • GOTELEMETRY=off go list -m -json github.com/lni/dragonboat/v4
  • GOTELEMETRY=off GOCACHE=/private/tmp/mo-dragonboat-3dev-gocache go test github.com/lni/dragonboat/v4/tools github.com/lni/dragonboat/v4/internal/rsm github.com/lni/dragonboat/v4/internal/raft -run '^$' -count=0

Fixes logservice stale replica recovery with the previous MO-side stale truncation metadata cleanup plus the Dragonboat snapshot import metadata fix from #24967. This keeps truncation from processing stale local replica metadata/exported snapshots, and updates Dragonboat so imported snapshots no longer synthesize membership ConfigChangeId from snapshot index.

## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

issue matrixorigin#24966

## What this PR does / why we need it:

This PR updates the MatrixOne `3.0-dev` branch to use the Dragonboat
snapshot import metadata fix merged in:

-
matrixorigin/dragonboat@103d119
- matrixorigin/dragonboat#14

Main changes:

- Update the `github.com/lni/dragonboat/v4` replacement to
`github.com/matrixorigin/dragonboat/v4
v4.0.0-20260612094223-103d119addce`.
- Add the corresponding `go.sum` entries for the updated Dragonboat
module.

Why this is needed:

- The upstream fix prevents imported snapshots from synthesizing
`Membership.ConfigChangeId` from the snapshot index.
- HAKeeper uses Dragonboat membership `ConfigChangeId` as the LogService
shard epoch.
- Without this fix, an old imported membership can be reported with a
large fake epoch and be treated as newer than the live membership view.
- The upstream fix also preserves online imported snapshot membership
consistently and rejects invalid target membership before restore.

Validation:

- `git diff --check`
- `GOTELEMETRY=off go mod download github.com/lni/dragonboat/v4`
- `GOTELEMETRY=off go list -m -json github.com/lni/dragonboat/v4`
- `GOTELEMETRY=off GOCACHE=/private/tmp/mo-dragonboat-3dev-gocache go
test github.com/lni/dragonboat/v4/tools
github.com/lni/dragonboat/v4/internal/rsm
github.com/lni/dragonboat/v4/internal/raft -run '^$' -count=0`

Fixes logservice stale replica recovery with the previous MO-side stale
truncation metadata cleanup plus the Dragonboat snapshot import metadata
fix from matrixorigin#24967. This keeps truncation from processing stale local
replica metadata/exported snapshots, and updates Dragonboat so imported
snapshots no longer synthesize membership ConfigChangeId from snapshot
index.
@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 →

@LeftHandCold LeftHandCold changed the title fix logservice stale replica truncation for main (#24983) fix logservice stale replica truncation for 4.0 (#24983) Jun 18, 2026
@matrix-meow matrix-meow added the size/M Denotes a PR that changes [100,499] lines label Jun 18, 2026
@mergify mergify Bot added the kind/bug Something isn't working label Jun 18, 2026

@XuPeng-SH XuPeng-SH 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.

Re-checked this from the stale-replica and unhappy-path angle. The MO-side fix looks coherent: stale local replica metadata is only cleaned after reconciling against live NodeHost state, stale exported snapshots are removed before metadata deletion, snapshot-index realignment avoids wedging the export path afterward, and the failure-path tests cover the important cleanup edge cases. I did not find a substantive correctness issue left to block on.

This branch was previously deployed

1 inactive deployment
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 size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants