Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
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
- Loading branch information