Debian Codegraph @

mysql-test/suite/memcached/t/memc296_alter_column.test

raw
1 source include/not_valgrind.inc;
2 source include/have_memcached_plugin.inc;
3 source include/not_windows.inc;
4
5 --disable_query_log
6 CALL mtr.add_suppression("daemon-memcached-w-batch-size': unsigned");
7 CALL mtr.add_suppression("Could not obtain server's UPN to be used as target service name");
8 CALL mtr.add_suppression("Warning: MySQL is trying to drop");
9 --enable_query_log
10
11 --enable_connect_log
12 SET @transaction_isolation= @@global.transaction_isolation;
13 SET GLOBAL TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
14
15 # Create the memcached tables
16 --disable_query_log
17 source include/memcache_config.inc;
18 --enable_query_log
19
20 INSERT INTO cache_policies VALUES("cache_policy", "innodb_only",
21 "innodb_only", "innodb_only", "innodb_only");
22
23 INSERT INTO config_options VALUES("separator", "|");
24
25 # describe table for memcache
26 INSERT INTO containers VALUES ("desc_t1", "test", "t1",
27 "c1", "c2", "c3", "c4", "c5", "PRIMARY");
28
29 USE test;
30
31 connect (con1,localhost,root,,);
32
33 --disable_warnings
34 DROP TABLE IF EXISTS t1;
35 --enable_warnings
36 CREATE TABLE t1 (c1 VARCHAR(32),
37 c2 VARCHAR(1024),
38 c3 INT, c4 BIGINT UNSIGNED, c5 INT, primary key(c1))
39 ENGINE = INNODB;
40
41 INSERT INTO t1 VALUES ('D', 'Darmstadt', 0, 0, 0);
42
43 # Tables must exist before plugin can be started!
44 --let $memcached_address=127.0.0.1:11296
45 --source ../include/load_daemon_memcached_expecting_success.inc
46
47 --sorted_result
48 SELECT c1,c2 FROM t1;
49
50 --sorted_result
51 SELECT c1,c2 FROM t1;
52 ALTER TABLE test.t1 ADD COLUMN j JSON;
53 delimiter //;
54 CREATE PROCEDURE alter_column()
55 BEGIN
56 SELECT SLEEP(10);
57 ALTER TABLE test.t1 ADD COLUMN foo varchar(200) AS (j->'$.foo') VIRTUAL;
58 END//
59 delimiter ;//
60
61
62 connection con1;
63 set session lock_wait_timeout=1;
64 --send call alter_column();
65
66 connection default;
67
68 perl;
69 use DBI;
70 use Cache::Memcached;
71 my $memd = new Cache::Memcached {
72 'servers' => [ "127.0.0.1:11296" ],
73 'connect_timeout' => 20,
74 'select_timeout' => 20
75 };
76 print "Here are the memcached results with E:\n";
77 $val = $memd->get("D");
78 if ($val) { print "$val\n"; }
79 sleep(20);
80
81 $memd->disconnect_all;
82 EOF
83
84 connection con1;
85 # Now all Memcached operation will acquire MDL lock on the table.
86 # So the alter table will have to wait for MDL lock released by Memcached
87 # connection, and then start the alter. If we set shorter timeout interval
88 # it should report timeout
89 --error ER_LOCK_WAIT_TIMEOUT
90 reap;
91
92 connection default;
93 disconnect con1;
94 drop procedure alter_column;
95 DROP TABLE t1;
96
97 UNINSTALL PLUGIN daemon_memcached;
98 DROP DATABASE innodb_memcache;
99
100 SET @@global.transaction_isolation= @transaction_isolation;