Skip to content
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

*: support flashback dropped/truncated table #13109

Merged
merged 20 commits into from
Dec 3, 2019

Conversation

crazycs520
Copy link
Contributor

@crazycs520 crazycs520 commented Nov 4, 2019

What problem does this PR solve?

test> create table t (a int key,b int);
test> insert into t values (1,1);
test> truncate table t; -- truncate the table;
test> admin show ddl jobs 3; -- look for the start_time of the truncate job. 
+--------+---------+--------------------+----------------+--------------+-----------+----------+-----------+-----------------------------------+-----------------------------------+--------+
| JOB_ID | DB_NAME | TABLE_NAME         | JOB_TYPE       | SCHEMA_STATE | SCHEMA_ID | TABLE_ID | ROW_COUNT | START_TIME                        | END_TIME                          | STATE  |
+--------+---------+--------------------+----------------+--------------+-----------+----------+-----------+-----------------------------------+-----------------------------------+--------+
| 46     | test    | t                  | truncate table | public       | 1         | 43       | 0         | 2019-11-04 11:56:49.497 +0800 CST | 2019-11-04 11:56:49.598 +0800 CST | synced |
| 44     | test    | t                  | create table   | public       | 1         | 43       | 0         | 2019-11-04 11:56:11.647 +0800 CST | 2019-11-04 11:56:11.747 +0800 CST | synced |
| 42     | mysql   | opt_rule_blacklist | create table   | public       | 3         | 41       | 0         | 2019-11-04 11:48:04.137 +0800 CST | 2019-11-04 11:48:04.19 +0800 CST  | synced |
+--------+---------+--------------------+----------------+--------------+-----------+----------+-----------+-----------------------------------+-----------------------------------+--------+
test> select * from t;
+---+---+
| a | b |
+---+---+
test> flashback table t until timestamp '2019-11-04 11:56:49.497 +0800 CST' to t1;  
test> select * from t1;
+---+---+
| a | b |
+---+---+
| 1 | 1 |
+---+---+
test> insert into t1 values (2,2)
test> select * from t1;
+---+---+
| a | b |
+---+---+
| 1 | 1 |
| 2 | 2 |
+---+---+
test> select * from t;
+---+---+
| a | b |
+---+---+

What is changed and how it works?

Check List

Tests

  • Unit test

Code changes

  • Has exported function/method change

Side effects

Related changes

Release note

  • Support flashback dropped/truncated table.

@codecov
Copy link

codecov bot commented Nov 4, 2019

Codecov Report

Merging #13109 into master will not change coverage.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master     #13109   +/-   ##
===========================================
  Coverage   80.2158%   80.2158%           
===========================================
  Files           475        475           
  Lines        118029     118029           
===========================================
  Hits          94678      94678           
  Misses        15882      15882           
  Partials       7469       7469

executor/ddl.go Outdated Show resolved Hide resolved
executor/executor_test.go Outdated Show resolved Hide resolved
@djshow832
Copy link
Contributor

Why don't you use RECOVER TABLE t UNTIL TIMESTAMP ...? It can be compatible with RECOVER TALBE t and RECOVER TABLE BY ....

crazycs520 and others added 3 commits November 7, 2019 20:22
Co-Authored-By: djshow832 <873581766@qq.com>
Co-Authored-By: djshow832 <873581766@qq.com>
@crazycs520
Copy link
Contributor Author

@djshow832 flashback syntax is the PM demand.🙃

executor/ddl.go Outdated Show resolved Hide resolved
executor/ddl.go Show resolved Hide resolved
executor/ddl.go Show resolved Hide resolved
executor/ddl.go Show resolved Hide resolved
executor/ddl.go Outdated Show resolved Hide resolved
crazycs520 and others added 2 commits November 14, 2019 16:33
Co-Authored-By: Arenatlx <ailinsilence4@gmail.com>
Co-Authored-By: Arenatlx <ailinsilence4@gmail.com>
Copy link
Contributor

@djshow832 djshow832 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@djshow832 djshow832 added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 18, 2019
Copy link
Contributor

@AilinKid AilinKid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rest LGTM

ddl/db_change_test.go Outdated Show resolved Hide resolved
ddl/db_change_test.go Outdated Show resolved Hide resolved
executor/ddl.go Show resolved Hide resolved
executor/executor_test.go Outdated Show resolved Hide resolved
Copy link
Member

@bb7133 bb7133 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bb7133 bb7133 added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Dec 2, 2019
@crazycs520 crazycs520 requested a review from a team as a code owner December 3, 2019 06:40
@ghost ghost requested review from eurekaka and lzmhhh123 and removed request for a team December 3, 2019 06:41
@eurekaka eurekaka removed their request for review December 3, 2019 06:41
@pingcap pingcap deleted a comment from crazycs520 Dec 3, 2019
Copy link
Contributor

@AilinKid AilinKid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Need parser merged first.

@crazycs520
Copy link
Contributor Author

/run-all-tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants