Commit 224376a7 authored by Guangbao Ni's avatar Guangbao Ni

Auto-merge from 5.1-bugteam

parents 0ba1cc25 af53e585
...@@ -11,6 +11,11 @@ ...@@ -11,6 +11,11 @@
# $engine_type storage engine to be tested # $engine_type storage engine to be tested
# #
# Last update: # 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 # 2006-08-02 ML test refactored
# old name was t/innodb_concurrent.test # old name was t/innodb_concurrent.test
# main code went into include/concurrent.inc # main code went into include/concurrent.inc
...@@ -21,7 +26,6 @@ ...@@ -21,7 +26,6 @@
# #
connection default; connection default;
# #
# Show prerequisites for this test. # Show prerequisites for this test.
# #
...@@ -50,8 +54,6 @@ GRANT USAGE ON test.* TO mysqltest@localhost; ...@@ -50,8 +54,6 @@ GRANT USAGE ON test.* TO mysqltest@localhost;
# #
# Preparatory cleanup. # Preparatory cleanup.
# #
DO release_lock("hello");
DO release_lock("hello2");
--disable_warnings --disable_warnings
drop table if exists t1; drop table if exists t1;
--enable_warnings --enable_warnings
...@@ -89,10 +91,11 @@ drop table if exists t1; ...@@ -89,10 +91,11 @@ drop table if exists t1;
--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. --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; send update t1 set eta=1+get_lock("hello",10)*0 where tipo=11;
sleep 1;
--echo ** connection thread1 --echo ** connection thread1
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 --echo ** Start new transaction for thread 1
begin; begin;
--echo ** Update on t1 will cause a table scan which will be blocked because --echo ** Update on t1 will cause a table scan which will be blocked because
...@@ -111,7 +114,9 @@ drop table if exists t1; ...@@ -111,7 +114,9 @@ drop table if exists t1;
} }
--echo ** Release user level name lock from thread 1. This will cause the ULL --echo ** Release user level name lock from thread 1. This will cause the ULL
--echo ** on thread 2 to end its wait. --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. --echo ** Table is now updated with a new eta on tipo=22 for thread 1.
select * from t1; select * from t1;
...@@ -119,7 +124,9 @@ drop table if exists t1; ...@@ -119,7 +124,9 @@ drop table if exists t1;
connection thread2; connection thread2;
--echo ** Release the lock and collect result from update on thread 2 --echo ** Release the lock and collect result from update on thread 2
reap; 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 ** Table should have eta updates where tipo=11 but updates made by
--echo ** thread 1 shouldn't be visible yet. --echo ** thread 1 shouldn't be visible yet.
select * from t1; select * from t1;
...@@ -183,10 +190,11 @@ drop table t1; ...@@ -183,10 +190,11 @@ drop table t1;
--echo ** This will cause a hang on the first row where tipo=1 until the --echo ** This will cause a hang on the first row where tipo=1 until the
--echo ** blocking ULL is released. --echo ** blocking ULL is released.
send update t1 set eta=1+get_lock("hello",10)*0 where tipo=1; send update t1 set eta=1+get_lock("hello",10)*0 where tipo=1;
sleep 1;
--echo ** connection thread1 --echo ** connection thread1
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 --echo ** Start transaction on thread 1
begin; begin;
--echo ** Update on t1 will cause a table scan which will be blocked because --echo ** Update on t1 will cause a table scan which will be blocked because
...@@ -204,7 +212,9 @@ drop table t1; ...@@ -204,7 +212,9 @@ drop table t1;
update t1 set tipo=1 where tipo=2; update t1 set tipo=1 where tipo=2;
} }
--echo ** Release ULL. This will release the next waiting ULL on thread 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: --echo ** The table should still be updated with updates for thread 1 only:
select * from t1; select * from t1;
...@@ -212,7 +222,9 @@ drop table t1; ...@@ -212,7 +222,9 @@ drop table t1;
connection thread2; connection thread2;
--echo ** Release the lock and collect result from thread 2: --echo ** Release the lock and collect result from thread 2:
reap; 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 ** Seen from thread 2 the table should have been updated on four
--echo ** places. --echo ** places.
select * from t1; select * from t1;
...@@ -264,15 +276,18 @@ drop table t1; ...@@ -264,15 +276,18 @@ drop table t1;
--echo ** Update will create a table scan which creates a ULL where a=2; --echo ** Update will create a table scan which creates a ULL where a=2;
--echo ** this will hang waiting on thread 1. --echo ** this will hang waiting on thread 1.
send update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2; send update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2;
sleep 1;
--echo ** connection thread1 --echo ** connection thread1
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 ** Insert new values to t1 from thread 1; this created an implicit
--echo ** commit since there are no on-going transactions. --echo ** commit since there are no on-going transactions.
insert into t1 values (1,1); insert into t1 values (1,1);
--echo ** Release the ULL (thread 2 updates will finish). --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: --echo ** ..but thread 1 will still see t1 as if nothing has happend:
select * from t1; select * from t1;
...@@ -280,7 +295,9 @@ drop table t1; ...@@ -280,7 +295,9 @@ drop table t1;
connection thread2; connection thread2;
--echo ** Collect results from thread 2 and release the lock. --echo ** Collect results from thread 2 and release the lock.
reap; 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 ** The table should look like the original+updates for thread 2,
--echo ** and consist of new rows: --echo ** and consist of new rows:
select * from t1; select * from t1;
...@@ -534,6 +551,9 @@ drop table t1; ...@@ -534,6 +551,9 @@ drop table t1;
connection thread2; connection thread2;
begin; begin;
send delete from t1 where tipo=2; 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; sleep 1;
--echo ** connection thread1 --echo ** connection thread1
...@@ -594,6 +614,9 @@ drop table t1; ...@@ -594,6 +614,9 @@ drop table t1;
connection thread2; connection thread2;
begin; begin;
send delete from t1 where tipo=2; 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; sleep 1;
--echo ** connection thread1 --echo ** connection thread1
......
...@@ -7,8 +7,6 @@ SELECT @@global.innodb_locks_unsafe_for_binlog; ...@@ -7,8 +7,6 @@ SELECT @@global.innodb_locks_unsafe_for_binlog;
0 0
# keep_locks == 1 # keep_locks == 1
GRANT USAGE ON test.* TO mysqltest@localhost; GRANT USAGE ON test.* TO mysqltest@localhost;
DO release_lock("hello");
DO release_lock("hello2");
drop table if exists t1; drop table if exists t1;
** **
...@@ -51,9 +49,7 @@ update t1 set eta=2 where tipo=22; ...@@ -51,9 +49,7 @@ update t1 set eta=2 where tipo=22;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
** Release user level name lock from thread 1. This will cause the ULL ** Release user level name lock from thread 1. This will cause the ULL
** on thread 2 to end its wait. ** on thread 2 to end its wait.
select release_lock("hello"); DO release_lock("hello");
release_lock("hello")
1
** Table is now updated with a new eta on tipo=22 for thread 1. ** Table is now updated with a new eta on tipo=22 for thread 1.
select * from t1; select * from t1;
eta tipo c eta tipo c
...@@ -70,9 +66,7 @@ eta tipo c ...@@ -70,9 +66,7 @@ eta tipo c
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk 90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2 ** connection thread2
** Release the lock and collect result from update on thread 2 ** Release the lock and collect result from update on thread 2
select release_lock("hello"); DO release_lock("hello");
release_lock("hello")
1
** Table should have eta updates where tipo=11 but updates made by ** Table should have eta updates where tipo=11 but updates made by
** thread 1 shouldn't be visible yet. ** thread 1 shouldn't be visible yet.
select * from t1; select * from t1;
...@@ -194,9 +188,7 @@ begin; ...@@ -194,9 +188,7 @@ begin;
update t1 set tipo=1 where tipo=2; update t1 set tipo=1 where tipo=2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
** Release ULL. This will release the next waiting ULL on thread 2. ** Release ULL. This will release the next waiting ULL on thread 2.
select release_lock("hello"); DO release_lock("hello");
release_lock("hello")
1
** The table should still be updated with updates for thread 1 only: ** The table should still be updated with updates for thread 1 only:
select * from t1; select * from t1;
eta tipo c eta tipo c
...@@ -213,9 +205,7 @@ eta tipo c ...@@ -213,9 +205,7 @@ eta tipo c
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk 90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2 ** connection thread2
** Release the lock and collect result from thread 2: ** Release the lock and collect result from thread 2:
select release_lock("hello"); DO release_lock("hello");
release_lock("hello")
1
** Seen from thread 2 the table should have been updated on four ** Seen from thread 2 the table should have been updated on four
** places. ** places.
select * from t1; select * from t1;
...@@ -319,9 +309,7 @@ update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2; ...@@ -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. ** commit since there are no on-going transactions.
insert into t1 values (1,1); insert into t1 values (1,1);
** Release the ULL (thread 2 updates will finish). ** Release the ULL (thread 2 updates will finish).
select release_lock("hello2"); DO release_lock("hello2");
release_lock("hello2")
1
** ..but thread 1 will still see t1 as if nothing has happend: ** ..but thread 1 will still see t1 as if nothing has happend:
select * from t1; select * from t1;
a b a b
...@@ -332,9 +320,7 @@ a b ...@@ -332,9 +320,7 @@ a b
1 1 1 1
** connection thread2 ** connection thread2
** Collect results from thread 2 and release the lock. ** Collect results from thread 2 and release the lock.
select release_lock("hello2"); DO release_lock("hello2");
release_lock("hello2")
1
** The table should look like the original+updates for thread 2, ** The table should look like the original+updates for thread 2,
** and consist of new rows: ** and consist of new rows:
select * from t1; select * from t1;
......
...@@ -7,8 +7,6 @@ SELECT @@global.innodb_locks_unsafe_for_binlog; ...@@ -7,8 +7,6 @@ SELECT @@global.innodb_locks_unsafe_for_binlog;
1 1
# keep_locks == 0 # keep_locks == 0
GRANT USAGE ON test.* TO mysqltest@localhost; GRANT USAGE ON test.* TO mysqltest@localhost;
DO release_lock("hello");
DO release_lock("hello2");
drop table if exists t1; drop table if exists t1;
** **
...@@ -50,9 +48,7 @@ begin; ...@@ -50,9 +48,7 @@ begin;
update t1 set eta=2 where tipo=22; update t1 set eta=2 where tipo=22;
** Release user level name lock from thread 1. This will cause the ULL ** Release user level name lock from thread 1. This will cause the ULL
** on thread 2 to end its wait. ** on thread 2 to end its wait.
select release_lock("hello"); DO release_lock("hello");
release_lock("hello")
1
** Table is now updated with a new eta on tipo=22 for thread 1. ** Table is now updated with a new eta on tipo=22 for thread 1.
select * from t1; select * from t1;
eta tipo c eta tipo c
...@@ -69,9 +65,7 @@ eta tipo c ...@@ -69,9 +65,7 @@ eta tipo c
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk 90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2 ** connection thread2
** Release the lock and collect result from update on thread 2 ** Release the lock and collect result from update on thread 2
select release_lock("hello"); DO release_lock("hello");
release_lock("hello")
1
** Table should have eta updates where tipo=11 but updates made by ** Table should have eta updates where tipo=11 but updates made by
** thread 1 shouldn't be visible yet. ** thread 1 shouldn't be visible yet.
select * from t1; select * from t1;
...@@ -192,9 +186,7 @@ begin; ...@@ -192,9 +186,7 @@ begin;
** do not match the WHERE condition are released. ** do not match the WHERE condition are released.
update t1 set tipo=1 where tipo=2; update t1 set tipo=1 where tipo=2;
** Release ULL. This will release the next waiting ULL on thread 2. ** Release ULL. This will release the next waiting ULL on thread 2.
select release_lock("hello"); DO release_lock("hello");
release_lock("hello")
1
** The table should still be updated with updates for thread 1 only: ** The table should still be updated with updates for thread 1 only:
select * from t1; select * from t1;
eta tipo c eta tipo c
...@@ -211,9 +203,7 @@ eta tipo c ...@@ -211,9 +203,7 @@ eta tipo c
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk 90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2 ** connection thread2
** Release the lock and collect result from thread 2: ** Release the lock and collect result from thread 2:
select release_lock("hello"); DO release_lock("hello");
release_lock("hello")
1
** Seen from thread 2 the table should have been updated on four ** Seen from thread 2 the table should have been updated on four
** places. ** places.
select * from t1; select * from t1;
...@@ -317,9 +307,7 @@ update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2; ...@@ -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. ** commit since there are no on-going transactions.
insert into t1 values (1,1); insert into t1 values (1,1);
** Release the ULL (thread 2 updates will finish). ** Release the ULL (thread 2 updates will finish).
select release_lock("hello2"); DO release_lock("hello2");
release_lock("hello2")
1
** ..but thread 1 will still see t1 as if nothing has happend: ** ..but thread 1 will still see t1 as if nothing has happend:
select * from t1; select * from t1;
a b a b
...@@ -330,9 +318,7 @@ a b ...@@ -330,9 +318,7 @@ a b
1 1 1 1
** connection thread2 ** connection thread2
** Collect results from thread 2 and release the lock. ** Collect results from thread 2 and release the lock.
select release_lock("hello2"); DO release_lock("hello2");
release_lock("hello2")
1
** The table should look like the original+updates for thread 2, ** The table should look like the original+updates for thread 2,
** and consist of new rows: ** and consist of new rows:
select * from t1; select * from t1;
......
...@@ -1731,7 +1731,7 @@ t1 CREATE TABLE `t1` ( ...@@ -1731,7 +1731,7 @@ t1 CREATE TABLE `t1` (
`HOST` varchar(64) NOT NULL DEFAULT '', `HOST` varchar(64) NOT NULL DEFAULT '',
`DB` varchar(64) DEFAULT NULL, `DB` varchar(64) DEFAULT NULL,
`COMMAND` varchar(16) NOT NULL DEFAULT '', `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, `STATE` varchar(64) DEFAULT NULL,
`INFO` longtext `INFO` longtext
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ) ENGINE=MyISAM DEFAULT CHARSET=utf8
...@@ -1745,7 +1745,7 @@ t1 CREATE TEMPORARY TABLE `t1` ( ...@@ -1745,7 +1745,7 @@ t1 CREATE TEMPORARY TABLE `t1` (
`HOST` varchar(64) NOT NULL DEFAULT '', `HOST` varchar(64) NOT NULL DEFAULT '',
`DB` varchar(64) DEFAULT NULL, `DB` varchar(64) DEFAULT NULL,
`COMMAND` varchar(16) NOT NULL DEFAULT '', `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, `STATE` varchar(64) DEFAULT NULL,
`INFO` longtext `INFO` longtext
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ) ENGINE=MyISAM DEFAULT CHARSET=utf8
......
...@@ -1720,4 +1720,9 @@ SELECT CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1'; ...@@ -1720,4 +1720,9 @@ SELECT CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
CREATE_OPTIONS CREATE_OPTIONS
KEY_BLOCK_SIZE=1 KEY_BLOCK_SIZE=1
DROP TABLE t1; 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. End of 5.1 tests.
...@@ -87,9 +87,7 @@ show binary logs; ...@@ -87,9 +87,7 @@ show binary logs;
Log_name File_size Log_name File_size
master-bin.000002 # master-bin.000002 #
master-bin.000003 # master-bin.000003 #
select @time_for_purge:=DATE_ADD(UPDATE_TIME, INTERVAL 1 SECOND) SELECT @time_for_purge:=DATE_ADD('tmpval', INTERVAL 1 SECOND);
from information_schema.tables
where TABLE_SCHEMA="test" and TABLE_NAME="t2";
purge master logs before (@time_for_purge); purge master logs before (@time_for_purge);
show binary logs; show binary logs;
Log_name File_size Log_name File_size
......
...@@ -112,14 +112,24 @@ source include/show_master_logs.inc; ...@@ -112,14 +112,24 @@ source include/show_master_logs.inc;
purge binary logs to 'master-bin.000002'; purge binary logs to 'master-bin.000002';
source include/show_binary_logs.inc; source include/show_binary_logs.inc;
# Calculate time to use in "purge master logs before" by taking # Set the purge time 1 second after the last modify time of master-bin.000002.
# last modification time of t2 and adding 1 second perl;
# This is donw in order to handle the case where file system open F, ">>".$ENV{'MYSQLTEST_VARDIR'}.'/tmp/rpl_rotate_logs.tmp' or die "Tmp file rpl_rotate_logs.tmp not found";
# time differs from mysqld's time 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 --disable_result_log
select @time_for_purge:=DATE_ADD(UPDATE_TIME, INTERVAL 1 SECOND) --replace_result $tmpval tmpval
from information_schema.tables --eval SELECT @time_for_purge:=DATE_ADD('$tmpval', INTERVAL 1 SECOND)
where TABLE_SCHEMA="test" and TABLE_NAME="t2";
--enable_result_log --enable_result_log
purge master logs before (@time_for_purge); purge master logs before (@time_for_purge);
......
...@@ -1410,6 +1410,15 @@ CREATE TABLE t1(a INT) KEY_BLOCK_SIZE=1; ...@@ -1410,6 +1410,15 @@ CREATE TABLE t1(a INT) KEY_BLOCK_SIZE=1;
SELECT CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1'; SELECT CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
DROP TABLE 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. --echo End of 5.1 tests.
# Wait till all disconnects are completed # Wait till all disconnects are completed
......
...@@ -918,7 +918,7 @@ ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp, ...@@ -918,7 +918,7 @@ ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp,
if (num < (ulonglong) optp->min_value) if (num < (ulonglong) optp->min_value)
{ {
num= (ulonglong) optp->min_value; num= (ulonglong) optp->min_value;
if (old < optp->min_value) if (old < (ulonglong) optp->min_value)
adjusted= TRUE; adjusted= TRUE;
} }
......
...@@ -1704,7 +1704,8 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) ...@@ -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_list.push_back(field=new Item_empty_string("db",NAME_CHAR_LEN));
field->maybe_null=1; field->maybe_null=1;
field_list.push_back(new Item_empty_string("Command",16)); 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_list.push_back(field=new Item_empty_string("State",30));
field->maybe_null=1; field->maybe_null=1;
field_list.push_back(field=new Item_empty_string("Info",max_query_length)); 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) ...@@ -1797,7 +1798,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
else else
protocol->store(command_name[thd_info->command].str, system_charset_info); protocol->store(command_name[thd_info->command].str, system_charset_info);
if (thd_info->start_time) if (thd_info->start_time)
protocol->store((uint32) (now - thd_info->start_time)); protocol->store_long ((longlong) (now - thd_info->start_time));
else else
protocol->store_null(); protocol->store_null();
protocol->store(thd_info->state_info, system_charset_info); protocol->store(thd_info->state_info, system_charset_info);
...@@ -1872,8 +1873,8 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond) ...@@ -1872,8 +1873,8 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
table->field[4]->store(command_name[tmp->command].str, table->field[4]->store(command_name[tmp->command].str,
command_name[tmp->command].length, cs); command_name[tmp->command].length, cs);
/* MYSQL_TIME */ /* MYSQL_TIME */
table->field[5]->store((uint32)(tmp->start_time ? table->field[5]->store((longlong)(tmp->start_time ?
now - tmp->start_time : 0), TRUE); now - tmp->start_time : 0), FALSE);
/* STATE */ /* STATE */
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
val= (char*) (tmp->locked ? "Locked" : val= (char*) (tmp->locked ? "Locked" :
...@@ -6558,7 +6559,7 @@ ST_FIELD_INFO processlist_fields_info[]= ...@@ -6558,7 +6559,7 @@ ST_FIELD_INFO processlist_fields_info[]=
SKIP_OPEN_TABLE}, SKIP_OPEN_TABLE},
{"DB", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, "Db", 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}, {"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}, {"STATE", 64, MYSQL_TYPE_STRING, 0, 1, "State", SKIP_OPEN_TABLE},
{"INFO", PROCESS_LIST_INFO_WIDTH, MYSQL_TYPE_STRING, 0, 1, "Info", {"INFO", PROCESS_LIST_INFO_WIDTH, MYSQL_TYPE_STRING, 0, 1, "Info",
SKIP_OPEN_TABLE}, SKIP_OPEN_TABLE},
......
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