-
-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(tianmu):(Primary/Secondary)Error 1032 occasionally occurs during …
…primary/secondary synchronization if UUIDs are used as the primary key(#1464) Cause of the problem: When performing a primary key scan under the master slave, "ha_tianmu:: position()" is called first to obtain the primary key value from the "record", However, in this scenario, after calling the "key_copy()" function, the "record" will be cleared, resulting in the subsequent "GetKeys()" obtaining a null primary key value. Solution: Because the value "handler->ref" is not used in the future, you can simply delete the call to "key_copy()".
- Loading branch information
1 parent
ef58f6c
commit 05db04d
Showing
6 changed files
with
97 additions
and
13 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
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,51 @@ | ||
include/master-slave.inc | ||
[connection master] | ||
# on master: | ||
DROP DATABASE IF EXISTS issue1464_test; | ||
CREATE DATABASE issue1464_test; | ||
USE issue1464_test; | ||
include/sync_slave_sql_with_master.inc | ||
# on slave: | ||
USE issue1464_test; | ||
# on master: | ||
create table ttt(id varchar(64) primary key,name varchar(10))engine=innodb; | ||
insert into ttt values('0000352b6b4f4011bd18da7176e22c03','AAA'); | ||
insert into ttt values('000246c51ca745f893a705f1699e9b2a','BBB'); | ||
insert into ttt values('00049c87d9c64c498e004f6b08f1dd38','CCC'); | ||
delete from ttt where id='0000352b6b4f4011bd18da7176e22c03'; | ||
select * from ttt order by id; | ||
id name | ||
000246c51ca745f893a705f1699e9b2a BBB | ||
00049c87d9c64c498e004f6b08f1dd38 CCC | ||
include/sync_slave_sql_with_master.inc | ||
# on slave: | ||
show create table ttt; | ||
Table Create Table | ||
ttt CREATE TABLE `ttt` ( | ||
`id` varchar(64) NOT NULL, | ||
`name` varchar(10) DEFAULT NULL, | ||
PRIMARY KEY (`id`) | ||
) ENGINE=TIANMU DEFAULT CHARSET=latin1 | ||
select * from ttt order by id; | ||
id name | ||
000246c51ca745f893a705f1699e9b2a BBB | ||
00049c87d9c64c498e004f6b08f1dd38 CCC | ||
# on master: | ||
insert into ttt values('0000352b6b4f4011bd18da7176e22c03','AAA'); | ||
update ttt set name='name_' where id='000246c51ca745f893a705f1699e9b2a'; | ||
select * from ttt order by id; | ||
id name | ||
0000352b6b4f4011bd18da7176e22c03 AAA | ||
000246c51ca745f893a705f1699e9b2a name_ | ||
00049c87d9c64c498e004f6b08f1dd38 CCC | ||
include/sync_slave_sql_with_master.inc | ||
# on slave: | ||
select * from ttt order by id; | ||
id name | ||
0000352b6b4f4011bd18da7176e22c03 AAA | ||
000246c51ca745f893a705f1699e9b2a name_ | ||
00049c87d9c64c498e004f6b08f1dd38 CCC | ||
# on master: | ||
DROP DATABASE issue1464_test; | ||
include/sync_slave_sql_with_master.inc | ||
stop slave; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--tianmu_mandatory=ON | ||
--tianmu_no_key_error=ON |
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,44 @@ | ||
--source include/have_tianmu.inc | ||
--source include/have_binlog_format_row.inc | ||
--disable_warnings | ||
--source include/master-slave.inc | ||
--enable_warnings | ||
|
||
connection master; | ||
--echo # on master: | ||
--disable_warnings | ||
DROP DATABASE IF EXISTS issue1464_test; | ||
--enable_warnings | ||
CREATE DATABASE issue1464_test; | ||
USE issue1464_test; | ||
--source include/sync_slave_sql_with_master.inc | ||
--echo # on slave: | ||
USE issue1464_test; | ||
|
||
connection master; | ||
--echo # on master: | ||
create table ttt(id varchar(64) primary key,name varchar(10))engine=innodb; | ||
insert into ttt values('0000352b6b4f4011bd18da7176e22c03','AAA'); | ||
insert into ttt values('000246c51ca745f893a705f1699e9b2a','BBB'); | ||
insert into ttt values('00049c87d9c64c498e004f6b08f1dd38','CCC'); | ||
delete from ttt where id='0000352b6b4f4011bd18da7176e22c03'; | ||
select * from ttt order by id; | ||
--source include/sync_slave_sql_with_master.inc | ||
--echo # on slave: | ||
show create table ttt; | ||
select * from ttt order by id; | ||
|
||
connection master; | ||
--echo # on master: | ||
insert into ttt values('0000352b6b4f4011bd18da7176e22c03','AAA'); | ||
update ttt set name='name_' where id='000246c51ca745f893a705f1699e9b2a'; | ||
select * from ttt order by id; | ||
--source include/sync_slave_sql_with_master.inc | ||
--echo # on slave: | ||
select * from ttt order by id; | ||
|
||
connection master; | ||
--echo # on master: | ||
DROP DATABASE issue1464_test; | ||
--source include/sync_slave_sql_with_master.inc | ||
stop slave; |
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