File: ndb_dbug_lock.test

package info (click to toggle)
percona-xtrabackup 2.2.3-2.1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 293,260 kB
  • ctags: 146,881
  • sloc: cpp: 1,051,960; ansic: 570,217; java: 54,595; perl: 53,495; pascal: 44,194; sh: 27,826; yacc: 15,314; python: 12,142; xml: 7,848; sql: 4,125; makefile: 1,459; awk: 785; lex: 758
file content (73 lines) | stat: -rw-r--r-- 1,988 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# uses 'send' and 'reap' which seems not supported for emb testing
-- source include/not_embedded.inc
-- source include/have_ndb.inc
# We are using some debug-only features in this test
--source include/have_debug.inc

--disable_warnings
drop table if exists t1;
--enable_warnings

--connect (another_con, localhost, root,,)
--connect (yet_another_con, localhost, root,,)

--echo #
--echo # Test that alter during lock table aborts with error if
--echo # global schema lock already exists
--echo #
--connection default
create table t1 (a int key) engine ndb row_format dynamic;
# delay after lock
set session debug="+d,sleep_after_global_schema_lock";
--send alter table t1 add column (b int)
--sleep 2

--connection another_con
lock tables t1 write;
--error ER_LOCK_OR_ACTIVE_TRANSACTION
alter table t1 add column (c int);
# make sure it continues to block
--error ER_LOCK_OR_ACTIVE_TRANSACTION
alter table t1 add column (c int);
--error ER_LOCK_OR_ACTIVE_TRANSACTION
alter table t1 add column (c int);
unlock tables;

--connection default
--reap

--echo #
--echo # Test that alter during lock works without global schema lock
--echo # and that an alter done in parallell test serialized
--echo #
--connection default
lock tables t1 write;
--echo # delay is still set after lock
--send alter table t1 add column (c int)
--sleep 2

--echo # issue alter in parallell, which should be hanging waiting on
--connection another_con
--send alter table t1 add column (d int)
--sleep 1

--echo # check thread state which should be:
--echo # "Waiting for allowed to take ndbcluster global schema lock"
--echo # _not_ "Waiting for ndbcluster global schema lock"
--connection yet_another_con
select state from information_schema.processlist where info = "alter table t1 add column (d int)";

# wait for alter to complete
--connection default
--reap
unlock tables;

--connection another_con
--reap

show create table t1;

--echo # Cleanup
--connection default
set session debug="-d,";
drop table t1;