Skip to content

Conversation

@pav-kv
Copy link
Collaborator

@pav-kv pav-kv commented Oct 21, 2025

The heuristic in ClearRangeData was introduced in b320ff5 when CRDB used RocksDB. The optimization is no longer needed with Pebble, because Pebble does not load all range tombstones when reading SSTables. The tombstones are loaded and cached as needed, when iterating.
Upd [thread]: however, the RANGEDEL block is unsplittable, and can be loaded into memory entirely, so many range tombstones is still a concern.

Additional benefits of this change:

  • no need for reading when destructing replicas, the batch is constructed with a blind Writer
  • fewer corner cases in replica destruction code
  • predictable replica destruction batches (which is convenient in tests)

Related to #152845

@cockroach-teamcity
Copy link
Member

This change is Reviewable

The heuristic in ClearRangeData was introduced in b320ff5 when CRDB
used RocksDB. The optimization is no longer needed with Pebble, because
Pebble does not load all range tombstones when reading SSTables. The
tombstones are loaded and cached as needed, when iterating.

Additional benefits of this change: fewer corner cases in replica
destruction code, and predictable replica destruction batches (which is
convenient in tests).

Epic: none
Release note: none
@pav-kv pav-kv force-pushed the no-heuristic-in-range-destroy branch from d21d0ac to e0f093f Compare October 21, 2025 13:10
UserKeys: true,
},
ReplicatedByRangeID: opts.clearReplicatedByRangeID,
UnreplicatedByRangeID: opts.clearUnreplicatedByRangeID,
Copy link
Collaborator Author

@pav-kv pav-kv Oct 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: in the unreplicated keyspace, we don't need to clear "range keys" since they don't exist.

TODO: check if the same applies to the replicated RangeID-local space.

TODO: we can also not clear the replicated space for uninitialized replicas, since it is empty.

@pav-kv pav-kv requested a review from jbowens October 21, 2025 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants