-
Notifications
You must be signed in to change notification settings - Fork 101
lightning: support restore data into tables that contains data #784
Conversation
Need to update the |
8c03754
to
b2c981c
Compare
9dcb8a6
to
c500ab5
Compare
c500ab5
to
6d89f9d
Compare
/run-all-tests |
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
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.
rest LGTM
tests/lightning_incremental/run.sh
Outdated
for backend in importer local; do | ||
if [ "$backend" = 'local' ]; then | ||
check_cluster_version 4 0 0 'local backend' || continue | ||
fi |
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.
this check is useless
pkg/lightning/restore/restore.go
Outdated
Logger: log.L(), | ||
HideQueryLog: redact.NeedRedact(), | ||
} | ||
metaDBSQL := fmt.Sprintf("CREATE DATABASE IF NOT EXISTS `%s`", b.schema) |
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.
the b.schema
here and the two below should be identifier-escaped (foo`bar
→ `foo``bar`
)
pkg/lightning/restore/restore.go
Outdated
} | ||
|
||
// avoid override existing metadata if the meta is already inserted. | ||
stmt := fmt.Sprintf("DROP DATABASE %s;", m.schemaName) |
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.
(ditto)
pkg/lightning/restore/restore.go
Outdated
@@ -2733,3 +2933,789 @@ func (cr *chunkRestore) restore( | |||
return ctx.Err() | |||
} | |||
} | |||
|
|||
type metaMgrBuilder interface { |
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.
let's move these meta-manager stuff into its own .go
file to avoid further bloating the restore.go
file (it's over 3700 lines after this PR 😅)
/run-all-tests |
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: a352c3a
|
backup/checksum: add cluster index support for ranges (pingcap#1120) lightning/restore: support ingset multi ssts for same range (pingcap#1089) * ingest ssts for the same range in a batch * make ingest compatible with old tikv tests: add row count check for br clustered index tests (pingcap#1151) storage: mkdirAll for local storage even when SkipCheckPath is true (pingcap#1156) tests/br: fix bug in issue pingcap#1158 (pingcap#1160) tests/br/compatibility: fix failed for manifest unknown (pingcap#1161) *: upgrade go version from 1.13/1.15 to 1.16 (pingcap#1159) action trigger: fix compatibility trigger bug on push (pingcap#1170) address comment fix test address comment address comment fix build add ut for ignore columns go.mod: update tidb to the new version (pingcap#1153) lightning: support restore data into tables that contains data (pingcap#784) fix conflict after merge master
What problem does this PR solve?
What is changed and how it works?
mysql.brie_sub_tasks
in TiDB to store the meta data for each table restore task.show table next_row_id
for the auto_id allocator base value. This can avoid auto_id conflict with the existing data. If there are other task record for the same table in brie_sub_tasks, the rowid rang will be calculated based on the recored info.local checksum
info into the metatable, so the last only actually do the checksum can sum all the local checksum to get the right result.Alternatives:
mysql
db. We can create a temporary table like the checkpoints db on-demand and drop it after all lightning tasks are finished.admin
permisssion.pd
instead of in TiDB.Check List
Tests
Code changes
Side effects
Related changes
Release Note