Zero-downtime database cutovers need sticky entity routing

Dual-write and CDC lag break financial-grade cutovers. When a short-lived per-entity routing pin — plus a careful ramp — fits SaaS migrations that cannot serve stale reads.

Priya Nair3 min read

Laptop showing SQL queries against application tables, illustrating live database cutovers under traffic

Why maintenance windows keep returning

Product teams promise zero downtime. Migration playbooks quietly add a freeze. For payments, billing and ordering — or any SaaS workflow where a stale read charges twice or drops an order — a short write block is still an outage.

Recent large-scale migration write-ups spell out the trap: classic techniques each fail one of zero data loss, strong read-after-write consistency, or continuous availability under live traffic.

If your brief says “migrate with no downtime” without naming consistency requirements, you will rediscover the maintenance window at cutover. Related framing: migrating legacy without a big bang.

Where dual-write fails

Writing to both databases on every request looks simple. It is not atomic. Retries, timeouts and partial successes leave silent divergence. Outboxes and reconciliation help after the fact; they do not give you a single truth at write time.

Financial and subscription systems feel this first. A few cents of disagreement still means two systems disagree — and disagreement blocks a safe cutover.

Use dual-write only when you accept eventual repair and soft consistency. Do not market it as strong correctness.

Where CDC lag hurts users

Change-data-capture with shadow reads is excellent for validation. Replication lag — seconds normally, worse under load — means a read can miss a write the user just made.

Pausing traffic until lag clears reintroduces downtime proportional to the lag. Locking per key until catch-up can look like an outage under concurrency.

CDC remains useful for bootstrap and parity checks. It is not, by itself, a cutover strategy for strong read-after-write under live payments-like load.

Sticky entity routing in plain terms

Pick a stable entity key (customer, tenant, account). While an entity is actively writing during migration, pin its traffic to one database until its replication state is safe. Refresh the pin on writes; let it expire when writes stop.

A feature-flag ramp decides the default database for unpinned entities. Pins always win over the ramp so a just-migrated writer does not bounce back mid-flight.

Multi-region products need sticky routing or a globally visible pin store so two regions cannot disagree about where an entity lives. Single-region SaaS can keep the mechanism smaller.

When a pin pattern is worth the dependency

You need a routable entity id, boundable replication-lag SLO for TTL design, and tolerance for a small write-path cost plus a pin store (often a TTL-native key-value service).

Skip the complexity when a maintenance window is acceptable, or when stale reads are harmless. Not every catalogue migration needs payments-grade machinery.

Fail-open vs fail-closed on pin-store outages is a product decision. Document it. Prefer measuring pin fallback rate beside replication lag during the ramp.

Ramp, observe, roll back without drama

Bootstrap the target, enable bidirectional replication, shadow-read for parity, then ramp the flag in small steps. Watch application errors, lag, latency and pin-store health at each step.

Rollback lowers the ramp for unpinned traffic. Pinned entities stay put until TTL expiry — yanking them mid-write is the risky move.

Declare done only when the ramp is 100% and no pins still reference the source. Until then, honouring pins is what keeps the migration honest.

What to put in a SaaS migration brief

Name consistency requirements per workflow, entity keys, lag SLOs, environments, and whether dual-write is forbidden for money paths. Ask for cutover and rollback runbooks, not only a target engine brand.

Require observability on lag and routing decisions before the first production cohort. Tenancy decisions made earlier constrain what you can pin — see SaaS multi-tenancy decisions that stick.

Keep ownership client-side: repos, cloud accounts and the pin store configuration should not live only in a vendor laptop.

How ThreeIndex plans cutovers clients can own

Our SaaS development work designs tenancy, billing-adjacent flows and data access in systems you own. Migrations get phased slices, parity checks and rollback — not a big-bang weekend hope.

Data engineering and DevOps and cloud cover replication, observability and environment rails so cutover metrics are visible to your team.

Send a brief with the databases involved, the entity you would pin, and which reads must never be stale. We will propose a cutover shape that matches the consistency you actually need.

Keep going

Explore further

Where to go after this article, depending on what you are deciding.

Related articles

FAQ

Questions, answered plainly.

Short answers related to this article.

Not covered here?Ask the engineers who would do the work.

Ask a question
Why do dual writes fail during live database migrations?

There is no atomic transaction across two databases. A partial failure can leave them diverging, and reconciliation usually finds the problem after users already saw wrong state.

What is sticky entity routing in a cutover?

Keeping an entity’s reads and writes on one source of truth — often via a short-lived pin refreshed on writes — until replication lag for that entity is safe, then letting a feature flag ramp move traffic.

How can ThreeIndex help with SaaS database migrations?

We design multi-tenant SaaS and data paths in client-owned repos and cloud accounts, with phased cutovers, observability and rollback plans that match the consistency your product actually needs.

Why ThreeIndex

Large enough to staff serious products. Small enough that the author can still explain the module.

AI-first software development company with senior engineers in India, building for teams worldwide. Founded 2020. 44+ IT professionals. 231+ projects shipped.

Start a project

Tell us what you are trying to build.

Send a short description of the project. You will get a reply from someone technical, with questions worth answering. Not a brochure.

  1. We reply with questionsA technical person reads it first
  2. A call, if it is worth having30 to 45 minutes, no sales deck
  3. A written scopeStages, dates and cost basis. Yours to keep