-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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 PiTR feature #34409
br: support PiTR feature #34409
Conversation
* stream: initial commit of stream backup * br/stream: basic logic of stream backup metadata * br/stream: add prefix scanner * br/stream: use types from kv package * br/stream: unexport prefix scanner(remove it to utils package and export it in need) * br/stream: move kvproto to br-stream branch, added a playground * br/stream: added some new functions for playground * br/stream: added a builder for task * br/stream: remove playground, use math.MaxUInt64 * br: replace kvproto with br-stream * br/stream: update error code * br/stream: fix tests * br/stream: added copyright
* Add stream start/pause/resume/stop command Signed-off-by: joccau <zak.zhao@pingcap.com>
* Add stream start/pause/resume/stop command Signed-off-by: joccau <zak.zhao@pingcap.com> * Add build observe ranges Signed-off-by: joccau <zak.zhao@pingcap.com> * Compare startTS and endTS Signed-off-by: joccau <zak.zhao@pingcap.com> * test for stream task Signed-off-by: joccau <zak.zhao@pingcap.com> * test for stream task Signed-off-by: joccau <zak.zhao@pingcap.com> * Deal comments in pr Signed-off-by: joccau <zak.zhao@pingcap.com> * Add comment for function Signed-off-by: joccau <zak.zhao@pingcap.com> * modify comments Signed-off-by: joccau <zak.zhao@pingcap.com> * update building of key-range for tableID Signed-off-by: joccau <zak.zhao@pingcap.com> * resolve the check issue Signed-off-by: joccau <zak.zhao@pingcap.com> * Deal comments in pr Signed-off-by: joccau <zak.zhao@pingcap.com> * Debug stream log to test flow Signed-off-by: joccau <zak.zhao@pingcap.com> * Deal comments in PR Signed-off-by: joccau <zak.zhao@pingcap.com> * use + / rather join Signed-off-by: joccau <zak.zhao@pingcap.com> * maintain test case for backup stream Signed-off-by: joccau <zak.zhao@pingcap.com> Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
* Add stream start/pause/resume/stop command Signed-off-by: joccau <zak.zhao@pingcap.com>
* add restore command * coarse implement restore
* add restore_ts for apply * update kvproto
* fix file rewrite end key Signed-off-by: Yu Juncen <yujuncen@pingcap.com> * run go fmt Signed-off-by: Yu Juncen <yu745514916@live.com> * run go mod tidy Signed-off-by: Yu Juncen <yu745514916@live.com> Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
* br-stream: add region context in applyRequest
* add ObjPrefix to speed up walkDir in br-stream * add start/end key to filter unnecessay key
* Add code for stream restore metaKV Signed-off-by: joccau <zak.zhao@pingcap.com>
* add switch check before stream starts
* added truncate log Signed-off-by: Yu Juncen <yu745514916@live.com>
* observer all data in stream task Signed-off-by: joccau <zak.zhao@pingcap.com>
* support checkSum during restore dml kv-events. Signed-off-by: joccau <zak.zhao@pingcap.com> * update usage API Signed-off-by: joccau <zak.zhao@pingcap.com> * fix bug in stream start Signed-off-by: joccau <zak.zhao@pingcap.com> * maintain testcase Signed-off-by: joccau <zak.zhao@pingcap.com>
* restore full and stream by command "br stream restore" Signed-off-by: joccau <zak.zhao@pingcap.com>
* support task info Signed-off-by: Yu Juncen <yu745514916@live.com> * added QPS Signed-off-by: Yu Juncen <yu745514916@live.com> address comments Signed-off-by: Yu Juncen <yu745514916@live.com> * set the start ts as the default global checkpoint Signed-off-by: Yu Juncen <yu745514916@live.com>
commit 981c9c39f9b7fe4cbe6e6f3cbf2a0c57838c1224 Author: Yu Juncen <yu745514916@live.com> Date: Thu Mar 17 17:22:53 2022 +0800 fix tests Signed-off-by: Yu Juncen <yu745514916@live.com> commit b3bafa8f0f8fd1f243c990179cbbfe8ecf2fed7e Author: Yu Juncen <yu745514916@live.com> Date: Thu Mar 17 11:14:07 2022 +0800 retry if epoch not match during finding leader Signed-off-by: Yu Juncen <yu745514916@live.com> commit cf0bf4b0d61e163eb527db032dd880dbbabed809 Author: Yu Juncen <yu745514916@live.com> Date: Wed Mar 16 16:34:27 2022 +0800 fix import error ignored Signed-off-by: Yu Juncen <yu745514916@live.com> commit 0ae287d65465856b013680bc2183d60a08c6b37f Author: Yu Juncen <yu745514916@live.com> Date: Fri Mar 11 14:48:06 2022 +0800 fix typo Signed-off-by: Yu Juncen <yu745514916@live.com> commit 4eba96e5cc6110734233376b39216fbb66a88d8d Author: Yu Juncen <yu745514916@live.com> Date: Fri Mar 11 14:09:31 2022 +0800 run tests sequential Signed-off-by: Yu Juncen <yu745514916@live.com> commit 4b659359963c141ab405dca52f3607f10f2be6a2 Author: Yu Juncen <yu745514916@live.com> Date: Fri Mar 11 12:10:48 2022 +0800 update go.mod Signed-off-by: Yu Juncen <yu745514916@live.com> commit fc2d9290cd8d5782455565175c78edbfb43aac60 Author: Yu Juncen <yu745514916@live.com> Date: Fri Mar 11 11:53:43 2022 +0800 update kvproto Signed-off-by: Yu Juncen <yu745514916@live.com> commit 365975b6ef2341f4307ac39b43af9bdd037b74b4 Author: Yu Juncen <yujuncen@pingcap.com> Date: Thu Mar 10 20:33:10 2022 +0800 added test cases Signed-off-by: Yu Juncen <yujuncen@pingcap.com> commit 08502b5c0670989474b6de5239235dede72f581f Author: Yu Juncen <yujuncen@pingcap.com> Date: Wed Mar 9 18:23:58 2022 +0800 added some tools for retry Signed-off-by: Yu Juncen <yujuncen@pingcap.com> commit b8d518b69dd827680f074ec1899cadf1b00647d3 Merge: 5c329e46f ce0b12c Author: Yu Juncen <yujuncen@pingcap.com> Date: Wed Mar 9 16:06:36 2022 +0800 Merge branch 'br-stream' of https://github.com/pingcap/tidb into retry-apply Signed-off-by: Yu Juncen <yujuncen@pingcap.com> commit 5c329e46f70424c27df3862a407d4a9751af1824 Author: Yu Juncen <yujuncen@pingcap.com> Date: Wed Mar 9 15:55:09 2022 +0800 added retry Signed-off-by: Yu Juncen <yujuncen@pingcap.com> commit 044d804 Merge: 0451199 ebd27f8 Author: 3pointer <luancheng@pingcap.com> Date: Tue Mar 8 16:59:22 2022 +0800 Merge branch 'br-stream' into key_not_found commit 0451199 Author: 3pointer <luancheng@pingcap.com> Date: Tue Mar 8 16:47:47 2022 +0800 address comment commit b5470a9 Author: 3pointer <luancheng@pingcap.com> Date: Mon Mar 7 19:30:23 2022 +0800 fix check commit 00d49d8 Author: 3pointer <luancheng@pingcap.com> Date: Mon Mar 7 18:57:58 2022 +0800 format commit 232a646 Author: 3pointer <luancheng@pingcap.com> Date: Mon Mar 7 18:49:32 2022 +0800 update kvproto commit d46105e Author: 3pointer <luancheng@pingcap.com> Date: Fri Mar 4 12:28:58 2022 +0800 add start/end key to filter unnecessay key commit d61a01f Author: 3pointer <luancheng@pingcap.com> Date: Fri Mar 4 12:26:17 2022 +0800 add ObjPrefix to speed up walkDir in br-stream Signed-off-by: Yu Juncen <yu745514916@live.com>
…k here (#33725) * refactor the status command && print "no task" when no task here Signed-off-by: Yu Juncen <yujuncen@pingcap.com> * added some test cases Signed-off-by: Yu Juncen <yujuncen@pingcap.com> * added the status of backup task Signed-off-by: Yu Juncen <yujuncen@pingcap.com> * fix typo Signed-off-by: Yu Juncen <yujuncen@pingcap.com> * make write success always Signed-off-by: Yu Juncen <yujuncen@pingcap.com> * apply suggestions from comment Signed-off-by: Yu Juncen <yujuncen@pingcap.com>
* br: refine cmd stream restore to restore log
* support pause/resume stream task Signed-off-by: joccau <zak.zhao@pingcap.com>
Signed-off-by: Yu Juncen <yujuncen@pingcap.com>
* show errors Signed-off-by: Yu Juncen <yujuncen@pingcap.com> * fix remove last error Signed-off-by: Yu Juncen <yujuncen@pingcap.com> * ignore tiflash when getting status Signed-off-by: Yu Juncen <yujuncen@pingcap.com> * Update br/pkg/stream/stream_status.go Co-authored-by: 3pointer <qdlc2010@gmail.com> * fix build Signed-off-by: Yu Juncen <yujuncen@pingcap.com> Co-authored-by: 3pointer <qdlc2010@gmail.com>
* remove checkpointTs in pd when stop stream task Signed-off-by: joccau <zak.zhao@pingcap.com>
* br-stream: split put file and delete file in restore * br-stream: implement cleanup files
) * update command name Signed-off-by: joccau <zak.zhao@pingcap.com> * support restoring autoTable Signed-off-by: joccau <zak.zhao@pingcap.com> * report other tidb after update global schema version Signed-off-by: joccau <zak.zhao@pingcap.com> * support restoring sequence id Signed-off-by: joccau <zak.zhao@pingcap.com> * make fmt
Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/4dcbb0f8df492c6c6c80864c064d070d913d3ebb |
/component br |
Signed-off-by: joccau <zak.zhao@pingcap.com>
} | ||
|
||
// UpdateSchemaVersion updates schema version by transaction way. | ||
func (rc *Client) UpdateSchemaVersion(ctx context.Context) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not compatible with the concurrent DDL, we need to take care of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because PiTR is used in an empty cluster, the concurrent scenarios does not happen.
The PiTR is contains 2 parts:
- restore snapshot
- restore log
* rewrite db Signed-off-by: joccau <zak.zhao@pingcap.com> * rewrite table Signed-off-by: joccau <zak.zhao@pingcap.com> * restore log from start-ts to restore-ts Signed-off-by: joccau <zak.zhao@pingcap.com> * safe old schemas after restore log Signed-off-by: joccau <zak.zhao@pingcap.com> * batch put raw kv Signed-off-by: joccau <zak.zhao@pingcap.com> * remove useless function and set 64 to rawkv put batch count Signed-off-by: joccau <zak.zhao@pingcap.com> * rename backup-stream to log-backup Signed-off-by: joccau <zak.zhao@pingcap.com> * deal comments in PR Signed-off-by: joccau <zak.zhao@pingcap.com>
/run-integration-br-tests |
Signed-off-by: joccau <zak.zhao@pingcap.com>
/run-integration-br-test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given all commits LGTM, trivially(?) this PR LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* remove the duplicated meta key entry
Signed-off-by: joccau <zak.zhao@pingcap.com>
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 952ea7c
|
/run-all-tests |
1 similar comment
/run-all-tests |
/run-all-tests |
TiDB MergeCI notify
|
What problem does this PR solve?
Issue Number: ref #29501
Problem Summary:
What is changed and how it works?
The new feature: PiTR
br log start ...
br restore point ...
Relative design/tests
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.