-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
MDEV-23077: --flashback + --table produces buggy results #3968
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
Open
ParadoxV5
wants to merge
2
commits into
10.11
Choose a base branch
from
mdev-23077
base: 10.11
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -364,13 +364,118 @@ FLUSH LOGS; | |
|
||
DROP TABLE t1; | ||
|
||
--echo # < CASE 8 > | ||
--echo # MDEV-23077: --flashback + --table produces buggy results | ||
--echo # | ||
|
||
CREATE TABLE t1 (i INT); | ||
INSERT INTO t1 VALUES (1), (-1); | ||
CREATE TABLE t2 (i INT); | ||
INSERT INTO t2 VALUES (1), (-2); | ||
|
||
RESET MASTER; | ||
BEGIN; | ||
UPDATE t1, t2 SET t1.i=2, t2.i=2 WHERE t1.i=t2.i AND t1.i=1; | ||
DELETE t1, t2 FROM t1 INNER JOIN t2 WHERE t1.i=2; | ||
COMMIT; | ||
FLUSH BINARY LOGS; | ||
|
||
# only (-1) | ||
SELECT * FROM t1; | ||
# empty | ||
SELECT * FROM t2; | ||
|
||
--echo # < CASE 8.1 > | ||
--echo # Only the table used in WHERE | ||
--echo # MDEV-23077 bug03: Only the first Base64 was in a BINLOG statement. | ||
--echo # | ||
|
||
--exec $MYSQL_BINLOG -Bvv --table=t1 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_8_1.sql | ||
--exec $MYSQL -e "SOURCE $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_8_1.sql;" | ||
|
||
# (1), (-1) | ||
SELECT * FROM t1; | ||
# still empty | ||
SELECT * FROM t2; | ||
|
||
--echo # < CASE 8.2 > | ||
--echo # Ignore the table used in WHERE | ||
--echo # MDEV-23077 bug02: Output includes extraneous "unknown table". | ||
--echo # | ||
|
||
--exec $MYSQL_BINLOG -Bvv --table=t2 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_8_2.sql | ||
--exec $MYSQL -e "SOURCE $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_8_2.sql;" | ||
|
||
# (1), (-1) | ||
SELECT * FROM t1; | ||
# (1), (-2) | ||
SELECT * FROM t2; | ||
|
||
--let SEARCH_FILE= $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_8_2.sql | ||
--let SEARCH_PATTERN= ### Row event for unknown table | ||
--source include/search_pattern_in_file.inc | ||
|
||
DROP TABLE t1; | ||
DROP TABLE t2; | ||
|
||
--echo # < CASE 9 > | ||
--echo # --flashback + --database | ||
--echo # | ||
ParadoxV5 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
CREATE DATABASE d1; | ||
CREATE DATABASE d2; | ||
CREATE TABLE d1.t (i INT); | ||
INSERT INTO d1.t VALUES (1), (-1); | ||
CREATE TABLE d2.t (i INT); | ||
INSERT INTO d2.t VALUES (1), (-2); | ||
|
||
RESET MASTER; | ||
BEGIN; | ||
UPDATE d1.t, d2.t SET d1.t.i=2, d2.t.i=2 WHERE d1.t.i=d2.t.i AND d1.t.i=1; | ||
DELETE d1.t, d2.t FROM d1.t INNER JOIN d2.t WHERE d1.t.i=2; | ||
COMMIT; | ||
FLUSH BINARY LOGS; | ||
|
||
--echo # < CASE 9.1 > | ||
--echo # Only the database used in WHERE | ||
--echo # MDEV-23077 bug03: Only the first Base64 was in a BINLOG statement. | ||
--echo # | ||
|
||
--exec $MYSQL_BINLOG -Bvv --database=d1 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_9_1.sql | ||
--exec $MYSQL -e "SOURCE $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_9_1.sql;" | ||
|
||
# (1), (-1) | ||
SELECT * FROM d1.t; | ||
# still empty | ||
SELECT * FROM d2.t; | ||
|
||
--echo # < CASE 9.2 > | ||
--echo # Ignore the database used in WHERE | ||
--echo # MDEV-23077 bug02: Output includes extraneous "unknown table". | ||
--echo # | ||
|
||
--exec $MYSQL_BINLOG -Bvv --database=d2 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_9_2.sql | ||
--exec $MYSQL -e "SOURCE $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_9_2.sql;" | ||
|
||
# (1), (-1) | ||
SELECT * FROM d1.t; | ||
# (1), (-2) | ||
SELECT * FROM d2.t; | ||
|
||
--let SEARCH_FILE= $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_9_2.sql | ||
--let SEARCH_PATTERN= ### Row event for unknown table | ||
--source include/search_pattern_in_file.inc | ||
|
||
DROP DATABASE d1; | ||
DROP DATABASE d2; | ||
|
||
--echo # | ||
--echo # MDEV-30698 Cover missing test cases for mariadb-binlog options | ||
--echo # --raw [and] --flashback | ||
--echo # | ||
|
||
--error 1 # --raw mode and --flashback mode are not allowed | ||
--exec $MYSQL_BINLOG -vv -B --raw --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000003> $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_8.sql | ||
--exec $MYSQL_BINLOG -vv -B --raw --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000003> $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_0.sql | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have a real Case 8 now. |
||
|
||
## Clear | ||
SET binlog_format=statement; | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
What #1674 did was copy-pasting the
else
branch of the nextif
to the previousif
tree as a new branch for(skip_event && opt_flashback && is_stmt_end)
.Here, I reimplement it by skipping this intermediate “step” (?) for that exact condition.
While the diff is now smaller, it has become proof that our code is 🍝.