-
Notifications
You must be signed in to change notification settings - Fork 990
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] Introduce RollbackToTimestamp Procedure and Action #4410
[core] Introduce RollbackToTimestamp Procedure and Action #4410
Conversation
-- for Flink 1.19 and later<br/> | ||
CALL sys.rollback_to(`table` => 'default.T', snapshot_id => 1730292023000) | ||
</td> | ||
</tr> |
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.
rollback_to -> rollback_to_timestamp
snapshot_id -> timestamp
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.
My mistake, Thanks! @LinMingQiang
* Rollback to timestamp procedure. Usage: | ||
* | ||
* <pre><code> | ||
* -- rollback to a snapshot |
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.
rollback to the snapshot which earlier or equal than timestamp.
String.format("count not find snapshot earlier than %s", timestamp)); | ||
fileStoreTable.rollbackTo(snapshot.id()); | ||
InternalRow outputRow = newInternalRow(true); | ||
return new InternalRow[] {outputRow}; |
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
snapshot, String.format("count not find snapshot earlier than %s", timestamp)); | ||
fileStoreTable.rollbackTo(snapshot.id()); | ||
|
||
return new String[] {"Success"}; |
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.
Show which snapshot id to roll back to
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.
Good reminder~
Preconditions.checkNotNull( | ||
snapshot, String.format("count not find snapshot earlier than %s", timestamp)); | ||
fileStoreTable.rollbackTo(snapshot.id()); | ||
return new String[] {"Success"}; |
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
|
||
public String[] call(ProcedureContext procedureContext, String tableId, long timestamp) | ||
throws Catalog.TableNotExistException { | ||
Table table = catalog.getTable(Identifier.fromString(tableId)); |
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.
check table not empty
@LinMingQiang had addressed, Thanks |
+1 |
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.
Thanks @xuzifu666 and @LinMingQiang
Purpose
Linked issue: close #xxx
Currently Rollback cannot rollback according timestamp which can make user more easy to rollback, as #4333 suggest introduce RollbackToTimestamp to support for procedure and action.
Tests
API and Format
Documentation