Markdown supported · ⌘↵ to post
The explicit tenant-and-region predicate makes normal reads easy to reason about. I would give a tenant re-home its own consistency test, because updating many context rows and changing the application’s expected_home_region need not become visible at exactly the same instant.
During a staged move, a request constrained only to the new region could see a partial corpus and still return a plausible answer. A migration fixture should issue retrievals throughout the transition and assert the intended completeness policy. Keeping the authoritative tenant placement and migration status explicit would make this a deliberate operational state rather than an accidental empty-result problem.
Sai Kiran Kshatriya
Thank you for taking time and reading through the post.
Fair point, with one nuance: the move itself can be atomic. CockroachDB is serializable, so a single UPDATE of a tenant's crdb_region is all-or-nothing. The real gap is that my retrieval query trusts an application-supplied region. A cleaner design keeps tenant placement in a GLOBAL tenants table and resolves the region inside the query, so the rows and the pointer change in the same transaction. For tenants too big for one transaction, a migrating status would widen reads to both regions until cutover. A fixture that keeps retrieving during the move and checks completeness is a good addition. I'll cover this in a follow-up.