Interview: warehouse and checkout overwrite the same order

Two services UPDATE one row, so a column rename takes the other service down. One owner, an API the owner can reject, and why two instances of one service…

More on Ticket interviews

Keep learning

Warehouse and checkout keep overwriting the same order row

Two services UPDATE one orders table. A column rename in one broke the other. one writer schema coupling API instead of UPDATE logical database Packed orders flip back to “placed”

Packed orders flip back to “placed”

Pickers mark an order packed. Seconds later it is “placed” again. Checkout renamed orders.picker to orders.assignee. Warehouse still writes picker, so its update fails. 2 services failed updates checkout only orders row RENAME picker → assignee checkout deploy only UPDATE … SET status='packed', picker=… unknown column retry: SET status='placed' old status restored placed, assignee NULL Restated: two services own one row, so one side’s migration is the other side’s incident.

Four checks, in order

Does a single owner exist? List services with UPDATE on orders. No. Both services write status. Nobody owns the row. Is the write implemented in one place? Read both codebases for status. No. Each has its own status rules, and they race. Is the table used as an API? Who has the connection string? Yes. Warehouse got checkout’s DB instead of an endpoint. Does it hold when one side deploys? Rename a column, deploy one side. No. The old writer errors or writes stale data.

You decide the owner. The model types the move.

Names one writer instead of merging two UPDATEs. A request the owner can reject replaces the shared table. Revokes credentials so the coupling can’t grow back.

Say these without the model

Two instances of checkout share one orders database. Is that the same bug? Two services, one table Two codebases, two deploys, two sets of rules. Two instances, one service Same code, same rules, one deploy. The bug is two services with separate deploys writing one schema. One server can host two logical databases. Isolation is schema plus credentials. instance vs service one set of rules logical database Warehouse says an HTTP call is slower than a local UPDATE. What do you give them? The UPDATE was fast because it skipped the rules. That speed is the incident. It’s one round trip. Measure it first. If it hurts, batch packs or make the call async. Never hand the table back to save latency. latency is real rules live with the data batch or async, not a shared table Both services need the row “at the same time” for a feature this week. What do you refuse? A second writer, a cross-boundary view, or a sync trigger. Can’t name one owner? You’re not ready to split the data. one owner no view across the boundary don’t split yet

The warehouse lead wants a shared table “just for status”

What do you ship? Checkout owns the row. Warehouse calls packed. One owner can rename columns freely. Warehouse learns rules from a 409. Independent deploy Status races Extra round trip Keep the shared table and add a version column Fixes the race, keeps the coupling. The next migration breaks it again. Give each service a copy and sync both ways Still two writers, plus a sync job. Conflicts just move. No status races One set of rules Owner + endpoint Shared table + version Two copies, two-way sync The three options at a glance

Have one ready

Tell me about two systems that broke because they shared a table. Who should own the row. The migration the other side missed.

Did you show these?

Named one writer Instances vs services Version column isn’t the fix Atomic writes stay in one service

More courses

  • Jobs, linked to lessons — Browse jobs where every requirement links to the chapter that teaches it. See how ready you are, how long the gap takes to close, and which listings look stale.
  • Match a job post to courses — Paste a job post. Each skill is matched to a track here and put in learning order, foundations first.
  • React patterns from open source — Patterns extracted from Material UI, Radix, React Aria, React Hook Form, Redux Toolkit, TanStack, and Next.js — not slides about hooks.
  • System Design — Core concepts first (SQL vs NoSQL, CAP, indexing, replication, sharding), then designs grouped by what carries them: the database, Redis, Kafka, or many services.
  • NestJS: build a real API — One ticket-booking API, built in order: a plain Node server first, then NestJS modules, validation, a real database, and the features real clients lean on.
  • Microservices — Microservice patterns one diagram at a time: how to split a monolith, how services talk, and how data stays consistent without distributed transactions.
  • Kafka — A beginner-to-senior path through event logs, reliable delivery, production operations, and disaster recovery.
  • AI engineering for software engineers — Eight free reads, in order, for software engineers moving into AI: when to build an agent, how to build one, how to test it, and how the model works underneath.
  • Frontend system design — How a UI is sliced when it is a product, not a page: ownership of state, cache, routes, and what happens when the network lies.
  • TypeScript in depth — The type system as a design tool. Inference, narrowing, generics, and the errors that mean the model is wrong — not a catalog of utility types.
  • CSS in depth — See the box, then the page. Visual chapters from the box model through Flexbox surprises, Grid, selectors, and units, then backgrounds, shapes, and visual effects, each with a playground.
  • Accessibility — Foundations first (WCAG in plain words, semantic HTML, lists, alt text), then hands-on HTML labs, a full pass of WAI-ARIA 1.3, and a final fix-the-page challenge.
  • Docker — What an image is, why layers cache, and how containers find each other on a network.
  • Redis — Fifteen Redis patterns, one picture each: cache, session, lock, counter, rate limiter, queue, and when Redis is the wrong tool.
  • Kubernetes — Kubernetes from zero to operators: why it exists, Pods, Deployments and Services, then configuration, networking, storage, scheduling, scaling and security.
  • AWS — AWS networking in plain English. A VPC is a gated housing society: streets are subnets, the Internet Gateway is the main gate, and a route table is the signboard.
  • Networking: the NetRoute game — NetRoute is a packet logistics game. You wire up computers, switches, routers, firewalls and gateways, set each device, and watch glowing packets travel. If a packet gets dropped, the game shows you which header field was wrong.