Skip to content

kv: timetravel queries do not error on ClearRange'd data #31563

@eriktrinh

Description

@eriktrinh

Describe the problem

After dropping a table and the underlying data has been deleted by the ClearRange command, queries with a transaction timestamp before the table has been dropped serve empty, invalid results. It should error because by the time ClearRange has been issued, the GC ttl should have already been passed.

This also affects drop index when the index truncation uses ClearRange, where if a transaction uses an older version of a table descriptor with the index then incorrect results are returned if the index is used.

To Reproduce

  1. create table t(i int primary key);
  2. insert some data into t
  3. note timestamp from select now();
  4. (optionally) alter table t configure zone with gc.ttlseconds={ttlseconds}
  5. drop table t
  6. wait GC period until the drop job has completed
  7. select * from t as of system time '{timestamp from 3}'

Jira issue: CRDB-4786

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.S-3-erroneous-edge-caseDatabase produces or stores erroneous data without visible error/warning, in rare edge cases.T-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions