Skip to content
AITroveRead. Build. Understand.
Make this comfortable

Spring exercise: predict startup and SQL states across a staged rollout

Last updated: 30 Sept 20264 min read
tutorial
IntermediateBy AITrove Editorial

A rollout trace asks which configuration value binds and which write shape survives each database phase.

Download Spring source kit

Resolve startup first

The application default says relay.batch-size=8 and relay.timeout=2s. The operator passes --relay.batch-size=12 and --relay.timeout=450ms. Predict the bound record: batch size 12, timeout 450 milliseconds. Change the batch flag to 0; startup fails before a worker can claim an event. These are checked by BootRelaySettingsTest.

Now add nullable tenant_id to shipment_receipt. An old writer omitting it succeeds. Backfill historical rows to legacy. Set tenant_id NOT NULL. The same old insert fails; a writer supplying east succeeds. These states are checked by SchemaEvolutionContractTest. The contract lesson explains why an old version must be drained first.

Change the rollout

Suppose ten million rows have no trusted tenant owner. Do not label all of them legacy merely to satisfy a constraint. Describe how to quarantine ambiguous rows, batch provable assignments and measure completion. Then write the target-database and versioned-runner tests still missing from the kit.

The exercise combines separate local fixtures. It is not a deployed migration, hosted judge or authorization audit. The configuration matrix and the schema matrix are the next checks.

Checked source

bash
mvn -q -Dtest=BootRelaySettingsTest,SchemaEvolutionContractTest test

Verification boundary

BootRelaySettingsTest and SchemaEvolutionContractTest provide the local answers. The excerpt is shortened or a labelled design sketch; the kit contains the checked tests.

Costs and limits

The exercise has no real environment-variable source, migration runner, tenant registry or target database.

Common Mistakes

  • Do not treat a default property as the effective operator value.
  • Do not invent tenant ownership to satisfy NOT NULL.
  • Do not call a passing H2 test a deployed rollout.

Read next

Spring Boot command-line properties: test the effective value at startup, Spring Boot configuration validation: reject an unusable relay before work starts, Spring database contract phase: reject old writers only after backfill, Spring schema rollout tests: check old and new writers at every phase.

spring
spring-boot
migration
Storage details