Sanjaay Gowda T S
CNOOC Limited practice

ORIGINAL COMPANY-CONTEXT PRACTICE

Recover an offline field-data buffer

Software engineeringHardConcept

Original practice scenario inspired by CNOOC Limited's public business context; this is not a reported interview question or a description of its internal systems. A synthetic field device buffers observations on disk while connectivity is unavailable. It can lose power during a write or acknowledgement. Explain a durable queue and replay protocol that avoids silent gaps.

Written for independent practice using company context; this is not a verified question from a company interview.

A REASONED APPROACH

Model answer.

Use a crash-consistent local log with stable record identities and explicit acknowledgement checkpoints. Connectivity retries should resend the same observation, allowing the receiver to deduplicate rather than relying on exactly-once transport.

Work through it

  1. Frame records with lengths and checksums, and define when a write is durably committed. On recovery, detect and truncate or quarantine an incomplete trailing record.
  2. Upload bounded batches with stable IDs. Advance the local acknowledgement checkpoint only after durable remote acceptance, then reclaim acknowledged storage safely.
  3. Test power loss at each write and checkpoint boundary, repeated acknowledgements, disk exhaustion, and a prolonged outage. Expose dropped or rejected records through counters.

Tradeoffs to discuss

  • Stronger durability increases write latency and storage wear. Capacity limits need an explicit retention or backpressure policy rather than an unbounded promise.

Common pitfalls

  • Deleting a batch when sending starts loses data on timeout.
  • Reusing sequence IDs after a device reset can cause valid observations to be mistaken for duplicates.

KEEP PRACTISING

Related questions.

Keep learning beyond the interview.

Explore the Learning Hub