mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
bzr merge from guilhem's maria tree to our local 5.1
configure.in: Manually merged mysql-test/lib/My/ConfigFactory.pm: Manually merged mysql-test/mysql-test-run.pl: Manually merged mysql-test/t/information_schema.test: Manually merged sql/handler.cc: Manually merged support-files/mysql.spec.sh: Manually merged
This commit is contained in:
@ -27,7 +27,7 @@ create temporary table error_log (
|
||||
) engine=myisam;
|
||||
|
||||
# Get the name of servers error log
|
||||
let $log_error= query_get_value(show variables like 'log_error', Value, 1);
|
||||
let $log_error= $MTR_LOG_ERROR;
|
||||
let $log_warning= $log_error.warnings;
|
||||
|
||||
# Try tload the warnings into a temporary table,
|
||||
|
21
mysql-test/include/count_sessions.inc
Normal file
21
mysql-test/include/count_sessions.inc
Normal file
@ -0,0 +1,21 @@
|
||||
# include/count_sessions.inc
|
||||
#
|
||||
# SUMMARY
|
||||
#
|
||||
# Stores the number of current sessions in $count_sessions.
|
||||
#
|
||||
#
|
||||
# USAGE
|
||||
#
|
||||
# Please look into include/wait_until_count_sessions.inc
|
||||
# for examples of typical usage.
|
||||
#
|
||||
#
|
||||
# EXAMPLE
|
||||
# backup.test, grant3.test
|
||||
#
|
||||
#
|
||||
# Created: 2009-01-14 mleich
|
||||
#
|
||||
|
||||
let $count_sessions= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1);
|
@ -479,6 +479,7 @@ handler t1 open;
|
||||
--echo --> client 1
|
||||
connection default;
|
||||
drop table t1;
|
||||
disconnect con2;
|
||||
|
||||
#
|
||||
# Bug#30632 HANDLER read failure causes hang
|
||||
@ -692,3 +693,30 @@ unlock tables;
|
||||
drop table t1;
|
||||
--error ER_UNKNOWN_TABLE
|
||||
handler t1 read a next;
|
||||
|
||||
#
|
||||
# Bug#41110: crash with handler command when used concurrently with alter table
|
||||
# Bug#41112: crash in mysql_ha_close_table/get_lock_data with alter table
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1);
|
||||
handler t1 open;
|
||||
connect(con1,localhost,root,,);
|
||||
send alter table t1 engine=memory;
|
||||
connection default;
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = "rename result table" and info = "alter table t1 engine=memory";
|
||||
--source include/wait_condition.inc
|
||||
--error ER_ILLEGAL_HA
|
||||
handler t1 read a next;
|
||||
handler t1 close;
|
||||
connection con1;
|
||||
--reap
|
||||
drop table t1;
|
||||
disconnect con1;
|
||||
connection default;
|
||||
|
@ -2,6 +2,13 @@
|
||||
# By JBM 2006-02-16 So that the code is not repeated #
|
||||
# in test cases and can be reused. #
|
||||
######################################################
|
||||
|
||||
# Bug#41307: Tests using include/ndb_backup.inc won't work on Windows due to
|
||||
# 'grep' call
|
||||
# This test is disabled on Windows via the next line until the above bug is
|
||||
# resolved
|
||||
--source include/not_windows.inc
|
||||
|
||||
--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "start backup" >> $NDB_TOOLS_OUTPUT
|
||||
|
||||
# there is no neat way to find the backupid, this is a hack to find it...
|
||||
|
@ -108,7 +108,6 @@ execute stmt1 using @arg00, @arg01;
|
||||
select a,b from t1 where a=@arg00;
|
||||
set @arg00=NULL;
|
||||
set @arg01=2;
|
||||
--error 1048
|
||||
execute stmt1 using @arg00, @arg01;
|
||||
select a,b from t1 order by a;
|
||||
set @arg00=0;
|
||||
|
@ -69,9 +69,9 @@ let $_fake_relay_log_purge= `SELECT @@global.relay_log_purge`;
|
||||
# Create relay log file.
|
||||
copy_file $fake_relay_log $_fake_relay_log;
|
||||
# Create relay log index.
|
||||
--exec echo $_fake_relay_log > $_fake_relay_index
|
||||
--exec echo $_fake_filename-fake.000001 > $_fake_relay_index
|
||||
|
||||
# Setup replication from existing relay log.
|
||||
eval CHANGE MASTER TO MASTER_HOST='dummy.localdomain', RELAY_LOG_FILE='$_fake_relay_log', RELAY_LOG_POS=4;
|
||||
eval CHANGE MASTER TO MASTER_HOST='dummy.localdomain', RELAY_LOG_FILE='$_fake_filename-fake.000001', RELAY_LOG_POS=4;
|
||||
|
||||
--enable_query_log
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Run a query over and over until it suceeds ot timeout occurs
|
||||
# Run a query over and over until it succeeds ot timeout occurs
|
||||
#
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ while ($mysql_errno)
|
||||
|
||||
if (!$counter)
|
||||
{
|
||||
die("Waited too long for query to suceed");
|
||||
--die "Waited too long for query to succeed";
|
||||
}
|
||||
}
|
||||
enable_abort_on_error;
|
78
mysql-test/include/wait_show_condition.inc
Normal file
78
mysql-test/include/wait_show_condition.inc
Normal file
@ -0,0 +1,78 @@
|
||||
# include/wait_show_condition.inc
|
||||
#
|
||||
# SUMMARY
|
||||
#
|
||||
# Waits until the show statement ($show_statement) has at least within one of
|
||||
# the rows of the result set for the field ($field) a value which fulfils
|
||||
# a condition ($condition), or the operation times out.
|
||||
#
|
||||
#
|
||||
# USAGE
|
||||
#
|
||||
# let $show_statement= SHOW PROCESSLIST;
|
||||
# let $field= State;
|
||||
# let $condition= = 'Updating';
|
||||
# --source include/wait_show_condition.inc
|
||||
#
|
||||
# OR
|
||||
#
|
||||
# let $wait_timeout= 60; # Override default of 30 seconds with 60.
|
||||
# let $show_statement= SHOW PROCESSLIST;
|
||||
# let $field= State;
|
||||
# let $condition= = 'Updating';
|
||||
# --source include/wait_show_condition.inc
|
||||
#
|
||||
# Please do not use this use routine if you can replace the SHOW statement
|
||||
# with a select. In such a case include/wait_condition.inc is recommended.
|
||||
#
|
||||
# Created: 2009-02-18 mleich
|
||||
#
|
||||
|
||||
let $max_run_time= 30;
|
||||
if ($wait_timeout)
|
||||
{
|
||||
let $max_run_time= $wait_timeout;
|
||||
}
|
||||
# Reset $wait_timeout so that its value won't be used on subsequent
|
||||
# calls, and default will be used instead.
|
||||
let $wait_timeout= 0;
|
||||
|
||||
# The smallest timespan till UNIX_TIMESTAMP() gets incremented is ~0 seconds.
|
||||
# We add one second to avoid the case that somebody measures timespans on a
|
||||
# real clock with fractions of seconds, detects that n seconds are sufficient,
|
||||
# assigns n to this routine and suffers because he sometimes gets n - 1
|
||||
# seconds in reality.
|
||||
inc $max_run_time;
|
||||
|
||||
let $found= 0;
|
||||
let $max_end_time= `SELECT UNIX_TIMESTAMP() + $max_run_time`;
|
||||
while (`SELECT UNIX_TIMESTAMP() <= $max_end_time AND $found = 0`)
|
||||
{
|
||||
# Sleep a bit to avoid too heavy load.
|
||||
real_sleep 0.2;
|
||||
let $rowno= 1;
|
||||
let $process_result= 1;
|
||||
while (`SELECT $process_result = 1 AND $found = 0`)
|
||||
{
|
||||
let $field_value= query_get_value($show_statement, $field, $rowno);
|
||||
if (`SELECT '$field_value' $condition`)
|
||||
{
|
||||
let $found= 1;
|
||||
}
|
||||
if (`SELECT '$field_value' = 'No such row'`)
|
||||
{
|
||||
# We are behind the last row of the result set.
|
||||
let $process_result= 0;
|
||||
}
|
||||
inc $rowno;
|
||||
}
|
||||
}
|
||||
if (!$found)
|
||||
{
|
||||
echo # Timeout in include/wait_show_condition.inc for $wait_condition;
|
||||
echo # show_statement : $show_statement;
|
||||
echo # field : $field;
|
||||
echo # condition : $condition;
|
||||
echo # max_run_time : $max_run_time;
|
||||
}
|
||||
|
126
mysql-test/include/wait_until_count_sessions.inc
Normal file
126
mysql-test/include/wait_until_count_sessions.inc
Normal file
@ -0,0 +1,126 @@
|
||||
# include/wait_until_count_sessions.inc
|
||||
#
|
||||
# SUMMARY
|
||||
#
|
||||
# Waits until the passed number ($count_sessions) of concurrent sessions or
|
||||
# a smaller number was observed via
|
||||
# SHOW STATUS LIKE 'Threads_connected'
|
||||
# or the operation times out.
|
||||
# Note:
|
||||
# 1. We wait for $current_sessions <= $count_sessions because in the use case
|
||||
# with count_sessions.inc before and wait_until_count_sessions.inc after
|
||||
# the core of the test it could happen that the disconnects of sessions
|
||||
# belonging to the preceeding test are not finished.
|
||||
# sessions at test begin($count_sessions) = m + n
|
||||
# sessions of the previous test which will be soon disconnected = n (n >= 0)
|
||||
# sessions at test end ($current sessions, assuming the test disconnects
|
||||
# all additional sessions) = m
|
||||
# 2. Starting with 5.1 we could also use
|
||||
# SELECT COUNT(*) FROM information_schema.processlist
|
||||
# I stay with "SHOW STATUS LIKE 'Threads_connected'" because this
|
||||
# runs in all versions 5.0+
|
||||
#
|
||||
#
|
||||
# USAGE
|
||||
#
|
||||
# let $count_sessions= 3;
|
||||
# --source include/wait_until_count_sessions.inc
|
||||
#
|
||||
# OR typical example of a test which uses more than one session
|
||||
# Such a test could harm successing tests if there is no server shutdown
|
||||
# and start between.
|
||||
#
|
||||
# If the testing box is slow than the disconnect of sessions belonging to
|
||||
# the current test might happen when the successing test gets executed.
|
||||
# This means the successing test might see activities like unexpected
|
||||
# rows within the general log or the PROCESSLIST.
|
||||
# Example from bug http://bugs.mysql.com/bug.php?id=40377
|
||||
# --- bzr_mysql-6.0-rpl/.../r/log_state.result
|
||||
# +++ bzr_mysql-6.0-rpl/.../r/log_state.reject
|
||||
# @@ -25,6 +25,7 @@
|
||||
# event_time user_host ... command_type argument
|
||||
# TIMESTAMP USER_HOST ... Query create table t1(f1 int)
|
||||
# TIMESTAMP USER_HOST ... Query select * from mysql.general_log
|
||||
# +TIMESTAMP USER_HOST ... Quit
|
||||
# ....
|
||||
#
|
||||
# What to do?
|
||||
# -----------
|
||||
# <start of test>
|
||||
# # Determine initial number of connections (set $count_sessions)
|
||||
# --source include/count_sessions.inc
|
||||
# ...
|
||||
# connect (con1,.....)
|
||||
# ...
|
||||
# connection default;
|
||||
# ...
|
||||
# disconnect con1;
|
||||
# ...
|
||||
# # Wait until we have reached the initial number of connections
|
||||
# # or more than the sleep time above (10 seconds) has passed.
|
||||
# # $count_sessions
|
||||
# --source include/wait_until_count_sessions.inc
|
||||
# <end of test>
|
||||
#
|
||||
# Important note about tests with unfortunate (= not cooperative
|
||||
# to successing tests) architecture:
|
||||
# connection con1;
|
||||
# send SELECT ..., sleep(10)
|
||||
# connection default;
|
||||
# ...
|
||||
# disconnect con1;
|
||||
# <end of test>
|
||||
# should be fixed by
|
||||
# connection con1;
|
||||
# send SELECT ..., sleep(10)
|
||||
# connection default;
|
||||
# ...
|
||||
# connect con1;
|
||||
# reap;
|
||||
# connection default;
|
||||
# disconnect con1;
|
||||
# <end of test>
|
||||
# and not only by appending include/wait_until_count_sessions.inc etc.
|
||||
#
|
||||
#
|
||||
# EXAMPLE
|
||||
#
|
||||
# backup.test, grant3.test
|
||||
#
|
||||
#
|
||||
# Created:
|
||||
# 2009-01-14 mleich
|
||||
# Modified:
|
||||
# 2009-02-24 mleich Fix Bug#43114 wait_until_count_sessions too restrictive,
|
||||
# random PB failures
|
||||
#
|
||||
|
||||
let $wait_counter= 100;
|
||||
if ($wait_timeout)
|
||||
{
|
||||
let $wait_counter= `SELECT $wait_timeout * 10`;
|
||||
}
|
||||
# Reset $wait_timeout so that its value won't be used on subsequent
|
||||
# calls, and default will be used instead.
|
||||
let $wait_timeout= 0;
|
||||
while ($wait_counter)
|
||||
{
|
||||
let $current_sessions= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1);
|
||||
let $success= `SELECT $current_sessions <= $count_sessions`;
|
||||
if ($success)
|
||||
{
|
||||
let $wait_counter= 0;
|
||||
}
|
||||
if (!$success)
|
||||
{
|
||||
real_sleep 0.1;
|
||||
dec $wait_counter;
|
||||
}
|
||||
}
|
||||
if (!$success)
|
||||
{
|
||||
--echo # Timeout in wait_until_count_sessions.inc
|
||||
--echo # Number of sessions expected: <= $count_sessions found: $current_sessions
|
||||
SHOW PROCESSLIST;
|
||||
}
|
||||
|
Reference in New Issue
Block a user