You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TRUNCATE TABLE on a colocated table truncates all tables in the colocated tablet. Prevent that from happening, even if it would mean that the TRUNCATE doesn't really truncate the targeted table.
This is step 1 of 4 for the data deletion of the drop flow, issue #3035.
The text was updated successfully, but these errors were encountered:
ndeodhar
changed the title
[colo] Prevent TRUNCATE from affecting all tables in tablet
[colocation] Prevent TRUNCATE from affecting all tables in tablet
Jan 15, 2020
Summary:
There is no mechanism to delete the data for a colocated table. For
`DROP TABLE`, metadata changes ensure that the dropped table is no
longer reachable; however, the data remains in the colocated tablet.
For `TRUNCATE TABLE`, all tables in the colocated tablet are truncated.
Use the concept of a table-level tombstone to delete colocated table
data for both `DROP TABLE` and `TRUNCATE TABLE`. Split the work into
four steps:
1. Prevent `TRUNCATE TABLE` on a colocated table from sending
`TruncateTablet` RPCs
1. For both `DROP TABLE` and `TRUNCATE TABLE`, send write DML requests
to create table-level tombstones
1. Detect table-level tombstone for read path
1. Detect table-level tombstone for compactions
Perform the first two steps. Additionally, heavily modify the
`yb_feature_colocation` PostgreSQL regress test to include `TRUNCATE`
statements, test `DROP` cases more comprehensively, and use more
descriptive table and index names.
Call tree:
* [ ] `YBCDropIndex` | `YBCDropTable` | `YBCTruncateTable`
* [x] `YBCPgNewTruncateColocated`
* [x] `PgApiImpl::NewTruncateColocated`
* [x] `PgTruncateColocated::PgTruncateColocated`
* [ ] `PgDmlWrite::Prepare`
* [x] `PgTruncateColocated::AllocWriteRequest`
* [x] `PgTableDesc::NewPgsqlTruncateColocated`
* [x] `YBTable::NewPgsqlTruncateColocated`
* [x] `YBPgsqlWriteOp::NewTruncateColocated`
* [ ] `NewYBPgsqlWriteOp`
* [x] `YBCPgDmlBindTable`
* [x] `PgApiImpl::DmlBindTable`
* [x] `PgDml::BindTable`
* [ ] `YBCPgDmlExecWriteOp`
* [ ] `PgApiImpl::DmlExecWriteOp`
* [ ] `PgDmlWrite::Exec`
* [ ] `PgDocOp::Execute`
* ...
* [ ] `TabletServiceImpl::Write`
* ...
* [ ] `PgsqlWriteOperation::Apply`
* [x] `PgsqlWriteOperation::ApplyTruncateColocated`
Unused functions:
* [x] `PgApiImpl::ExecTruncateColocated`
* [x] `PgsqlWriteRequestPB::PGSQL_TRUNCATE_COLOCATED`
* [x] `YBCPgExecTruncateColocated`
Style:
* Fix typo `s/contants/constants/` in `pggate.h` and `ybc_pggate.h`
* Fix typo in comments regarding `BindColumn`
* Remove unused function `YBPgsqlWriteOp::NewUpsert`
Legend:
* [x] Newly added
* [ ] Already existed
Test Plan:
* `./yb_build.sh --java-test org.yb.pgsql.TestPgRegressBetaFeatures`
Reviewers: neha
Reviewed By: neha
Subscribers: yql, bogdan
Differential Revision: https://phabricator.dev.yugabyte.com/D7800
TRUNCATE TABLE
on a colocated table truncates all tables in the colocated tablet. Prevent that from happening, even if it would mean that theTRUNCATE
doesn't really truncate the targeted table.This is step 1 of 4 for the data deletion of the drop flow, issue #3035.
The text was updated successfully, but these errors were encountered: