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

BR support for placement rules #32290

Closed
Tracked by #18030
morgo opened this issue Feb 12, 2022 · 5 comments · Fixed by #33007
Closed
Tracked by #18030

BR support for placement rules #32290

morgo opened this issue Feb 12, 2022 · 5 comments · Fixed by #33007
Assignees
Labels
type/feature-request Categorizes issue or PR as related to a new feature.

Comments

@morgo
Copy link
Contributor

morgo commented Feb 12, 2022

For BR, when creating a full backup placement rules (all placement policies, not just those in use) will be dumped. Upon a full restore of a backup, they will be restored.

On a partial restore (i.e. one table) they will not be restored, since the behavior around restoring the policy first is unclear.

@lcwangchao
Copy link
Collaborator

lcwangchao commented Mar 4, 2022

Details of the specification:

  • Backup TiDB placement Policies

    • When backing up the entire cluster (using br backup full), br will back up the tidb placement policies;
    • Otherwise, While backing up the specified database/table (using br backup db/table or table filter), placement policies are not backed up. Placement options in table/database will not be backed up too.
  • Restore TiDB placement Policies

    • If backup data contains placement policies data.
      • BR supports all restore policies when using br restore full;
      • While using br restore db/table or table filter, The policies associated with the restored table will be restored;
      • If the placement policy already exists in cluster, br restore just ignores the placement policy in backup data;
        if backup data doesn’t contain placement policies data, br restore will ignore the policy options in the create table statement automatically if it has these options.

If the user does not want to restore the placement policies, or ignore the wrong policies, or restore the data to an earlier version of TiDB (unsupported placement policy), BR provides an ignore option --with-tidb-placement-mode=strict/ignore, which corresponds to the TiDB system variable TIDB_PLACEMENT_MODE:

  • STRICT (default): br tries to restore the placement policies if the backup data contains them. BR restores all placement policies for br restore full, and only associated policies for br restore db/table and table filter. If the create table statement cannot be applied because of missing the required object(pollicy, label...), an error is reported by br restore.
  • IGNORE: BR ignores all placement policies and the options in the create table statement.

The option only can be used in br restore, it doesn't work for br backup.

@3pointer
Copy link
Contributor

3pointer commented Mar 9, 2022

To implement this. we need to do following things.

@lcwangchao
Copy link
Collaborator

@3pointer I think getPolicyInfos , createPolicysWithInfo , createPolicyWithInfo will be added to the ddl.DDL interface ? For getPolicyInfos , the package meta also provides a method meta.ListPolicies , can you use it instead

@3pointer
Copy link
Contributor

3pointer commented Mar 9, 2022

meta.ListPolicies is fine. we can use it.

@lcwangchao
Copy link
Collaborator

After discussion. We can only provide createPolicysWithInfo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature-request Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants