FastPrepDurable Data Writer
Problems/Durable Data Writer

Durable Data Writer

Databricks logoDatabricks● MediumFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Databricks onsite interview. The report names a systems coding exercise to implement and test a durable data writer. The candidate did not remember the detailed life cycle and API. Our version uses the smallest finite model with write, flush, crash, recovery, and durable read. It is about 80% the same as the reported question.

Simulate a durable record writer by processing a finite operation sequence. The writer starts in the running state with empty pending and durable storage.

Each operation is one of:

  • ["WRITE", record]: append record to the in-memory pending buffer.
  • ["FLUSH"]: atomically append every pending record to durable storage, preserving order, then clear the pending buffer. Flushing an empty buffer does nothing.
  • ["CRASH"]: discard only pending records and enter the crashed state. Durable records remain unchanged.
  • ["RECOVER"]: leave the crashed state with the durable records intact and an empty pending buffer.
  • ["READ"]: return a snapshot of the durable records. Pending records are not visible.

After CRASH, the next operation is RECOVER. Return one string array for every READ operation, in operation order. Duplicate records are preserved.

Function

simulateDurableWriter(operations: String[][]) → String[][]

Examples

Example 1

operations = [["WRITE","A"],["WRITE","B"],["READ"],["FLUSH"],["READ"]]return = [[],["A","B"]]

The first read sees no durable records because both writes are pending. After the flush, both records are durable and visible in order.

Example 2

operations = [["WRITE","a"],["FLUSH"],["WRITE","b"],["CRASH"],["RECOVER"],["READ"],["WRITE","c"],["FLUSH"],["READ"]]return = [["a"],["a","c"]]

Record a survives because it was flushed. Pending record b is lost in the crash. After recovery, c is written and flushed after a.

Constraints

  • 1 <= operations.length <= 10000
  • Every operation has a valid name and arity.
  • Every record is a non-empty string of at most 100 characters.
  • The total number of WRITE operations is at most 5000.
  • After each CRASH, the next operation is RECOVER.

More Databricks Onsite Interview questions

  • Path Between Two Nodes of a Fibonacci TreeONSITE INTERVIEW · Seen Oct 2026
  • Rectangular K-in-a-RowONSITE INTERVIEW · Seen Oct 2026
  • Customer Revenue with Direct ReferralsPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
  • File Encryption Tree OptimizationPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
  • Cipher Cover Interval EditingONSITE INTERVIEW · Seen Aug 2026
  • Hybrid Run-Length and Bit-Packing EncoderONSITE INTERVIEW · Seen Aug 2026
  • Concurrent Buffered File LoggerONSITE INTERVIEW · Seen Aug 2026
  • Key-Value Store with Hit CounterONSITE INTERVIEW · Seen Jul 2026
  • Blocking Keyed Cache with Waiting ReadersONSITE INTERVIEW · Seen Jul 2026
  • Snapshot Set IteratorPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2026

Similar questions at other companies

  • Customer Bootstrap APIDoorDash · PHONE SCREEN · ONSITE INTERVIEWDoorDash interview questions
  • Path Leaf Character IteratorGoogle · ONSITE INTERVIEWGoogle interview questions
  • Escape Room LeaderboardPinterest · PHONE SCREEN · ONSITE INTERVIEWPinterest interview questions
  • Implement MallocNVIDIA · ONSITE INTERVIEWNVIDIA interview questions
  • Removal PoolCitadel · ONSITE INTERVIEWCitadel interview questions
  • Circuit Breaker State MachineWise · ONSITE INTERVIEW
  • Memory AllocatorMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Ring Buffer OperationsAmazon · ONSITE INTERVIEW
  • Apply Overridden Integer TransformsOptimus Information · ONSITE INTERVIEWOptimus Information interview questions
  • Randomized Collection with Duplicate ValuesOkta · ONSITE INTERVIEWOkta interview questions
All Databricks interview questionsSee Databricks hiring insights
Saved
class Solution {
    public String[][] simulateDurableWriter(String[][] operations) {
        // Write your code here.
    }
}
Checking account…