File: ndb_restore_discover.test

package info (click to toggle)
mariadb-10.0 10.0.30-0%2Bdeb8u2
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 474,048 kB
  • ctags: 183,740
  • sloc: cpp: 1,391,728; ansic: 831,813; perl: 59,717; sh: 36,566; pascal: 32,281; yacc: 14,921; xml: 5,257; sql: 4,660; cs: 4,647; makefile: 4,555; ruby: 4,465; python: 2,292; lex: 1,427; java: 941; asm: 295; awk: 54; php: 22; sed: 16
file content (70 lines) | stat: -rw-r--r-- 1,758 bytes parent folder | download | duplicates (6)
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
-- source include/have_ndb.inc
-- source include/count_sessions.inc

--echo #
--echo # 18075170 - sql node restart required to avoid deadlock after
--echo #            restore
--echo #
# Test Auto Discover option within a transaction
# and make sure the transaction is not broken.
CREATE TABLE t1 (id INT) ENGINE=NDBCluster;
CREATE TABLE t2 (id INT) ENGINE=NDBCluster;

INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);

-- source include/ndb_backup.inc

DROP TABLE t1;
DROP TABLE t2;

-- source include/ndb_restore_master.inc

SET autocommit = 0;
SELECT * FROM t1;

# Without fix below select was resulting in DEADLOCK error. With fix select
# should succeed.
SELECT * FROM t2;
ROLLBACK;
SET autocommit = 1;

drop table t1;
drop table t2;

#
# Checking lock preservation in transaction
#
# Using existing backup to create the scenario. Tables are deleted as part of
# above test cleanup. Thus restoring the backup will bring the system to
# required state.
-- source include/ndb_restore_master.inc

SET autocommit = 0;
SELECT * FROM t1;
SELECT * FROM t2;

connect(con2, localhost, root);
--SEND ALTER TABLE t1 ADD val INT

connection default;
# Alter from con2 will be in waiting state as there is a lock on t1 from
# default connection due to active transaction. We check for this condition
# then releasing the lock by rollbacking active transaction.
let $wait_condition=
  SELECT count(*) = 1 FROM information_schema.processlist WHERE state
  LIKE "Waiting%" AND info = "ALTER TABLE t1 ADD val INT";
--source include/wait_condition.inc
ROLLBACK;
SET autocommit = 1;

connection con2;
--REAP

disconnect con2;
connection default;
drop table t1;
drop table t2;

# Wait till all disconnects are completed
-- source include/wait_until_count_sessions.inc