Skip to content

Define the placement of data by SQL statements #18030

Closed
pingcap/parser
#1334
@scsldb

Description

Description

TiDB supports placement rules, which can define the placement of data in a more flexible and more granular way. But it only provides configuration files to define them, and it’s complicated.

This issue tracks our progress in adding support via SQL.

The use cases for Placement Rules generally fit into two broad categories:

  1. Optimization (local stale reads) and High Availability
  2. Compliance / Geographical Restrictions

We are designing the syntax with both of these features in mind, but anticipate that initially use-case (1) will be better handled.

Sub Tasks

Named Placement Policy

(Previously: #26580 )

Support SHOW PLACEMENT

(Previously: #26582 )

Information_schema

Direct Placement Options / General Meta data

(Previously: #26581 )

table_option: {
..
 | FOLLOWERS [=] n
 | VOTERS [=] n
 | LEARNERS  [=] n
 | PRIMARY_REGION [=] "str"
 | REGIONS  [=] "str"
 | SCHEDULE [=] "str"
 | CONSTRAINTS  [=] "str"
 | FOLLOWER_CONSTRAINTS  [=] "str"
 | VOTER_CONSTRAINTS  [=] "str"
 | LEARNER_CONSTRAINTS  [=] "str"
 | PLACEMENT POLICY  [=] "str"
}

SHOW PLACEMENT LABELS

New Placement Rules Engine

(Previously: #27011 )

This is a sub-task of Placement Rules in SQL: #18030. Depends on #26580 and #26581. Once metadata has been finished, we need to add a new middle state to all related DDL jobs to sync rules to PD. Previous, we have already implemented similar code, so the work is more of a migration.

This requires the following subtasks:

Rule Removal

Others

Remove direct placement options

This is to track the changes required for #31423

Tools Behaviors

Future work

We will plan for future delivery:

Metadata

Assignees

No one assigned

    Labels

    feature/acceptedThis feature request is accepted by product managerstype/feature-requestCategorizes issue or PR as related to a new feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions