-
Notifications
You must be signed in to change notification settings - Fork 949
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
[core] Fast return if rollback verion equals lastest version #4467
Conversation
@@ -625,14 +630,19 @@ public void rollbackTo(String tagName) { | |||
checkArgument(tagManager.tagExists(tagName), "Rollback tag '%s' doesn't exist.", tagName); | |||
|
|||
Snapshot taggedSnapshot = tagManager.taggedSnapshot(tagName); | |||
SnapshotManager snapshotManager = snapshotManager(); |
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.
Add a blank line.
@@ -512,6 +512,11 @@ public void rollbackTo(long snapshotId) { | |||
"Rollback snapshot '%s' doesn't exist.", | |||
snapshotId); | |||
|
|||
// fast return | |||
if (new Long(snapshotId).equals(snapshotManager.latestSnapshotId())) { |
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 think new Long has a little strange.
Why not:
Long latestSnapshotId = snapshotManager.latestSnapshotId();
if (latestSnapshotId == null) {
exception or error log
}
if (taggedSnapshot.id() == latestSnapshotId) {
fast return
}
A question: |
In this case, the result is not what the user wants. But although there does not fast return, this case may also occur. For example, the rollback snapshot is 1 and the latest snapshot of table is also 1, before rollback ends the lastest snapshot of table changes to 2 or 3, the rollback logic gets the lastest shotshot is diffcult to keep always the newest, this will cause some new snapshots not to be processed. |
Hi @askwang , what is this PR aims to? just for performance? |
yes, juse fast return, no need to execute RollbackHelper#cleanLargerThan. |
Do we need to care about the speed of this operation? I think it should be very fast even no optimization. |
Purpose
If the rollback snapshot version is equal to the lastest snapshot version, we should fast return.
Tests
API and Format
Documentation