forked from facebook/mysql-5.6
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add primary key information to table map log event
Summary: Add primary key information to table map log event. This is useful for incremental backup tool to fetch primary key of a table without querying the server. This is also useful for the backup tool in tracking primary key change due to schema changes. Preserves the order of primary key columns in table map log events. Bitmap used for storing primary key column index in table map log events doesn't preserve the order. While this is completely fine with mysql_backup tool which generates incremental logical dump files, this doesn't work when differentialbackup is used to merge dump files since the sorted order of rows in full logical dumps and in incremental logical dumps generated by mysql_backup are different. Test Plan: mtr test to print primary key fields using mysqlbinlog. Reviewers: steaphan, jtolmer Reviewed By: jtolmer
- Loading branch information
1 parent
0507fa2
commit e236984
Showing
5 changed files
with
160 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
34 changes: 34 additions & 0 deletions
34
mysql-test/suite/rpl/r/rpl_table_map_primary_fields.result
This file contains 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
include/master-slave.inc | ||
Warnings: | ||
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. | ||
Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. | ||
[connection master] | ||
set timestamp=1000000000; | ||
create table t1 (i1 int); | ||
insert into t1 values(1); | ||
drop table t1; | ||
create table t1 (i1 int, primary key(i1)); | ||
insert into t1 values(1); | ||
drop table t1; | ||
create table t1(i1 int, i2 int, i3 int, primary key(i1, i2, i3)); | ||
insert into t1 values(1, 1, 1); | ||
drop table t1; | ||
create table t1(i1 int, i2 int, i3 int, primary key(i3, i2, i1)); | ||
insert into t1 values(1, 1, 1); | ||
drop table t1; | ||
create table t1(i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8 int, i9 int, primary key(i4, i8, i9)); | ||
insert into t1 values(1, 1, 1, 1, 1, 1, 1, 1, 1); | ||
drop table t1; | ||
## Primary key fields of tables on master | ||
#Primary Key Fields: ` ` | ||
#Primary Key Fields: ` 0 ` | ||
#Primary Key Fields: ` 0 1 2 ` | ||
#Primary Key Fields: ` 2 1 0 ` | ||
#Primary Key Fields: ` 3 7 8 ` | ||
## Primary key fields of tables on slave | ||
#Primary Key Fields: ` ` | ||
#Primary Key Fields: ` 0 ` | ||
#Primary Key Fields: ` 0 1 2 ` | ||
#Primary Key Fields: ` 2 1 0 ` | ||
#Primary Key Fields: ` 3 7 8 ` | ||
include/rpl_end.inc |
This file contains 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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
source include/mysqlbinlog_have_debug.inc; | ||
source include/master-slave.inc; | ||
source include/have_binlog_format_row.inc; | ||
|
||
set timestamp=1000000000; | ||
connection master; | ||
create table t1 (i1 int); | ||
insert into t1 values(1); | ||
drop table t1; | ||
|
||
create table t1 (i1 int, primary key(i1)); | ||
insert into t1 values(1); | ||
drop table t1; | ||
|
||
create table t1(i1 int, i2 int, i3 int, primary key(i1, i2, i3)); | ||
insert into t1 values(1, 1, 1); | ||
drop table t1; | ||
|
||
create table t1(i1 int, i2 int, i3 int, primary key(i3, i2, i1)); | ||
insert into t1 values(1, 1, 1); | ||
drop table t1; | ||
|
||
create table t1(i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8 int, i9 int, primary key(i4, i8, i9)); | ||
insert into t1 values(1, 1, 1, 1, 1, 1, 1, 1, 1); | ||
drop table t1; | ||
|
||
# Verify a client can understand the primary key field indexes in the binary log. | ||
echo ## Primary key fields of tables on master; | ||
let $MYSQLD_DATADIR= `select @@datadir`; | ||
--exec $MYSQL_BINLOG -#d,print_primary_key_fields -v -v $MYSQLD_DATADIR/master-bin.000001 | grep 'Primary Key Fields' | ||
sync_slave_with_master; | ||
|
||
echo ## Primary key fields of tables on slave; | ||
let $SLAVE_DATADIR= `select @@datadir`; | ||
--exec $MYSQL_BINLOG -#d,print_primary_key_fields -v -v $SLAVE_DATADIR/slave-bin.000001 | grep 'Primary Key Fields' | ||
source include/rpl_end.inc; |
This file contains 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 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