cockroachdb / cockroachdb/cockroach

sql/gcjob: use `DelRange` for tenant GC

Open
#107,527 1 comment 0 reactions 0 assignees View on GitHub
C-cleanup C-enhancement T-multitenant
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

Currently tenant GC is still on the legacy path (wait for gcttl and `ClearRange` until gcttl is expired). We may change it to use the new path where DeleteRange is used to mark tombstone of ranges and wait for MVCC GC clearing the data. Then delete tenant records from system tables and delete kv span configs when mvcc gc is done.

Note: we need to handle backward compatibility with tenant gc jobs created in previous CRDB version. There is no need to do a migration, but just need to respect the legacy gc jobs already performing the legacy `ClearRange` gc and just let it finish. For those still in the loop waiting for gcttl expiration, there is a chance we can hijack it to the new `DeleteRange` path like [what we did here](https://github.com/cockroachdb/cockroach/blob/3b2c0353b80291983ea61d414daaa46f4b14d4c3/pkg/sql/gcjob/gc_job.go#L455-L455). We can do the tenant gc in `deleteDataAndWaitForGC()` as well, so that we don't need to do anything here.

Jira issue: CRDB-30096

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.