Place Extent Group Replicas Across Distinct Rack Fault Domains
Last updated: November 29, 2026
Quick Overview
Given nodes as (node_id, rack_id, free_bytes), choose rf nodes on pairwise distinct racks that each have room for a new extent group of a given size, preferring nodes with the most free space. Then place a sequence of extent groups, updating free space after each placement.
Nutanix
November 29, 20260
0
0 solved
Given nodes as (node_id, rack_id, free_bytes), choose rf nodes on pairwise distinct racks that each have room for a new extent group of a given size, preferring nodes with the most free space. Then place a sequence of extent groups, updating free space after each placement.
With rack awareness enabled, the storage fabric must keep every replica of a piece of data in a different rack so a single rack failure never loses all copies under RF2 or RF3. The interviewer checks that you reduce the constraint correctly (best node per rack, then top rf racks) and think about balance and capacity exhaustion.
What the Interviewer Expects
- Observes that only the best candidate per rack can matter
- Uses a heap or sort to pick the top rf racks
- Filters nodes without enough free space before grouping
- Returns a clear failure when fewer than rf racks qualify
- Updates free space for sequential placements and discusses imbalance
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- The local node should hold one replica for data locality. How does the selection change?
- How would you avoid every new write landing on the same emptiest node?
- Racks have different numbers of nodes. Can greedy placement strand capacity?
- How would you re-place replicas after a rack is lost?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Each replica needs free >= size. No two replicas may share a rack. Among valid choices, maximize free space (a simple balancing heuristic). Return the chosen node ids or None. A second function pl...
High-Level Design
Key observation: if a rack contributes a replica, it should contribute its node with the most free space, since swapping in any other node from that rack only lowers free space. So: filter by capacity...