Prevent Lost Updates on File Metadata With ETags

Last updated: November 29, 2026

Quick Overview

Explain how an API like Box's should use ETags and If-Match headers so two clients editing the same file's metadata or uploading a new version do not silently overwrite each other.

Box
Software Engineering Fundamentals
Software Engineer
Box
November 29, 2026
Software Engineer
Technical Screen
Software Engineering Fundamentals
Easy

0

0

0 solved


Explain how an API like Box's should use ETags and If-Match headers so two clients editing the same file's metadata or uploading a new version do not silently overwrite each other.

Box's public APIs return an etag on files and folders and accept If-Match on writes, and integrations, Box Drive, and the web app all write concurrently. This screen checks whether you understand optimistic concurrency at the HTTP level and what a client should do on a 412.

What the Interviewer Expects
  • Defines the lost update problem with a concrete two-client timeline
  • Explains ETag as a version token returned on reads
  • Uses If-Match on writes and 412 Precondition Failed on mismatch
  • Describes the client retry: re-read, merge or ask the user, resend
  • Contrasts with pessimistic locking and when Box style file locks still help
Key Topics to Cover
Optimistic concurrency
HTTP conditional requests
ETags
Lost updates
Conflict resolution
How to Approach This
  1. Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
  2. Choose data structures based on access patterns, not familiarity.
  3. Prefer immutable data and message passing over shared mutable state for concurrency.
  4. Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
  • Should a metadata-only change bump the same ETag as a content upload?
  • How does If-None-Match help with caching downloads?
  • What should Box Drive do when a 412 arrives for a file the user edited offline?
  • How would you implement the check atomically in the database?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Two clients read file 123 with description "Q3 draft". Client A sets it to "Q3 final", client B sets it to "Q3 draft v2". Without coordination, whichever arrives last wins and the other edit vanishes ...

High-Level Design

Every read returns an etag, an opaque version token for the object's current state. Writes send If-Match: <etag>. The server applies the write only if the stored version still matches, and otherwi...


Submit Your Answer
Markdown supported

Related Questions