Design a system that tracks changed memory address blocks (64-byte blocks); given changed ranges like [1,2],[3,4],[6,9],[10,12], return merged ranges [1,4],[6,12] on query, and make it thread-safe.
Asked in the System coding stage. Treat range endpoints as inclusive block numbers and merge both overlapping and directly adjacent ranges.
merged_start_block and merged_end_block.merged_start_block ascending, and ensure concurrent sessions use a consistent view.| Column | Type | Description |
|---|---|---|
| range_idPK | BIGINT | Unique identifier for the recorded changed range |
| start_block | BIGINT | Inclusive first 64-byte block number |
| end_block | BIGINT | Inclusive last 64-byte block number |