-
Notifications
You must be signed in to change notification settings - Fork 409
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
ddl: Support FLASHBACK DATABASE
#8424
ddl: Support FLASHBACK DATABASE
#8424
Conversation
4b8bda6
to
21e59f2
Compare
FLASHBACK DATABASE
FLASHBACK DATABASE
/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.
Rewritten into flashback/flashback_database.test
/run-all-tests |
FLASHBACK DATABASE
FLASHBACK DATABASE
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.
Others LGTM
/run-all-tests |
/run-all-tests |
LOG_INFO(log, "Recover database begin, database_id={}", database_id); | ||
auto db_name = name_mapper.mapDatabaseName(database_id, keyspace_id); | ||
auto db = context.tryGetDatabase(db_name); | ||
if (unlikely(!db)) |
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.
If the db is not existed now, do we need to create the db and related tables based on it's db info?
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.
I'm a little worried about this scenario: the customer is stuck in the gc time to do the flash back, and tiflash may receive and process it later, which may be just longer than tiflash's local gc, so the db and tables still don't exist.
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 tombstone_ts for
IDatabase
andIStorage
are allocated by tiflash when it receives theDROP DATABASE
orDROP TABLE
DDL. So the tombstone_ts are usually sliently larger than the user actually executed those DROP statements. When a user executeFLASHBACK DATABASE
, thoseIDatabase
andIStorage
instance are possible not pass the gc safepoint. - If those
IStorage
andIDatabase
instance are actually get physically dropped in TiFlash instance, it is dangerous to "create" them when applying "FLASHBACK DATABASE". Because there are some rows is permanently deleted from tiflash instance. If we silently "create" them, it means the error is hard to find out but data inconsistency happens. An explicit error is better than implicit data loss.
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
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hongyunyan, Lloyd-Pottiger The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
@JaySon-Huang: Your PR was out of date, I have automatically updated it for you. At the same time I will also trigger all tests for you: /run-all-tests
If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
What problem does this PR solve?
Issue Number: close #8450
Problem Summary:
tidb support
FLASHBACK DATABASE DBName [TO newDBName]
since v6.4.0 https://docs.pingcap.com/tidb/stable/sql-statement-flashback-databaseAfter executing
FLASHBACK DATABASE ... TO ...
, the storage instances in TiFlash are not recovered as non tombstone. After the gc safepoint advanced, the storage instances will be physically drop.What is changed and how it works?
Recover all the tables on the database when
FLASHBACK DATABASE
is executed.Note that the implementation is different from that on release-7.1, release-6.5
Check List
Tests
Side effects
Documentation
Release note