TABLET_DATA_TOMBSTONED in YugabyteDB

16 Views Asked by At

Some tablet is in TABLET_DATA_TOMBSTONED status, what does it mean? Do we have ways to remove tablets in that state?

1

There are 1 best solutions below

0
dh YB On

The tablet status TABLET_DATA_TOMBSTONED is the result of a truncate on the table or index that the tablet serves.

All the tablets belonging to that table and all tablets belonging to what we refer to as ‘secondary indexes’ will be in this state.

You probably are thinking about the disk space that the tablet(s) still would occupy, when it is simply given the TABLET_DATA_TOMBSTONED status? This is a logical state of the tablet.

The function of a truncate is to remove all the rows the object that is truncated stores, but without touching any of the rows. This is done by simply de-attaching the rows from the object. Therefore, a truncate (in both PostgreSQL and YugabyteDB) is not MVCC safe. This the consequence of the truncate: if you want it to be MVCC safe, you should use the delete command.

What actually happens during a truncate is that the SST files (the “data files”) are dropped from each tablet.

If you pay close attention you will see the tablets still taking some space, which is because of the WAL files; the SST files are dropped after the truncate command, but the WAL files remain.

These will be garbage collected after some time and shrink in size.