Skip to content

[release-1.15] fix(ovn-central): recover from invalid raft headers - #7122

Merged
zhangzujian merged 2 commits into
kubeovn:release-1.15from
zhangzujian:backport-7112-release-1.15
Aug 4, 2026
Merged

[release-1.15] fix(ovn-central): recover from invalid raft headers#7122
zhangzujian merged 2 commits into
kubeovn:release-1.15from
zhangzujian:backport-7112-release-1.15

Conversation

@zhangzujian

Copy link
Copy Markdown
Member

What type of this PR

  • Bug fixes
  • Tests

What this PR does

This backports #7112 to release-1.15 from squash commit bdec52c1e85d1cee4b9a891c5d74fafe7f36a8c0.

  • Rejects zero, missing, or mismatched RAFT header cluster IDs and zero server IDs.
  • Discovers and validates the live cluster ID for up to 60 seconds before recovery fallback.
  • Preserves the original server ID when rebuilding a member, avoiding a stale fourth RAFT member.
  • Archives failed recovery artifacts and only uses clean bootstrap when no valid recovery path remains.
  • Writes RAFT header snapshots atomically.
  • Adds deterministic leader-checker recovery regression tests.
  • Adds the existing AtomicWriteFile helper from fix: install CNI config and binaries atomically #7035 because this maintenance branch predates that helper; unrelated CNI changes from fix: install CNI config and binaries atomically #7035 are not included.

The master-only test/e2e/ha package does not exist on this maintenance branch, so the HA E2E part of #7112 is intentionally excluded instead of introducing a new E2E suite during a backport.

Verification

  • bash -n dist/images/start-db.sh
  • GOMEMLIMIT=2GiB GOMAXPROCS=2 go test ./pkg/ovn_leader_checker ./pkg/util -count=20
  • GOMEMLIMIT=2GiB GOMAXPROCS=2 go test -race ./pkg/ovn_leader_checker ./pkg/util -count=1
  • GOMEMLIMIT=2GiB GOMAXPROCS=2 go vet ./pkg/ovn_leader_checker ./pkg/util
  • targeted modernize analysis for pkg/ovn_leader_checker and pkg/util
  • targeted golangci-lint for pkg/ovn_leader_checker and pkg/util
  • git diff --check origin/release-1.15...HEAD

Related issue

Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
(cherry picked from commit bdec52c)
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working go Pull requests that update Go code test automation tests labels Aug 4, 2026
@coveralls

coveralls commented Aug 4, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 30870638578

Coverage increased (+0.08%) to 25.047%

Details

  • Coverage increased (+0.08%) from the base build.
  • Patch coverage: 27 uncovered changes across 2 files (45 of 72 lines covered, 62.5%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
pkg/util/file.go 33 18 54.55%
pkg/ovn_leader_checker/ovn.go 39 27 69.23%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 55667
Covered Lines: 13943
Line Coverage: 25.05%
Coverage Strength: 0.29 hits per line

💛 - Coveralls

Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
@zhangzujian
zhangzujian merged commit add6eef into kubeovn:release-1.15 Aug 4, 2026
140 of 143 checks passed
@zhangzujian
zhangzujian deleted the backport-7112-release-1.15 branch August 4, 2026 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working go Pull requests that update Go code size:L This PR changes 100-499 lines, ignoring generated files. test automation tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants