Repository navigation
Conversation
This branch has not been deployed
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.
Summary
Draft proof of concept for copying small, referenced dependency sets during sharding cutover without adding a sharding-key column to those tables.
Separate reference selection, source pagination, and destination logical identity. A dependency can retain a destination-local surrogate ID even when the equivalent source row has a different ID.
Behavior
CutoverDependenciesconfiguration. No behavior changes without it.shardingpackage tests inmake test-goand the existing MySQL CI matrix.See
docs/cutover-dependencies.mdfor a fictional configuration example, the callback contract, and the remaining work.Explicit POC limits
Not ready for production enablement.
The caller must stop relevant source and destination writers, including cleanup, until route switch. An HTTP lock callback's presence does not prove that application contract. This PR changes no caller configuration and enables no application tables.
The prototype requires matching InnoDB schemas, no target triggers/generated columns, a single integer pagination primary key, and a separate non-nullable full-column unique logical key. Payload comparison is intentionally strict, including timestamps. Query plans and write-stop latency still need evaluation with representative data. Source-replica and application-level concurrent-writer tests remain follow-ups. This is not a live dependency replication mechanism and does not apply to other migration backends.
Validation
Against local MySQL 8.0.32 source and target instances:
go test ./sharding -count=3 -timeout=90s— PASS.go test ./sharding/test -count=1 -timeout=150s— PASS, existing sharding suite.-race, excluding the full streamer lifecycle — PASS.go vet -composites=false ./sharding/...— PASS.git diff --check— PASS.go test -vet=off ./... -run '^$'— PASS, compile-only check.Coverage includes different destination IDs, composite identity/joins, duplicate references, other tenants, released-row exclusion, multiple modules, idempotent retry, binary/null values, keyset batches, atomic rollback, missing dependencies, conflicts, schema restrictions, budgets, and a blocked-write deadline. Full lifecycle tests exercise a last in-flight write in the lock callback and prove that a conflict does not reach the success unlock callback.
Existing baseline issues, not changed here:
-racereports unsynchronized binlog-streamer state. The existingTestSelectiveCopyDataWithoutAnyWritesToSourcealso reproduces the streamer stop races without this patch.go vetreports an existing unkeyedMetricTagliteral insharding/filter.go.go test ./... -run '^$'hits an existing vet error attesthelpers/integration_test_case.go:124(Fatalfwith a non-constant format string).No full repository test-suite or production rollout claim.