📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

📚 Interview question

How do you make a long-running bulk import restartable after a failure halfway through?

Senior Theory Advanced

🎯 Key points

  • Idempotent chunks: MERGE on a business key so a re-run changes nothing
  • Checkpoint table updated in the same transaction as the chunk
  • Resume from the last committed range on restart
  • Immutable input with a batch id
  • Short transactions per chunk to limit locking and log use; avoid one transaction for the whole import
  • Structured logs and metrics per chunk (rows, duration, failures) with an alert on partial runs
  • Retry transient errors around a whole chunk, not inside it

⏱ 30-second answer

Make each chunk idempotent and record progress. Load into a staging table with a batch id, apply changes with a set-based MERGE keyed on the business key so re-running a chunk changes nothing, and write the last committed key range to a checkpoint table in the same transaction as the chunk. On restart, read the checkpoint and continue. Keep the import's input (file or snapshot) immutable so a re-run sees the same data.

🔍 What the interviewer is checking

Checks they design for idempotency and checkpoints rather than all-or-nothing

↩ Usually asked after

More in EF Core Performance

Last updated 23 Nov 2026.

🌐 Sangam's Webring

⏪ Previous 🏠 Main Next ⏩
💬 Chat with me