Commit 9404e88d authored by Alexey Botchkov's avatar Alexey Botchkov

merging

parents cf0d0a5e fd5084f6
......@@ -159,7 +159,8 @@ void thr_multi_unlock(THR_LOCK_DATA **data,uint count);
void thr_abort_locks(THR_LOCK *lock, my_bool upgrade_lock);
my_bool thr_abort_locks_for_thread(THR_LOCK *lock, my_thread_id thread);
void thr_print_locks(void); /* For debugging */
my_bool thr_upgrade_write_delay_lock(THR_LOCK_DATA *data);
my_bool thr_upgrade_write_delay_lock(THR_LOCK_DATA *data,
enum thr_lock_type new_lock_type);
void thr_downgrade_write_lock(THR_LOCK_DATA *data,
enum thr_lock_type new_lock_type);
my_bool thr_reschedule_write_lock(THR_LOCK_DATA *data);
......
# 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);
# include/wait_until_count_sessions.inc
#
# SUMMARY
#
# Waits until the passed number ($count_sessions) of concurrent sessions was
# observed via
# SHOW STATUS LIKE 'Threads_connected'
# or the operation times out.
# Note: 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.cw
#
# 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
#
let $wait_counter= 50;
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
}
......@@ -1528,8 +1528,8 @@ sub mysql_fix_arguments () {
mtr_init_args(\$args);
mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
mtr_add_arg($args, "--basedir=", $basedir);
mtr_add_arg($args, "--bindir=", $path_client_bindir);
mtr_add_arg($args, "--basedir=%s", $basedir);
mtr_add_arg($args, "--bindir=%s", $path_client_bindir);
mtr_add_arg($args, "--verbose");
return mtr_args2str($exe, @$args);
}
......
......@@ -21,6 +21,25 @@ select * from t1 where c1='b';
c1
a
drop table t1;
CREATE TABLE t1 (
col1 varchar(100) character set utf8 collate utf8_test_ci
);
INSERT INTO t1 (col1) VALUES ('abcd'),('efgh'),('ijkl');
ALTER TABLE t1 ADD FULLTEXT INDEX (col1);
SELECT * FROM t1 where match (col1) against ('abcd');
col1
abcd
SELECT * FROM t1 where match (col1) against ('abcd' IN BOOLEAN MODE);
col1
abcd
ALTER TABLE t1 ADD (col2 varchar(100) character set latin1);
UPDATE t1 SET col2=col1;
SELECT * FROM t1 WHERE col1=col2 ORDER BY col1;
col1 col2
abcd abcd
efgh efgh
ijkl ijkl
DROP TABLE t1;
show collation like 'ucs2_vn_ci';
Collation Charset Id Default Compiled Sortlen
ucs2_vn_ci ucs2 242 8
......
......@@ -284,4 +284,30 @@ ERROR 22007: Incorrect date value: '0000-00-00' for column 'f1' at row 1
INSERT DELAYED INTO t2 VALUES (0,'2007-00-00');
ERROR 22007: Incorrect date value: '2007-00-00' for column 'f1' at row 1
DROP TABLE t1,t2;
set @old_delayed_updates = @@global.low_priority_updates;
set global low_priority_updates = 1;
select @@global.low_priority_updates;
@@global.low_priority_updates
1
drop table if exists t1;
create table t1 (a int, b int);
insert into t1 values (1,1);
lock table t1 read;
connection: update
insert delayed into t1 values (2,2);;
connection: select
select * from t1;
a b
1 1
connection: default
select * from t1;
a b
1 1
unlock tables;
select * from t1;
a b
1 1
2 2
drop table t1;
set global low_priority_updates = @old_delayed_updates;
End of 5.1 tests
......@@ -324,6 +324,11 @@ select @my_uuid_date - @my_uuid_synthetic;
@my_uuid_date - @my_uuid_synthetic
0
set @@session.time_zone=@save_tz;
CREATE TABLE t1 (a DATE);
SELECT * FROM t1 WHERE a = NAME_CONST('reportDate',
_binary'2009-01-09' COLLATE 'binary');
a
DROP TABLE t1;
End of 5.0 tests
select connection_id() > 0;
connection_id() > 0
......
......@@ -367,20 +367,20 @@ drop database TESTDB;
flush privileges;
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
grant all privileges on test.* to `a@`@localhost;
grant execute on * to `a@`@localhost;
create table t2 (s1 int);
insert into t2 values (1);
drop function if exists f2;
create function f2 () returns int
begin declare v int; select s1 from t2 into v; return v; end//
select f2();
GRANT ALL PRIVILEGES ON test.* TO `a@`@localhost;
GRANT EXECUTE ON * TO `a@`@localhost;
CREATE TABLE t2 (s1 INT);
INSERT INTO t2 VALUES (1);
DROP FUNCTION IF EXISTS f2;
CREATE FUNCTION f2 () RETURNS INT
BEGIN DECLARE v INT; SELECT s1 FROM t2 INTO v; RETURN v; END//
SELECT f2();
f2()
1
drop function f2;
drop table t2;
DROP FUNCTION f2;
DROP TABLE t2;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM `a@`@localhost;
drop user `a@`@localhost;
DROP USER `a@`@localhost;
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
drop database if exists mysqltest_1;
drop database if exists mysqltest_2;
......@@ -438,6 +438,7 @@ SELECT * FROM t2;
ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for table 't2'
SELECT * FROM t1 JOIN t2 USING (b);
ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2'
USE test;
DROP TABLE db1.t1, db1.t2;
DROP USER mysqltest1@localhost;
DROP DATABASE db1;
......
load_file(concat(@tmpdir,"/outfile.test"))
load_file(concat(@tmpdir,'/outfile.test'))
Outfile OK
drop table if exists t1;
create table t1(a int) engine=innodb;
lock tables t1 write;
insert into t1 values(10);
select * from t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT) ENGINE=innodb;
LOCK TABLES t1 WRITE;
INSERT INTO t1 VALUES(10);
SELECT * FROM t1;
a
10
drop table t1;
DROP TABLE t1;
......@@ -988,6 +988,17 @@ m1 CREATE TABLE `m1` (
`a` int(11) DEFAULT NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1, m1;
CREATE TABLE t1(a INT);
CREATE TABLE t2(a VARCHAR(10));
CREATE TABLE m1(a INT) ENGINE=MERGE UNION=(t1, t2);
CREATE TABLE m2(a INT) ENGINE=MERGE UNION=(t1);
SELECT * FROM t1;
a
SELECT * FROM m1;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
SELECT * FROM m2;
a
DROP TABLE t1, t2, m1, m2;
End of 5.0 tests
create table t1 (c1 int, index(c1));
create table t2 (c1 int, index(c1)) engine=merge union=(t1);
......
This diff is collapsed.
......@@ -492,6 +492,7 @@ a b c
5 NULL 2001-09-09 04:46:59
6 NULL 2006-06-06 06:06:06
drop table t1;
End of 4.1 tests
set time_zone= @@global.time_zone;
CREATE TABLE t1 (
`id` int(11) NOT NULL auto_increment,
......@@ -508,3 +509,21 @@ select is_nullable from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='t1' and COL
is_nullable
NO
drop table t1;
CREATE TABLE t1 ( f1 INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
f2 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
f3 TIMESTAMP);
INSERT INTO t1 (f2,f3) VALUES (NOW(), "0000-00-00 00:00:00");
INSERT INTO t1 (f2,f3) VALUES (NOW(), NULL);
INSERT INTO t1 (f2,f3) VALUES (NOW(), ASCII(NULL));
INSERT INTO t1 (f2,f3) VALUES (NOW(), FROM_UNIXTIME('9999999999'));
INSERT INTO t1 (f2,f3) VALUES (NOW(), TIME(NULL));
UPDATE t1 SET f2=NOW(), f3=FROM_UNIXTIME('9999999999') WHERE f1=1;
SELECT f1,f2-f3 FROM t1;
f1 f2-f3
1 0
2 0
3 0
4 0
5 0
DROP TABLE t1;
End of 5.0 tests
......@@ -1053,4 +1053,15 @@ ExtractValue('<xml xxx "yyy">CharData</xml>', '/xml')
NULL
Warnings:
Warning 1525 Incorrect XML value: 'parse error at line 1 pos 17: STRING unexpected ('>' wanted)'
set @x=10;
select extractvalue('<a></a>','$@x/a');
ERROR HY000: XPATH syntax error: '/a'
select extractvalue('<a></a>','round(123.4)/a');
ERROR HY000: XPATH syntax error: '/a'
select extractvalue('<a></a>','1/a');
ERROR HY000: XPATH syntax error: '/a'
select extractvalue('<a></a>','"b"/a');
ERROR HY000: XPATH syntax error: '/a'
select extractvalue('<a></a>','(1)/a');
ERROR HY000: XPATH syntax error: '/a'
End of 5.1 tests
......@@ -862,6 +862,9 @@ drop table t21,t31;
drop table t11;
STOP SLAVE;
FLUSH LOGS;
--> Stop master server
--> Start master server
--> Master binlog: Server ver: 5.0.16-debug-log, Binlog ver: 4
RESET SLAVE;
START SLAVE;
SELECT MASTER_POS_WAIT('master-bin.000001', 513) >= 0;
......
......@@ -46,9 +46,7 @@ insert into t2 values(NULL,0),(500,0);
select a,b, truncate(rand_value,4) from t1;
select * from t2;
select a,name, old_a, old_b, truncate(rand_value,4) from t3;
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
--disable_query_log
select "--- On slave --" as "";
--enable_query_log
......@@ -108,9 +106,7 @@ SELECT trigger_name, definer
FROM information_schema.triggers
WHERE trigger_name = 't1_first';
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
--disable_query_log
select "--- On slave --" as "";
--enable_query_log
......@@ -165,9 +161,7 @@ create database other;
use other;
insert into test.t1 values (1);
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
connection master;
use test;
......@@ -304,8 +298,28 @@ STOP SLAVE;
connection master;
let $MYSQLD_DATADIR= `select @@datadir`;
FLUSH LOGS;
# Stop master server
--echo --> Stop master server
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
wait
EOF
--shutdown_server 10
--source include/wait_until_disconnected.inc
# Replace binlog
remove_file $MYSQLD_DATADIR/master-bin.000001;
copy_file $MYSQL_TEST_DIR/std_data/bug16266.000001 $MYSQLD_DATADIR/master-bin.000001;
--echo --> Start master server
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart
EOF
--enable_reconnect
--source include/wait_until_connected_again.inc
let $binlog_version= query_get_value(SHOW BINLOG EVENTS, Info, 1);
# Make the slave to replay the new binlog.
--echo --> Master binlog: $binlog_version
# Make the slave to replay the new binlog.
......@@ -381,9 +395,7 @@ DROP TABLE IF EXISTS t2;
--echo
--echo ---> Synchronizing slave with master...
--save_master_pos
--connection slave
--sync_with_master
--sync_slave_with_master
--echo
--echo ---> connection: master
......@@ -415,9 +427,7 @@ SELECT * FROM t2;
--echo
--echo ---> Synchronizing slave with master...
--save_master_pos
--connection slave
--sync_with_master
--sync_slave_with_master
--echo ---> connection: master
......@@ -439,9 +449,7 @@ SELECT * FROM t2;
DROP TABLE t1;
DROP TABLE t2;
--save_master_pos
--connection slave
--sync_with_master
--sync_slave_with_master
--connection master
#
......
......@@ -45,58 +45,20 @@ CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL,
*** Basic testing ***
Insert rows via all hosts
Check data on both clusters
* Cluster A *
SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 1 GROUP BY b ORDER BY b;
COUNT(*) SUM(a) b
10 190 master
10 210 master1
10 200 slave
10 220 slave1
* Cluster B *
SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 1 GROUP BY b ORDER BY b;
COUNT(*) SUM(a) b
10 190 master
10 210 master1
10 200 slave
10 220 slave1
Comparing tables master:test.t1 and slave:test.t1
*** Transaction testing ***
BEGIN;
BEGIN;
COMMIT;
COMMIT;
Check data on both clusters
* Cluster A *
SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 2 GROUP BY b ORDER BY b;
COUNT(*) SUM(a) b
100 23900 master
100 24100 master1
100 24000 slave
100 24200 slave1
* Cluster B *
SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 2 GROUP BY b ORDER BY b;
COUNT(*) SUM(a) b
100 23900 master
100 24100 master1
100 24000 slave
100 24200 slave1
Comparing tables master:test.t1 and slave:test.t1
BEGIN;
BEGIN;
ROLLBACK;
ROLLBACK;
Check data on both clusters
* Cluster A *
SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 3 GROUP BY b ORDER BY b;
COUNT(*) SUM(a) b
100 64100 master1
100 64000 slave
* Cluster B *
SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 3 GROUP BY b ORDER BY b;
COUNT(*) SUM(a) b
100 64100 master1
100 64000 slave
Comparing tables master:test.t1 and slave:test.t1
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
......@@ -10,7 +10,4 @@
#
##############################################################################
rpl_ndb_circular : Bug#41183 rpl_ndb_circular, rpl_ndb_circular_simplex need maintenance, crash
rpl_ndb_circular_simplex : Bug#41183 rpl_ndb_circular, rpl_ndb_circular_simplex need maintenance, crash
# the below testcase have been reworked to avoid the bug, test contains comment, keep bug open
......@@ -75,13 +75,10 @@ let $wait_condition= SELECT COUNT(*)=40 FROM t1 WHERE c = 1;
# Check data
--echo Check data on both clusters
--connection master
--echo * Cluster A *
SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 1 GROUP BY b ORDER BY b;
--connection slave
--echo * Cluster B *
SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 1 GROUP BY b ORDER BY b;
--echo
let $diff_table_1=master:test.t1;
let $diff_table_2=slave:test.t1;
source include/diff_tables.inc;
--echo *** Transaction testing ***
# Start transaction for one mysqld and do mass of inserts for other.
......@@ -119,13 +116,10 @@ let $wait_condition= SELECT COUNT(*)=400 FROM t1 WHERE c = 2;
--source include/wait_condition.inc
--echo Check data on both clusters
--connection master
--echo * Cluster A *
SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 2 GROUP BY b ORDER BY b;
--connection slave
--echo * Cluster B *
SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 2 GROUP BY b ORDER BY b;
--echo
let $diff_table_1=master:test.t1;
let $diff_table_2=slave:test.t1;
source include/diff_tables.inc;
# Start transaction and then roll back
......@@ -161,13 +155,10 @@ let $wait_condition= SELECT COUNT(*)=200 FROM t1 WHERE c = 3;
--source include/wait_condition.inc
--echo Check data on both clusters
--connection master
--echo * Cluster A *
SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 3 GROUP BY b ORDER BY b;
--connection slave
--echo * Cluster B *
SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 3 GROUP BY b ORDER BY b;
--echo
let $diff_table_1=master:test.t1;
let $diff_table_2=slave:test.t1;
source include/diff_tables.inc;
# Clean up
--connection master
......
......@@ -21,6 +21,22 @@ insert into t1 values ('a');
select * from t1 where c1='b';
drop table t1;
#
# Bug#41084 full-text index added to custom UCA collation not working
#
CREATE TABLE t1 (
col1 varchar(100) character set utf8 collate utf8_test_ci
);
INSERT INTO t1 (col1) VALUES ('abcd'),('efgh'),('ijkl');
ALTER TABLE t1 ADD FULLTEXT INDEX (col1);
SELECT * FROM t1 where match (col1) against ('abcd');
SELECT * FROM t1 where match (col1) against ('abcd' IN BOOLEAN MODE);
ALTER TABLE t1 ADD (col2 varchar(100) character set latin1);
UPDATE t1 SET col2=col1;
SELECT * FROM t1 WHERE col1=col2 ORDER BY col1;
DROP TABLE t1;
#
# Vietnamese experimental collation
#
......
......@@ -285,4 +285,47 @@ INSERT DELAYED INTO t2 VALUES (0,'0000-00-00');
INSERT DELAYED INTO t2 VALUES (0,'2007-00-00');
DROP TABLE t1,t2;
#
# Bug#40536: SELECT is blocked by INSERT DELAYED waiting on upgrading lock,
# even with low_priority_updates
#
set @old_delayed_updates = @@global.low_priority_updates;
set global low_priority_updates = 1;
select @@global.low_priority_updates;
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (a int, b int);
insert into t1 values (1,1);
lock table t1 read;
connect (update,localhost,root,,);
connection update;
--echo connection: update
--send insert delayed into t1 values (2,2);
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where command = "Delayed insert" and state = "upgrading lock";
--source include/wait_condition.inc
connect (select,localhost,root,,);
--echo connection: select
select * from t1;
connection default;
--echo connection: default
select * from t1;
connection default;
disconnect update;
disconnect select;
unlock tables;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where command = "Delayed insert" and state = "Waiting for INSERT";
--source include/wait_condition.inc
select * from t1;
drop table t1;
set global low_priority_updates = @old_delayed_updates;
--echo End of 5.1 tests
......@@ -445,6 +445,15 @@ select @my_uuid_date - @my_uuid_synthetic;
set @@session.time_zone=@save_tz;
#
# Bug#42014: Crash, name_const with collate
#
CREATE TABLE t1 (a DATE);
SELECT * FROM t1 WHERE a = NAME_CONST('reportDate',
_binary'2009-01-09' COLLATE 'binary');
DROP TABLE t1;
--echo End of 5.0 tests
#
......
This diff is collapsed.
# Can't run with embedded server
# Can't run with embedded server because we use GRANT
-- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# Test of GRANT commands
SET NAMES binary;
......@@ -23,10 +27,11 @@ grant create user on *.* to mysqltest_1@localhost;
grant select on `my\_1`.* to mysqltest_1@localhost with grant option;
connect (user_a,localhost,mysqltest_1,,);
connection user_a;
--error 1410
--error ER_CANT_CREATE_USER_WITH_GRANT
grant select on `my\_1`.* to mysqltest_2@localhost;
create user mysqltest_2@localhost;
disconnect user_a;
disconnect master;
connection default;
delete from mysql.user where user like 'mysqltest\_%';
......@@ -36,7 +41,7 @@ delete from mysql.columns_priv where user like 'mysqltest\_%';
flush privileges;
#
# Bug: #19828 Case sensitivity in Grant/Revoke
# Bug#19828 Case sensitivity in Grant/Revoke
#
grant select on test.* to CUser@localhost;
......@@ -137,7 +142,7 @@ DROP USER CUser2@LOCALHOST;
#
# Bug#31194: Privilege ordering does not order properly for wildcard values
# Bug#31194 Privilege ordering does not order properly for wildcard values
#
CREATE DATABASE mysqltest_1;
......@@ -160,3 +165,6 @@ DROP DATABASE mysqltest_1;
--echo End of 5.0 tests
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
# This is a test for bug 578
# Test for Bug#578 mysqlimport -l silently fails when binlog-ignore-db is set
-- source include/have_innodb.inc
--source include/have_innodb.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con1;
--disable_warnings
drop table if exists t1;
create table t1(a int) engine=innodb;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT) ENGINE=innodb;
--enable_warnings
lock tables t1 write;
insert into t1 values(10);
LOCK TABLES t1 WRITE;
INSERT INTO t1 VALUES(10);
disconnect con1;
connection con2;
# The bug was that, because of the LOCK TABLES, the handler "forgot" to commit,
# and the other commit when we write to the binlog was not done because of
# binlog-ignore-db
select * from t1;
drop table t1;
# binlog-ignore-db
SELECT * FROM t1;
DROP TABLE t1;
connection default;
disconnect con2;
# End of 4.1 tests
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
......@@ -613,6 +613,19 @@ ALTER TABLE m1 UNION=();
SHOW CREATE TABLE m1;
DROP TABLE t1, m1;
#
# BUG#32047 - 'Spurious' errors while opening MERGE tables
#
CREATE TABLE t1(a INT);
CREATE TABLE t2(a VARCHAR(10));
CREATE TABLE m1(a INT) ENGINE=MERGE UNION=(t1, t2);
CREATE TABLE m2(a INT) ENGINE=MERGE UNION=(t1);
SELECT * FROM t1;
--error ER_WRONG_MRG_TABLE
SELECT * FROM m1;
SELECT * FROM m2;
DROP TABLE t1, t2, m1, m2;
--echo End of 5.0 tests
#
......
This diff is collapsed.
......@@ -3,6 +3,10 @@
--source include/have_ssl.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
......@@ -21,38 +25,42 @@ connect (con2,localhost,ssl_user2,,,,,SSL);
connect (con3,localhost,ssl_user3,,,,,SSL);
connect (con4,localhost,ssl_user4,,,,,SSL);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (con5,localhost,ssl_user5,,,,,SSL);
connection con1;
# Check ssl turned on
SHOW STATUS LIKE 'Ssl_cipher';
select * from t1;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
delete from t1;
connection con2;
# Check ssl turned on
SHOW STATUS LIKE 'Ssl_cipher';
select * from t1;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
delete from t1;
connection con3;
# Check ssl turned on
SHOW STATUS LIKE 'Ssl_cipher';
select * from t1;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
delete from t1;
connection con4;
# Check ssl turned on
SHOW STATUS LIKE 'Ssl_cipher';
select * from t1;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
delete from t1;
connection default;
disconnect con1;
disconnect con2;
disconnect con3;
disconnect con4;
drop user ssl_user1@localhost, ssl_user2@localhost,
ssl_user3@localhost, ssl_user4@localhost, ssl_user5@localhost;
......@@ -97,7 +105,7 @@ drop table t1;
--exec $MYSQL_TEST --ssl-cert= --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
#
# BUG#21611 Slave can't connect when master-ssl-cipher specified
# Bug#21611 Slave can't connect when master-ssl-cipher specified
# - Apparently selecting a cipher doesn't work at all
# - Usa a cipher that both yaSSL and OpenSSL supports
#
......@@ -115,7 +123,7 @@ drop table t1;
--echo End of 5.0 tests
#
# Bug #26174 Server Crash: INSERT ... SELECT ... FROM I_S.GLOBAL_STATUS in
# Bug#26174 Server Crash: INSERT ... SELECT ... FROM I_S.GLOBAL_STATUS in
# Event (see also information_schema.test for the other part of test for
# this bug).
#
......@@ -171,7 +179,7 @@ SET GLOBAL event_scheduler=0;
--exec $MYSQL_TEST --ssl-cipher=UNKNOWN-CIPHER < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
#
# Bug #27669 mysqldump: SSL connection error when trying to connect
# Bug#27669 mysqldump: SSL connection error when trying to connect
#
CREATE TABLE t1(a int);
......@@ -190,10 +198,11 @@ INSERT INTO t1 VALUES (1), (2);
--exec $MYSQL_DUMP --skip-create --skip-comments --ssl --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test 2>&1
DROP TABLE t1;
--remove_file $MYSQLTEST_VARDIR/tmp/test.sql
#
# Bug#39172: Asking for DH+non-RSA key with server set to use other key caused
# YaSSL to crash the server.
# Bug#39172 Asking for DH+non-RSA key with server set to use other key caused
# YaSSL to crash the server.
#
# Common ciphers to openssl and yassl
......@@ -231,3 +240,6 @@ select 'is still running; no cipher request crashed the server' as result from d
##
--echo End of 5.1 tests
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
......@@ -5,6 +5,10 @@ eval set @tmpdir="../../tmp";
enable_query_log;
-- source include/have_outfile.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
#
# test of into outfile|dumpfile
#
......@@ -46,7 +50,7 @@ select load_file(concat(@tmpdir,"/outfile-test.not-exist"));
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.3
drop table t1;
# Bug#8191
# Bug#8191 SELECT INTO OUTFILE insists on FROM clause
disable_query_log;
eval select 1 into outfile "../../tmp/outfile-test.4";
enable_query_log;
......@@ -54,11 +58,11 @@ select load_file(concat(@tmpdir,"/outfile-test.4"));
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4
#
# Bug #5382: 'explain select into outfile' crashes the server
# Bug#5382 'explain select into outfile' crashes the server
#
CREATE TABLE t1 (a INT);
EXPLAIN
EXPLAIN
SELECT *
INTO OUTFILE '/tmp/t1.txt'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
......@@ -68,7 +72,7 @@ DROP TABLE t1;
# End of 4.1 tests
#
# Bug#13202 SELECT * INTO OUTFILE ... FROM information_schema.schemata now fails
# Bug#13202 SELECT * INTO OUTFILE ... FROM information_schema.schemata now fails
#
disable_query_log;
eval SELECT * INTO OUTFILE "../../tmp/outfile-test.4"
......@@ -114,6 +118,7 @@ from information_schema.schemata
where schema_name like 'mysqltest';
connection default;
disconnect con28181_1;
grant file on *.* to user_1@localhost;
connect (con28181_2,localhost,user_1,,mysqltest);
......@@ -125,9 +130,12 @@ from information_schema.schemata
where schema_name like 'mysqltest';
connection default;
disconnect con28181_2;
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4
use test;
revoke all privileges on *.* from user_1@localhost;
drop user user_1@localhost;
drop database mysqltest;
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
......@@ -324,7 +324,7 @@ insert into t1 (a, c) values (4, '2004-04-04 00:00:00'),
select * from t1;
drop table t1;
# End of 4.1 tests
--echo End of 4.1 tests
# Restore timezone to default
set time_zone= @@global.time_zone;
......@@ -339,3 +339,21 @@ PRIMARY KEY (`id`)
show fields from t1;
select is_nullable from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='t1' and COLUMN_NAME='posted_on';
drop table t1;
#
# Bug#41370: TIMESTAMP field does not accepts NULL from FROM_UNIXTIME()
#
CREATE TABLE t1 ( f1 INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
f2 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
f3 TIMESTAMP);
INSERT INTO t1 (f2,f3) VALUES (NOW(), "0000-00-00 00:00:00");
INSERT INTO t1 (f2,f3) VALUES (NOW(), NULL);
INSERT INTO t1 (f2,f3) VALUES (NOW(), ASCII(NULL));
INSERT INTO t1 (f2,f3) VALUES (NOW(), FROM_UNIXTIME('9999999999'));
INSERT INTO t1 (f2,f3) VALUES (NOW(), TIME(NULL));
UPDATE t1 SET f2=NOW(), f3=FROM_UNIXTIME('9999999999') WHERE f1=1;
SELECT f1,f2-f3 FROM t1;
DROP TABLE t1;
--echo End of 5.0 tests
......@@ -6,7 +6,7 @@ drop table if exists t1,t2;
--enable_warnings
#
# Bug #19263: variables.test doesn't clean up after itself (I/II -- save)
# Bug#19263: variables.test doesn't clean up after itself (I/II -- save)
#
set @my_binlog_cache_size =@@global.binlog_cache_size;
set @my_connect_timeout =@@global.connect_timeout;
......@@ -198,46 +198,46 @@ SELECT @@version_compile_os LIKE 'non-existent';
# The following should give errors
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set big_tables=OFFF;
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set big_tables="OFFF";
--error 1193
--error ER_UNKNOWN_SYSTEM_VARIABLE
set unknown_variable=1;
--error 1232
--error ER_WRONG_TYPE_FOR_VAR
set max_join_size="hello";
--error 1286
--error ER_UNKNOWN_STORAGE_ENGINE
set storage_engine=UNKNOWN_TABLE_TYPE;
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set storage_engine=MERGE, big_tables=2;
show local variables like 'storage_engine';
--error 1229
--error ER_GLOBAL_VARIABLE
set SESSION query_cache_size=10000;
--error 1230
--error ER_NO_DEFAULT
set GLOBAL storage_engine=DEFAULT;
--error 1115
--error ER_UNKNOWN_CHARACTER_SET
set character_set_client=UNKNOWN_CHARACTER_SET;
--error 1273
--error ER_UNKNOWN_COLLATION
set collation_connection=UNKNOWN_COLLATION;
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set character_set_client=NULL;
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set collation_connection=NULL;
--error 1228
--error ER_LOCAL_VARIABLE
set global autocommit=1;
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@global.timestamp;
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set @@version='';
--error 1229
--error ER_GLOBAL_VARIABLE
set @@concurrent_insert=1;
--error 1228
--error ER_LOCAL_VARIABLE
set @@global.sql_auto_is_null=1;
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@global.sql_auto_is_null;
--error 1229
--error ER_GLOBAL_VARIABLE
set myisam_max_sort_file_size=100;
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set @@SQL_WARNINGS=NULL;
# Test setting all variables
......@@ -368,23 +368,23 @@ drop table t1,t2;
# error conditions
#
--error 1193
--error ER_UNKNOWN_SYSTEM_VARIABLE
select @@xxxxxxxxxx;
select 1;
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@session.key_buffer_size;
--error 1229
--error ER_GLOBAL_VARIABLE
set ft_boolean_syntax = @@init_connect;
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set global ft_boolean_syntax = @@init_connect;
--error 1229
--error ER_GLOBAL_VARIABLE
set init_connect = NULL;
set global init_connect = NULL;
--error 1229
--error ER_GLOBAL_VARIABLE
set ft_boolean_syntax = @@init_connect;
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set global ft_boolean_syntax = @@init_connect;
# Bug#3754 SET GLOBAL myisam_max_sort_file_size doesn't work as
......@@ -417,15 +417,15 @@ select @a, @b;
#
# Bug#2586:Disallow global/session/local as structured var. instance names
#
--error 1064
--error ER_PARSE_ERROR
set @@global.global.key_buffer_size= 1;
--error 1064
--error ER_PARSE_ERROR
set GLOBAL global.key_buffer_size= 1;
--error 1064
--error ER_PARSE_ERROR
SELECT @@global.global.key_buffer_size;
--error 1064
--error ER_PARSE_ERROR
SELECT @@global.session.key_buffer_size;
--error 1064
--error ER_PARSE_ERROR
SELECT @@global.local.key_buffer_size;
# BUG#5135: cannot turn on log_warnings with SET in 4.1 (and 4.0)
......@@ -516,27 +516,27 @@ select @@lc_time_names;
--echo *** LC_TIME_NAMES: testing with string expressions
set lc_time_names=concat('de','_','DE');
select @@lc_time_names;
--error 1105
--error ER_UNKNOWN_ERROR
set lc_time_names=concat('de','+','DE');
select @@lc_time_names;
--echo LC_TIME_NAMES: testing with numeric expressions
set @@lc_time_names=1+2;
select @@lc_time_names;
--error 1232
--error ER_WRONG_TYPE_FOR_VAR
set @@lc_time_names=1/0;
select @@lc_time_names;
set lc_time_names=en_US;
--echo LC_TIME_NAMES: testing NULL and a negative number:
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set lc_time_names=NULL;
--error 1105
--error ER_UNKNOWN_ERROR
set lc_time_names=-1;
select @@lc_time_names;
--echo LC_TIME_NAMES: testing locale with the last ID:
set lc_time_names=108;
select @@lc_time_names;
--echo LC_TIME_NAMES: testing a number beyond the valid ID range:
--error 1105
--error ER_UNKNOWN_ERROR
set lc_time_names=109;
select @@lc_time_names;
--echo LC_TIME_NAMES: testing that 0 is en_US:
......@@ -578,7 +578,7 @@ select @@query_prealloc_size = @test;
# Bug#31588 buffer overrun when setting variables
#
# Buffer-size Off By One. Should throw valgrind-warning without fix #31588.
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set global sql_mode=repeat('a',80);
--echo End of 4.1 tests
......@@ -596,9 +596,9 @@ drop table t1;
# Bug #10339: read only variables.
#
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set @@warning_count=1;
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set @@global.error_count=1;
#
......@@ -616,9 +616,9 @@ select @@max_heap_table_size > 0;
# Bug #11775 Variable character_set_system does not exist (sometimes)
#
select @@character_set_system;
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set global character_set_system = latin1;
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set @@global.version_compile_os='234';
#
......@@ -729,7 +729,7 @@ select @@@;
# Don't actually output, since it depends on the system
--replace_column 1 #
select @@hostname;
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set @@hostname= "anothername";
--replace_column 2 #
show variables like 'hostname';
......
......@@ -575,5 +575,19 @@ SELECT ExtractValue(@xml, 'html/body');
SELECT ExtractValue('<xml "xxx" "yyy">CharData</xml>', '/xml');
SELECT ExtractValue('<xml xxx "yyy">CharData</xml>', '/xml');
#
# Bug#42495 updatexml: Assertion failed: xpath->context, file .\item_xmlfunc.cc, line 2507
#
set @x=10;
--error ER_UNKNOWN_ERROR
select extractvalue('<a></a>','$@x/a');
--error ER_UNKNOWN_ERROR
select extractvalue('<a></a>','round(123.4)/a');
--error ER_UNKNOWN_ERROR
select extractvalue('<a></a>','1/a');
--error ER_UNKNOWN_ERROR
select extractvalue('<a></a>','"b"/a');
--error ER_UNKNOWN_ERROR
select extractvalue('<a></a>','(1)/a');
--echo End of 5.1 tests
......@@ -212,6 +212,8 @@ copy_uca_collation(CHARSET_INFO *to, CHARSET_INFO *from)
to->max_sort_char= from->max_sort_char;
to->mbminlen= from->mbminlen;
to->mbmaxlen= from->mbmaxlen;
to->state|= MY_CS_AVAILABLE | MY_CS_LOADED |
MY_CS_STRNXFRM | MY_CS_UNICODE;
}
......@@ -246,14 +248,12 @@ static int add_collation(CHARSET_INFO *cs)
{
#if defined(HAVE_CHARSET_ucs2) && defined(HAVE_UCA_COLLATIONS)
copy_uca_collation(newcs, &my_charset_ucs2_unicode_ci);
newcs->state|= MY_CS_AVAILABLE | MY_CS_LOADED;
#endif
}
else if (!strcmp(cs->csname, "utf8"))
{
#if defined (HAVE_CHARSET_utf8) && defined(HAVE_UCA_COLLATIONS)
copy_uca_collation(newcs, &my_charset_utf8_unicode_ci);
newcs->state|= MY_CS_AVAILABLE | MY_CS_LOADED;
#endif
}
else
......
......@@ -1359,7 +1359,8 @@ void thr_downgrade_write_lock(THR_LOCK_DATA *in_data,
/* Upgrade a WRITE_DELAY lock to a WRITE_LOCK */
my_bool thr_upgrade_write_delay_lock(THR_LOCK_DATA *data)
my_bool thr_upgrade_write_delay_lock(THR_LOCK_DATA *data,
enum thr_lock_type new_lock_type)
{
THR_LOCK *lock=data->lock;
DBUG_ENTER("thr_upgrade_write_delay_lock");
......@@ -1372,7 +1373,7 @@ my_bool thr_upgrade_write_delay_lock(THR_LOCK_DATA *data)
}
check_locks(lock,"before upgrading lock",0);
/* TODO: Upgrade to TL_WRITE_CONCURRENT_INSERT in some cases */
data->type=TL_WRITE; /* Upgrade lock */
data->type= new_lock_type; /* Upgrade lock */
/* Check if someone has given us the lock */
if (!data->cond)
......@@ -1411,6 +1412,7 @@ my_bool thr_upgrade_write_delay_lock(THR_LOCK_DATA *data)
my_bool thr_reschedule_write_lock(THR_LOCK_DATA *data)
{
THR_LOCK *lock=data->lock;
enum thr_lock_type write_lock_type;
DBUG_ENTER("thr_reschedule_write_lock");
pthread_mutex_lock(&lock->mutex);
......@@ -1420,6 +1422,7 @@ my_bool thr_reschedule_write_lock(THR_LOCK_DATA *data)
DBUG_RETURN(0);
}
write_lock_type= data->type;
data->type=TL_WRITE_DELAYED;
if (lock->update_status)
(*lock->update_status)(data->status_param);
......@@ -1438,7 +1441,7 @@ my_bool thr_reschedule_write_lock(THR_LOCK_DATA *data)
free_all_read_locks(lock,0);
pthread_mutex_unlock(&lock->mutex);
DBUG_RETURN(thr_upgrade_write_delay_lock(data));
DBUG_RETURN(thr_upgrade_write_delay_lock(data, write_lock_type));
}
......
......@@ -293,7 +293,12 @@ sub start_mysqlds()
@groups = &find_groups($groupids);
for ($i = 0; defined($groups[$i]); $i++)
{
# Defaults are made explicit parameters to server execution...
@options = defaults_for_group($groups[$i]);
# ...so server MUST NOT try to read again from some config file, especially
# as the "right" file may be unknown to the server if we are using
# --defaults-file=... params in here.
unshift(@options,"--no-defaults");
$mysqld_found= 1; # The default
$mysqld_found= 0 if (!length($mysqld));
......
......@@ -47,7 +47,7 @@ $opt_machine=""; $opt_suffix="";
$opt_create_options=undef;
$opt_optimization="None";
$opt_hw="";
$opt_threads=5;
$opt_threads=-1;
if (!defined($opt_time_limit))
{
......@@ -68,6 +68,11 @@ $limits=merge_limits($server,$opt_cmp);
$date=date();
@estimated=(0.0,0.0,0.0); # For estimated time support
if ($opt_threads != -1)
{
print "WARNING: Option --threads is deprecated and has no effect\n"
}
if ($opt_hires)
{
eval "use Time::HiRes;";
......@@ -560,8 +565,8 @@ All benchmarks takes the following options:
Inform test suite that we are generate random inital values for sequence of
test executions. It should be used for imitation of real conditions.
--threads=# (Default 5)
Number of threads for multi-user benchmarks.
--threads=# **DEPRECATED**
This option has no effect, and will be removed in a future version.
--tcpip
Inform test suite that we are using TCP/IP to connect to the server. In
......
......@@ -327,7 +327,7 @@ int Item::save_time_in_field(Field *field)
{
MYSQL_TIME ltime;
if (get_time(&ltime))
return set_field_to_null(field);
return set_field_to_null_with_conversions(field, 0);
field->set_notnull();
return field->store_time(&ltime, MYSQL_TIMESTAMP_TIME);
}
......@@ -337,7 +337,7 @@ int Item::save_date_in_field(Field *field)
{
MYSQL_TIME ltime;
if (get_date(&ltime, TIME_FUZZY_DATE))
return set_field_to_null(field);
return set_field_to_null_with_conversions(field, 0);
field->set_notnull();
return field->store_time(&ltime, MYSQL_TIMESTAMP_DATETIME);
}
......@@ -1274,13 +1274,26 @@ Item::Type Item_name_const::type() const
valid_args guarantees value_item->basic_const_item(); if type is
FUNC_ITEM, then we have a fudged item_func_neg() on our hands
and return the underlying type.
For Item_func_set_collation()
e.g. NAME_CONST('name', 'value' COLLATE collation) we return its
'value' argument type.
*/
return valid_args ?
(((value_item->type() == FUNC_ITEM) &&
(((Item_func *) value_item)->functype() == Item_func::NEG_FUNC)) ?
((Item_func *) value_item)->key_item()->type() :
value_item->type()) :
NULL_ITEM;
if (!valid_args)
return NULL_ITEM;
Item::Type value_type= value_item->type();
if (value_type == FUNC_ITEM)
{
/*
The second argument of NAME_CONST('name', 'value') must be
a simple constant item or a NEG_FUNC/COLLATE_FUNC.
*/
DBUG_ASSERT(((Item_func *) value_item)->functype() ==
Item_func::NEG_FUNC ||
((Item_func *) value_item)->functype() ==
Item_func::COLLATE_FUNC);
return ((Item_func *) value_item)->key_item()->type();
}
return value_type;
}
......
......@@ -1969,6 +1969,13 @@ my_xpath_parse_FilterExpr_opt_slashes_RelativeLocationPath(MY_XPATH *xpath)
if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_SLASH))
return 1;
if (xpath->item->type() != Item::XPATH_NODESET)
{
xpath->lasttok= xpath->prevtok;
xpath->error= 1;
return 0;
}
my_xpath_parse_term(xpath, MY_XPATH_LEX_SLASH);
return my_xpath_parse_RelativeLocationPath(xpath);
}
......@@ -1976,7 +1983,6 @@ static int my_xpath_parse_PathExpr(MY_XPATH *xpath)
{
return my_xpath_parse_LocationPath(xpath) ||
my_xpath_parse_FilterExpr_opt_slashes_RelativeLocationPath(xpath);
}
......
......@@ -53,6 +53,8 @@
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
static int rows_event_stmt_cleanup(Relay_log_info const *rli, THD* thd);
static const char *HA_ERR(int i)
{
switch (i) {
......@@ -2894,7 +2896,37 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli,
DBUG_PRINT("info", ("log_pos: %lu", (ulong) log_pos));
clear_all_errors(thd, const_cast<Relay_log_info*>(rli));
const_cast<Relay_log_info*>(rli)->clear_tables_to_lock();
if (strcmp("COMMIT", query) == 0 && rli->tables_to_lock)
{
/*
Cleaning-up the last statement context:
the terminal event of the current statement flagged with
STMT_END_F got filtered out in ndb circular replication.
*/
int error;
char llbuff[22];
if ((error= rows_event_stmt_cleanup(const_cast<Relay_log_info*>(rli), thd)))
{
const_cast<Relay_log_info*>(rli)->report(ERROR_LEVEL, error,
"Error in cleaning up after an event preceeding the commit; "
"the group log file/position: %s %s",
const_cast<Relay_log_info*>(rli)->group_master_log_name,
llstr(const_cast<Relay_log_info*>(rli)->group_master_log_pos,
llbuff));
}
/*
Executing a part of rli->stmt_done() logics that does not deal
with group position change. The part is redundant now but is
future-change-proof addon, e.g if COMMIT handling will start checking
invariants like IN_STMT flag must be off at committing the transaction.
*/
const_cast<Relay_log_info*>(rli)->inc_event_relay_log_pos();
const_cast<Relay_log_info*>(rli)->clear_flag(Relay_log_info::IN_STMT);
}
else
{
const_cast<Relay_log_info*>(rli)->clear_tables_to_lock();
}
/*
Note: We do not need to execute reset_one_shot_variables() if this
......@@ -7403,16 +7435,20 @@ Rows_log_event::do_shall_skip(Relay_log_info *rli)
return Log_event::do_shall_skip(rli);
}
int
Rows_log_event::do_update_pos(Relay_log_info *rli)
{
DBUG_ENTER("Rows_log_event::do_update_pos");
int error= 0;
DBUG_PRINT("info", ("flags: %s",
get_flags(STMT_END_F) ? "STMT_END_F " : ""));
/**
The function is called at Rows_log_event statement commit time,
normally from Rows_log_event::do_update_pos() and possibly from
Query_log_event::do_apply_event() of the COMMIT.
The function commits the last statement for engines, binlog and
releases resources have been allocated for the statement.
@retval 0 Ok.
@retval non-zero Error at the commit.
*/
if (get_flags(STMT_END_F))
static int rows_event_stmt_cleanup(Relay_log_info const *rli, THD * thd)
{
int error;
{
/*
This is the end of a statement or transaction, so close (and
......@@ -7454,14 +7490,39 @@ Rows_log_event::do_update_pos(Relay_log_info *rli)
thd->reset_current_stmt_binlog_row_based();
rli->cleanup_context(thd, 0);
if (error == 0)
const_cast<Relay_log_info*>(rli)->cleanup_context(thd, 0);
}
return error;
}
/**
The method either increments the relay log position or
commits the current statement and increments the master group
possition if the event is STMT_END_F flagged and
the statement corresponds to the autocommit query (i.e replicated
without wrapping in BEGIN/COMMIT)
@retval 0 Success
@retval non-zero Error in the statement commit
*/
int
Rows_log_event::do_update_pos(Relay_log_info *rli)
{
DBUG_ENTER("Rows_log_event::do_update_pos");
int error= 0;
DBUG_PRINT("info", ("flags: %s",
get_flags(STMT_END_F) ? "STMT_END_F " : ""));
if (get_flags(STMT_END_F))
{
if ((error= rows_event_stmt_cleanup(rli, thd)) == 0)
{
/*
Indicate that a statement is finished.
Step the group log position if we are not in a transaction,
otherwise increase the event log position.
*/
*/
rli->stmt_done(log_pos, when);
/*
......@@ -7475,11 +7536,13 @@ Rows_log_event::do_update_pos(Relay_log_info *rli)
thd->clear_error();
}
else
{
rli->report(ERROR_LEVEL, error,
"Error in %s event: commit of row events failed, "
"table `%s`.`%s`",
get_type_str(), m_table->s->db.str,
m_table->s->table_name.str);
}
}
else
{
......
......@@ -1690,6 +1690,7 @@ public:
class Delayed_insert :public ilink {
uint locks_in_memory;
thr_lock_type delayed_lock;
public:
THD thd;
TABLE *table;
......@@ -1731,6 +1732,8 @@ public:
pthread_cond_init(&cond_client,NULL);
VOID(pthread_mutex_lock(&LOCK_thread_count));
delayed_insert_threads++;
delayed_lock= global_system_variables.low_priority_updates ?
TL_WRITE_LOW_PRIORITY : TL_WRITE;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
}
~Delayed_insert()
......@@ -2540,7 +2543,7 @@ bool Delayed_insert::handle_inserts(void)
table->use_all_columns();
thd_proc_info(&thd, "upgrading lock");
if (thr_upgrade_write_delay_lock(*thd.lock->locks))
if (thr_upgrade_write_delay_lock(*thd.lock->locks, delayed_lock))
{
/*
This can happen if thread is killed either by a shutdown
......
......@@ -3577,7 +3577,8 @@ ha_innobase::write_row(
/* out: error code */
uchar* record) /* in: a row in MySQL format */
{
int error = 0;
ulint error = 0;
int error_result= 0;
ibool auto_inc_used= FALSE;
ulint sql_command;
trx_t* trx = thd_to_trx(user_thd);
......@@ -3693,6 +3694,7 @@ no_commit:
}
/* MySQL errors are passed straight back. */
error_result = (int) error;
goto func_exit;
}
......@@ -3786,7 +3788,7 @@ set_max_autoinc:
err = innobase_set_max_autoinc(auto_inc);
if (err != DB_SUCCESS) {
error = (int) err;
error = err;
}
}
break;
......@@ -3796,12 +3798,12 @@ set_max_autoinc:
innodb_srv_conc_exit_innodb(prebuilt->trx);
report_error:
error = convert_error_code_to_mysql(error, user_thd);
error_result = convert_error_code_to_mysql((int) error, user_thd);
func_exit:
innobase_active_small();
DBUG_RETURN(error);
DBUG_RETURN(error_result);
}
/**************************************************************************
......
......@@ -47,6 +47,7 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
MI_INFO *isam=0;
uint found_merge_insert_method= 0;
size_t name_buff_length;
my_bool bad_children= FALSE;
DBUG_ENTER("myrg_open");
LINT_INIT(key_parts);
......@@ -97,13 +98,13 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
fn_format(buff, buff, "", "", 0);
if (!(isam=mi_open(buff,mode,(handle_locking?HA_OPEN_WAIT_IF_LOCKED:0))))
{
my_errno= HA_ERR_WRONG_MRG_TABLE_DEF;
if (handle_locking & HA_OPEN_FOR_REPAIR)
{
myrg_print_wrong_table(buff);
bad_children= TRUE;
continue;
}
goto err;
goto bad_children;
}
if (!m_info) /* First file */
{
......@@ -128,13 +129,13 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
files++;
if (m_info->reclength != isam->s->base.reclength)
{
my_errno=HA_ERR_WRONG_MRG_TABLE_DEF;
if (handle_locking & HA_OPEN_FOR_REPAIR)
{
myrg_print_wrong_table(buff);
bad_children= TRUE;
continue;
}
goto err;
goto bad_children;
}
m_info->options|= isam->s->options;
m_info->records+= isam->state->records;
......@@ -147,8 +148,8 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
m_info->tables);
}
if (my_errno == HA_ERR_WRONG_MRG_TABLE_DEF)
goto err;
if (bad_children)
goto bad_children;
if (!m_info && !(m_info= (MYRG_INFO*) my_malloc(sizeof(MYRG_INFO),
MYF(MY_WME | MY_ZEROFILL))))
goto err;
......@@ -178,12 +179,14 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
pthread_mutex_unlock(&THR_LOCK_open);
DBUG_RETURN(m_info);
bad_children:
my_errno= HA_ERR_WRONG_MRG_TABLE_DEF;
err:
save_errno=my_errno;
switch (errpos) {
case 3:
while (files)
mi_close(m_info->open_tables[--files].table);
(void) mi_close(m_info->open_tables[--files].table);
my_free((char*) m_info,MYF(0));
/* Fall through */
case 2:
......@@ -392,6 +395,7 @@ int myrg_attach_children(MYRG_INFO *m_info, int handle_locking,
uint child_nr;
uint key_parts;
uint min_keys;
my_bool bad_children= FALSE;
DBUG_ENTER("myrg_attach_children");
DBUG_PRINT("myrg", ("handle_locking: %d", handle_locking));
......@@ -441,13 +445,13 @@ int myrg_attach_children(MYRG_INFO *m_info, int handle_locking,
DBUG_PRINT("error", ("definition mismatch table: '%s' repair: %d",
myisam->filename,
(handle_locking & HA_OPEN_FOR_REPAIR)));
my_errno= HA_ERR_WRONG_MRG_TABLE_DEF;
if (handle_locking & HA_OPEN_FOR_REPAIR)
{
myrg_print_wrong_table(myisam->filename);
bad_children= TRUE;
continue;
}
goto err;
goto bad_children;
}
m_info->options|= myisam->s->options;
......@@ -462,6 +466,9 @@ int myrg_attach_children(MYRG_INFO *m_info, int handle_locking,
child_nr++;
}
if (bad_children)
goto bad_children;
/* Note: callback() resets my_errno, so it is safe to check it here */
if (my_errno == HA_ERR_WRONG_MRG_TABLE_DEF)
goto err;
if (sizeof(my_off_t) == 4 && file_offset > (ulonglong) (ulong) ~0L)
......@@ -477,6 +484,8 @@ int myrg_attach_children(MYRG_INFO *m_info, int handle_locking,
pthread_mutex_unlock(&m_info->mutex);
DBUG_RETURN(0);
bad_children:
my_errno= HA_ERR_WRONG_MRG_TABLE_DEF;
err:
save_errno= my_errno;
switch (errpos) {
......
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