Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
9cd21e8c
Commit
9cd21e8c
authored
Apr 21, 2010
by
Jon Olav Hauglid
Browse files
Options
Browse Files
Download
Plain Diff
merge from mysql-trunk-runtime
parents
26d34c03
da1fbb37
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
584 additions
and
70 deletions
+584
-70
mysql-test/r/innodb_mysql_sync.result
mysql-test/r/innodb_mysql_sync.result
+24
-0
mysql-test/r/lock_sync.result
mysql-test/r/lock_sync.result
+20
-0
mysql-test/r/myisam.result
mysql-test/r/myisam.result
+33
-0
mysql-test/r/show_check.result
mysql-test/r/show_check.result
+17
-0
mysql-test/r/sp-lock.result
mysql-test/r/sp-lock.result
+42
-0
mysql-test/r/sp_sync.result
mysql-test/r/sp_sync.result
+89
-18
mysql-test/t/disabled.def
mysql-test/t/disabled.def
+0
-1
mysql-test/t/innodb_mysql_sync.test
mysql-test/t/innodb_mysql_sync.test
+37
-0
mysql-test/t/lock_sync.test
mysql-test/t/lock_sync.test
+33
-0
mysql-test/t/myisam.test
mysql-test/t/myisam.test
+32
-0
mysql-test/t/show_check.test
mysql-test/t/show_check.test
+26
-0
mysql-test/t/sp-lock.test
mysql-test/t/sp-lock.test
+62
-0
mysql-test/t/sp_sync.test
mysql-test/t/sp_sync.test
+133
-31
sql/event_scheduler.cc
sql/event_scheduler.cc
+4
-4
sql/handler.cc
sql/handler.cc
+2
-1
sql/sql_base.cc
sql/sql_base.cc
+2
-0
sql/sql_parse.cc
sql/sql_parse.cc
+6
-0
sql/sql_show.cc
sql/sql_show.cc
+7
-4
sql/sql_table.cc
sql/sql_table.cc
+11
-5
sql/sql_update.cc
sql/sql_update.cc
+0
-2
sql/sys_vars.cc
sql/sys_vars.cc
+1
-1
storage/myisam/ha_myisam.h
storage/myisam/ha_myisam.h
+3
-3
No files found.
mysql-test/r/innodb_mysql_sync.result
View file @
9cd21e8c
...
...
@@ -24,3 +24,27 @@ Warnings:
Error 1030 Got error -1 from storage engine
DROP TABLE t1;
SET DEBUG_SYNC='RESET';
#
# Bug#47459 Assertion in Diagnostics_area::set_eof_status on
# OPTIMIZE TABLE
#
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT) ENGINE= InnoDB;
# Connection con1
SET DEBUG_SYNC= "ha_admin_open_ltable SIGNAL opening WAIT_FOR dropped";
# Sending:
OPTIMIZE TABLE t1;
# Connection default
SET DEBUG_SYNC= "now WAIT_FOR opening";
DROP TABLE t1;
SET DEBUG_SYNC= "now SIGNAL dropped";
# Connection con1
# Reaping: OPTIMIZE TABLE t1
Table Op Msg_type Msg_text
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
test.t1 optimize error Table 'test.t1' doesn't exist
test.t1 optimize status Operation failed
Warnings:
Error 1146 Table 'test.t1' doesn't exist
# Connection default
SET DEBUG_SYNC= "RESET";
mysql-test/r/lock_sync.result
View file @
9cd21e8c
...
...
@@ -92,3 +92,23 @@ COMMIT;
# Connection default
# Reaping ALTER TABLE t1 ADD COLUMN j INT
DROP TABLE t1, t2;
#
# Bug#51391 Deadlock involving events during rqg_info_schema test
#
CREATE EVENT e1 ON SCHEDULE EVERY 5 HOUR DO SELECT 1;
CREATE EVENT e2 ON SCHEDULE EVERY 5 HOUR DO SELECT 2;
# Connection con1
SET DEBUG_SYNC="before_lock_tables_takes_lock SIGNAL drop WAIT_FOR query";
# Sending:
DROP EVENT e1;;
# Connection default
SET DEBUG_SYNC="now WAIT_FOR drop";
SELECT name FROM mysql.event, INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE definer = VARIABLE_VALUE;
name
SET DEBUG_SYNC="now SIGNAL query";
# Connection con1
# Reaping: DROP EVENT t1
# Connection default
DROP EVENT e2;
SET DEBUG_SYNC="RESET";
mysql-test/r/myisam.result
View file @
9cd21e8c
...
...
@@ -2411,3 +2411,36 @@ DROP TABLE t1;
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
SET myisam_repair_threads=@@global.myisam_repair_threads;
End of 5.1 tests
#
# Bug#51327 MyISAM table is automatically repaired on ALTER
#
even if myisam-recover is OFF
#
call mtr.add_suppression("Got an error from thread_id=.*ha_myisam.cc:");
call mtr.add_suppression("MySQL thread id .*, query id .* localhost.*root Checking table");
call mtr.add_suppression(" '\..test.t1'");
#
Test that we can exchange a crashed partition with a table
SELECT @@global.myisam_recover_options;
@@global.myisam_recover_options
OFF
CREATE TABLE t1 (a INT, KEY (a)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1), (2);
FLUSH TABLES;
#
replacing t.MYI with a corrupt + unclosed one created by doing:
#
'create table t1 (a int key(a))' head -c1024 t1.MYI > corrupt_t1.MYI
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check warning 1 client is using or hasn't closed the table properly
test.t1 check error Size of indexfile is: 1024 Should be: 2048
test.t1 check warning Size of datafile is: 14 Should be: 7
test.t1 check error Corrupt
#
Alter table should report error and not auto-repair the table.
ALTER TABLE t1 ENGINE = MyISAM;
ERROR HY000: Table 't1' is marked as crashed and should be repaired
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check warning Table is marked as crashed
test.t1 check warning 1 client is using or hasn't closed the table properly
test.t1 check error Size of indexfile is: 1024 Should be: 2048
test.t1 check warning Size of datafile is: 14 Should be: 7
test.t1 check error Corrupt
DROP TABLE t1;
mysql-test/r/show_check.result
View file @
9cd21e8c
...
...
@@ -1448,3 +1448,20 @@ DROP USER test_u@localhost;
SHOW CREATE TABLE non_existent;
ERROR 70100: Query execution was interrupted
End of 5.1 tests
#
# Bug#52593 SHOW CREATE TABLE is blocked if table is locked
# for write by another connection
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (i INT PRIMARY KEY);
LOCK TABLE t1 WRITE;
# Switching to connection 'con1'.
# This statement used to be blocked.
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) NOT NULL,
PRIMARY KEY (`i`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
# Switching to connection 'default'.
UNLOCK TABLES;
DROP TABLE t1;
mysql-test/r/sp-lock.result
View file @
9cd21e8c
...
...
@@ -693,5 +693,47 @@ set @@session.max_sp_recursion_depth=default;
# --> connection con3
# --> connection default
#
# SHOW CREATE PROCEDURE p1 called from p1, after p1 was altered
#
# We are just covering the existing behaviour with tests. The
# results are not necessarily correct."
#
CREATE PROCEDURE p1()
BEGIN
SELECT get_lock("test", 10);
SHOW CREATE PROCEDURE p1;
END|
# Connection default
SELECT get_lock("test", 10);
get_lock("test", 10)
1
# Connection 2
# Will halt before executing SHOW CREATE PROCEDURE p1
# Sending:
CALL p1();
# Connection 3
# Alter p1
DROP PROCEDURE p1;
CREATE PROCEDURE p1() BEGIN END;
# Connection default
# Resume CALL p1, now with new p1
SELECT release_lock("test");
release_lock("test")
1
# Connection 2
# Reaping: CALL p1()
get_lock("test", 10)
1
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
BEGIN
SELECT get_lock("test", 10);
SHOW CREATE PROCEDURE p1;
END latin1 latin1_swedish_ci latin1_swedish_ci
# Connection 3
# Connection 2
# Connection default;
DROP PROCEDURE p1;
#
# End of 5.5 tests
#
mysql-test/r/sp_sync.result
View file @
9cd21e8c
Tests of syncronization of stored procedure execution.
SET DEBUG_SYNC= 'RESET';
#
# Bug#48157: crash in Item_field::used_tables
# Bug #30977 Concurrent statement using stored function and
# DROP FUNCTION breaks SBR
#
CREATE TABLE t1 AS SELECT 1 AS a, 1 AS b;
CREATE TABLE t2 AS SELECT 1 AS a, 1 AS b;
CREATE PROCEDURE p1()
BEGIN
UPDATE t1 JOIN t2 USING( a, b ) SET t1.b = 1, t2.b = 1;
END|
LOCK TABLES t1 WRITE, t2 WRITE;
SET DEBUG_SYNC = 'multi_update_reopen_tables SIGNAL parked WAIT_FOR go';
# A stored routine could change after dispatch_command()
# but before a MDL lock is taken. This must be noticed and the
# sp cache flushed so the correct version can be loaded.
#
# Connection default
CREATE FUNCTION f1() RETURNS INT RETURN 1;
# Get f1 cached
SELECT f1();
f1()
1
# Then start executing it again...
SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL before WAIT_FOR changed';
# Sending:
SELECT f1();
# Connection 2
SET DEBUG_SYNC= 'now WAIT_FOR before';
# ... but before f1 is locked, change it.
DROP FUNCTION f1;
CREATE FUNCTION f1() RETURNS INT RETURN 2;
SET DEBUG_SYNC= 'now SIGNAL changed';
# Connection default
# We should now get '2' and not '1'.
# Reaping: SELECT f1()
f1()
2
DROP FUNCTION f1;
SET DEBUG_SYNC= 'RESET';
#
# Field translation items must be cleared in case of back-offs
# for queries that use Information Schema tables. Otherwise
# memory allocated in fix_fields() for views may end up referring
# to freed memory.
#
DROP FUNCTION IF EXISTS f1;
# Connection default
CREATE FUNCTION f1() RETURNS INT RETURN 0;
# Connection con2
SET DEBUG_SYNC= 'after_wait_locked_pname SIGNAL locked WAIT_FOR issued';
# con2 will now have an x-lock on f1
# Sending:
ALTER FUNCTION f1 COMMENT 'comment';
# Connection default
SET DEBUG_SYNC= 'now WAIT_FOR locked';
# This query will block due to the x-lock on f1 and back-off
SHOW OPEN TABLES WHERE f1()=0;
# Connection con3
# Check that the IS query is blocked before releasing the x-lock
SET DEBUG_SYNC= 'now SIGNAL issued';
# Connection default
# Reaping: ALTER FUNCTION f1 COMMENT 'comment'
DROP FUNCTION f1;
SET DEBUG_SYNC= 'RESET';
#
# Bug #48246 assert in close_thread_table
#
CREATE TABLE t1 (a INTEGER);
CREATE FUNCTION f1(b INTEGER) RETURNS INTEGER RETURN 1;
CREATE PROCEDURE p1() SELECT COUNT(f1(a)) FROM t1;
INSERT INTO t1 VALUES(1), (2);
# Connection 2
CALL p1();
COUNT(f1(a))
2
# Connection default
SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR called';
# Sending:
CREATE TABLE t1 (a INTEGER);
# Connection 2
SET DEBUG_SYNC= 'now WAIT_FOR locked';
SET DEBUG_SYNC= 'before_open_table_wait_refresh SIGNAL called WAIT_FOR created';
# This call used to cause an assertion. MDL locking conflict will
# cause back-off and retry. A variable indicating if a prelocking list
# exists, used to be not reset properly causing an eventual assert.
# Sending:
CALL p1();
DROP TABLE t1, t2;
SET DEBUG_SYNC = 'now WAIT_FOR parked';
CREATE TABLE t1 AS SELECT 1 AS a, 1 AS b;
CREATE TABLE t2 AS SELECT 1 AS a, 1 AS b;
SET DEBUG_SYNC = 'now SIGNAL go';
# Without the DEBUG_SYNC supplied in the same patch as this test in the
# code, this test statement will hang.
DROP TABLE t1, t2;
# Connection default
# Reaping: CREATE TABLE t1 (a INTEGER)
ERROR 42S01: Table 't1' already exists
SET DEBUG_SYNC= 'now SIGNAL created';
# Connection 2
# Reaping: CALL p1()
COUNT(f1(a))
2
# Connection default
DROP PROCEDURE p1;
SET DEBUG_SYNC = 'RESET';
DROP FUNCTION f1;
DROP TABLE t1;
SET DEBUG_SYNC= 'RESET';
mysql-test/t/disabled.def
View file @
9cd21e8c
...
...
@@ -11,7 +11,6 @@
##############################################################################
kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild.
query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically
sp_sync : Bug#48157 2010-02-06 5.5-m3 demands a differnt solution
innodb-autoinc : Bug#49267 2009-12-02 test fails on windows because of different case mode
innodb : Bug#49396 2009-12-03 test fails in embedded mode
plugin_load : Bug#42144 2009-12-21 alik plugin_load fails
mysql-test/t/innodb_mysql_sync.test
View file @
9cd21e8c
...
...
@@ -43,6 +43,43 @@ DROP TABLE t1;
SET
DEBUG_SYNC
=
'RESET'
;
--
echo
#
--
echo
# Bug#47459 Assertion in Diagnostics_area::set_eof_status on
--
echo
# OPTIMIZE TABLE
--
echo
#
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
;
--
enable_warnings
connect
(
con1
,
localhost
,
root
);
connection
default
;
CREATE
TABLE
t1
(
a
INT
)
ENGINE
=
InnoDB
;
--
echo
# Connection con1
connection
con1
;
SET
DEBUG_SYNC
=
"ha_admin_open_ltable SIGNAL opening WAIT_FOR dropped"
;
--
echo
# Sending:
--
send
OPTIMIZE
TABLE
t1
--
echo
# Connection default
connection
default
;
SET
DEBUG_SYNC
=
"now WAIT_FOR opening"
;
DROP
TABLE
t1
;
SET
DEBUG_SYNC
=
"now SIGNAL dropped"
;
--
echo
# Connection con1
connection
con1
;
--
echo
# Reaping: OPTIMIZE TABLE t1
--
reap
--
echo
# Connection default
connection
default
;
disconnect
con1
;
SET
DEBUG_SYNC
=
"RESET"
;
# Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence.
--
source
include
/
wait_until_count_sessions
.
inc
mysql-test/t/lock_sync.test
View file @
9cd21e8c
...
...
@@ -178,6 +178,39 @@ DROP TABLE t1, t2;
disconnect
con2
;
--
echo
#
--
echo
# Bug#51391 Deadlock involving events during rqg_info_schema test
--
echo
#
CREATE
EVENT
e1
ON
SCHEDULE
EVERY
5
HOUR
DO
SELECT
1
;
CREATE
EVENT
e2
ON
SCHEDULE
EVERY
5
HOUR
DO
SELECT
2
;
--
echo
# Connection con1
connect
(
con1
,
localhost
,
root
);
SET
DEBUG_SYNC
=
"before_lock_tables_takes_lock SIGNAL drop WAIT_FOR query"
;
--
echo
# Sending:
--
send
DROP
EVENT
e1
;
--
echo
# Connection default
connection
default
;
SET
DEBUG_SYNC
=
"now WAIT_FOR drop"
;
SELECT
name
FROM
mysql
.
event
,
INFORMATION_SCHEMA
.
GLOBAL_VARIABLES
WHERE
definer
=
VARIABLE_VALUE
;
SET
DEBUG_SYNC
=
"now SIGNAL query"
;
--
echo
# Connection con1
connection
con1
;
--
echo
# Reaping: DROP EVENT t1
--
reap
disconnect
con1
;
--
source
include
/
wait_until_disconnected
.
inc
--
echo
# Connection default
connection
default
;
DROP
EVENT
e2
;
SET
DEBUG_SYNC
=
"RESET"
;
# Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence.
--
source
include
/
wait_until_count_sessions
.
inc
mysql-test/t/myisam.test
View file @
9cd21e8c
...
...
@@ -1648,3 +1648,35 @@ SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
SET
myisam_repair_threads
=@@
global
.
myisam_repair_threads
;
--
echo
End
of
5.1
tests
--
echo
#
--
echo
# Bug#51327 MyISAM table is automatically repaired on ALTER
--
echo
# even if myisam-recover is OFF
--
echo
#
call
mtr
.
add_suppression
(
"Got an error from thread_id=.*ha_myisam.cc:"
);
call
mtr
.
add_suppression
(
"MySQL thread id .*, query id .* localhost.*root Checking table"
);
call
mtr
.
add_suppression
(
" '\..test.t1'"
);
let
$MYSQLD_DATADIR
=
`SELECT @@datadir`
;
--
echo
# Test that we can exchange a crashed partition with a table
SELECT
@@
global
.
myisam_recover_options
;
CREATE
TABLE
t1
(
a
INT
,
KEY
(
a
))
ENGINE
=
MyISAM
;
INSERT
INTO
t1
VALUES
(
1
),
(
2
);
FLUSH
TABLES
;
--
echo
# replacing t.MYI with a corrupt + unclosed one created by doing:
--
echo
# 'create table t1 (a int key(a))' head -c1024 t1.MYI > corrupt_t1.MYI
--
remove_file
$MYSQLD_DATADIR
/
test
/
t1
.
MYI
--
copy_file
std_data
/
corrupt_t1
.
MYI
$MYSQLD_DATADIR
/
test
/
t1
.
MYI
CHECK
TABLE
t1
;
--
echo
# Alter table should report error and not auto-repair the table.
# Remove the path to t1 to prevent platform differences
--
replace_regex
/
'[^'
]
+
'/'
t1
'
/
--
error
145
ALTER
TABLE
t1
ENGINE
=
MyISAM
;
CHECK
TABLE
t1
;
DROP
TABLE
t1
;
mysql-test/t/show_check.test
View file @
9cd21e8c
...
...
@@ -1212,6 +1212,32 @@ DISCONNECT con1;
--
echo
End
of
5.1
tests
--
echo
#
--
echo
# Bug#52593 SHOW CREATE TABLE is blocked if table is locked
--
echo
# for write by another connection
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
;
--
enable_warnings
connect
(
con1
,
localhost
,
root
);
connection
default
;
CREATE
TABLE
t1
(
i
INT
PRIMARY
KEY
);
LOCK
TABLE
t1
WRITE
;
--
echo
# Switching to connection 'con1'.
connection
con1
;
--
echo
# This statement used to be blocked.
SHOW
CREATE
TABLE
t1
;
--
echo
# Switching to connection 'default'.
connection
default
;
disconnect
con1
;
UNLOCK
TABLES
;
DROP
TABLE
t1
;
# Wait till all disconnects are completed
--
source
include
/
wait_until_count_sessions
.
inc
mysql-test/t/sp-lock.test
View file @
9cd21e8c
...
...
@@ -893,6 +893,68 @@ disconnect con3;
--
source
include
/
wait_until_disconnected
.
inc
--
echo
# --> connection default
connection
default
;
--
echo
#
--
echo
# SHOW CREATE PROCEDURE p1 called from p1, after p1 was altered
--
echo
#
--
echo
# We are just covering the existing behaviour with tests. The
--
echo
# results are not necessarily correct."
--
echo
#
delimiter
|
;
CREATE
PROCEDURE
p1
()
BEGIN
SELECT
get_lock
(
"test"
,
10
);
SHOW
CREATE
PROCEDURE
p1
;
END
|
delimiter
;
|
connect
(
con2
,
localhost
,
root
);
connect
(
con3
,
localhost
,
root
);
--
echo
# Connection default
connection
default
;
SELECT
get_lock
(
"test"
,
10
);
--
echo
# Connection 2
connection
con2
;
--
echo
# Will halt before executing SHOW CREATE PROCEDURE p1
--
echo
# Sending:
--
send
CALL
p1
()
--
echo
# Connection 3
connection
con3
;
let
$wait_condition
=
SELECT
COUNT
(
*
)
=
1
FROM
information_schema
.
processlist
WHERE
state
=
'User lock'
and
info
=
'SELECT get_lock("test", 10)'
;
--
source
include
/
wait_condition
.
inc
--
echo
# Alter p1
DROP
PROCEDURE
p1
;
CREATE
PROCEDURE
p1
()
BEGIN
END
;
--
echo
# Connection default
connection
default
;
--
echo
# Resume CALL p1, now with new p1
SELECT
release_lock
(
"test"
);
--
echo
# Connection 2
connection
con2
;
--
echo
# Reaping: CALL p1()
--
reap
--
echo
# Connection 3
connection
con3
;
disconnect
con3
;
--
source
include
/
wait_until_disconnected
.
inc
--
echo
# Connection 2
connection
con2
;
disconnect
con2
;
--
source
include
/
wait_until_disconnected
.
inc
--
echo
# Connection default;
connection
default
;
DROP
PROCEDURE
p1
;
--
echo
#
--
echo
# End of 5.5 tests
--
echo
#
mysql-test/t/sp_sync.test
View file @
9cd21e8c
...
...
@@ -5,54 +5,156 @@
--
source
include
/
have_debug_sync
.
inc
# Save the initial number of concurrent sessions.
--
source
include
/
count_sessions
.
inc
# Clean up resources used in this test case.
--
disable_warnings
SET
DEBUG_SYNC
=
'RESET'
;
--
enable_warnings
--
echo
#
--
echo
# Bug #30977 Concurrent statement using stored function and
--
echo
# DROP FUNCTION breaks SBR
--
echo
#
--
echo
# Bug#48157: crash in Item_field::used_tables
--
echo
# A stored routine could change after dispatch_command()
--
echo
# but before a MDL lock is taken. This must be noticed and the
--
echo
# sp cache flushed so the correct version can be loaded.
--
echo
#
CREATE
TABLE
t1
AS
SELECT
1
AS
a
,
1
AS
b
;
CREATE
TABLE
t2
AS
SELECT
1
AS
a
,
1
AS
b
;
connect
(
con2
,
localhost
,
root
);
DELIMITER
|
;
--
echo
# Connection default
connection
default
;
CREATE
FUNCTION
f1
()
RETURNS
INT
RETURN
1
;
--
echo
# Get f1 cached
SELECT
f1
();
--
echo
# Then start executing it again...
SET
DEBUG_SYNC
=
'before_execute_sql_command SIGNAL before WAIT_FOR changed'
;
--
echo
# Sending:
--
send
SELECT
f1
()
--
echo
# Connection 2
connection
con2
;
SET
DEBUG_SYNC
=
'now WAIT_FOR before'
;
--
echo
# ... but before f1 is locked, change it.
DROP
FUNCTION
f1
;
CREATE
FUNCTION
f1
()
RETURNS
INT
RETURN
2
;
SET
DEBUG_SYNC
=
'now SIGNAL changed'
;
--
echo
# Connection default
--
echo
# We should now get '2' and not '1'.
connection
default
;
--
echo
# Reaping: SELECT f1()
--
reap
disconnect
con2
;
DROP
FUNCTION
f1
;
SET
DEBUG_SYNC
=
'RESET'
;
CREATE
PROCEDURE
p1
()
BEGIN
UPDATE
t1
JOIN
t2
USING
(
a
,
b
)
SET
t1
.
b
=
1
,
t2
.
b
=
1
;
END
|
--
echo
#
--
echo
# Field translation items must be cleared in case of back-offs
--
echo
# for queries that use Information Schema tables. Otherwise
--
echo
# memory allocated in fix_fields() for views may end up referring
--
echo
# to freed memory.
--
echo
#
DELIMITER
;
|
--
disable_warnings
DROP
FUNCTION
IF
EXISTS
f1
;
--
enable_warnings
connect
(
con
1
,
localhost
,
root
,,
);
connect
(
con
2
,
localhost
,
root
,,
);
connect
(
con
2
,
localhost
,
root
);
connect
(
con
3
,
localhost
,
root
);
connection
con1
;
LOCK
TABLES
t1
WRITE
,
t2
WRITE
;
--
echo
# Connection default
connection
default
;
CREATE
FUNCTION
f1
()
RETURNS
INT
RETURN
0
;
--
echo
# Connection con2
connection
con2
;
LET
$ID
=
`select connection_id()`
;
SET
DEBUG_SYNC
=
'multi_update_reopen_tables SIGNAL parked WAIT_FOR go'
;
--
send
CALL
p1
()
SET
DEBUG_SYNC
=
'after_wait_locked_pname SIGNAL locked WAIT_FOR issued'
;
--
echo
# con2 will now have an x-lock on f1
--
echo
# Sending:
--
send
ALTER
FUNCTION
f1
COMMENT
'comment'
connection
con1
;
let
$wait_condition
=
SELECT
1
FROM
information_schema
.
processlist
WHERE
ID
=
$ID
AND
state
=
"Waiting for table"
;
--
echo
# Connection default
connection
default
;
SET
DEBUG_SYNC
=
'now WAIT_FOR locked'
;
--
disable_result_log
--
echo
# This query will block due to the x-lock on f1 and back-off
--
send
SHOW
OPEN
TABLES
WHERE
f1
()
=
0
--
echo
# Connection con3
connection
con3
;
let
$wait_condition
=
SELECT
COUNT
(
*
)
=
1
FROM
information_schema
.
processlist
WHERE
state
=
'Waiting for table'
AND
info
=
'SHOW OPEN TABLES WHERE f1()=0'
;
--
source
include
/
wait_condition
.
inc
DROP
TABLE
t1
,
t2
;
SET
DEBUG_SYNC
=
'now WAIT_FOR parked'
;
CREATE
TABLE
t1
AS
SELECT
1
AS
a
,
1
AS
b
;
CREATE
TABLE
t2
AS
SELECT
1
AS
a
,
1
AS
b
;
SET
DEBUG_SYNC
=
'now SIGNAL go'
;
--
echo
# Check that the IS query is blocked before releasing the x-lock
SET
DEBUG_SYNC
=
'now SIGNAL issued'
;
connection
con2
;
--
echo
# Connection default
connection
default
;
--
echo
# Reaping: ALTER FUNCTION f1 COMMENT 'comment'
--
reap
disconnect
con1
;
--
enable_result_log
DROP
FUNCTION
f1
;
SET
DEBUG_SYNC
=
'RESET'
;
disconnect
con2
;
disconnect
con3
;
--
echo
#
--
echo
# Bug #48246 assert in close_thread_table
--
echo
#
CREATE
TABLE
t1
(
a
INTEGER
);
CREATE
FUNCTION
f1
(
b
INTEGER
)
RETURNS
INTEGER
RETURN
1
;
CREATE
PROCEDURE
p1
()
SELECT
COUNT
(
f1
(
a
))
FROM
t1
;
INSERT
INTO
t1
VALUES
(
1
),
(
2
);
--
echo
# Connection 2
connect
(
con2
,
localhost
,
root
);
CALL
p1
();
--
echo
# Connection default
connection
default
;
SET
DEBUG_SYNC
=
'after_open_table_mdl_shared SIGNAL locked WAIT_FOR called'
;
--
echo
# Sending:
--
send
CREATE
TABLE
t1
(
a
INTEGER
)
--
echo
# Without the DEBUG_SYNC supplied in the same patch as this test in the
--
echo
# code, this test statement will hang.
DROP
TABLE
t1
,
t2
;
--
echo
# Connection 2
connection
con2
;
SET
DEBUG_SYNC
=
'now WAIT_FOR locked'
;
SET
DEBUG_SYNC
=
'before_open_table_wait_refresh SIGNAL called WAIT_FOR created'
;
--
echo
# This call used to cause an assertion. MDL locking conflict will
--
echo
# cause back-off and retry. A variable indicating if a prelocking list
--
echo
# exists, used to be not reset properly causing an eventual assert.
--
echo
# Sending:
--
send
CALL
p1
()
--
echo
# Connection default
connection
default
;
--
echo
# Reaping: CREATE TABLE t1 (a INTEGER)
--
error
ER_TABLE_EXISTS_ERROR
--
reap
SET
DEBUG_SYNC
=
'now SIGNAL created'
;
--
echo
# Connection 2
connection
con2
;
--
echo
# Reaping: CALL p1()
--
reap
;
--
echo
# Connection default
connection
default
;
disconnect
con2
;
DROP
PROCEDURE
p1
;
DROP
FUNCTION
f1
;
DROP
TABLE
t1
;
SET
DEBUG_SYNC
=
'RESET'
;
SET
DEBUG_SYNC
=
'RESET'
;
# Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence.
--
source
include
/
wait_until_count_sessions
.
inc
sql/event_scheduler.cc
View file @
9cd21e8c
/* Copyright (C) 2004
-2006 MySQL AB, 2008-2009 Sun Microsystems, Inc
/* Copyright (C) 2004
, 2010 Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 5
9 Temple Place, Suite 330, Boston, MA 02111-1307
USA */
Foundation, Inc., 5
1 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA */
#include "sql_priv.h"
#include "unireg.h"
...
...
@@ -500,8 +500,8 @@ Event_scheduler::run(THD *thd)
deinit_event_thread
(
thd
);
scheduler_thd
=
NULL
;
state
=
INITIALIZED
;
DBUG_PRINT
(
"info"
,
(
"
Signalling back to the stopper COND_state
"
));
mysql_cond_
signal
(
&
COND_state
);
DBUG_PRINT
(
"info"
,
(
"
Broadcasting COND_state back to the stoppers
"
));
mysql_cond_
broadcast
(
&
COND_state
);
UNLOCK_DATA
();
DBUG_RETURN
(
res
);
...
...
sql/handler.cc
View file @
9cd21e8c
...
...
@@ -57,7 +57,8 @@ static handlerton *installed_htons[128];
#define BITMAP_STACKBUF_SIZE (128/8)
KEY_CREATE_INFO
default_key_create_info
=
{
HA_KEY_ALG_UNDEF
,
0
,
{
NullS
,
0
}
};
KEY_CREATE_INFO
default_key_create_info
=
{
HA_KEY_ALG_UNDEF
,
0
,
{
NullS
,
0
},
{
NullS
,
0
}
};
/* number of entries in handlertons[] */
ulong
total_ha
=
0
;
...
...
sql/sql_base.cc
View file @
9cd21e8c
...
...
@@ -752,6 +752,7 @@ TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name)
}
#ifdef DISABLED_UNTIL_GRL_IS_MADE_PART_OF_MDL
/**
@brief Mark table share as having one more user (increase its reference
count).
...
...
@@ -769,6 +770,7 @@ static void reference_table_share(TABLE_SHARE *share)
(
ulong
)
share
,
share
->
ref_count
));
DBUG_VOID_RETURN
;
}
#endif
/*
...
...
sql/sql_parse.cc
View file @
9cd21e8c
...
...
@@ -92,6 +92,7 @@
#include "transaction.h"
#include "sql_audit.h"
#include "sql_prepare.h"
#include "debug_sync.h"
#include "probes_mysql.h"
#include "set_var.h"
...
...
@@ -2178,6 +2179,11 @@ mysql_execute_command(THD *thd)
if
(
thd
->
global_read_lock
.
wait_if_global_read_lock
(
thd
,
FALSE
,
TRUE
))
goto
error
;
#ifndef DBUG_OFF
if
(
lex
->
sql_command
!=
SQLCOM_SET_OPTION
)
DEBUG_SYNC
(
thd
,
"before_execute_sql_command"
);
#endif
switch
(
lex
->
sql_command
)
{
case
SQLCOM_SHOW_EVENTS
:
...
...
sql/sql_show.cc
View file @
9cd21e8c
/* Copyright 2000
-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc
.
/* Copyright 2000
, 2010 Oracle and/or its affiliates. All rights reserved
.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 5
9 Temple Place, Suite 330, Boston, MA 02111-1307
USA */
Foundation, Inc., 5
1 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA */
/* Function with list databases, tables or fields */
...
...
@@ -658,7 +658,9 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
{
Show_create_error_handler
view_error_suppressor
(
thd
,
table_list
);
thd
->
push_internal_handler
(
&
view_error_suppressor
);
bool
error
=
open_normal_and_derived_tables
(
thd
,
table_list
,
0
);
bool
error
=
open_normal_and_derived_tables
(
thd
,
table_list
,
MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL
);
thd
->
pop_internal_handler
();
if
(
error
&&
(
thd
->
killed
||
thd
->
is_error
()))
DBUG_RETURN
(
TRUE
);
...
...
@@ -832,7 +834,8 @@ mysqld_list_fields(THD *thd, TABLE_LIST *table_list, const char *wild)
DBUG_ENTER
(
"mysqld_list_fields"
);
DBUG_PRINT
(
"enter"
,(
"table: %s"
,
table_list
->
table_name
));
if
(
open_normal_and_derived_tables
(
thd
,
table_list
,
0
))
if
(
open_normal_and_derived_tables
(
thd
,
table_list
,
MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL
))
DBUG_VOID_RETURN
;
table
=
table_list
->
table
;
...
...
sql/sql_table.cc
View file @
9cd21e8c
...
...
@@ -5017,11 +5017,17 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
{
/* Clear the ticket released in close_thread_tables(). */
table
->
mdl_request
.
ticket
=
NULL
;
if
((
table
->
table
=
open_ltable
(
thd
,
table
,
lock_type
,
0
))
&&
((
result_code
=
table
->
table
->
file
->
ha_analyze
(
thd
,
check_opt
))
>
0
))
result_code
=
0
;
// analyze went ok
if
(
result_code
)
// analyze failed
table
->
table
->
file
->
print_error
(
result_code
,
MYF
(
0
));
DEBUG_SYNC
(
thd
,
"ha_admin_open_ltable"
);
if
(
table
->
table
=
open_ltable
(
thd
,
table
,
lock_type
,
0
))
{
result_code
=
table
->
table
->
file
->
ha_analyze
(
thd
,
check_opt
);
if
(
result_code
==
HA_ADMIN_ALREADY_DONE
)
result_code
=
HA_ADMIN_OK
;
else
if
(
result_code
)
// analyze failed
table
->
table
->
file
->
print_error
(
result_code
,
MYF
(
0
));
}
else
result_code
=
-
1
;
// open failed
}
/* Start a new row for the final status row */
protocol
->
prepare_for_resend
();
...
...
sql/sql_update.cc
View file @
9cd21e8c
...
...
@@ -222,7 +222,6 @@ int mysql_update(THD *thd,
ulonglong
id
;
List
<
Item
>
all_fields
;
THD
::
killed_state
killed_status
=
THD
::
NOT_KILLED
;
MDL_ticket
*
start_of_statement_svp
=
thd
->
mdl_context
.
mdl_savepoint
();
DBUG_ENTER
(
"mysql_update"
);
if
(
open_tables
(
thd
,
&
table_list
,
&
table_count
,
0
))
...
...
@@ -972,7 +971,6 @@ int mysql_multi_update_prepare(THD *thd)
uint
table_count
=
lex
->
table_count
;
const
bool
using_lock_tables
=
thd
->
locked_tables_mode
!=
LTM_NONE
;
bool
original_multiupdate
=
(
thd
->
lex
->
sql_command
==
SQLCOM_UPDATE_MULTI
);
MDL_ticket
*
start_of_statement_svp
=
thd
->
mdl_context
.
mdl_savepoint
();
DBUG_ENTER
(
"mysql_multi_update_prepare"
);
/* following need for prepared statements, to run next time multi-update */
...
...
sql/sys_vars.cc
View file @
9cd21e8c
...
...
@@ -2819,7 +2819,7 @@ static Sys_var_charptr Sys_slave_load_tmpdir(
static
bool
fix_slave_net_timeout
(
sys_var
*
self
,
THD
*
thd
,
enum_var_type
type
)
{
mysql_mutex_lock
(
&
LOCK_active_mi
);
DBUG_PRINT
(
"info"
,
(
"slave_net_timeout=%
l
u mi->heartbeat_period=%.3f"
,
DBUG_PRINT
(
"info"
,
(
"slave_net_timeout=%u mi->heartbeat_period=%.3f"
,
slave_net_timeout
,
(
active_mi
?
active_mi
->
heartbeat_period
:
0.0
)));
if
(
active_mi
&&
slave_net_timeout
<
active_mi
->
heartbeat_period
)
...
...
storage/myisam/ha_myisam.h
View file @
9cd21e8c
/* Copyright (C) 2000
-2006 MySQL AB
/* Copyright (C) 2000
, 2010 Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 5
9 Temple Place, Suite 330, Boston, MA 02111-1307
USA */
Foundation, Inc., 5
1 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA */
#ifdef USE_PRAGMA_INTERFACE
...
...
@@ -129,7 +129,7 @@ class ha_myisam: public handler
int
repair
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
bool
check_and_repair
(
THD
*
thd
);
bool
is_crashed
()
const
;
bool
auto_repair
()
const
{
return
myisam_recover_options
!=
0
;
}
bool
auto_repair
()
const
{
return
myisam_recover_options
!=
HA_RECOVER_OFF
;
}
int
optimize
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
int
assign_to_keycache
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
int
preload_keys
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment