Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[colocation] Create table-level tombstones for data deletion #3358

Closed
jaki opened this issue Jan 15, 2020 · 0 comments
Closed

[colocation] Create table-level tombstones for data deletion #3358

jaki opened this issue Jan 15, 2020 · 0 comments
Assignees
Labels
area/ysql Yugabyte SQL (YSQL)
Projects

Comments

@jaki
Copy link
Contributor

jaki commented Jan 15, 2020

DROP TABLE and TRUNCATE TABLE on a colocated table should create a table-level tombstone of the following form:

KEY  : SubDocKey(DocKey(CoTableId=07400000-0000-0080-0030-000001400000, [], []), [])
VALUE: DEL

This is step 2 of 4 for the data deletion of the drop flow, issue #3035.

@jaki jaki added the area/ysql Yugabyte SQL (YSQL) label Jan 15, 2020
@jaki jaki self-assigned this Jan 15, 2020
@jaki jaki added this to To do in YSQL via automation Jan 15, 2020
jaki pushed a commit that referenced this issue Jan 22, 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
@jaki jaki closed this as completed Jan 22, 2020
YSQL automation moved this from To do to Done Jan 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL)
Projects
YSQL
  
Done
Development

No branches or pull requests

1 participant