Coalesce Changed Blocks Between Snapshots Into Transfer Extents

Last updated: November 29, 2026

Quick Overview

Given the block maps (LBA to physical block) of a base snapshot and a newer snapshot, produce the list of extents an incremental replication job must send: runs of changed data blocks and runs of deleted blocks (holes), merging data runs separated by small unchanged gaps and capping each extent's length.

Netapp
Coding & Algorithms
Software Engineer
Netapp
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


Given the block maps (LBA to physical block) of a base snapshot and a newer snapshot, produce the list of extents an incremental replication job must send: runs of changed data blocks and runs of deleted blocks (holes), merging data runs separated by small unchanged gaps and capping each extent's length.

SnapMirror-style replication sends only the blocks that differ between the last common snapshot and the new one, and request count matters as much as bytes on a WAN link. This screen checks diffing, sorting and interval merging, plus the judgment to trade a few redundant blocks for fewer round trips.

What the Interviewer Expects
  • Defines changed as present in one map but not the other, or pointing to a different physical block
  • Separates deleted LBAs (holes) from changed data and never merges them together
  • Merges data runs across gaps no larger than max_gap and never exceeds max_len
  • Sorts once and does a single linear pass
  • Explains the bandwidth versus request-count trade-off behind max_gap
Key Topics to Cover
Snapshot diff
Interval merging
Incremental replication
Sorting
WAN efficiency
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • The maps are huge B-trees on disk. How would you diff them without materializing every LBA?
  • How would you choose max_gap automatically from link latency and bandwidth?
  • If the transfer is interrupted halfway, how do you resume without resending everything?
Sharpen Your Skills on Codemia

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

Practice DSA Problems
Sample Answer
Requirements

Inputs: base and new as dicts from LBA to physical block number, max_gap (unchanged blocks we are willing to resend to avoid a new request), max_len (largest extent the protocol accepts). Outp...

High-Level Design

Because WAFL never overwrites in place, a changed block always has a different physical block number, so comparing pointers is enough, no content hashing needed. Compute the changed LBA set, sort it, ...


Submit Your Answer
Markdown supported

Related Questions