The interview problem

Practice prompt

A file-indexing service relies on change notifications, but its event queue overflows. Design recovery without assuming every change was observed.

Original practice, not a reported company interview. Scenarios and numbers are illustrative. Interview date: not applicable. Sources retrieved October 1, 2026.

1. Scope and worked approach

Assume notifications are hints and the filesystem remains authoritative. Maintain an index with file identity and observed metadata, process events idempotently and detect overflow explicitly. On loss, mark the affected scope dirty and rescan it while continuing to buffer or version new observations. Reconcile additions, changes and deletions before declaring the index caught up. Directory renames need subtree-aware handling.

2. Trace the design or derivation

Observe hints
  → update index
  → detect loss
  → rescan dirty scope
  → reconcile live changes

Use scan generations and mark entries seen during the scan, but do not delete unseen entries until the scan finishes successfully. A failed partial scan is not evidence of deletion. Expose a degraded freshness state to search consumers while recovery is incomplete, rather than serving stale data as current.

3. Calculate the example

In a simplified one-event-per-change burst with no draining, if 10,000 changes occur while a watcher can buffer only 4,096 events, the index cannot infer the missing 5,904 changes from the surviving queue. A rescan restores current state but cannot reconstruct every intermediate edit.

4. Failure cases and trade-offs

A rescan racing changes can miss transitions unless its reconciliation boundary is defined. Path reuse means a name may refer to a different file. Continuous polling is simple but costly; watch-plus-rescan lowers normal cost while retaining a correctness recovery path.

5. Validation, follow-ups and self-review

Force overflow, rename directories and replace a file at the same path. Follow-up: what history can never be recovered from a scan? Self-review: distinguish current-state convergence from complete event capture.

Sources and related practice

Technical reference: man7.org — Filesystem event queue overflow and monitoring limitations.

Source publication/update: Not established. Retrieved October 1, 2026. The workflow, calculations and review exercises are original; this reference is not evidence that a company asked this question.

Continue with Design a change-data-capture pipeline with snapshot recovery; Build and atomically switch a distributed search index.

Continue your preparation

Choose a connected learning path or browse more System design questions. Read our editorial method and attribution policy.