All Questions
Api Design hard

During deployment, old and new versions briefly run simultaneously. A database migration adds a required column. New code writes it; old code doesn't. What happens?

  1. A Execute the database schema migration and the application code deployment as a single, atomic operation to ensure that no instance ever encounters a schema mismatch.
  2. B Temporarily stop the application traffic to run the migration through a maintenance window, ensuring that the database state is fully settled before restarting the cluster.
  3. C Rely on the database's default value mechanism to automatically populate the new column for all writes originating from older application instances during the rollout period.
  4. D Utilize the 'Expand-Contract' pattern: first add the column as nullable, deploy code that writes to it, backfill the data, and finally apply the strict Not-Null constraint.

One system design question a day, with spaced repetition so the ones you miss come back.

Get the app

Related questions