Debian Codegraph @

mysql-test/suite/innodb/t/virtual_uncommitted.test

raw
1 --source include/have_debug_sync.inc
2 --source include/count_sessions.inc
3
4 --echo #
5 --echo # Bug #26625652: SIG=11 ROW_SEL_SEC_REC_IS_FOR_CLUST_REC ROW_SEARCH_MVCC
6 --echo #
7
8 #
9 # Prepare
10 #
11
12 --echo # Connection default:
13 connection default;
14 SET @page_size = @@innodb_page_size;
15 # the value must be >= than commit_freq in lob::insert
16 SET @page_count = 4;
17 SET @initial_isolation = @@SESSION.transaction_isolation;
18
19 SET DEBUG_SYNC='reset';
20
21 --echo # Connection con1:
22 connect(con1,localhost,root,,test);
23 SET SESSION transaction_isolation = 'READ-UNCOMMITTED';
24 SELECT @@SESSION.transaction_isolation;
25
26 --echo # Connection default:
27 connection default;
28 SET SESSION transaction_isolation = 'READ-UNCOMMITTED';
29 SELECT @@SESSION.transaction_isolation;
30
31 CREATE TABLE t (
32 a INT,
33 c VARCHAR(100),
34 j JSON,
35 vj varchar(100) as (json_unquote(j->'$.hash')) virtual,
36 INDEX idx_a(a),
37 INDEX idx_c(c),
38 INDEX idx_vj(vj)
39 ) ROW_FORMAT=COMPACT;
40
41 set @json_data_a = repeat('a', @page_size * @page_count);
42 set @json_data_b = repeat('b', @page_size * @page_count);
43 set @json_data_c = repeat('c', @page_size * @page_count);
44
45 INSERT INTO t VALUES
46 (1, 'aaaa123xx', CONCAT('{ "hash": "the_hash_a", "data": "', @json_data_a, '" }'), DEFAULT),
47 (2, 'aaaa1234x', CONCAT('{ "hash": "the_hash_b", "data": "', @json_data_b, '" }'), DEFAULT),
48 (3, 'aaaa12345', CONCAT('{ "hash": "the_hash_c", "data": "', @json_data_c, '" }'), DEFAULT);
49
50 #
51 # Test 1:
52 # - Modify row, but wait before writing JSON BLOB page.
53 # - Select with filter on virtual column which cannot be calculated
54 # (missing BLOB data, only prefix available).
55 #
56 --echo # Connection con1:
57 connection con1;
58 SET DEBUG_SYNC='blob_write_middle_after_check SIGNAL s1 WAIT_FOR s2 EXECUTE 2';
59 BEGIN;
60 --echo # Sending:
61 send UPDATE t SET j=json_set(j,'$.hash','"the_hash_x"') WHERE a=2;
62
63 --echo # Connection default:
64 connection default;
65 SET DEBUG_SYNC='now WAIT_FOR s1';
66 SET DEBUG_SYNC='now SIGNAL s2 WAIT_FOR s1';
67 SELECT json_extract(j, "$.data") = @json_data_a FROM t WHERE vj LIKE 'the_hash_a';
68 SELECT json_extract(j, "$.data") = @json_data_b FROM t WHERE vj LIKE 'the_hash_b';
69 SELECT json_extract(j, "$.data") = @json_data_c FROM t WHERE vj LIKE 'the_hash_c';
70 SET DEBUG_SYNC='now SIGNAL s2';
71
72 --echo # Connection con1:
73 connection con1;
74 reap;
75 ROLLBACK;
76
77 #
78 # Test 2:
79 # - Modify row, but wait before writing JSON BLOB page.
80 # - Select with filter on valid column, but read column
81 # that cannot be calculated (missing BLOB data, only prefix available).
82 #
83
84 --echo # Connection con1:
85 connection con1;
86 SET DEBUG_SYNC='blob_write_middle_after_check SIGNAL s1 WAIT_FOR s2 EXECUTE 2';
87 BEGIN;
88 --echo # Sending:
89 send UPDATE t SET j=json_set(j,'$.hash','"the_hash_x"') WHERE a=2;
90
91 --echo # Connection default:
92 connection default;
93 SET DEBUG_SYNC='now WAIT_FOR s1';
94 SET DEBUG_SYNC='now SIGNAL s2 WAIT_FOR s1';
95 --sorted_result
96 SELECT vj FROM t WHERE c LIKE 'aaaa1234%';
97 SET DEBUG_SYNC='now SIGNAL s2';
98
99 --echo # Connection con1:
100 connection con1;
101 reap;
102 ROLLBACK;
103
104 #
105 # Cleanup
106 #
107 --echo # Connection default:
108 connection default;
109 disconnect con1;
110
111 DROP TABLE t;
112
113 SET DEBUG_SYNC='reset';
114
115 SET SESSION transaction_isolation = @initial_isolation;
116
117 --source include/wait_until_count_sessions.inc