Repository navigation
Conversation
bb7133
force-pushed
the
codex/rust-vip-owner
branch
from
September 26, 2026 01:57
d7ebe25 to
63e7360
Compare
added 11 commits
September 26, 2026 10:08
Owner
Author
|
Migrated to pingcap#1389: pingcap#1389 This source PR is closed as part of the upstream migration; its historical timeline and checks remain here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Scope
Draft Rust VIP owner for #149, based on the standalone SQL process from #290. The config projection selects exactly one backend cluster and uses that cluster's PD endpoints and TLS for a dedicated
/tiproxy/vip/<ip>/ownerelection. The Rust owner runs only with--standalone; the Go process retains VIP authority in dual-process mode.The owner removes a stale local address before readiness, waits for the SQL ready gate before campaigning, uses a 3-second session with a 1-second etcd request timeout, and binds the address after election. Keepalive continues during Linux add/delete commands and GARP bursts, which can exceed the lease TTL when commands are slow. It sends an initial GARP burst and bounded one-second refreshes. On controlled shutdown, an awaited pre-close removes the address and retires the owner before SQL drain. Main calls the barrier on all supervised termination paths.
The Linux adapter uses
ipfor exact-IP/prefix inspection and address changes, with noninteractivesudo ipfallback on permission errors. GARP uses directarpingor noninteractivesudo arping. This does not reproduce Go's raw-socket library GARP path and needs real Linux validation.Checks
make rust-lint(workspace): PASSmake rust-test(workspace): PASS, including address parsing and pre-close acknowledgement/fallback testsmake rust-build(workspace): PASSmake lint: fails on pre-existing Gopkg/controlbridge/helpers_test.gounusedrecordingHandlerdeclarations. This PR changes Rust, its Linux acceptance workflow, and its test script; it does not change Go source.go mod tidyleft no changes.Draft acceptance gate
No Linux host/network namespace is available in the local macOS workspace. The new
Rust VIP Linux acceptanceworkflow runs two real standalone processes in separate namespaces against one PD/TiDB, capturingip -j addr, election state, SQL results and timestamps for one holder, controlled close, restart, and whole-node/link loss. The first five runs, through 36213639260, failed SQL: the fixture's TiDB topology lacked a keyspace label, so standalone metering correctly rejected incomplete backend attribution after routing. The test now supplies a TiDB[labels] keyspaceconfiguration and verifies that PD publishes it before starting Rust.Head
78b0a941Linux run 36214270719 passed: the initial owner b, controlled handoff to a, b restart while a retained ownership, and a node/link loss followed by takeover by b each had exactly one bound VIP and successful SQL through it. Address snapshots, election records, backend topology, SQL events and an empty overlap sampler are in the run artifact. Follow-up headsc7b983a8and0264bf4bpassed SQL but did not prove GARP: the runner uses Thomas Habets ARPing 2.24 (-ifor interface), and-U -iwithout-S VIPsends with the node IP as source. Head5ad76d6badded-S VIP. Current exact headda5904d5Linux run 36215836966 passed SQL, single-owner and per-owner GARP checks: the initial a MAC, controlled takeover b MAC, and whole-node/link-loss takeover a MAC each broadcastwho-has VIP tell VIP. Address/election snapshots, MAC-bearing packet capture, SQL events, and an empty overlap sampler are in the artifact.The workflow does not yet prove process-only SIGKILL safety. The owner currently adds an address without a finite lifetime, and SIGKILL bypasses its delete path; a surviving interface may therefore retain the old VIP when another node acquires the expired lease. Persistent local delete failure has the same split-brain risk. The per-owner, on-wire GARP gate is now passing; resolve these address-fencing failure cases before marking this PR ready.