| 1 |
################################################################################ |
| 2 |
# WL#4618 RBR: extended table metadata in the binary log |
| 3 |
# |
| 4 |
# Below metadata is logged into Table_map_log_event |
| 5 |
# - signedness of numeric columns |
| 6 |
# - charsets of character columns |
| 7 |
# - column names |
| 8 |
# - set/enum character sets and string values |
| 9 |
# - primary key |
| 10 |
# |
| 11 |
# The first two are always logged. The others are controlled by system |
| 12 |
# variable --binlog-row-metadata |
| 13 |
# |
| 14 |
# The test will verify if the metadata can be logged and printed by mysqlbinlog |
| 15 |
# correctly. |
| 16 |
# mysqlbinlog --print-table-metadata will print the extra metadata |
| 17 |
################################################################################ |
| 18 |
--source include/have_debug.inc |
| 19 |
--source include/have_binlog_format_row.inc |
| 20 |
--source include/have_ucs2.inc |
| 21 |
--source include/test_db_charset_latin1.inc |
| 22 |
|
| 23 |
--let $MYSQLD_DATADIR= `select @@datadir` |
| 24 |
--let $binlog_file= $MYSQLD_DATADIR/master-bin.000001 |
| 25 |
|
| 26 |
RESET MASTER; |
| 27 |
--echo # |
| 28 |
--echo # Verify that SET string values and character sets can be printed correctly |
| 29 |
--echo # |
| 30 |
|
| 31 |
SET NAMES utf8; |
| 32 |
CREATE TABLE t1( |
| 33 |
c_set_1 SET("set1_v1_å", "set1_v2_ä", "set1_v3_ö"), |
| 34 |
c_set_2 SET("set2_v1_å", "set2_v2_ä", "set2_v3_ö") CHARACTER SET ucs2); |
| 35 |
|
| 36 |
SET GLOBAL binlog_row_metadata = MINIMAL; |
| 37 |
INSERT INTO t1 VALUES("set1_v1_å", "set2_v2_ä"); |
| 38 |
--source include/print_optional_metadata.inc |
| 39 |
|
| 40 |
RESET MASTER; |
| 41 |
SET GLOBAL binlog_row_metadata = FULL; |
| 42 |
INSERT INTO t1 VALUES("set1_v1_å", "set2_v2_ä"); |
| 43 |
--source include/print_optional_metadata.inc |
| 44 |
INSERT INTO t1 VALUES("set1_v3_ö", "set2_v3_ö"); |
| 45 |
INSERT INTO t1 VALUES("set1_v1_å", "set2_v1_å"); |
| 46 |
SELECT c_set_1, HEX(c_set_1) FROM t1; |
| 47 |
SELECT c_set_2, HEX(c_set_2) FROM t1; |
| 48 |
|
| 49 |
DROP TABLE t1; |
| 50 |
RESET MASTER; |
| 51 |
|
| 52 |
--echo # |
| 53 |
--echo # Verify that ENUM string values and character sets can be printed correctly |
| 54 |
--echo # |
| 55 |
|
| 56 |
CREATE TABLE t1( |
| 57 |
c_enum_1 ENUM("enum1_v1_å", "enum1_v2_ä", "enum1_v3_ö"), |
| 58 |
c_enum_2 ENUM("enum2_v1_å", "enum2_v2_ä", "enum2_v3_ö") CHARACTER SET ucs2); |
| 59 |
|
| 60 |
SET GLOBAL binlog_row_metadata = MINIMAL; |
| 61 |
INSERT INTO t1 VALUES("enum1_v1_å", "enum2_v2_ä"); |
| 62 |
--source include/print_optional_metadata.inc |
| 63 |
|
| 64 |
|
| 65 |
RESET MASTER; |
| 66 |
SET GLOBAL binlog_row_metadata = FULL; |
| 67 |
INSERT INTO t1 VALUES("enum1_v1_å", "enum2_v2_ä"); |
| 68 |
--source include/print_optional_metadata.inc |
| 69 |
INSERT INTO t1 VALUES("enum1_v3_ö", "enum2_v3_ö"); |
| 70 |
INSERT INTO t1 VALUES("enum1_v1_å", "enum2_v1_å"); |
| 71 |
SELECT c_enum_1, HEX(c_enum_1) FROM t1; |
| 72 |
SELECT c_enum_2, HEX(c_enum_2) FROM t1; |
| 73 |
|
| 74 |
DROP TABLE t1; |
| 75 |
RESET MASTER; |
| 76 |
|
| 77 |
SET GLOBAL binlog_row_metadata = NO_LOG; |
| 78 |
|
| 79 |
--source include/test_db_charset_restore.inc |