# ==== Purpose ==== # # This file contains test cases to validate the behavior of mysqlbinlog # with the replication of GIPKs # # ==== Requirements ==== # # R1: if the info is present, mysqlbinlog shall print stating if table maps contain GIPKs or not # R2: Despite the value of binlog_row_metadata if a GIPK exists, full info on it is printed. # # ==== Implementation ==== # # 1. Check the output of mysqlbinlog when the input file is a log # from an old version server where GIPKs are not supported # No info about GIPK should be present # 2. Check the output of mysqlbinlog when the input files are logs # created in a server version that supports GIPKs # Info about GIPKs should be present # 3. Check a binlog file containing the 2 tables above, but now with --print-table-metadata # Even with binlog_row_metadata = minimal, data about the GIPK columns should be present # 4. Check an equivalent binlog file but generated with binlog_row_metadata = full # With --print-table-metadata the info should still be the same for GIPKs # 5. Cleanup # # ==== Related Worklog ==== # # WL#14639: Row-based replication between tables that differ in the existence of a generated invisible primary key # Bug#34668313: Fix rpl_gipk_cross_version_schema_changes & binlog_mysqlbinlog_source_gipk_info # -- source include/have_binlog_format_row.inc --echo --echo ################################################## --echo # 1. Check the output of mysqlbinlog when the input file is a log --echo # from an old version server where GIPKs are not supported --echo # No info about GIPK should be present # The following binlog file was generated with the data: # # CREATE TABLE t1 (c1 BIGINT, c2 TEXT); # INSERT INTO t1 VALUES (1,'1'); --let $input_binlog_file = $MYSQL_TEST_DIR/std_data/rpl_binlog_with_no_gipk_info.000001 --exec $MYSQL_BINLOG --force-if-open $input_binlog_file > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_no_gipk_info.output --let $assert_text= Check the output contains no information GIPK --let $assert_file = $MYSQLTEST_VARDIR/tmp/mysqlbinlog_no_gipk_info.output --let $assert_select = # has_generated_invisible_primary_key=0 --let $assert_count = 0 --source include/assert_grep.inc --let $assert_text= Check the output contains no information GIPK --let $assert_file = $MYSQLTEST_VARDIR/tmp/mysqlbinlog_no_gipk_info.output --let $assert_select = # has_generated_invisible_primary_key=1 --let $assert_count = 0 --source include/assert_grep.inc --echo --echo ################################################## --echo # 2. Check the output of mysqlbinlog when the input files are logs --echo # created in a server version that supports GIPKs --echo # Info about GIPKs should be present # The following binlog file was generated with the data: # # CREATE TABLE t1 (c1 BIGINT, c2 TEXT, PRIMARY KEY(c1)); # INSERT INTO t1 VALUES (1,'1'); # # binlog_row_metadata = MINIMAL --let $input_binlog_file = $MYSQL_TEST_DIR/std_data/rpl_binlog_with_gipk_info_no_gipk.000001 --exec $MYSQL_BINLOG --force-if-open $input_binlog_file > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_with_gipk_info.output --let $assert_text= Check the output contains information about t1 not containing a GIPK --let $assert_file = $MYSQLTEST_VARDIR/tmp/mysqlbinlog_with_gipk_info.output --let $assert_select = # has_generated_invisible_primary_key=0 --let $assert_count = 1 --source include/assert_grep.inc # The following binlog file was generated with the data: # # SET SESSION sql_generate_invisible_primary_key = ON; # CREATE TABLE t2(f1 INT, really_unique_column_name INT); # SET SESSION sql_generate_invisible_primary_key = OFF; # INSERT INTO t2 VALUES (1,'1'); # # binlog_row_metadata = MINIMAL --let $input_binlog_file = $MYSQL_TEST_DIR/std_data/rpl_binlog_with_gipk_info_with_gipk.000001 --exec $MYSQL_BINLOG --force-if-open $input_binlog_file > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_with_gipk_info.output --let $assert_text= Check the output contains information about t2 containing a GIPK --let $assert_file = $MYSQLTEST_VARDIR/tmp/mysqlbinlog_with_gipk_info.output --let $assert_select = # has_generated_invisible_primary_key=1 --let $assert_count = 1 --source include/assert_grep.inc --echo --echo ################################################## --echo # 3. Check a binlog file containing the 2 tables above, but now with --print-table-metadata --echo # Even with binlog_row_metadata = minimal, data about the GIPK columns should be present # The following binlog file was generated with the data: # # CREATE TABLE t1 (c1 BIGINT, c2 TEXT, PRIMARY KEY(c1)); # INSERT INTO t1 VALUES (1,'1'); # SET SESSION sql_generate_invisible_primary_key = ON; # CREATE TABLE t2(f1 INT, really_unique_column_name INT); # SET SESSION sql_generate_invisible_primary_key = OFF; # INSERT INTO t2 VALUES (1,'1'); # # binlog_row_metadata = MINIMAL --let $input_binlog_file = $MYSQL_TEST_DIR/std_data/rpl_binlog_with_gipk_info_minimal_metadata.000001 --exec $MYSQL_BINLOG --print-table-metadata --force-if-open $input_binlog_file > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_no_gipk_info.output --let $assert_text= Check the output contains complete info about the GIPK column on t2 --let $assert_file = $MYSQLTEST_VARDIR/tmp/mysqlbinlog_no_gipk_info.output --let $assert_select = # Columns\(`my_row_id` BIGINT UNSIGNED NOT NULL INVISIBLE AUTO_INCREMENT --let $assert_count = 1 --source include/assert_grep.inc --let $assert_text= Check the output contains info about the GIPK being a PK on t2 --let $assert_file = $MYSQLTEST_VARDIR/tmp/mysqlbinlog_no_gipk_info.output --let $assert_select = # Primary Key\(my_row_id\) --let $assert_count = 1 --source include/assert_grep.inc --let $assert_text= Info about the column really_unique_column_name on t2 is only mentioned once on CREATE --let $assert_file = $MYSQLTEST_VARDIR/tmp/mysqlbinlog_no_gipk_info.output --let $assert_select = really_unique_column_name --let $assert_count = 1 --source include/assert_grep.inc --let $assert_text= Check the output contains no info about c1 being a PK on t1 --let $assert_file = $MYSQLTEST_VARDIR/tmp/mysqlbinlog_no_gipk_info.output --let $assert_select = # Primary Key\(c1\) --let $assert_count = 0 --source include/assert_grep.inc --echo --echo ################################################## --echo # 4. Check an equivalent binlog file but generated with binlog_row_metadata = full --echo # With --print-table-metadata the info should still be the same for GIPKs # The following binlog file was generated with the data: # # CREATE TABLE t1 (c1 BIGINT, c2 TEXT, PRIMARY KEY(c1)); # INSERT INTO t1 VALUES (1,'1'); # SET SESSION sql_generate_invisible_primary_key = ON; # CREATE TABLE t2(f1 INT, really_unique_column_name INT); # SET SESSION sql_generate_invisible_primary_key = OFF; # INSERT INTO t2 VALUES (1,'1'); # # binlog_row_metadata = FULL --let $input_binlog_file = $MYSQL_TEST_DIR/std_data/rpl_binlog_with_gipk_info_full_metadata.000001 --exec $MYSQL_BINLOG --print-table-metadata --force-if-open $input_binlog_file > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_no_gipk_info.output --let $assert_text= Check the output contains complete info about the GIPK column on t2 --let $assert_file = $MYSQLTEST_VARDIR/tmp/mysqlbinlog_no_gipk_info.output --let $assert_select = # Columns\(`my_row_id` BIGINT UNSIGNED NOT NULL INVISIBLE AUTO_INCREMENT --let $assert_count = 1 --source include/assert_grep.inc --let $assert_text= Check the output contains info about the GIPK being a PK on t2 --let $assert_file = $MYSQLTEST_VARDIR/tmp/mysqlbinlog_no_gipk_info.output --let $assert_select = # Primary Key\(my_row_id\) --let $assert_count = 1 --source include/assert_grep.inc --let $assert_text= Info about the column really_unique_column_name on t2 is mentioned on CREATE and in the table map --let $assert_file = $MYSQLTEST_VARDIR/tmp/mysqlbinlog_no_gipk_info.output --let $assert_select = really_unique_column_name --let $assert_count = 2 --source include/assert_grep.inc --let $assert_text= Check the output contains info about c1 being a PK on t1 --let $assert_file = $MYSQLTEST_VARDIR/tmp/mysqlbinlog_no_gipk_info.output --let $assert_select = # Primary Key\(c1\) --let $assert_count = 1 --source include/assert_grep.inc --echo --echo ################################################## --echo # 5. Cleanup --remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_with_gipk_info.output --remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_no_gipk_info.output