Commit 79d59cca authored by Sergey Petrunia's avatar Sergey Petrunia

Merge

parents 076eb7a6 ff37912f
......@@ -11,6 +11,11 @@
# $engine_type storage engine to be tested
#
# Last update:
# 2009-02-13 HH "Release_lock("hello")" is now also successful when delivering NULL,
# replaced two sleeps by wait_condition. The last two "sleep 1" have not been
# replaced as all tried wait conditions leaded to nondeterministic results, especially
# to succeeding concurrent updates. To replace the sleeps there should be some time
# planned (or internal knowledge of the server may help).
# 2006-08-02 ML test refactored
# old name was t/innodb_concurrent.test
# main code went into include/concurrent.inc
......@@ -21,7 +26,6 @@
#
connection default;
#
# Show prerequisites for this test.
#
......@@ -50,8 +54,6 @@ GRANT USAGE ON test.* TO mysqltest@localhost;
#
# Preparatory cleanup.
#
DO release_lock("hello");
DO release_lock("hello2");
--disable_warnings
drop table if exists t1;
--enable_warnings
......@@ -86,13 +88,14 @@ drop table if exists t1;
connection thread2;
--echo ** Start transaction for thread 2
begin;
--echo ** Update will cause a table scan and a new ULL will
--echo ** Update will cause a table scan and a new ULL will
--echo ** be created and blocked on the first row where tipo=11.
send update t1 set eta=1+get_lock("hello",10)*0 where tipo=11;
sleep 1;
--echo ** connection thread1
connection thread1;
let $wait_condition= select count(*)= 1 from information_schema.processlist where state= 'User lock';
--source include/wait_condition.inc
--echo ** Start new transaction for thread 1
begin;
--echo ** Update on t1 will cause a table scan which will be blocked because
......@@ -111,7 +114,9 @@ drop table if exists t1;
}
--echo ** Release user level name lock from thread 1. This will cause the ULL
--echo ** on thread 2 to end its wait.
select release_lock("hello");
# Due to Bug#32782 User lock hash fails to find lock, which probably also cause Bug#39484 (main.concurrent_innodb_safelog fails sporadically) the success of the following
# is also guaranteed for NULL. Replaced SELECT by DO (no result).
DO release_lock("hello");
--echo ** Table is now updated with a new eta on tipo=22 for thread 1.
select * from t1;
......@@ -119,7 +124,9 @@ drop table if exists t1;
connection thread2;
--echo ** Release the lock and collect result from update on thread 2
reap;
select release_lock("hello");
# Due to Bug#32782 User lock hash fails to find lock, which probably also cause Bug#39484 (main.concurrent_innodb_safelog fails sporadically) the success of the following
# is also guaranteed for NULL. Replaced SELECT by DO (no result).
DO release_lock("hello");
--echo ** Table should have eta updates where tipo=11 but updates made by
--echo ** thread 1 shouldn't be visible yet.
select * from t1;
......@@ -183,10 +190,11 @@ drop table t1;
--echo ** This will cause a hang on the first row where tipo=1 until the
--echo ** blocking ULL is released.
send update t1 set eta=1+get_lock("hello",10)*0 where tipo=1;
sleep 1;
--echo ** connection thread1
--echo ** connection thread1
connection thread1;
let $wait_condition= select count(*)= 1 from information_schema.processlist where state= 'User lock';
--source include/wait_condition.inc
--echo ** Start transaction on thread 1
begin;
--echo ** Update on t1 will cause a table scan which will be blocked because
......@@ -204,7 +212,9 @@ drop table t1;
update t1 set tipo=1 where tipo=2;
}
--echo ** Release ULL. This will release the next waiting ULL on thread 2.
select release_lock("hello");
# Due to Bug#32782 User lock hash fails to find lock, which probably also cause Bug#39484 (main.concurrent_innodb_safelog fails sporadically)the success of the following
# is also guaranteed for NULL. Replaced SELECT by DO (no result).
DO release_lock("hello");
--echo ** The table should still be updated with updates for thread 1 only:
select * from t1;
......@@ -212,7 +222,9 @@ drop table t1;
connection thread2;
--echo ** Release the lock and collect result from thread 2:
reap;
select release_lock("hello");
# Due to Bug#32782 User lock hash fails to find lock, which probably also cause Bug#39484 (main.concurrent_innodb_safelog fails sporadically) the success of the following
# is also guaranteed for NULL. Replaced SELECT by DO (no result).
DO release_lock("hello");
--echo ** Seen from thread 2 the table should have been updated on four
--echo ** places.
select * from t1;
......@@ -264,15 +276,18 @@ drop table t1;
--echo ** Update will create a table scan which creates a ULL where a=2;
--echo ** this will hang waiting on thread 1.
send update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2;
sleep 1;
--echo ** connection thread1
connection thread1;
let $wait_condition= select count(*)= 1 from information_schema.processlist where state= 'User lock';
--source include/wait_condition.inc
--echo ** Insert new values to t1 from thread 1; this created an implicit
--echo ** commit since there are no on-going transactions.
insert into t1 values (1,1);
--echo ** Release the ULL (thread 2 updates will finish).
select release_lock("hello2");
# Due to Bug#32782 User lock hash fails to find lock, which probably also cause Bug#39484 (main.concurrent_innodb_safelog fails sporadically) the success of the following
# is also guaranteed for NULL. Replaced SELECT by DO (no result).
DO release_lock("hello2");
--echo ** ..but thread 1 will still see t1 as if nothing has happend:
select * from t1;
......@@ -280,7 +295,9 @@ drop table t1;
connection thread2;
--echo ** Collect results from thread 2 and release the lock.
reap;
select release_lock("hello2");
# Due to Bug#32782 User lock hash fails to find lock, which probably also cause Bug#39484 (main.concurrent_innodb_safelog fails sporadically) the success of the following
# is also guaranteed for NULL. Replaced SELECT by DO (no result).
DO release_lock("hello2");
--echo ** The table should look like the original+updates for thread 2,
--echo ** and consist of new rows:
select * from t1;
......@@ -534,6 +551,9 @@ drop table t1;
connection thread2;
begin;
send delete from t1 where tipo=2;
# The sleep has not been replaced as all tried wait conditions leaded to sporadically
# succeding update in the following thread. Also the used status variables '%lock%' and
# 'innodb_deleted_rows' and infos in processlist where not sucessful.
sleep 1;
--echo ** connection thread1
......@@ -594,8 +614,11 @@ drop table t1;
connection thread2;
begin;
send delete from t1 where tipo=2;
# The sleep has not been replaced as all tried wait conditions leaded to sporadically
# succeding update in the following thread. Also the used status variables '%lock%' and
# 'innodb_deleted_rows' and infos in processlist where not sucessful.
sleep 1;
--echo ** connection thread1
connection thread1;
begin;
......
......@@ -12695,3 +12695,22 @@ a b
1 NULL
2 NULL
DROP TABLE t1;
#
# BUG#32880 - Repairing Archive table fails with internal error 144
#
# Test with an existing table which is corrupted
# Copy t1 from std_data
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` blob
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check error Corrupt
REPAIR TABLE t1;
Table Op Msg_type Msg_text
test.t1 repair error Corrupt
DROP TABLE t1;
......@@ -7,8 +7,6 @@ SELECT @@global.innodb_locks_unsafe_for_binlog;
0
# keep_locks == 1
GRANT USAGE ON test.* TO mysqltest@localhost;
DO release_lock("hello");
DO release_lock("hello2");
drop table if exists t1;
**
......@@ -36,7 +34,7 @@ get_lock("hello",10)
** connection thread2
** Start transaction for thread 2
begin;
** Update will cause a table scan and a new ULL will
** Update will cause a table scan and a new ULL will
** be created and blocked on the first row where tipo=11.
update t1 set eta=1+get_lock("hello",10)*0 where tipo=11;
** connection thread1
......@@ -51,9 +49,7 @@ update t1 set eta=2 where tipo=22;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
** Release user level name lock from thread 1. This will cause the ULL
** on thread 2 to end its wait.
select release_lock("hello");
release_lock("hello")
1
DO release_lock("hello");
** Table is now updated with a new eta on tipo=22 for thread 1.
select * from t1;
eta tipo c
......@@ -70,9 +66,7 @@ eta tipo c
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
** Release the lock and collect result from update on thread 2
select release_lock("hello");
release_lock("hello")
1
DO release_lock("hello");
** Table should have eta updates where tipo=11 but updates made by
** thread 1 shouldn't be visible yet.
select * from t1;
......@@ -194,9 +188,7 @@ begin;
update t1 set tipo=1 where tipo=2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
** Release ULL. This will release the next waiting ULL on thread 2.
select release_lock("hello");
release_lock("hello")
1
DO release_lock("hello");
** The table should still be updated with updates for thread 1 only:
select * from t1;
eta tipo c
......@@ -213,9 +205,7 @@ eta tipo c
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
** Release the lock and collect result from thread 2:
select release_lock("hello");
release_lock("hello")
1
DO release_lock("hello");
** Seen from thread 2 the table should have been updated on four
** places.
select * from t1;
......@@ -319,9 +309,7 @@ update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2;
** commit since there are no on-going transactions.
insert into t1 values (1,1);
** Release the ULL (thread 2 updates will finish).
select release_lock("hello2");
release_lock("hello2")
1
DO release_lock("hello2");
** ..but thread 1 will still see t1 as if nothing has happend:
select * from t1;
a b
......@@ -332,9 +320,7 @@ a b
1 1
** connection thread2
** Collect results from thread 2 and release the lock.
select release_lock("hello2");
release_lock("hello2")
1
DO release_lock("hello2");
** The table should look like the original+updates for thread 2,
** and consist of new rows:
select * from t1;
......
......@@ -7,8 +7,6 @@ SELECT @@global.innodb_locks_unsafe_for_binlog;
1
# keep_locks == 0
GRANT USAGE ON test.* TO mysqltest@localhost;
DO release_lock("hello");
DO release_lock("hello2");
drop table if exists t1;
**
......@@ -36,7 +34,7 @@ get_lock("hello",10)
** connection thread2
** Start transaction for thread 2
begin;
** Update will cause a table scan and a new ULL will
** Update will cause a table scan and a new ULL will
** be created and blocked on the first row where tipo=11.
update t1 set eta=1+get_lock("hello",10)*0 where tipo=11;
** connection thread1
......@@ -50,9 +48,7 @@ begin;
update t1 set eta=2 where tipo=22;
** Release user level name lock from thread 1. This will cause the ULL
** on thread 2 to end its wait.
select release_lock("hello");
release_lock("hello")
1
DO release_lock("hello");
** Table is now updated with a new eta on tipo=22 for thread 1.
select * from t1;
eta tipo c
......@@ -69,9 +65,7 @@ eta tipo c
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
** Release the lock and collect result from update on thread 2
select release_lock("hello");
release_lock("hello")
1
DO release_lock("hello");
** Table should have eta updates where tipo=11 but updates made by
** thread 1 shouldn't be visible yet.
select * from t1;
......@@ -192,9 +186,7 @@ begin;
** do not match the WHERE condition are released.
update t1 set tipo=1 where tipo=2;
** Release ULL. This will release the next waiting ULL on thread 2.
select release_lock("hello");
release_lock("hello")
1
DO release_lock("hello");
** The table should still be updated with updates for thread 1 only:
select * from t1;
eta tipo c
......@@ -211,9 +203,7 @@ eta tipo c
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
** Release the lock and collect result from thread 2:
select release_lock("hello");
release_lock("hello")
1
DO release_lock("hello");
** Seen from thread 2 the table should have been updated on four
** places.
select * from t1;
......@@ -317,9 +307,7 @@ update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2;
** commit since there are no on-going transactions.
insert into t1 values (1,1);
** Release the ULL (thread 2 updates will finish).
select release_lock("hello2");
release_lock("hello2")
1
DO release_lock("hello2");
** ..but thread 1 will still see t1 as if nothing has happend:
select * from t1;
a b
......@@ -330,9 +318,7 @@ a b
1 1
** connection thread2
** Collect results from thread 2 and release the lock.
select release_lock("hello2");
release_lock("hello2")
1
DO release_lock("hello2");
** The table should look like the original+updates for thread 2,
** and consist of new rows:
select * from t1;
......
......@@ -1731,7 +1731,7 @@ t1 CREATE TABLE `t1` (
`HOST` varchar(64) NOT NULL DEFAULT '',
`DB` varchar(64) DEFAULT NULL,
`COMMAND` varchar(16) NOT NULL DEFAULT '',
`TIME` bigint(7) NOT NULL DEFAULT '0',
`TIME` int(7) NOT NULL DEFAULT '0',
`STATE` varchar(64) DEFAULT NULL,
`INFO` longtext
) ENGINE=MyISAM DEFAULT CHARSET=utf8
......@@ -1745,7 +1745,7 @@ t1 CREATE TEMPORARY TABLE `t1` (
`HOST` varchar(64) NOT NULL DEFAULT '',
`DB` varchar(64) DEFAULT NULL,
`COMMAND` varchar(16) NOT NULL DEFAULT '',
`TIME` bigint(7) NOT NULL DEFAULT '0',
`TIME` int(7) NOT NULL DEFAULT '0',
`STATE` varchar(64) DEFAULT NULL,
`INFO` longtext
) ENGINE=MyISAM DEFAULT CHARSET=utf8
......
......@@ -1720,4 +1720,9 @@ SELECT CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
CREATE_OPTIONS
KEY_BLOCK_SIZE=1
DROP TABLE t1;
SET TIMESTAMP=@@TIMESTAMP + 10000000;
SELECT 'OK' AS TEST_RESULT FROM INFORMATION_SCHEMA.PROCESSLIST WHERE time < 0;
TEST_RESULT
OK
SET TIMESTAMP=DEFAULT;
End of 5.1 tests.
......@@ -276,8 +276,6 @@ Variable_name Value
Key_blocks_unused KEY_BLOCKS_UNUSED
set global keycache2.key_buffer_size=0;
set global keycache3.key_buffer_size=100;
Warnings:
Warning 1292 Truncated incorrect key_buffer_size value: '100'
set global keycache3.key_buffer_size=0;
create table t1 (mytext text, FULLTEXT (mytext));
insert t1 values ('aaabbb');
......
......@@ -27,6 +27,7 @@ set @my_slow_launch_time =@@global.slow_launch_time;
set @my_storage_engine =@@global.storage_engine;
set @my_thread_cache_size =@@global.thread_cache_size;
set @my_max_allowed_packet =@@global.max_allowed_packet;
set @my_join_buffer_size =@@global.join_buffer_size;
set @`test`=1;
select @test, @`test`, @TEST, @`TEST`, @"teSt";
@test @`test` @TEST @`TEST` @"teSt"
......@@ -1018,6 +1019,11 @@ show variables like 'hostname';
Variable_name Value
hostname #
End of 5.0 tests
set join_buffer_size=1;
Warnings:
Warning 1292 Truncated incorrect join_buffer_size value: '1'
set @save_join_buffer_size=@@join_buffer_size;
set join_buffer_size=@save_join_buffer_size;
set global binlog_cache_size =@my_binlog_cache_size;
set global connect_timeout =@my_connect_timeout;
set global delayed_insert_timeout =@my_delayed_insert_timeout;
......@@ -1048,6 +1054,7 @@ set global slow_launch_time =@my_slow_launch_time;
set global storage_engine =@my_storage_engine;
set global thread_cache_size =@my_thread_cache_size;
set global max_allowed_packet =@my_max_allowed_packet;
set global join_buffer_size =@my_join_buffer_size;
show global variables where Variable_name='table_definition_cache' or
Variable_name='table_lock_wait_timeout';
Variable_name Value
......
......@@ -125,8 +125,9 @@ create table t6 engine=myisam as select * from t6_c;
create table t7 engine=myisam as select * from t7_c;
create table t8 engine=myisam as select * from t8_c;
create table t9 engine=myisam as select * from t9_c;
CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info
(id INT, backup_id INT) ENGINE = MEMORY;
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
select count(*) from t1;
......@@ -244,8 +245,9 @@ PARTITION BY LINEAR HASH (`relatta`)
PARTITIONS 4;
ALTER TABLE t7_c
PARTITION BY LINEAR KEY (`dardtestard`);
CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info
(id INT, backup_id INT) ENGINE = MEMORY;
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
select count(*) from t1;
......@@ -448,8 +450,9 @@ select * from t9_c) a;
count(*)
3
drop table t1_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info
(id INT, backup_id INT) ENGINE = MEMORY;
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
Create table test/def/t2_c failed: Translate frm error
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
......
......@@ -27,8 +27,9 @@ pk1 c2 c3 hex(c4)
3 Sweden 498 1
4 Sweden 497 1
5 Sweden 496 1
CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info
(id INT, backup_id INT) ENGINE = MEMORY;
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
DROP TABLE test.t1;
ALTER TABLESPACE table_space1
......@@ -91,8 +92,9 @@ LENGTH(data)
SELECT LENGTH(data) FROM test.t4 WHERE c1 = 2;
LENGTH(data)
16384
CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info
(id INT, backup_id INT) ENGINE = MEMORY;
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
DROP TABLE test.t1;
DROP TABLE test.t2;
......@@ -317,8 +319,9 @@ pk1 c2 c3 hex(c4)
248 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 4 1
247 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 6 1
246 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 8 1
CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info
(id INT, backup_id INT) ENGINE = MEMORY;
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
DROP TABLE test.t1;
DROP TABLE test.t2;
......
......@@ -27,8 +27,9 @@ pk1 c2 c3 hex(c4)
3 Sweden 498 1
4 Sweden 497 1
5 Sweden 496 1
CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info
(id INT, backup_id INT) ENGINE = MEMORY;
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
DROP TABLE test.t1;
ALTER TABLESPACE table_space1
......@@ -91,8 +92,9 @@ LENGTH(data)
SELECT LENGTH(data) FROM test.t4 WHERE c1 = 2;
LENGTH(data)
16384
CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info
(id INT, backup_id INT) ENGINE = MEMORY;
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
DROP TABLE test.t1;
DROP TABLE test.t2;
......@@ -317,8 +319,9 @@ pk1 c2 c3 hex(c4)
248 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 4 1
247 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 6 1
246 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 8 1
CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info
(id INT, backup_id INT) ENGINE = MEMORY;
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
DROP TABLE test.t1;
DROP TABLE test.t2;
......
......@@ -89,3 +89,81 @@ show grants for rpl_do_grant2@localhost;
ERROR 42000: There is no such grant defined for user 'rpl_do_grant2' on host 'localhost'
show grants for rpl_do_grant2@localhost;
ERROR 42000: There is no such grant defined for user 'rpl_do_grant2' on host 'localhost'
DROP DATABASE IF EXISTS bug42217_db;
CREATE DATABASE bug42217_db;
GRANT CREATE ROUTINE ON bug42217_db.* TO 'create_rout_db'@'localhost'
IDENTIFIED BY 'create_rout_db' WITH GRANT OPTION;
USE bug42217_db;
CREATE FUNCTION upgrade_del_func() RETURNS CHAR(30)
BEGIN
RETURN "INSIDE upgrade_del_func()";
END//
USE bug42217_db;
SELECT * FROM mysql.procs_priv;
Host Db User Routine_name Routine_type Grantor Proc_priv Timestamp
localhost bug42217_db create_rout_db upgrade_del_func FUNCTION create_rout_db@localhost Execute,Alter Routine #
SELECT upgrade_del_func();
upgrade_del_func()
INSIDE upgrade_del_func()
SELECT * FROM mysql.procs_priv;
Host Db User Routine_name Routine_type Grantor Proc_priv Timestamp
localhost bug42217_db create_rout_db upgrade_del_func FUNCTION create_rout_db@localhost Execute,Alter Routine #
SHOW GRANTS FOR 'create_rout_db'@'localhost';
Grants for create_rout_db@localhost
GRANT USAGE ON *.* TO 'create_rout_db'@'localhost' IDENTIFIED BY PASSWORD '*08792480350CBA057BDE781B9DF183B263934601'
GRANT CREATE ROUTINE ON `bug42217_db`.* TO 'create_rout_db'@'localhost' WITH GRANT OPTION
GRANT EXECUTE, ALTER ROUTINE ON FUNCTION `bug42217_db`.`upgrade_del_func` TO 'create_rout_db'@'localhost'
USE bug42217_db;
SHOW CREATE FUNCTION upgrade_del_func;
Function sql_mode Create Function character_set_client collation_connection Database Collation
upgrade_del_func CREATE DEFINER=`create_rout_db`@`localhost` FUNCTION `upgrade_del_func`() RETURNS char(30) CHARSET latin1
BEGIN
RETURN "INSIDE upgrade_del_func()";
END latin1 latin1_swedish_ci latin1_swedish_ci
SELECT upgrade_del_func();
upgrade_del_func()
INSIDE upgrade_del_func()
"Check whether the definer user will be able to execute the replicated routine on slave"
USE bug42217_db;
SHOW CREATE FUNCTION upgrade_del_func;
Function sql_mode Create Function character_set_client collation_connection Database Collation
upgrade_del_func CREATE DEFINER=`create_rout_db`@`localhost` FUNCTION `upgrade_del_func`() RETURNS char(30) CHARSET latin1
BEGIN
RETURN "INSIDE upgrade_del_func()";
END latin1 latin1_swedish_ci latin1_swedish_ci
SELECT upgrade_del_func();
upgrade_del_func()
INSIDE upgrade_del_func()
DELETE FROM mysql.procs_priv;
FLUSH PRIVILEGES;
USE bug42217_db;
"Can't execute the replicated routine on slave like before after procs privilege is deleted "
SELECT upgrade_del_func();
ERROR 42000: execute command denied to user 'create_rout_db'@'localhost' for routine 'bug42217_db.upgrade_del_func'
"Test the user who creates a function on master doesn't exist on slave."
"Hence SQL thread ACL_GLOBAL privilege jumps in and no mysql.procs_priv is inserted"
DROP USER 'create_rout_db'@'localhost';
CREATE FUNCTION upgrade_alter_func() RETURNS CHAR(30)
BEGIN
RETURN "INSIDE upgrade_alter_func()";
END//
SELECT upgrade_alter_func();
upgrade_alter_func()
INSIDE upgrade_alter_func()
SHOW CREATE FUNCTION upgrade_alter_func;
Function sql_mode Create Function character_set_client collation_connection Database Collation
upgrade_alter_func CREATE DEFINER=`create_rout_db`@`localhost` FUNCTION `upgrade_alter_func`() RETURNS char(30) CHARSET latin1
BEGIN
RETURN "INSIDE upgrade_alter_func()";
END latin1 latin1_swedish_ci latin1_swedish_ci
"Should no privilege record for upgrade_alter_func in mysql.procs_priv"
SELECT * FROM mysql.procs_priv;
Host Db User Routine_name Routine_type Grantor Proc_priv Timestamp
SELECT upgrade_alter_func();
ERROR HY000: The user specified as a definer ('create_rout_db'@'localhost') does not exist
USE bug42217_db;
DROP FUNCTION upgrade_del_func;
DROP FUNCTION upgrade_alter_func;
DROP DATABASE bug42217_db;
DROP USER 'create_rout_db'@'localhost';
"End of test"
......@@ -87,9 +87,7 @@ show binary logs;
Log_name File_size
master-bin.000002 #
master-bin.000003 #
select @time_for_purge:=DATE_ADD(UPDATE_TIME, INTERVAL 1 SECOND)
from information_schema.tables
where TABLE_SCHEMA="test" and TABLE_NAME="t2";
SELECT @time_for_purge:=DATE_ADD('tmpval', INTERVAL 1 SECOND);
purge master logs before (@time_for_purge);
show binary logs;
Log_name File_size
......
......@@ -112,3 +112,100 @@ show grants for rpl_do_grant2@localhost;
sync_slave_with_master;
--error 1141
show grants for rpl_do_grant2@localhost;
#####################################################
# Purpose
# Test whether mysql.procs_priv get replicated
# Related bugs:
# BUG42217 mysql.procs_priv does not get replicated
#####################################################
connection master;
--disable_warnings
DROP DATABASE IF EXISTS bug42217_db;
--enable_warnings
CREATE DATABASE bug42217_db;
GRANT CREATE ROUTINE ON bug42217_db.* TO 'create_rout_db'@'localhost'
IDENTIFIED BY 'create_rout_db' WITH GRANT OPTION;
connect (create_rout_db_master, localhost, create_rout_db, create_rout_db, bug42217_db,$MASTER_MYPORT,);
connect (create_rout_db_slave, localhost, create_rout_db, create_rout_db, bug42217_db, $SLAVE_MYPORT,);
connection create_rout_db_master;
USE bug42217_db;
DELIMITER //;
CREATE FUNCTION upgrade_del_func() RETURNS CHAR(30)
BEGIN
RETURN "INSIDE upgrade_del_func()";
END//
DELIMITER ;//
connection master;
USE bug42217_db;
--replace_column 8 #
SELECT * FROM mysql.procs_priv;
SELECT upgrade_del_func();
sync_slave_with_master;
--replace_column 8 #
SELECT * FROM mysql.procs_priv;
SHOW GRANTS FOR 'create_rout_db'@'localhost';
USE bug42217_db;
SHOW CREATE FUNCTION upgrade_del_func;
SELECT upgrade_del_func();
--echo "Check whether the definer user will be able to execute the replicated routine on slave"
connection create_rout_db_slave;
USE bug42217_db;
SHOW CREATE FUNCTION upgrade_del_func;
SELECT upgrade_del_func();
connection slave;
DELETE FROM mysql.procs_priv;
FLUSH PRIVILEGES;
USE bug42217_db;
--echo "Can't execute the replicated routine on slave like before after procs privilege is deleted "
--error 1370
SELECT upgrade_del_func();
--echo "Test the user who creates a function on master doesn't exist on slave."
--echo "Hence SQL thread ACL_GLOBAL privilege jumps in and no mysql.procs_priv is inserted"
DROP USER 'create_rout_db'@'localhost';
connection create_rout_db_master;
DELIMITER //;
CREATE FUNCTION upgrade_alter_func() RETURNS CHAR(30)
BEGIN
RETURN "INSIDE upgrade_alter_func()";
END//
DELIMITER ;//
connection master;
SELECT upgrade_alter_func();
sync_slave_with_master;
SHOW CREATE FUNCTION upgrade_alter_func;
--echo "Should no privilege record for upgrade_alter_func in mysql.procs_priv"
--replace_column 8 #
SELECT * FROM mysql.procs_priv;
--error 1449
SELECT upgrade_alter_func();
###### CLEAN UP SECTION ##############
disconnect create_rout_db_master;
disconnect create_rout_db_slave;
connection master;
USE bug42217_db;
DROP FUNCTION upgrade_del_func;
DROP FUNCTION upgrade_alter_func;
DROP DATABASE bug42217_db;
DROP USER 'create_rout_db'@'localhost';
--echo "End of test"
......@@ -112,14 +112,24 @@ source include/show_master_logs.inc;
purge binary logs to 'master-bin.000002';
source include/show_binary_logs.inc;
# Calculate time to use in "purge master logs before" by taking
# last modification time of t2 and adding 1 second
# This is donw in order to handle the case where file system
# time differs from mysqld's time
# Set the purge time 1 second after the last modify time of master-bin.000002.
perl;
open F, ">>".$ENV{'MYSQLTEST_VARDIR'}.'/tmp/rpl_rotate_logs.tmp' or die "Tmp file rpl_rotate_logs.tmp not found";
my $binlogpath = $ENV{'MYSQLTEST_VARDIR'}.'/mysqld.1/data/master-bin.000002';
my @array = stat($binlogpath);
my $filemodifytime = $array[9];
my @t = localtime $filemodifytime;
my $modifytime = sprintf "%04u-%02u-%02u %02u:%02u:%02u",$t[5]+1900,$t[4]+1,$t[3],$t[2],$t[1],$t[0];
printf F ("let \$tmpval = %s;",$modifytime);
close F;
EOF
--source $MYSQLTEST_VARDIR/tmp/rpl_rotate_logs.tmp
remove_file $MYSQLTEST_VARDIR/tmp/rpl_rotate_logs.tmp;
--disable_result_log
select @time_for_purge:=DATE_ADD(UPDATE_TIME, INTERVAL 1 SECOND)
from information_schema.tables
where TABLE_SCHEMA="test" and TABLE_NAME="t2";
--replace_result $tmpval tmpval
--eval SELECT @time_for_purge:=DATE_ADD('$tmpval', INTERVAL 1 SECOND)
--enable_result_log
purge master logs before (@time_for_purge);
......
......@@ -25,8 +25,9 @@ hex(c2) hex(c3) c1
0 1 BCDEF
1 0 CD
0 0 DEFGHIJKL
CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info
(id INT, backup_id INT) ENGINE = MEMORY;
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
UPDATE t1 SET c2=0 WHERE c3="row2";
SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
......
......@@ -1599,3 +1599,18 @@ INSERT INTO t1 VALUES (NULL, NULL),(NULL, NULL);
FLUSH TABLE t1;
SELECT * FROM t1 ORDER BY a;
DROP TABLE t1;
--echo #
--echo # BUG#32880 - Repairing Archive table fails with internal error 144
--echo #
--echo
--echo # Test with an existing table which is corrupted
--echo # Copy t1 from std_data
let $MYSQLD_DATADIR= `select @@datadir`;
copy_file std_data/bug32880.frm $MYSQLD_DATADIR/test/t1.frm;
copy_file std_data/bug32880.ARZ $MYSQLD_DATADIR/test/t1.ARZ;
copy_file std_data/bug32880.ARN $MYSQLD_DATADIR/test/t1.ARN;
SHOW CREATE TABLE t1;
CHECK TABLE t1;
REPAIR TABLE t1;
DROP TABLE t1;
......@@ -1410,6 +1410,15 @@ CREATE TABLE t1(a INT) KEY_BLOCK_SIZE=1;
SELECT CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
DROP TABLE t1;
#
# Bug #22047: Time in SHOW PROCESSLIST for SQL thread in replication seems
# to become negative
#
SET TIMESTAMP=@@TIMESTAMP + 10000000;
SELECT 'OK' AS TEST_RESULT FROM INFORMATION_SCHEMA.PROCESSLIST WHERE time < 0;
SET TIMESTAMP=DEFAULT;
--echo End of 5.1 tests.
# Wait till all disconnects are completed
......
......@@ -36,6 +36,7 @@ set @my_slow_launch_time =@@global.slow_launch_time;
set @my_storage_engine =@@global.storage_engine;
set @my_thread_cache_size =@@global.thread_cache_size;
set @my_max_allowed_packet =@@global.max_allowed_packet;
set @my_join_buffer_size =@@global.join_buffer_size;
# case insensitivity tests (new in 5.0)
set @`test`=1;
select @test, @`test`, @TEST, @`TEST`, @"teSt";
......@@ -780,6 +781,18 @@ show variables like 'hostname';
--echo End of 5.0 tests
#
# Bug#36446: Attempt to set @@join_buffer_size to its minimum value
# produces spurious warning
#
# set to 1 so mysqld will correct to minimum (+ warn)
set join_buffer_size=1;
# save minimum
set @save_join_buffer_size=@@join_buffer_size;
# set minimum
set join_buffer_size=@save_join_buffer_size;
# This is at the very after the versioned tests, since it involves doing
# cleanup
#
......@@ -816,6 +829,8 @@ set global slow_launch_time =@my_slow_launch_time;
set global storage_engine =@my_storage_engine;
set global thread_cache_size =@my_thread_cache_size;
set global max_allowed_packet =@my_max_allowed_packet;
set global join_buffer_size =@my_join_buffer_size;
#
# Bug#28580 Repeatation of status variables
#
......
......@@ -846,7 +846,8 @@ longlong getopt_ll_limit_value(longlong num, const struct my_option *optp,
if (num < optp->min_value)
{
num= optp->min_value;
adjusted= TRUE;
if (old < optp->min_value)
adjusted= TRUE;
}
if (fix)
......@@ -917,7 +918,8 @@ ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp,
if (num < (ulonglong) optp->min_value)
{
num= (ulonglong) optp->min_value;
adjusted= TRUE;
if (old < (ulonglong) optp->min_value)
adjusted= TRUE;
}
if (fix)
......
......@@ -4129,9 +4129,32 @@ end_with_restore_list:
res= (sp_result= lex->sphead->create(thd));
switch (sp_result) {
case SP_OK:
case SP_OK: {
#ifndef NO_EMBEDDED_ACCESS_CHECKS
/* only add privileges if really neccessary */
Security_context security_context;
bool restore_backup_context= false;
Security_context *backup= NULL;
LEX_USER *definer= thd->lex->definer;
/*
Check if the definer exists on slave,
then use definer privilege to insert routine privileges to mysql.procs_priv.
For current user of SQL thread has GLOBAL_ACL privilege,
which doesn't any check routine privileges,
so no routine privilege record will insert into mysql.procs_priv.
*/
if (thd->slave_thread && is_acl_user(definer->host.str, definer->user.str))
{
security_context.change_security_context(thd,
&thd->lex->definer->user,
&thd->lex->definer->host,
&thd->lex->sphead->m_db,
&backup);
restore_backup_context= true;
}
if (sp_automatic_privileges && !opt_noacl &&
check_routine_access(thd, DEFAULT_CREATE_PROC_ACLS,
lex->sphead->m_db.str, name,
......@@ -4143,8 +4166,19 @@ end_with_restore_list:
ER_PROC_AUTO_GRANT_FAIL,
ER(ER_PROC_AUTO_GRANT_FAIL));
}
/*
Restore current user with GLOBAL_ACL privilege of SQL thread
*/
if (restore_backup_context)
{
DBUG_ASSERT(thd->slave_thread == 1);
thd->security_ctx->restore_security_context(thd, backup);
}
#endif
break;
}
case SP_WRITE_ROW_FAILED:
my_error(ER_SP_ALREADY_EXISTS, MYF(0), SP_TYPE_STRING(lex), name);
break;
......
......@@ -7643,10 +7643,12 @@ static COND *build_equal_items_for_cond(THD *thd, COND *cond,
/*
Check if we eliminated all the predicates of the level, e.g.
(a=a AND b=b AND a=a)
(a=a AND b=b AND a=a).
*/
if (!(args->elements + cond_equal.current_level.elements + eq_list.elements))
return new Item_int((longlong) 1,1);
if (!args->elements &&
!cond_equal.current_level.elements &&
!eq_list.elements)
return new Item_int((longlong) 1, 1);
List_iterator_fast<Item_equal> it(cond_equal.current_level);
while ((item_equal= it++))
......
......@@ -1704,7 +1704,8 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
field_list.push_back(field=new Item_empty_string("db",NAME_CHAR_LEN));
field->maybe_null=1;
field_list.push_back(new Item_empty_string("Command",16));
field_list.push_back(new Item_return_int("Time",7, MYSQL_TYPE_LONG));
field_list.push_back(field= new Item_return_int("Time",7, MYSQL_TYPE_LONG));
field->unsigned_flag= 0;
field_list.push_back(field=new Item_empty_string("State",30));
field->maybe_null=1;
field_list.push_back(field=new Item_empty_string("Info",max_query_length));
......@@ -1797,7 +1798,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
else
protocol->store(command_name[thd_info->command].str, system_charset_info);
if (thd_info->start_time)
protocol->store((uint32) (now - thd_info->start_time));
protocol->store_long ((longlong) (now - thd_info->start_time));
else
protocol->store_null();
protocol->store(thd_info->state_info, system_charset_info);
......@@ -1872,8 +1873,8 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
table->field[4]->store(command_name[tmp->command].str,
command_name[tmp->command].length, cs);
/* MYSQL_TIME */
table->field[5]->store((uint32)(tmp->start_time ?
now - tmp->start_time : 0), TRUE);
table->field[5]->store((longlong)(tmp->start_time ?
now - tmp->start_time : 0), FALSE);
/* STATE */
#ifndef EMBEDDED_LIBRARY
val= (char*) (tmp->locked ? "Locked" :
......@@ -6558,7 +6559,7 @@ ST_FIELD_INFO processlist_fields_info[]=
SKIP_OPEN_TABLE},
{"DB", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, "Db", SKIP_OPEN_TABLE},
{"COMMAND", 16, MYSQL_TYPE_STRING, 0, 0, "Command", SKIP_OPEN_TABLE},
{"TIME", 7, MYSQL_TYPE_LONGLONG, 0, 0, "Time", SKIP_OPEN_TABLE},
{"TIME", 7, MYSQL_TYPE_LONG, 0, 0, "Time", SKIP_OPEN_TABLE},
{"STATE", 64, MYSQL_TYPE_STRING, 0, 1, "State", SKIP_OPEN_TABLE},
{"INFO", PROCESS_LIST_INFO_WIDTH, MYSQL_TYPE_STRING, 0, 1, "Info",
SKIP_OPEN_TABLE},
......
......@@ -1076,11 +1076,9 @@ int ha_archive::unpack_row(azio_stream *file_to_read, uchar *record)
read= azread(file_to_read, record_buffer->buffer, row_len, &error);
DBUG_ASSERT(row_len == read);
if (read != row_len || error)
{
DBUG_RETURN(-1);
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
}
/* Copy null bits */
......@@ -1257,7 +1255,7 @@ int ha_archive::repair(THD* thd, HA_CHECK_OPT* check_opt)
int rc= optimize(thd, check_opt);
if (rc)
DBUG_RETURN(HA_ERR_CRASHED_ON_REPAIR);
DBUG_RETURN(HA_ADMIN_CORRUPT);
share->crashed= FALSE;
DBUG_RETURN(0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment