Companion code for Zero-Downtime Database Migrations: Expand-Contract in Practice with Spring Boot: a full expand/migrate-writes/migrate-reads/contract sequence run as an actual rolling deploy across two live replicas, with a load generator sending continuous HTTP traffic through all four deploys (99.98% success, every residual error traced to a root cause rather than left unexplained). Findings include a real NOT NULL constraint trap in the expand migration, a backfill-window bug in the read switch, H2's AUTO_SERVER=TRUE single-point-of-failure behavior under a rolling restart, the drain-before-SIGTERM fix needed to close a health-check gap during graceful shutdown, and H2 silently discarding a concurrently committed INSERT during an ALTER TABLE ADD/DROP COLUMN rebuild - confirmed, by primary source, to be an H2-specific behavior rather than a property of the technique itself. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019Fb7vW8vLyLKngBc4R3huA
15 lines
691 B
Plaintext
15 lines
691 B
Plaintext
==============================================================================
|
|
The backfill window: a Stage 1 write after Deploy 1, read by a naive Stage 3
|
|
==============================================================================
|
|
captured: 2026-09-16T19:20:56.276837493Z
|
|
|
|
|
|
-- the row a lingering Stage 1 instance just wrote --
|
|
[{NAME=Katherine Johnson, [email protected], EMAIL_ADDRESS=null}]
|
|
|
|
-- a NAIVE Stage 3 read (email_address alone) - the bug --
|
|
naive Stage 3 email column value: null
|
|
|
|
-- the SHIPPED Stage 3 read (CustomerService, COALESCE) - the fix --
|
|
CustomerService (stage 3) result: Optional[Customer[id=1, name=Katherine Johnson, [email protected]]]
|