cockroachdb / cockroachdb/cockroach

sql/schemachanger: gcjob can delete the descriptors to early

Open
#148,446 3 comments 0 reactions 0 assignees View on GitHub
C-bug T-sql-foundations
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

When using the DelRange mode of the schema changer GC job, its possible for data to be deleted before the GC interval is hit. This happens because we wait for the prefix to be empty via KV before deleting the descriptor and zone config. This can be easily reproduced by:

```
SET CLUSTER SETTING. sql.gc_job.wait_for_gc.interval='3s'
CREATE DATABASE foo
ALTER DATABASE foo CONFIGURE ZONE USING gc.ttlseconds = 12345
CREATE TABLE foo.public.bar (x INT PRIMARY KEY)
DROP DATABASE foo CASCADE
```

Because the prefix is empty the descriptor for bar will be instantly deleted, which is not ideal.

Jira issue: CRDB-51625

Epic CRDB-61004

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.