Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
438f2cff
Commit
438f2cff
authored
May 16, 2008
by
mats@mats-laptop.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes to make rpl_insert_id pass in 5.1-bugteam.
parent
87d7c13a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
44 deletions
+34
-44
mysql-test/extra/rpl_tests/rpl_insert_id.test
mysql-test/extra/rpl_tests/rpl_insert_id.test
+8
-7
mysql-test/suite/rpl/r/rpl_insert_id.result
mysql-test/suite/rpl/r/rpl_insert_id.result
+26
-26
mysql-test/suite/rpl/t/rpl_insert_id.test
mysql-test/suite/rpl/t/rpl_insert_id.test
+0
-11
No files found.
mysql-test/extra/rpl_tests/rpl_insert_id.test
View file @
438f2cff
...
@@ -18,13 +18,6 @@ use test;
...
@@ -18,13 +18,6 @@ use test;
drop
table
if
exists
t1
,
t2
,
t3
;
drop
table
if
exists
t1
,
t2
,
t3
;
--
enable_warnings
--
enable_warnings
# If concurrent inserts are on, it is not guaranteed that the rows
# inserted by INSERT are immediately accessible by SELECT in another
# thread. This would cause problems near the line 'connection master1'
# below. So we turn off concurrent inserts.
SET
@
old_concurrent_insert
=
@@
global
.
concurrent_insert
;
SET
@@
global
.
concurrent_insert
=
0
;
--
echo
#
--
echo
#
--
echo
# See if queries that use both auto_increment and LAST_INSERT_ID()
--
echo
# See if queries that use both auto_increment and LAST_INSERT_ID()
--
echo
# are replicated well
--
echo
# are replicated well
...
@@ -35,6 +28,14 @@ SET @@global.concurrent_insert= 0;
...
@@ -35,6 +28,14 @@ SET @@global.concurrent_insert= 0;
--
source
include
/
master
-
slave
.
inc
--
source
include
/
master
-
slave
.
inc
#should work for both SBR and RBR
#should work for both SBR and RBR
# If concurrent inserts are on, it is not guaranteed that the rows
# inserted by INSERT are immediately accessible by SELECT in another
# thread. This would cause problems near the line 'connection master1'
# below. So we turn off concurrent inserts.
connection
master
;
SET
@
old_concurrent_insert
=
@@
global
.
concurrent_insert
;
SET
@@
global
.
concurrent_insert
=
0
;
connection
master
;
connection
master
;
eval
create
table
t1
(
a
int
auto_increment
,
key
(
a
))
engine
=
$engine_type
;
eval
create
table
t1
(
a
int
auto_increment
,
key
(
a
))
engine
=
$engine_type
;
eval
create
table
t2
(
b
int
auto_increment
,
c
int
,
key
(
b
))
engine
=
$engine_type
;
eval
create
table
t2
(
b
int
auto_increment
,
c
int
,
key
(
b
))
engine
=
$engine_type
;
...
...
mysql-test/suite/rpl/r/rpl_insert_id.result
View file @
438f2cff
...
@@ -15,8 +15,10 @@ reset master;
...
@@ -15,8 +15,10 @@ reset master;
reset slave;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
start slave;
create table t1(a int auto_increment, key(a)) engine=innodb;
SET @old_concurrent_insert= @@global.concurrent_insert;
create table t2(b int auto_increment, c int, key(b)) engine=innodb;
SET @@global.concurrent_insert= 0;
create table t1(a int auto_increment, key(a)) engine=myisam;
create table t2(b int auto_increment, c int, key(b)) engine=myisam;
insert into t1 values (1),(2),(3);
insert into t1 values (1),(2),(3);
insert into t1 values (null);
insert into t1 values (null);
insert into t2 values (null,last_insert_id());
insert into t2 values (null,last_insert_id());
...
@@ -31,8 +33,8 @@ b c
...
@@ -31,8 +33,8 @@ b c
1 4
1 4
drop table t1;
drop table t1;
drop table t2;
drop table t2;
create table t1(a int auto_increment, key(a)) engine=
innodb
;
create table t1(a int auto_increment, key(a)) engine=
myisam
;
create table t2(b int auto_increment, c int, key(b), foreign key(b) references t1(a)) engine=
innodb
;
create table t2(b int auto_increment, c int, key(b), foreign key(b) references t1(a)) engine=
myisam
;
SET FOREIGN_KEY_CHECKS=0;
SET FOREIGN_KEY_CHECKS=0;
insert into t1 values (10);
insert into t1 values (10);
insert into t1 values (null),(null),(null);
insert into t1 values (null),(null),(null);
...
@@ -54,8 +56,8 @@ b c
...
@@ -54,8 +56,8 @@ b c
#
#
drop table t2;
drop table t2;
drop table t1;
drop table t1;
create table t1(a int auto_increment, key(a)) engine=
innodb
;
create table t1(a int auto_increment, key(a)) engine=
myisam
;
create table t2(b int auto_increment, c int, key(b)) engine=
innodb
;
create table t2(b int auto_increment, c int, key(b)) engine=
myisam
;
insert into t1 values (10);
insert into t1 values (10);
insert into t1 values (null),(null),(null);
insert into t1 values (null),(null),(null);
insert into t2 values (5,0);
insert into t2 values (5,0);
...
@@ -87,7 +89,7 @@ drop table t2;
...
@@ -87,7 +89,7 @@ drop table t2;
# FOREIGN_KEY_CHECKS
# FOREIGN_KEY_CHECKS
#
#
SET TIMESTAMP=1000000000;
SET TIMESTAMP=1000000000;
CREATE TABLE t1 ( a INT UNIQUE ) engine=
innodb
;
CREATE TABLE t1 ( a INT UNIQUE ) engine=
myisam
;
SET FOREIGN_KEY_CHECKS=0;
SET FOREIGN_KEY_CHECKS=0;
INSERT INTO t1 VALUES (1),(1);
INSERT INTO t1 VALUES (1),(1);
Got one of the listed errors
Got one of the listed errors
...
@@ -95,8 +97,8 @@ drop table t1;
...
@@ -95,8 +97,8 @@ drop table t1;
#
#
# Bug#14553: NULL in WHERE resets LAST_INSERT_ID
# Bug#14553: NULL in WHERE resets LAST_INSERT_ID
#
#
create table t1(a int auto_increment, key(a)) engine=
innodb
;
create table t1(a int auto_increment, key(a)) engine=
myisam
;
create table t2(a int) engine=
innodb
;
create table t2(a int) engine=
myisam
;
insert into t1 (a) values (null);
insert into t1 (a) values (null);
insert into t2 (a) select a from t1 where a is null;
insert into t2 (a) select a from t1 where a is null;
insert into t2 (a) select a from t1 where a is null;
insert into t2 (a) select a from t1 where a is null;
...
@@ -123,7 +125,7 @@ create table t1 (
...
@@ -123,7 +125,7 @@ create table t1 (
id int not null auto_increment,
id int not null auto_increment,
last_id int,
last_id int,
primary key (id)
primary key (id)
) engine=
innodb
;
) engine=
myisam
;
create function bug15728() returns int(11)
create function bug15728() returns int(11)
return last_insert_id();
return last_insert_id();
insert into t1 (last_id) values (0);
insert into t1 (last_id) values (0);
...
@@ -133,7 +135,7 @@ create table t2 (
...
@@ -133,7 +135,7 @@ create table t2 (
id int not null auto_increment,
id int not null auto_increment,
last_id int,
last_id int,
primary key (id)
primary key (id)
) engine=
innodb
;
) engine=
myisam
;
create function bug15728_insert() returns int(11) modifies sql data
create function bug15728_insert() returns int(11) modifies sql data
begin
begin
insert into t2 (last_id) values (bug15728());
insert into t2 (last_id) values (bug15728());
...
@@ -199,7 +201,7 @@ drop function bug15728_insert;
...
@@ -199,7 +201,7 @@ drop function bug15728_insert;
drop table t1,t2;
drop table t1,t2;
drop procedure foo;
drop procedure foo;
create table t1 (n int primary key auto_increment not null,
create table t1 (n int primary key auto_increment not null,
b int, unique(b)) engine=
innodb
;
b int, unique(b)) engine=
myisam
;
set sql_log_bin=0;
set sql_log_bin=0;
insert into t1 values(null,100);
insert into t1 values(null,100);
replace into t1 values(null,50),(null,100),(null,150);
replace into t1 values(null,50),(null,100),(null,150);
...
@@ -243,7 +245,7 @@ n b
...
@@ -243,7 +245,7 @@ n b
1001 600
1001 600
drop table t1;
drop table t1;
create table t1 (n int primary key auto_increment not null,
create table t1 (n int primary key auto_increment not null,
b int, unique(b)) engine=
innodb
;
b int, unique(b)) engine=
myisam
;
insert into t1 values(null,100);
insert into t1 values(null,100);
select * from t1 order by n;
select * from t1 order by n;
n b
n b
...
@@ -264,7 +266,7 @@ n b
...
@@ -264,7 +266,7 @@ n b
3 350
3 350
drop table t1;
drop table t1;
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b INT,
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b INT,
UNIQUE(b)) ENGINE=
innodb
;
UNIQUE(b)) ENGINE=
myisam
;
INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10;
INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10;
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t1 ORDER BY a;
a b
a b
...
@@ -282,12 +284,12 @@ field_2 varchar(255) NOT NULL,
...
@@ -282,12 +284,12 @@ field_2 varchar(255) NOT NULL,
field_3 varchar(255) NOT NULL,
field_3 varchar(255) NOT NULL,
PRIMARY KEY (id),
PRIMARY KEY (id),
UNIQUE KEY field_1 (field_1, field_2)
UNIQUE KEY field_1 (field_1, field_2)
) ENGINE=
innodb
;
) ENGINE=
myisam
;
CREATE TABLE t2 (
CREATE TABLE t2 (
field_a int(10) unsigned NOT NULL,
field_a int(10) unsigned NOT NULL,
field_b varchar(255) NOT NULL,
field_b varchar(255) NOT NULL,
field_c varchar(255) NOT NULL
field_c varchar(255) NOT NULL
) ENGINE=
innodb
;
) ENGINE=
myisam
;
INSERT INTO t2 (field_a, field_b, field_c) VALUES (1, 'a', '1a');
INSERT INTO t2 (field_a, field_b, field_c) VALUES (1, 'a', '1a');
INSERT INTO t2 (field_a, field_b, field_c) VALUES (2, 'b', '2b');
INSERT INTO t2 (field_a, field_b, field_c) VALUES (2, 'b', '2b');
INSERT INTO t2 (field_a, field_b, field_c) VALUES (3, 'c', '3c');
INSERT INTO t2 (field_a, field_b, field_c) VALUES (3, 'c', '3c');
...
@@ -330,12 +332,12 @@ CREATE TABLE t1 (
...
@@ -330,12 +332,12 @@ CREATE TABLE t1 (
id INT NOT NULL DEFAULT 0,
id INT NOT NULL DEFAULT 0,
last_id INT,
last_id INT,
PRIMARY KEY (id)
PRIMARY KEY (id)
) ENGINE=
innodb
;
) ENGINE=
myisam
;
CREATE TABLE t2 (
CREATE TABLE t2 (
id INT NOT NULL AUTO_INCREMENT,
id INT NOT NULL AUTO_INCREMENT,
last_id INT,
last_id INT,
PRIMARY KEY (id)
PRIMARY KEY (id)
) ENGINE=
innodb
;
) ENGINE=
myisam
;
CREATE PROCEDURE p1()
CREATE PROCEDURE p1()
BEGIN
BEGIN
INSERT INTO t2 (last_id) VALUES (LAST_INSERT_ID());
INSERT INTO t2 (last_id) VALUES (LAST_INSERT_ID());
...
@@ -364,8 +366,8 @@ DROP TABLE IF EXISTS t1, t2;
...
@@ -364,8 +366,8 @@ DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (
CREATE TABLE t1 (
i INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
i INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
j INT DEFAULT 0
j INT DEFAULT 0
) ENGINE=
innodb
;
) ENGINE=
myisam
;
CREATE TABLE t2 (i INT) ENGINE=
innodb
;
CREATE TABLE t2 (i INT) ENGINE=
myisam
;
CREATE PROCEDURE p1()
CREATE PROCEDURE p1()
BEGIN
BEGIN
INSERT INTO t1 (i) VALUES (NULL);
INSERT INTO t1 (i) VALUES (NULL);
...
@@ -401,13 +403,10 @@ INSERT INTO t1 VALUES (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID(5)),
...
@@ -401,13 +403,10 @@ INSERT INTO t1 VALUES (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID(5)),
INSERT INTO t1 VALUES (NULL, 0), (NULL, LAST_INSERT_ID());
INSERT INTO t1 VALUES (NULL, 0), (NULL, LAST_INSERT_ID());
UPDATE t1 SET j= -1 WHERE i IS NULL;
UPDATE t1 SET j= -1 WHERE i IS NULL;
INSERT INTO t1 (i) VALUES (NULL);
INSERT INTO t1 (i) VALUES (NULL);
SET @old_concurrent_insert= @@global.concurrent_insert;
SET @@global.concurrent_insert= 0;
INSERT INTO t1 (i) VALUES (NULL);
INSERT INTO t1 (i) VALUES (NULL);
SELECT f3();
SELECT f3();
f3()
f3()
0
0
SET @@global.concurrent_insert= @old_concurrent_insert;
SELECT * FROM t1 ORDER BY i;
SELECT * FROM t1 ORDER BY i;
i j
i j
1 -1
1 -1
...
@@ -478,9 +477,9 @@ create table t2 (
...
@@ -478,9 +477,9 @@ create table t2 (
id int not null auto_increment,
id int not null auto_increment,
last_id int,
last_id int,
primary key (id)
primary key (id)
) engine=
innodb
;
) engine=
myisam
;
truncate table t2;
truncate table t2;
create table t1 (id tinyint primary key) engine=
innodb
;
create table t1 (id tinyint primary key) engine=
myisam
;
create function insid() returns int
create function insid() returns int
begin
begin
insert into t2 (last_id) values (0);
insert into t2 (last_id) values (0);
...
@@ -516,7 +515,7 @@ drop table t1;
...
@@ -516,7 +515,7 @@ drop table t1;
drop function insid;
drop function insid;
truncate table t2;
truncate table t2;
create table t1 (n int primary key auto_increment not null,
create table t1 (n int primary key auto_increment not null,
b int, unique(b)) engine=
innodb
;
b int, unique(b)) engine=
myisam
;
create procedure foo()
create procedure foo()
begin
begin
insert into t1 values(null,10);
insert into t1 values(null,10);
...
@@ -539,3 +538,4 @@ id last_id
...
@@ -539,3 +538,4 @@ id last_id
1 3
1 3
drop table t1, t2;
drop table t1, t2;
drop procedure foo;
drop procedure foo;
SET @@global.concurrent_insert= @old_concurrent_insert;
mysql-test/suite/rpl/t/rpl_insert_id.test
deleted
100644 → 0
View file @
87d7c13a
#################################
# Wrapper for rpl_insert_id.test#
#################################
########################################################
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
# Added to skip if ndb is default #
########################################################
--
source
include
/
not_ndb_default
.
inc
--
source
include
/
have_innodb
.
inc
let
$engine_type
=
innodb
;
--
source
extra
/
rpl_tests
/
rpl_insert_id
.
test
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment