File: virtual_uncommitted.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (117 lines) | stat: -rw-r--r-- 3,435 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
--source include/have_debug_sync.inc
--source include/count_sessions.inc

--echo #
--echo # Bug #26625652: SIG=11 ROW_SEL_SEC_REC_IS_FOR_CLUST_REC ROW_SEARCH_MVCC
--echo #

#
# Prepare
#

--echo # Connection default:
connection default;
    SET @page_size = @@innodb_page_size;
    # the value must be >= than commit_freq in lob::insert
    SET @page_count = 4;
    SET @initial_isolation = @@SESSION.transaction_isolation;

    SET DEBUG_SYNC='reset';

--echo # Connection con1:
connect(con1,localhost,root,,test);
    SET SESSION transaction_isolation = 'READ-UNCOMMITTED';
    SELECT @@SESSION.transaction_isolation;

--echo # Connection default:
connection default;
    SET SESSION transaction_isolation = 'READ-UNCOMMITTED';
    SELECT @@SESSION.transaction_isolation;

    CREATE TABLE t (
        a INT,
        c VARCHAR(100),
        j JSON,
        vj varchar(100) as (json_unquote(j->'$.hash')) virtual,
        INDEX idx_a(a),
        INDEX idx_c(c),
        INDEX idx_vj(vj)
        ) ROW_FORMAT=COMPACT;

    set @json_data_a = repeat('a', @page_size * @page_count);
    set @json_data_b = repeat('b', @page_size * @page_count);
    set @json_data_c = repeat('c', @page_size * @page_count);

    INSERT INTO t VALUES
        (1, 'aaaa123xx', CONCAT('{ "hash": "the_hash_a", "data": "', @json_data_a, '" }'), DEFAULT),
        (2, 'aaaa1234x', CONCAT('{ "hash": "the_hash_b", "data": "', @json_data_b, '" }'), DEFAULT),
        (3, 'aaaa12345', CONCAT('{ "hash": "the_hash_c", "data": "', @json_data_c, '" }'), DEFAULT);

#
# Test 1:
# - Modify row, but wait before writing JSON BLOB page.
# - Select with filter on virtual column which cannot be calculated
#   (missing BLOB data, only prefix available).
#
--echo # Connection con1:
connection con1;
    SET DEBUG_SYNC='blob_write_middle_after_check SIGNAL s1 WAIT_FOR s2 EXECUTE 2';
    BEGIN;
	--echo # Sending:
    send UPDATE t SET j=json_set(j,'$.hash','"the_hash_x"') WHERE a=2;

--echo # Connection default:
connection default;
    SET DEBUG_SYNC='now WAIT_FOR s1';
    SET DEBUG_SYNC='now SIGNAL s2 WAIT_FOR s1';
    SELECT json_extract(j, "$.data")  = @json_data_a FROM t WHERE vj LIKE 'the_hash_a';
    SELECT json_extract(j, "$.data")  = @json_data_b FROM t WHERE vj LIKE 'the_hash_b';
    SELECT json_extract(j, "$.data")  = @json_data_c FROM t WHERE vj LIKE 'the_hash_c';
    SET DEBUG_SYNC='now SIGNAL s2';

--echo # Connection con1:
connection con1;
    reap;
    ROLLBACK;

#
# Test 2:
# - Modify row, but wait before writing JSON BLOB page.
# - Select with filter on valid column, but read column
#   that cannot be calculated (missing BLOB data, only prefix available).
#

--echo # Connection con1:
connection con1;
    SET DEBUG_SYNC='blob_write_middle_after_check SIGNAL s1 WAIT_FOR s2 EXECUTE 2';
    BEGIN;
    --echo # Sending:
    send UPDATE t SET j=json_set(j,'$.hash','"the_hash_x"') WHERE a=2;

--echo # Connection default:
connection default;
    SET DEBUG_SYNC='now WAIT_FOR s1';
    SET DEBUG_SYNC='now SIGNAL s2 WAIT_FOR s1';
    --sorted_result
    SELECT vj FROM t WHERE c LIKE 'aaaa1234%';
    SET DEBUG_SYNC='now SIGNAL s2';

--echo # Connection con1:
connection con1;
    reap;
    ROLLBACK;

#
# Cleanup
#
--echo # Connection default:
connection default;
    disconnect con1;

    DROP TABLE t;

    SET DEBUG_SYNC='reset';

    SET SESSION transaction_isolation = @initial_isolation;

--source include/wait_until_count_sessions.inc