Skip to content
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

fix(tianmu):(Primary/Secondary)Error 1032 occasionally occurs during … #1469

Merged
merged 1 commit into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions mysql-test/suite/tianmu/r/issue1325.result
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,4 @@ student_score CREATE TABLE `student_score` (
DROP DATABASE issue1325_test;
include/sync_slave_sql_with_master.inc
# on slave:
show databases;
Database
information_schema
cache
mtr
mysql
performance_schema
sys
sys_tianmu
test
tianmu_data
stop slave;
51 changes: 51 additions & 0 deletions mysql-test/suite/tianmu/r/issue1464.result
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;
1 change: 0 additions & 1 deletion mysql-test/suite/tianmu/t/issue1325.test
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,4 @@ DROP DATABASE issue1325_test;

--source include/sync_slave_sql_with_master.inc
--echo # on slave:
show databases;
stop slave;
2 changes: 2 additions & 0 deletions mysql-test/suite/tianmu/t/issue1464-slave.opt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--tianmu_mandatory=ON
--tianmu_no_key_error=ON
44 changes: 44 additions & 0 deletions mysql-test/suite/tianmu/t/issue1464.test
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;
1 change: 0 additions & 1 deletion storage/tianmu/handler/ha_tianmu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,6 @@ void ha_tianmu::position([[maybe_unused]] const uchar *record) {
if (table->in_use->slave_thread && table->s->primary_key != MAX_INDEXES) {
/* Copy primary key as the row reference */
KEY *key_info = table->key_info + table->s->primary_key;
key_copy(ref, (uchar *)record, key_info, key_info->key_length);
ref_length = key_info->key_length;
active_index = table->s->primary_key;
} else {
Expand Down