mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
merged 5.0-bugteam -> bug 33811-5.0-bugteam working tree
This commit is contained in:
@@ -1359,4 +1359,34 @@ tt
|
||||
41
|
||||
SET sql_mode=@save_sql_mode;
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# BUG#38072: Wrong result: HAVING not observed in a query with aggregate
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
pk int(11) NOT NULL AUTO_INCREMENT,
|
||||
int_nokey int(11) NOT NULL,
|
||||
int_key int(11) NOT NULL,
|
||||
varchar_key varchar(1) NOT NULL,
|
||||
varchar_nokey varchar(1) NOT NULL,
|
||||
PRIMARY KEY (pk),
|
||||
KEY int_key (int_key),
|
||||
KEY varchar_key (varchar_key)
|
||||
);
|
||||
INSERT INTO t1 VALUES
|
||||
(1,5,5, 'h','h'),
|
||||
(2,1,1, '{','{'),
|
||||
(3,1,1, 'z','z'),
|
||||
(4,8,8, 'x','x'),
|
||||
(5,7,7, 'o','o'),
|
||||
(6,3,3, 'p','p'),
|
||||
(7,9,9, 'c','c'),
|
||||
(8,0,0, 'k','k'),
|
||||
(9,6,6, 't','t'),
|
||||
(10,0,0,'c','c');
|
||||
explain SELECT COUNT(varchar_key) AS X FROM t1 WHERE pk = 8 having 'foo'='bar';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING
|
||||
SELECT COUNT(varchar_key) AS X FROM t1 WHERE pk = 8 having 'foo'='bar';
|
||||
X
|
||||
drop table t1;
|
||||
End of 5.0 tests
|
||||
|
@@ -1076,3 +1076,19 @@ set session max_sort_length= 2180;
|
||||
select * from t1 order by b;
|
||||
ERROR HY001: Out of sort memory; increase server sort buffer size
|
||||
drop table t1;
|
||||
#
|
||||
# Bug #39844: Query Crash Mysql Server 5.0.67
|
||||
#
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY);
|
||||
CREATE TABLE t2 (a INT PRIMARY KEY, b INT);
|
||||
CREATE TABLE t3 (c INT);
|
||||
INSERT INTO t1 (a) VALUES (1), (2);
|
||||
INSERT INTO t2 (a,b) VALUES (1,2), (2,3);
|
||||
INSERT INTO t3 (c) VALUES (1), (2);
|
||||
SELECT
|
||||
(SELECT t1.a FROM t1, t2 WHERE t1.a = t2.b AND t2.a = t3.c ORDER BY t1.a)
|
||||
FROM t3;
|
||||
(SELECT t1.a FROM t1, t2 WHERE t1.a = t2.b AND t2.a = t3.c ORDER BY t1.a)
|
||||
2
|
||||
NULL
|
||||
DROP TABLE t1, t2, t3;
|
||||
|
@@ -20,5 +20,36 @@ master_password='',master_port=SLAVE_PORT;
|
||||
start slave;
|
||||
flush logs;
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
# 127.0.0.1 root SLAVE_PORT 60 slave-bin.000001 208 # # slave-bin.000001 Yes Yes 0 0 208 # None 0 No #
|
||||
Slave_IO_State #
|
||||
Master_Host 127.0.0.1
|
||||
Master_User root
|
||||
Master_Port MASTER_PORT
|
||||
Connect_Retry 1
|
||||
Master_Log_File master-bin.000001
|
||||
Read_Master_Log_Pos 98
|
||||
Relay_Log_File #
|
||||
Relay_Log_Pos #
|
||||
Relay_Master_Log_File master-bin.000001
|
||||
Slave_IO_Running Yes
|
||||
Slave_SQL_Running Yes
|
||||
Replicate_Do_DB
|
||||
Replicate_Ignore_DB
|
||||
Replicate_Do_Table
|
||||
Replicate_Ignore_Table #
|
||||
Replicate_Wild_Do_Table
|
||||
Replicate_Wild_Ignore_Table
|
||||
Last_Errno 0
|
||||
Last_Error
|
||||
Skip_Counter 0
|
||||
Exec_Master_Log_Pos 98
|
||||
Relay_Log_Space #
|
||||
Until_Condition None
|
||||
Until_Log_File
|
||||
Until_Log_Pos 0
|
||||
Master_SSL_Allowed No
|
||||
Master_SSL_CA_File
|
||||
Master_SSL_CA_Path
|
||||
Master_SSL_Cert
|
||||
Master_SSL_Cipher
|
||||
Master_SSL_Key
|
||||
Seconds_Behind_Master #
|
||||
|
64
mysql-test/r/status2.result
Normal file
64
mysql-test/r/status2.result
Normal file
@@ -0,0 +1,64 @@
|
||||
#
|
||||
# Bug#24289 Status Variable "Questions" gets wrong values with Stored Routines
|
||||
#
|
||||
FLUSH STATUS;
|
||||
DROP TABLE IF EXISTS t1,t2;
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
DROP FUNCTION IF EXISTS f1;
|
||||
CREATE FUNCTION f1() RETURNS INTEGER
|
||||
BEGIN
|
||||
DECLARE foo INTEGER;
|
||||
DECLARE bar INTEGER;
|
||||
SET foo=1;
|
||||
SET bar=2;
|
||||
RETURN foo;
|
||||
END $$
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
SELECT 1;
|
||||
END $$
|
||||
CREATE TABLE t1 (c1 INT);
|
||||
CREATE TABLE t2 (c1 INT);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
Assert Questions == 9
|
||||
SHOW STATUS LIKE 'Questions';
|
||||
Variable_name Value
|
||||
Questions 9
|
||||
SELECT f1();
|
||||
f1()
|
||||
1
|
||||
Assert Questions == 11
|
||||
SHOW STATUS LIKE 'Questions';
|
||||
Variable_name Value
|
||||
Questions 11
|
||||
CALL p1();
|
||||
1
|
||||
1
|
||||
Assert Questions == 13
|
||||
SHOW STATUS LIKE 'Questions';
|
||||
Variable_name Value
|
||||
Questions 13
|
||||
SELECT 1;
|
||||
1
|
||||
1
|
||||
Assert Questions == 15
|
||||
SHOW STATUS LIKE 'Questions';
|
||||
Variable_name Value
|
||||
Questions 15
|
||||
FLUSH STATUS;
|
||||
SELECT 1;
|
||||
1
|
||||
1
|
||||
Assert Questions == 16
|
||||
SHOW STATUS LIKE 'Questions';
|
||||
Variable_name Value
|
||||
Questions 16
|
||||
Global status updated; Assert diff == 4
|
||||
FLUSH STATUS;
|
||||
SELECT 4;
|
||||
4
|
||||
4
|
||||
DROP TABLE t1,t2;
|
||||
DROP PROCEDURE p1;
|
||||
DROP FUNCTION f1;
|
||||
End of 6.0 tests
|
@@ -3677,6 +3677,8 @@ DROP VIEW v1;
|
||||
|
||||
# -- End of test case for Bug#35193.
|
||||
|
||||
CREATE VIEW v1 AS SELECT 1;
|
||||
DROP VIEW v1;
|
||||
# -----------------------------------------------------------------
|
||||
# -- End of 5.0 tests.
|
||||
# -----------------------------------------------------------------
|
||||
|
@@ -18,4 +18,5 @@ EXPLAIN SELECT * FROM t1 WHERE b = (SELECT max(2));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests.
|
||||
|
@@ -55,3 +55,23 @@ select * from t1;
|
||||
a
|
||||
20
|
||||
drop table t1;
|
||||
drop table if exists t1;
|
||||
create table t1(a int, b int, c varchar(20), primary key(a)) engine = innodb;
|
||||
insert into t1 values(1, 1, 'a');
|
||||
insert into t1 values(2, 2, 'b');
|
||||
xa start 'a','b';
|
||||
update t1 set c = 'aa' where a = 1;
|
||||
xa start 'a','c';
|
||||
update t1 set c = 'bb' where a = 2;
|
||||
update t1 set c = 'bb' where a = 2;
|
||||
update t1 set c = 'aa' where a = 1;
|
||||
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2
|
||||
xa end 'a','c';
|
||||
ERROR XA102: XA_RBDEADLOCK: Transaction branch was rolled back: deadlock was detected
|
||||
xa rollback 'a','c';
|
||||
xa start 'a','c';
|
||||
drop table t1;
|
||||
End of 5.0 tests
|
||||
|
@@ -1010,4 +1010,33 @@ select (select sum(outr.a + t1.a) from t1 limit 1) as tt from t1 as outr order b
|
||||
SET sql_mode=@save_sql_mode;
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo #
|
||||
--echo # BUG#38072: Wrong result: HAVING not observed in a query with aggregate
|
||||
--echo #
|
||||
CREATE TABLE t1 (
|
||||
pk int(11) NOT NULL AUTO_INCREMENT,
|
||||
int_nokey int(11) NOT NULL,
|
||||
int_key int(11) NOT NULL,
|
||||
varchar_key varchar(1) NOT NULL,
|
||||
varchar_nokey varchar(1) NOT NULL,
|
||||
PRIMARY KEY (pk),
|
||||
KEY int_key (int_key),
|
||||
KEY varchar_key (varchar_key)
|
||||
);
|
||||
INSERT INTO t1 VALUES
|
||||
(1,5,5, 'h','h'),
|
||||
(2,1,1, '{','{'),
|
||||
(3,1,1, 'z','z'),
|
||||
(4,8,8, 'x','x'),
|
||||
(5,7,7, 'o','o'),
|
||||
(6,3,3, 'p','p'),
|
||||
(7,9,9, 'c','c'),
|
||||
(8,0,0, 'k','k'),
|
||||
(9,6,6, 't','t'),
|
||||
(10,0,0,'c','c');
|
||||
|
||||
explain SELECT COUNT(varchar_key) AS X FROM t1 WHERE pk = 8 having 'foo'='bar';
|
||||
SELECT COUNT(varchar_key) AS X FROM t1 WHERE pk = 8 having 'foo'='bar';
|
||||
drop table t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@@ -738,3 +738,21 @@ set session max_sort_length= 2180;
|
||||
select * from t1 order by b;
|
||||
drop table t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Bug #39844: Query Crash Mysql Server 5.0.67
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY);
|
||||
CREATE TABLE t2 (a INT PRIMARY KEY, b INT);
|
||||
CREATE TABLE t3 (c INT);
|
||||
|
||||
INSERT INTO t1 (a) VALUES (1), (2);
|
||||
INSERT INTO t2 (a,b) VALUES (1,2), (2,3);
|
||||
INSERT INTO t3 (c) VALUES (1), (2);
|
||||
|
||||
SELECT
|
||||
(SELECT t1.a FROM t1, t2 WHERE t1.a = t2.b AND t2.a = t3.c ORDER BY t1.a)
|
||||
FROM t3;
|
||||
|
||||
DROP TABLE t1, t2, t3;
|
||||
|
@@ -12,16 +12,27 @@ stop slave;
|
||||
eval change master to master_host='127.0.0.1',master_user='root',
|
||||
master_password='',master_port=$MASTER_MYPORT;
|
||||
start slave;
|
||||
|
||||
connection master;
|
||||
--replace_result $SLAVE_MYPORT SLAVE_PORT
|
||||
eval change master to master_host='127.0.0.1',master_user='root',
|
||||
master_password='',master_port=$SLAVE_MYPORT;
|
||||
start slave;
|
||||
sleep 5;
|
||||
--source include/wait_for_slave_to_start.inc
|
||||
|
||||
# Calculate file name of relay log after flush logs
|
||||
let $relay_file= query_get_value(show slave status, Relay_Log_File,1);
|
||||
let $relay_name= `select substring_index('$relay_file','.',1);`;
|
||||
let $relay_index= `select substring_index('$relay_file','.',-1);`;
|
||||
let $relay_index_len= `select length(substring_index('$relay_file','.',-1));`;
|
||||
let $relay_index_next=`select $relay_index+1`;
|
||||
let $relay_file=`select concat('$relay_name','.',repeat('0',($relay_index_len-length($relay_index_next))),$relay_index_next);`;
|
||||
flush logs;
|
||||
sleep 5;
|
||||
--replace_result $SLAVE_MYPORT SLAVE_PORT
|
||||
--replace_column 1 # 8 # 9 # 23 # 33 #
|
||||
show slave status;
|
||||
let $slave_param= Relay_Log_File;
|
||||
let $slave_param_value= $relay_file;
|
||||
source include/wait_for_slave_param.inc;
|
||||
--replace_result $SLAVE_MYPORT SLAVE_PORT $MASTER_MYPORT MASTER_PORT
|
||||
--replace_column 1 # 8 # 9 # 16 # 23 # 33 # 34 # 35 #
|
||||
--query_vertical show slave status
|
||||
|
||||
# End of 4.1 tests
|
||||
|
64
mysql-test/t/status2.test
Normal file
64
mysql-test/t/status2.test
Normal file
@@ -0,0 +1,64 @@
|
||||
--echo #
|
||||
--echo # Bug#24289 Status Variable "Questions" gets wrong values with Stored Routines
|
||||
--echo #
|
||||
# The bogus connection below is needed to make the gobal statement count
|
||||
# deterministic when the test is run for the first time.
|
||||
connect (con1,localhost,root,,);
|
||||
connection con1;
|
||||
connection default;
|
||||
disconnect con1;
|
||||
FLUSH STATUS;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1,t2;
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
DROP FUNCTION IF EXISTS f1;
|
||||
--enable_warnings
|
||||
DELIMITER $$;
|
||||
CREATE FUNCTION f1() RETURNS INTEGER
|
||||
BEGIN
|
||||
DECLARE foo INTEGER;
|
||||
DECLARE bar INTEGER;
|
||||
SET foo=1;
|
||||
SET bar=2;
|
||||
RETURN foo;
|
||||
END $$
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
SELECT 1;
|
||||
END $$
|
||||
DELIMITER ;$$
|
||||
CREATE TABLE t1 (c1 INT);
|
||||
CREATE TABLE t2 (c1 INT);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
--echo Assert Questions == 9
|
||||
SHOW STATUS LIKE 'Questions';
|
||||
SELECT f1();
|
||||
--echo Assert Questions == 11
|
||||
SHOW STATUS LIKE 'Questions';
|
||||
CALL p1();
|
||||
--echo Assert Questions == 13
|
||||
SHOW STATUS LIKE 'Questions';
|
||||
SELECT 1;
|
||||
--echo Assert Questions == 15
|
||||
SHOW STATUS LIKE 'Questions';
|
||||
connect (con1,localhost,root,,);
|
||||
connection con1;
|
||||
FLUSH STATUS;
|
||||
let $org_questions= `SHOW GLOBAL STATUS LIKE 'questions'`;
|
||||
SELECT 1;
|
||||
connection default;
|
||||
--echo Assert Questions == 16
|
||||
SHOW STATUS LIKE 'Questions';
|
||||
--echo Global status updated; Assert diff == 4
|
||||
FLUSH STATUS;
|
||||
let $new_questions= `SHOW GLOBAL STATUS LIKE 'questions'`;
|
||||
--disable_log
|
||||
let $diff= `SELECT SUBSTRING('$new_questions',10)-SUBSTRING('$org_questions',10)`;
|
||||
--enable_log
|
||||
eval SELECT $diff;
|
||||
disconnect con1;
|
||||
DROP TABLE t1,t2;
|
||||
DROP PROCEDURE p1;
|
||||
DROP FUNCTION f1;
|
||||
--echo End of 6.0 tests
|
||||
|
@@ -3560,6 +3560,15 @@ DROP VIEW v1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
#
|
||||
# Bug#39040: valgrind errors/crash when creating views with binlog logging
|
||||
# enabled
|
||||
#
|
||||
# Bug is visible only when running in valgrind with binary logging.
|
||||
CREATE VIEW v1 AS SELECT 1;
|
||||
DROP VIEW v1;
|
||||
|
||||
|
||||
--echo # -----------------------------------------------------------------
|
||||
--echo # -- End of 5.0 tests.
|
||||
--echo # -----------------------------------------------------------------
|
||||
|
1
mysql-test/t/windows.test
Normal file → Executable file
1
mysql-test/t/windows.test
Normal file → Executable file
@@ -33,5 +33,6 @@ drop table t1;
|
||||
#
|
||||
CREATE TABLE t1 (a int, b int); INSERT INTO t1 VALUES (1,1);
|
||||
EXPLAIN SELECT * FROM t1 WHERE b = (SELECT max(2));
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
@@ -74,3 +74,48 @@ xa start 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz';
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
disconnect con1;
|
||||
|
||||
#
|
||||
# Bug#28323: Server crashed in xid cache operations
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
create table t1(a int, b int, c varchar(20), primary key(a)) engine = innodb;
|
||||
insert into t1 values(1, 1, 'a');
|
||||
insert into t1 values(2, 2, 'b');
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
connect (con2,localhost,root,,);
|
||||
|
||||
--connection con1
|
||||
xa start 'a','b';
|
||||
update t1 set c = 'aa' where a = 1;
|
||||
--connection con2
|
||||
xa start 'a','c';
|
||||
update t1 set c = 'bb' where a = 2;
|
||||
--connection con1
|
||||
--send update t1 set c = 'bb' where a = 2
|
||||
--connection con2
|
||||
--sleep 1
|
||||
--error ER_LOCK_DEADLOCK
|
||||
update t1 set c = 'aa' where a = 1;
|
||||
select count(*) from t1;
|
||||
--error ER_XA_RBDEADLOCK
|
||||
xa end 'a','c';
|
||||
xa rollback 'a','c';
|
||||
--disconnect con2
|
||||
|
||||
connect (con3,localhost,root,,);
|
||||
--connection con3
|
||||
xa start 'a','c';
|
||||
|
||||
--disconnect con1
|
||||
--disconnect con3
|
||||
--connection default
|
||||
drop table t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@@ -319,6 +319,14 @@
|
||||
fun:_dl_map_object
|
||||
}
|
||||
|
||||
{
|
||||
libc pthread_exit 8
|
||||
Memcheck:Leak
|
||||
fun:malloc
|
||||
fun:local_strdup
|
||||
fun:_dl_map_object
|
||||
fun:dl_open_worker
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
|
@@ -28,9 +28,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_SOURCE_DIR}/bdb/build_win32
|
||||
${CMAKE_SOURCE_DIR}/bdb/dbinc)
|
||||
|
||||
SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/sql/message.rc
|
||||
${CMAKE_SOURCE_DIR}/sql/message.h
|
||||
${CMAKE_SOURCE_DIR}/sql/sql_yacc.h
|
||||
SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/sql/sql_yacc.h
|
||||
${CMAKE_SOURCE_DIR}/sql/sql_yacc.cc
|
||||
${CMAKE_SOURCE_DIR}/include/mysql_version.h
|
||||
${CMAKE_SOURCE_DIR}/sql/lex_hash.h
|
||||
@@ -120,13 +118,6 @@ ADD_CUSTOM_COMMAND(
|
||||
DEPENDS ${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc
|
||||
)
|
||||
|
||||
# Windows message file
|
||||
ADD_CUSTOM_COMMAND(
|
||||
SOURCE ${PROJECT_SOURCE_DIR}/sql/message.mc
|
||||
OUTPUT message.rc message.h
|
||||
COMMAND mc ARGS ${PROJECT_SOURCE_DIR}/sql/message.mc
|
||||
DEPENDS ${PROJECT_SOURCE_DIR}/sql/message.mc)
|
||||
|
||||
# Gen_lex_hash
|
||||
# About "mysqlclient_notls", see note in "client/CMakeLists.txt"
|
||||
ADD_EXECUTABLE(gen_lex_hash gen_lex_hash.cc)
|
||||
@@ -141,7 +132,7 @@ ADD_DEPENDENCIES(mysqld${MYSQLD_EXE_SUFFIX} gen_lex_hash)
|
||||
|
||||
# Remove the auto-generated files as part of 'Clean Solution'
|
||||
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
|
||||
"lex_hash.h;message.rc;message.h;sql_yacc.h;sql_yacc.cc")
|
||||
"lex_hash.h;sql_yacc.h;sql_yacc.cc")
|
||||
|
||||
ADD_LIBRARY(udf_example MODULE udf_example.c udf_example.def)
|
||||
ADD_DEPENDENCIES(udf_example strings)
|
||||
|
BIN
sql/MSG00001.bin
Normal file
BIN
sql/MSG00001.bin
Normal file
Binary file not shown.
@@ -118,7 +118,8 @@ DEFS = -DMYSQL_SERVER \
|
||||
|
||||
BUILT_SOURCES = sql_yacc.cc sql_yacc.h lex_hash.h
|
||||
EXTRA_DIST = $(BUILT_SOURCES) nt_servc.cc nt_servc.h \
|
||||
message.mc examples/CMakeLists.txt CMakeLists.txt \
|
||||
message.mc message.h message.rc MSG00001.bin \
|
||||
examples/CMakeLists.txt CMakeLists.txt \
|
||||
udf_example.c udf_example.def
|
||||
DISTCLEANFILES = lex_hash.h sql_yacc.output
|
||||
|
||||
|
@@ -817,7 +817,12 @@ int ha_rollback_trans(THD *thd, bool all)
|
||||
trans->nht=0;
|
||||
trans->no_2pc=0;
|
||||
if (is_real_trans)
|
||||
{
|
||||
if (thd->transaction_rollback_request)
|
||||
thd->transaction.xid_state.rm_error= thd->net.last_errno;
|
||||
else
|
||||
thd->transaction.xid_state.xid.null();
|
||||
}
|
||||
if (all)
|
||||
{
|
||||
thd->variables.tx_isolation=thd->session_tx_isolation;
|
||||
|
55
sql/message.h
Normal file
55
sql/message.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
To change or add messages mysqld writes to the Windows error log, run
|
||||
mc.exe message.mc
|
||||
and checkin generated messages.h, messages.rc and msg000001.bin under the
|
||||
source control.
|
||||
mc.exe can be installed with Windows SDK, some Visual Studio distributions
|
||||
do not include it.
|
||||
*/
|
||||
//
|
||||
// Values are 32 bit values layed out as follows:
|
||||
//
|
||||
// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
|
||||
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
||||
// +---+-+-+-----------------------+-------------------------------+
|
||||
// |Sev|C|R| Facility | Code |
|
||||
// +---+-+-+-----------------------+-------------------------------+
|
||||
//
|
||||
// where
|
||||
//
|
||||
// Sev - is the severity code
|
||||
//
|
||||
// 00 - Success
|
||||
// 01 - Informational
|
||||
// 10 - Warning
|
||||
// 11 - Error
|
||||
//
|
||||
// C - is the Customer code flag
|
||||
//
|
||||
// R - is a reserved bit
|
||||
//
|
||||
// Facility - is the facility code
|
||||
//
|
||||
// Code - is the facility's status code
|
||||
//
|
||||
//
|
||||
// Define the facility codes
|
||||
//
|
||||
|
||||
|
||||
//
|
||||
// Define the severity codes
|
||||
//
|
||||
|
||||
|
||||
//
|
||||
// MessageId: MSG_DEFAULT
|
||||
//
|
||||
// MessageText:
|
||||
//
|
||||
// %1For more information, see Help and Support Center at http://www.mysql.com.
|
||||
//
|
||||
//
|
||||
//
|
||||
#define MSG_DEFAULT 0xC0000064L
|
||||
|
@@ -1,3 +1,11 @@
|
||||
;/*
|
||||
; To change or add messages mysqld writes to the Windows error log, run
|
||||
; mc.exe message.mc
|
||||
; and checkin generated messages.h, messages.rc and msg000001.bin under the
|
||||
; source control.
|
||||
; mc.exe can be installed with Windows SDK, some Visual Studio distributions
|
||||
; do not include it.
|
||||
;*/
|
||||
MessageId = 100
|
||||
Severity = Error
|
||||
Facility = Application
|
||||
|
2
sql/message.rc
Normal file
2
sql/message.rc
Normal file
@@ -0,0 +1,2 @@
|
||||
LANGUAGE 0x9,0x1
|
||||
1 11 MSG00001.bin
|
@@ -6573,7 +6573,9 @@ struct show_var_st status_vars[]= {
|
||||
{"Qcache_queries_in_cache", (char*) &query_cache.queries_in_cache, SHOW_LONG_CONST},
|
||||
{"Qcache_total_blocks", (char*) &query_cache.total_blocks, SHOW_LONG_CONST},
|
||||
#endif /*HAVE_QUERY_CACHE*/
|
||||
{"Questions", (char*) 0, SHOW_QUESTION},
|
||||
{"Questions", (char*) offsetof(STATUS_VAR, questions),
|
||||
SHOW_LONG_STATUS},
|
||||
|
||||
{"Rpl_status", (char*) 0, SHOW_RPL_STATUS},
|
||||
{"Select_full_join", (char*) offsetof(STATUS_VAR, select_full_join_count), SHOW_LONG_STATUS},
|
||||
{"Select_full_range_join", (char*) offsetof(STATUS_VAR, select_full_range_join_count), SHOW_LONG_STATUS},
|
||||
|
@@ -5645,3 +5645,7 @@ ER_LOAD_DATA_INVALID_COLUMN
|
||||
eng "Invalid column reference (%-.64s) in LOAD DATA"
|
||||
ER_LOG_PURGE_NO_FILE
|
||||
eng "Being purged log %s was not found"
|
||||
ER_XA_RBTIMEOUT XA106
|
||||
eng "XA_RBTIMEOUT: Transaction branch was rolled back: took too long"
|
||||
ER_XA_RBDEADLOCK XA102
|
||||
eng "XA_RBDEADLOCK: Transaction branch was rolled back: deadlock was detected"
|
||||
|
@@ -664,10 +664,17 @@ typedef struct system_status_var
|
||||
ulong com_stmt_fetch;
|
||||
ulong com_stmt_reset;
|
||||
ulong com_stmt_close;
|
||||
/*
|
||||
Number of statements sent from the client
|
||||
*/
|
||||
ulong questions;
|
||||
|
||||
/*
|
||||
Status variables which it does not make sense to add to
|
||||
global status variable counter
|
||||
IMPORTANT!
|
||||
SEE last_system_status_var DEFINITION BELOW.
|
||||
|
||||
Below 'last_system_status_var' are all variables which doesn't make any
|
||||
sense to add to the /global/ status variable counter.
|
||||
*/
|
||||
double last_query_cost;
|
||||
} STATUS_VAR;
|
||||
@@ -678,7 +685,7 @@ typedef struct system_status_var
|
||||
counter
|
||||
*/
|
||||
|
||||
#define last_system_status_var com_stmt_close
|
||||
#define last_system_status_var questions
|
||||
|
||||
|
||||
void free_tmp_table(THD *thd, TABLE *entry);
|
||||
@@ -920,7 +927,7 @@ struct st_savepoint {
|
||||
uint length, nht;
|
||||
};
|
||||
|
||||
enum xa_states {XA_NOTR=0, XA_ACTIVE, XA_IDLE, XA_PREPARED};
|
||||
enum xa_states {XA_NOTR=0, XA_ACTIVE, XA_IDLE, XA_PREPARED, XA_ROLLBACK_ONLY};
|
||||
extern const char *xa_state_names[];
|
||||
|
||||
typedef struct st_xid_state {
|
||||
@@ -928,6 +935,8 @@ typedef struct st_xid_state {
|
||||
XID xid; // transaction identifier
|
||||
enum xa_states xa_state; // used by external XA only
|
||||
bool in_thd;
|
||||
/* Error reported by the Resource Manager (RM) to the Transaction Manager. */
|
||||
uint rm_error;
|
||||
} XID_STATE;
|
||||
|
||||
extern pthread_mutex_t LOCK_xid_cache;
|
||||
|
@@ -2585,6 +2585,11 @@ bool Delayed_insert::handle_inserts(void)
|
||||
/* Remove all not used rows */
|
||||
while ((row=rows.get()))
|
||||
{
|
||||
if (table->s->blob_fields)
|
||||
{
|
||||
memcpy(table->record[0],row->record,table->s->reclength);
|
||||
free_delayed_insert_blobs(table);
|
||||
}
|
||||
delete row;
|
||||
thread_safe_increment(delayed_insert_errors,&LOCK_delayed_status);
|
||||
stacked_inserts--;
|
||||
|
@@ -90,9 +90,57 @@ const char *command_name[]={
|
||||
};
|
||||
|
||||
const char *xa_state_names[]={
|
||||
"NON-EXISTING", "ACTIVE", "IDLE", "PREPARED"
|
||||
"NON-EXISTING", "ACTIVE", "IDLE", "PREPARED", "ROLLBACK ONLY"
|
||||
};
|
||||
|
||||
/**
|
||||
Mark a XA transaction as rollback-only if the RM unilaterally
|
||||
rolled back the transaction branch.
|
||||
|
||||
@note If a rollback was requested by the RM, this function sets
|
||||
the appropriate rollback error code and transits the state
|
||||
to XA_ROLLBACK_ONLY.
|
||||
|
||||
@return TRUE if transaction was rolled back or if the transaction
|
||||
state is XA_ROLLBACK_ONLY. FALSE otherwise.
|
||||
*/
|
||||
static bool xa_trans_rolled_back(XID_STATE *xid_state)
|
||||
{
|
||||
if (xid_state->rm_error)
|
||||
{
|
||||
switch (xid_state->rm_error) {
|
||||
case ER_LOCK_WAIT_TIMEOUT:
|
||||
my_error(ER_XA_RBTIMEOUT, MYF(0));
|
||||
break;
|
||||
case ER_LOCK_DEADLOCK:
|
||||
my_error(ER_XA_RBDEADLOCK, MYF(0));
|
||||
break;
|
||||
default:
|
||||
my_error(ER_XA_RBROLLBACK, MYF(0));
|
||||
}
|
||||
xid_state->xa_state= XA_ROLLBACK_ONLY;
|
||||
}
|
||||
|
||||
return (xid_state->xa_state == XA_ROLLBACK_ONLY);
|
||||
}
|
||||
|
||||
/**
|
||||
Rollback work done on behalf of at ransaction branch.
|
||||
*/
|
||||
static bool xa_trans_rollback(THD *thd)
|
||||
{
|
||||
bool status= test(ha_rollback(thd));
|
||||
|
||||
thd->options&= ~(ulong) OPTION_BEGIN;
|
||||
thd->transaction.all.modified_non_trans_table= FALSE;
|
||||
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
||||
xid_cache_delete(&thd->transaction.xid_state);
|
||||
thd->transaction.xid_state.xa_state= XA_NOTR;
|
||||
thd->transaction.xid_state.rm_error= 0;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
static bool do_command(THD *thd);
|
||||
#endif // EMBEDDED_LIBRARY
|
||||
@@ -1690,8 +1738,24 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
thd->set_time();
|
||||
VOID(pthread_mutex_lock(&LOCK_thread_count));
|
||||
thd->query_id= global_query_id;
|
||||
if (command != COM_STATISTICS && command != COM_PING)
|
||||
|
||||
switch( command ) {
|
||||
/* Ignore these statements. */
|
||||
case COM_STATISTICS:
|
||||
case COM_PING:
|
||||
break;
|
||||
/* Only increase id on these statements but don't count them. */
|
||||
case COM_STMT_PREPARE:
|
||||
case COM_STMT_CLOSE:
|
||||
case COM_STMT_RESET:
|
||||
next_query_id();
|
||||
break;
|
||||
/* Increase id and count all other statements. */
|
||||
default:
|
||||
statistic_increment(thd->status_var.questions, &LOCK_status);
|
||||
next_query_id();
|
||||
}
|
||||
|
||||
thread_running++;
|
||||
/* TODO: set thd->lex->sql_command to SQLCOM_END here */
|
||||
VOID(pthread_mutex_unlock(&LOCK_thread_count));
|
||||
@@ -1896,6 +1960,11 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
VOID(pthread_mutex_lock(&LOCK_thread_count));
|
||||
thd->query_length= length;
|
||||
thd->query= next_packet;
|
||||
/*
|
||||
Count each statement from the client.
|
||||
*/
|
||||
statistic_increment(thd->status_var.questions, &LOCK_status);
|
||||
|
||||
thd->query_id= next_query_id();
|
||||
thd->set_time(); /* Reset the query start time. */
|
||||
/* TODO: set thd->lex->sql_command to SQLCOM_END here */
|
||||
@@ -5049,6 +5118,7 @@ create_sp_error:
|
||||
}
|
||||
DBUG_ASSERT(thd->transaction.xid_state.xid.is_null());
|
||||
thd->transaction.xid_state.xa_state=XA_ACTIVE;
|
||||
thd->transaction.xid_state.rm_error= 0;
|
||||
thd->transaction.xid_state.xid.set(thd->lex->xid);
|
||||
xid_cache_insert(&thd->transaction.xid_state);
|
||||
thd->transaction.all.modified_non_trans_table= FALSE;
|
||||
@@ -5074,6 +5144,8 @@ create_sp_error:
|
||||
my_error(ER_XAER_NOTA, MYF(0));
|
||||
break;
|
||||
}
|
||||
if (xa_trans_rolled_back(&thd->transaction.xid_state))
|
||||
break;
|
||||
thd->transaction.xid_state.xa_state=XA_IDLE;
|
||||
send_ok(thd);
|
||||
break;
|
||||
@@ -5105,6 +5177,12 @@ create_sp_error:
|
||||
XID_STATE *xs=xid_cache_search(thd->lex->xid);
|
||||
if (!xs || xs->in_thd)
|
||||
my_error(ER_XAER_NOTA, MYF(0));
|
||||
else if (xa_trans_rolled_back(xs))
|
||||
{
|
||||
ha_commit_or_rollback_by_xid(thd->lex->xid, 0);
|
||||
xid_cache_delete(xs);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
ha_commit_or_rollback_by_xid(thd->lex->xid, 1);
|
||||
@@ -5113,6 +5191,11 @@ create_sp_error:
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (xa_trans_rolled_back(&thd->transaction.xid_state))
|
||||
{
|
||||
xa_trans_rollback(thd);
|
||||
break;
|
||||
}
|
||||
if (thd->transaction.xid_state.xa_state == XA_IDLE &&
|
||||
thd->lex->xa_opt == XA_ONE_PHASE)
|
||||
{
|
||||
@@ -5159,28 +5242,26 @@ create_sp_error:
|
||||
my_error(ER_XAER_NOTA, MYF(0));
|
||||
else
|
||||
{
|
||||
bool ok= !xa_trans_rolled_back(xs);
|
||||
ha_commit_or_rollback_by_xid(thd->lex->xid, 0);
|
||||
xid_cache_delete(xs);
|
||||
if (ok)
|
||||
send_ok(thd);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (thd->transaction.xid_state.xa_state != XA_IDLE &&
|
||||
thd->transaction.xid_state.xa_state != XA_PREPARED)
|
||||
thd->transaction.xid_state.xa_state != XA_PREPARED &&
|
||||
thd->transaction.xid_state.xa_state != XA_ROLLBACK_ONLY)
|
||||
{
|
||||
my_error(ER_XAER_RMFAIL, MYF(0),
|
||||
xa_state_names[thd->transaction.xid_state.xa_state]);
|
||||
break;
|
||||
}
|
||||
if (ha_rollback(thd))
|
||||
if (xa_trans_rollback(thd))
|
||||
my_error(ER_XAER_RMERR, MYF(0));
|
||||
else
|
||||
send_ok(thd);
|
||||
thd->options&= ~(ulong) OPTION_BEGIN;
|
||||
thd->transaction.all.modified_non_trans_table= FALSE;
|
||||
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
||||
xid_cache_delete(&thd->transaction.xid_state);
|
||||
thd->transaction.xid_state.xa_state=XA_NOTR;
|
||||
break;
|
||||
case SQLCOM_XA_RECOVER:
|
||||
res= mysql_xa_recover(thd);
|
||||
|
@@ -6574,6 +6574,7 @@ only_eq_ref_tables(JOIN *join,ORDER *order,table_map tables)
|
||||
{
|
||||
if (specialflag & SPECIAL_SAFE_MODE)
|
||||
return 0; // skip this optimize /* purecov: inspected */
|
||||
tables&= ~PSEUDO_TABLE_BITS;
|
||||
for (JOIN_TAB **tab=join->map2table ; tables ; tab++, tables>>=1)
|
||||
{
|
||||
if (tables & 1 && !eq_ref_table(join, order, *tab))
|
||||
|
@@ -464,7 +464,7 @@ public:
|
||||
bool send_row_on_empty_set()
|
||||
{
|
||||
return (do_send_rows && tmp_table_param.sum_func_count != 0 &&
|
||||
!group_list);
|
||||
!group_list && having_value != Item::COND_FALSE);
|
||||
}
|
||||
bool change_result(select_result *result);
|
||||
bool is_top_level_join() const
|
||||
|
@@ -1520,9 +1520,6 @@ static bool show_status_array(THD *thd, const char *wild,
|
||||
nr= (long) (thd->query_start() - server_start_time);
|
||||
end= int10_to_str(nr, buff, 10);
|
||||
break;
|
||||
case SHOW_QUESTION:
|
||||
end= int10_to_str((long) thd->query_id, buff, 10);
|
||||
break;
|
||||
#ifdef HAVE_REPLICATION
|
||||
case SHOW_RPL_STATUS:
|
||||
end= strmov(buff, rpl_status_type[(int)rpl_status]);
|
||||
|
@@ -774,8 +774,13 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
|
||||
DBUG_PRINT("info", ("View: %s", str.ptr()));
|
||||
|
||||
/* fill structure */
|
||||
view->query.str= str.c_ptr_safe();
|
||||
view->query.length= str.length();
|
||||
if (!make_lex_string(thd, &view->query, str.ptr(), str.length(), false))
|
||||
{
|
||||
my_error(ER_OUT_OF_RESOURCES, MYF(0));
|
||||
error= -1;
|
||||
goto err;
|
||||
}
|
||||
|
||||
view->source.str= thd->query + thd->lex->create_view_select_start;
|
||||
view->source.length= (char *)skip_rear_comments(thd->charset(),
|
||||
(char *)view->source.str,
|
||||
@@ -784,7 +789,12 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
|
||||
view->source.str;
|
||||
view->file_version= 1;
|
||||
view->calc_md5(md5);
|
||||
view->md5.str= md5;
|
||||
if (!(view->md5.str= thd->memdup(md5, 32)))
|
||||
{
|
||||
my_error(ER_OUT_OF_RESOURCES, MYF(0));
|
||||
error= -1;
|
||||
goto err;
|
||||
}
|
||||
view->md5.length= 32;
|
||||
can_be_merged= lex->can_be_merged();
|
||||
if (lex->create_view_algorithm == VIEW_ALGORITHM_MERGE &&
|
||||
|
@@ -170,7 +170,7 @@ enum SHOW_TYPE
|
||||
SHOW_UNDEF,
|
||||
SHOW_LONG, SHOW_LONGLONG, SHOW_INT, SHOW_CHAR, SHOW_CHAR_PTR,
|
||||
SHOW_DOUBLE_STATUS,
|
||||
SHOW_BOOL, SHOW_MY_BOOL, SHOW_OPENTABLES, SHOW_STARTTIME, SHOW_QUESTION,
|
||||
SHOW_BOOL, SHOW_MY_BOOL, SHOW_OPENTABLES, SHOW_STARTTIME,
|
||||
SHOW_LONG_CONST, SHOW_INT_CONST, SHOW_HAVE, SHOW_SYS, SHOW_HA_ROWS,
|
||||
SHOW_VARS,
|
||||
#ifdef HAVE_OPENSSL
|
||||
|
@@ -7,6 +7,11 @@
|
||||
|
||||
/* @(#) $Id$ */
|
||||
|
||||
/* Need to be included "early" to control other headers */
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "zutil.h"
|
||||
|
Reference in New Issue
Block a user