mirror of
https://github.com/MariaDB/server.git
synced 2025-11-12 10:22:39 +03:00
Merge trift2.:/MySQL/M51/mysql-5.1
into trift2.:/MySQL/M51/push-5.1
This commit is contained in:
36
mysql-test/r/innodb-semi-consistent.result
Normal file
36
mysql-test/r/innodb-semi-consistent.result
Normal file
@@ -0,0 +1,36 @@
|
||||
set session transaction isolation level read committed;
|
||||
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
|
||||
insert into t1 values (1),(2),(3),(4),(5),(6),(7);
|
||||
set autocommit=0;
|
||||
select * from t1 where a=3 lock in share mode;
|
||||
a
|
||||
3
|
||||
set session transaction isolation level read committed;
|
||||
set autocommit=0;
|
||||
update t1 set a=10 where a=5;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
commit;
|
||||
update t1 set a=10 where a=5;
|
||||
select * from t1 where a=2 for update;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
select * from t1 where a=2 limit 1 for update;
|
||||
a
|
||||
2
|
||||
update t1 set a=11 where a=6;
|
||||
update t1 set a=12 where a=2;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
update t1 set a=13 where a=1;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
commit;
|
||||
update t1 set a=14 where a=1;
|
||||
commit;
|
||||
select * from t1;
|
||||
a
|
||||
14
|
||||
2
|
||||
3
|
||||
4
|
||||
10
|
||||
11
|
||||
7
|
||||
drop table t1;
|
||||
@@ -472,43 +472,6 @@ a b
|
||||
3 3
|
||||
drop table t1,t2;
|
||||
CREATE TABLE t1 (
|
||||
id int(11) NOT NULL auto_increment,
|
||||
ggid varchar(32) binary DEFAULT '' NOT NULL,
|
||||
email varchar(64) DEFAULT '' NOT NULL,
|
||||
passwd varchar(32) binary DEFAULT '' NOT NULL,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE ggid (ggid)
|
||||
) ENGINE=innodb;
|
||||
insert into t1 (ggid,passwd) values ('test1','xxx');
|
||||
insert into t1 (ggid,passwd) values ('test2','yyy');
|
||||
insert into t1 (ggid,passwd) values ('test2','this will fail');
|
||||
ERROR 23000: Duplicate entry 'test2' for key 'ggid'
|
||||
insert into t1 (ggid,id) values ('this will fail',1);
|
||||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
select * from t1 where ggid='test1';
|
||||
id ggid email passwd
|
||||
1 test1 xxx
|
||||
select * from t1 where passwd='xxx';
|
||||
id ggid email passwd
|
||||
1 test1 xxx
|
||||
select * from t1 where id=2;
|
||||
id ggid email passwd
|
||||
2 test2 yyy
|
||||
replace into t1 (ggid,id) values ('this will work',1);
|
||||
replace into t1 (ggid,passwd) values ('test2','this will work');
|
||||
update t1 set id=100,ggid='test2' where id=1;
|
||||
ERROR 23000: Duplicate entry 'test2' for key 'ggid'
|
||||
select * from t1;
|
||||
id ggid email passwd
|
||||
1 this will work
|
||||
4 test2 this will work
|
||||
select * from t1 where id=1;
|
||||
id ggid email passwd
|
||||
1 this will work
|
||||
select * from t1 where id=999;
|
||||
id ggid email passwd
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
user_name varchar(12),
|
||||
password text,
|
||||
subscribed char(1),
|
||||
@@ -1751,13 +1714,13 @@ Variable_name Value
|
||||
Innodb_page_size 16384
|
||||
show status like "Innodb_rows_deleted";
|
||||
Variable_name Value
|
||||
Innodb_rows_deleted 70
|
||||
Innodb_rows_deleted 69
|
||||
show status like "Innodb_rows_inserted";
|
||||
Variable_name Value
|
||||
Innodb_rows_inserted 1083
|
||||
Innodb_rows_inserted 1080
|
||||
show status like "Innodb_rows_updated";
|
||||
Variable_name Value
|
||||
Innodb_rows_updated 886
|
||||
Innodb_rows_updated 885
|
||||
show status like "Innodb_row_lock_waits";
|
||||
Variable_name Value
|
||||
Innodb_row_lock_waits 0
|
||||
@@ -3189,3 +3152,52 @@ c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255),
|
||||
c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255)
|
||||
) ENGINE = InnoDB;
|
||||
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
|
||||
DROP TABLE IF EXISTS t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
CREATE TABLE t1(
|
||||
id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY
|
||||
) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(-10);
|
||||
SELECT * FROM t1;
|
||||
id
|
||||
-10
|
||||
INSERT INTO t1 VALUES(NULL);
|
||||
SELECT * FROM t1;
|
||||
id
|
||||
-10
|
||||
1
|
||||
DROP TABLE t1;
|
||||
SET TX_ISOLATION='read-committed';
|
||||
SET AUTOCOMMIT=0;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
Note 1051 Unknown table 't2'
|
||||
CREATE TABLE t1 ( a int ) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
SELECT * FROM t2;
|
||||
a
|
||||
SET TX_ISOLATION='read-committed';
|
||||
SET AUTOCOMMIT=0;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
COMMIT;
|
||||
SELECT * FROM t1 WHERE a=1;
|
||||
a
|
||||
1
|
||||
SET TX_ISOLATION='read-committed';
|
||||
SET AUTOCOMMIT=0;
|
||||
SELECT * FROM t2;
|
||||
a
|
||||
SET TX_ISOLATION='read-committed';
|
||||
SET AUTOCOMMIT=0;
|
||||
INSERT INTO t1 VALUES (2);
|
||||
COMMIT;
|
||||
SELECT * FROM t1 WHERE a=2;
|
||||
a
|
||||
2
|
||||
SELECT * FROM t1 WHERE a=2;
|
||||
a
|
||||
2
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
|
||||
39
mysql-test/r/innodb_autoinc_lock_mode_zero.result
Normal file
39
mysql-test/r/innodb_autoinc_lock_mode_zero.result
Normal file
@@ -0,0 +1,39 @@
|
||||
drop table if exists t1;
|
||||
CREATE TABLE t1 (
|
||||
id int(11) NOT NULL auto_increment,
|
||||
ggid varchar(32) binary DEFAULT '' NOT NULL,
|
||||
email varchar(64) DEFAULT '' NOT NULL,
|
||||
passwd varchar(32) binary DEFAULT '' NOT NULL,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE ggid (ggid)
|
||||
) ENGINE=innodb;
|
||||
insert into t1 (ggid,passwd) values ('test1','xxx');
|
||||
insert into t1 (ggid,passwd) values ('test2','yyy');
|
||||
insert into t1 (ggid,passwd) values ('test2','this will fail');
|
||||
ERROR 23000: Duplicate entry 'test2' for key 'ggid'
|
||||
insert into t1 (ggid,id) values ('this will fail',1);
|
||||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
select * from t1 where ggid='test1';
|
||||
id ggid email passwd
|
||||
1 test1 xxx
|
||||
select * from t1 where passwd='xxx';
|
||||
id ggid email passwd
|
||||
1 test1 xxx
|
||||
select * from t1 where id=2;
|
||||
id ggid email passwd
|
||||
2 test2 yyy
|
||||
replace into t1 (ggid,id) values ('this will work',1);
|
||||
replace into t1 (ggid,passwd) values ('test2','this will work');
|
||||
update t1 set id=100,ggid='test2' where id=1;
|
||||
ERROR 23000: Duplicate entry 'test2' for key 'ggid'
|
||||
select * from t1;
|
||||
id ggid email passwd
|
||||
1 this will work
|
||||
3 test2 this will work
|
||||
select * from t1 where id=1;
|
||||
id ggid email passwd
|
||||
1 this will work
|
||||
select * from t1 where id=999;
|
||||
id ggid email passwd
|
||||
drop table t1;
|
||||
End of tests
|
||||
1
mysql-test/t/innodb-semi-consistent-master.opt
Normal file
1
mysql-test/t/innodb-semi-consistent-master.opt
Normal file
@@ -0,0 +1 @@
|
||||
--innodb_locks_unsafe_for_binlog=true --innodb_lock_wait_timeout=2
|
||||
46
mysql-test/t/innodb-semi-consistent.test
Normal file
46
mysql-test/t/innodb-semi-consistent.test
Normal file
@@ -0,0 +1,46 @@
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
# basic tests of semi-consistent reads
|
||||
|
||||
connect (a,localhost,root,,);
|
||||
connect (b,localhost,root,,);
|
||||
connection a;
|
||||
set session transaction isolation level read committed;
|
||||
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
|
||||
insert into t1 values (1),(2),(3),(4),(5),(6),(7);
|
||||
set autocommit=0;
|
||||
# this should lock the entire table
|
||||
select * from t1 where a=3 lock in share mode;
|
||||
connection b;
|
||||
set session transaction isolation level read committed;
|
||||
set autocommit=0;
|
||||
-- error ER_LOCK_WAIT_TIMEOUT
|
||||
update t1 set a=10 where a=5;
|
||||
connection a;
|
||||
commit;
|
||||
connection b;
|
||||
update t1 set a=10 where a=5;
|
||||
connection a;
|
||||
-- error ER_LOCK_WAIT_TIMEOUT
|
||||
select * from t1 where a=2 for update;
|
||||
# this should lock the records (1),(2)
|
||||
select * from t1 where a=2 limit 1 for update;
|
||||
connection b;
|
||||
update t1 set a=11 where a=6;
|
||||
-- error ER_LOCK_WAIT_TIMEOUT
|
||||
update t1 set a=12 where a=2;
|
||||
-- error ER_LOCK_WAIT_TIMEOUT
|
||||
update t1 set a=13 where a=1;
|
||||
connection a;
|
||||
commit;
|
||||
connection b;
|
||||
update t1 set a=14 where a=1;
|
||||
commit;
|
||||
connection a;
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
connection default;
|
||||
disconnect a;
|
||||
disconnect b;
|
||||
@@ -326,39 +326,6 @@ select * from t1;
|
||||
select * from t2;
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Search on unique key
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (
|
||||
id int(11) NOT NULL auto_increment,
|
||||
ggid varchar(32) binary DEFAULT '' NOT NULL,
|
||||
email varchar(64) DEFAULT '' NOT NULL,
|
||||
passwd varchar(32) binary DEFAULT '' NOT NULL,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE ggid (ggid)
|
||||
) ENGINE=innodb;
|
||||
|
||||
insert into t1 (ggid,passwd) values ('test1','xxx');
|
||||
insert into t1 (ggid,passwd) values ('test2','yyy');
|
||||
-- error ER_DUP_ENTRY
|
||||
insert into t1 (ggid,passwd) values ('test2','this will fail');
|
||||
-- error ER_DUP_ENTRY
|
||||
insert into t1 (ggid,id) values ('this will fail',1);
|
||||
|
||||
select * from t1 where ggid='test1';
|
||||
select * from t1 where passwd='xxx';
|
||||
select * from t1 where id=2;
|
||||
|
||||
replace into t1 (ggid,id) values ('this will work',1);
|
||||
replace into t1 (ggid,passwd) values ('test2','this will work');
|
||||
-- error ER_DUP_ENTRY
|
||||
update t1 set id=100,ggid='test2' where id=1;
|
||||
select * from t1;
|
||||
select * from t1 where id=1;
|
||||
select * from t1 where id=999;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# ORDER BY on not primary key
|
||||
#
|
||||
@@ -2323,6 +2290,67 @@ CREATE TABLE t1 (
|
||||
c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255)
|
||||
) ENGINE = InnoDB;
|
||||
|
||||
#
|
||||
# Bug #31860 InnoDB assumes AUTOINC values can only be positive.
|
||||
#
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1(
|
||||
id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY
|
||||
) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(-10);
|
||||
SELECT * FROM t1;
|
||||
#
|
||||
# NOTE: The server really needs to be restarted at this point
|
||||
# for the test to be useful.
|
||||
#
|
||||
# Without the fix InnoDB would trip over an assertion here.
|
||||
INSERT INTO t1 VALUES(NULL);
|
||||
# The next value should be 1 and not -9 or a -ve number
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #21409 Incorrect result returned when in READ-COMMITTED with
|
||||
# query_cache ON
|
||||
#
|
||||
CONNECT (c1,localhost,root,,);
|
||||
CONNECT (c2,localhost,root,,);
|
||||
CONNECTION c1;
|
||||
SET TX_ISOLATION='read-committed';
|
||||
SET AUTOCOMMIT=0;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
CREATE TABLE t1 ( a int ) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
SELECT * FROM t2;
|
||||
CONNECTION c2;
|
||||
SET TX_ISOLATION='read-committed';
|
||||
SET AUTOCOMMIT=0;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
COMMIT;
|
||||
CONNECTION c1;
|
||||
SELECT * FROM t1 WHERE a=1;
|
||||
DISCONNECT c1;
|
||||
DISCONNECT c2;
|
||||
CONNECT (c1,localhost,root,,);
|
||||
CONNECT (c2,localhost,root,,);
|
||||
CONNECTION c1;
|
||||
SET TX_ISOLATION='read-committed';
|
||||
SET AUTOCOMMIT=0;
|
||||
SELECT * FROM t2;
|
||||
CONNECTION c2;
|
||||
SET TX_ISOLATION='read-committed';
|
||||
SET AUTOCOMMIT=0;
|
||||
INSERT INTO t1 VALUES (2);
|
||||
COMMIT;
|
||||
CONNECTION c1;
|
||||
# The result set below should be the same for both selects
|
||||
SELECT * FROM t1 WHERE a=2;
|
||||
SELECT * FROM t1 WHERE a=2;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DISCONNECT c1;
|
||||
DISCONNECT c2;
|
||||
|
||||
#######################################################################
|
||||
# #
|
||||
# Please, DO NOT TOUCH this file as well as the innodb.result file. #
|
||||
|
||||
1
mysql-test/t/innodb_autoinc_lock_mode_zero-master.opt
Normal file
1
mysql-test/t/innodb_autoinc_lock_mode_zero-master.opt
Normal file
@@ -0,0 +1 @@
|
||||
--innodb-autoinc-lock-mode=0
|
||||
44
mysql-test/t/innodb_autoinc_lock_mode_zero.test
Normal file
44
mysql-test/t/innodb_autoinc_lock_mode_zero.test
Normal file
@@ -0,0 +1,44 @@
|
||||
# This test runs with old-style locking, as:
|
||||
# --innodb-autoinc-lock-mode=0
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
|
||||
#
|
||||
# Search on unique key
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (
|
||||
id int(11) NOT NULL auto_increment,
|
||||
ggid varchar(32) binary DEFAULT '' NOT NULL,
|
||||
email varchar(64) DEFAULT '' NOT NULL,
|
||||
passwd varchar(32) binary DEFAULT '' NOT NULL,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE ggid (ggid)
|
||||
) ENGINE=innodb;
|
||||
|
||||
insert into t1 (ggid,passwd) values ('test1','xxx');
|
||||
insert into t1 (ggid,passwd) values ('test2','yyy');
|
||||
-- error ER_DUP_ENTRY
|
||||
insert into t1 (ggid,passwd) values ('test2','this will fail');
|
||||
-- error ER_DUP_ENTRY
|
||||
insert into t1 (ggid,id) values ('this will fail',1);
|
||||
|
||||
select * from t1 where ggid='test1';
|
||||
select * from t1 where passwd='xxx';
|
||||
select * from t1 where id=2;
|
||||
|
||||
replace into t1 (ggid,id) values ('this will work',1);
|
||||
replace into t1 (ggid,passwd) values ('test2','this will work');
|
||||
-- error ER_DUP_ENTRY
|
||||
update t1 set id=100,ggid='test2' where id=1;
|
||||
select * from t1;
|
||||
select * from t1 where id=1;
|
||||
select * from t1 where id=999;
|
||||
drop table t1;
|
||||
|
||||
--echo End of tests
|
||||
@@ -155,13 +155,13 @@ set @@sql_mode='ansi,traditional';
|
||||
insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38');
|
||||
insert into t1 set dt='2007-03-23 13:49:38',da=dt;
|
||||
# Test error handling
|
||||
--error 1292
|
||||
--error ER_TRUNCATED_WRONG_VALUE
|
||||
insert into t1 values ('2007-03-32','2007-03-23 13:49:38');
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
--error 1067
|
||||
--error ER_INVALID_DEFAULT
|
||||
create table t1 (da date default '1962-03-32 23:33:34', dt datetime default '1962-03-03');
|
||||
--error 1067
|
||||
--error ER_INVALID_DEFAULT
|
||||
create table t1 (t time default '916:00:00 a');
|
||||
set @@sql_mode= @org_mode;
|
||||
|
||||
@@ -169,6 +169,19 @@ set @@sql_mode= @org_mode;
|
||||
#
|
||||
# Bug#27590: Wrong DATE/DATETIME comparison.
|
||||
#
|
||||
## The following sub test will fail (difference to expected result) if the
|
||||
## select curdate() < now(), f1 < now(), cast(f1 as date) < now() from t1;
|
||||
## runs exact at midnight ('00:00:00').
|
||||
## ( Bug#29290 type_datetime.test failure in 5.1 )
|
||||
## Therefore we sleep a bit if we are too close to midnight.
|
||||
## The complete test itself needs around 1 second.
|
||||
## Therefore a time_distance to midnight of 5 seconds should be sufficient.
|
||||
if (`SELECT CURTIME() > SEC_TO_TIME(24 * 3600 - 5)`)
|
||||
{
|
||||
# We are here when CURTIME() is between '23:59:56' and '23:59:59'.
|
||||
# So a sleep time of 5 seconds brings us between '00:00:01' and '00:00:04'.
|
||||
--real_sleep 5
|
||||
}
|
||||
create table t1 (f1 date, f2 datetime, f3 timestamp);
|
||||
insert into t1(f1) values(curdate());
|
||||
select curdate() < now(), f1 < now(), cast(f1 as date) < now() from t1;
|
||||
|
||||
Reference in New Issue
Block a user