Skip to content

Commit 864bbd4

Browse files
committed
Merge 10.6 into 10.9
2 parents b9c7da4 + b102872 commit 864bbd4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+767
-193
lines changed

include/my_compiler.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,15 @@
4040
/* GNU C/C++ */
4141
#if defined __GNUC__
4242
# define MY_ALIGN_EXT
43-
# define MY_ASSERT_UNREACHABLE() __builtin_unreachable()
43+
44+
/*
45+
__builtin_unreachable() removes the "statement may fall through" warning-as-
46+
error when MY_ASSERT_UNREACHABLE() is used in "case xxx:" in switch (...)
47+
statements.
48+
abort() is there to prevent the execution from reaching the
49+
__builtin_unreachable() as this may cause misleading stack traces.
50+
*/
51+
# define MY_ASSERT_UNREACHABLE() { abort(); __builtin_unreachable(); }
4452

4553
/* Microsoft Visual C++ */
4654
#elif defined _MSC_VER
@@ -88,7 +96,7 @@
8896
#endif
8997

9098
#ifndef MY_ASSERT_UNREACHABLE
91-
# define MY_ASSERT_UNREACHABLE() do { assert(0); } while (0)
99+
# define MY_ASSERT_UNREACHABLE() do { abort(); } while (0)
92100
#endif
93101

94102
/**

mysql-test/include/analyze-format.inc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
# The time on ANALYSE FORMAT=JSON is rather variable
1+
# Remove non-deterministic parts of ANALYZE FORMAT=JSON output:
2+
# - any timings
3+
# - Buffer sizes (depend on pointer size)
4+
# - r_engine_stats depends on buffer pool state and whether old record versions
5+
# were purged.
26

3-
--replace_regex /("(r_[a-z_]*_time(_in_progress)?_ms|r_buffer_size)": )[^, \n]*/\1"REPLACED"/
7+
--replace_regex /("(r_[a-z_]*_time(_in_progress)?_ms|r_buffer_size)": )[^, \n]*/\1"REPLACED"/ /("r_engine_stats":) {[^}]*}/\1 REPLACED/
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[slow_query_log_on]
2+
slow_query_log=ON
3+
4+
[slow_query_log_off]
5+
slow_query_log=OFF
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
create table t1 (
2+
pk int not null,
3+
a varchar(64),
4+
b varchar(64),
5+
c varchar(64)
6+
) engine=innodb;
7+
insert into t1 select
8+
seq, seq, seq, seq
9+
from
10+
seq_1_to_10000;
11+
analyze table t1 persistent for all;
12+
Table Op Msg_type Msg_text
13+
test.t1 analyze status Engine-independent statistics collected
14+
test.t1 analyze status OK
15+
# Note the r_engine_stats below. Only non-zero members are printed
16+
select '$out' as X;
17+
X
18+
{
19+
"query_block": {
20+
"select_id": 1,
21+
"r_loops": 1,
22+
"r_total_time_ms": "REPLACED",
23+
"nested_loop": [
24+
{
25+
"table": {
26+
"table_name": "t1",
27+
"access_type": "ALL",
28+
"r_loops": 1,
29+
"rows": 10000,
30+
"r_rows": 10000,
31+
"r_table_time_ms": "REPLACED",
32+
"r_other_time_ms": "REPLACED",
33+
"r_engine_stats": {
34+
"pages_accessed": "REPLACED"
35+
},
36+
"filtered": 100,
37+
"r_filtered": 100,
38+
"attached_condition": "t1.pk < 120000"
39+
}
40+
}
41+
]
42+
}
43+
}
44+
set @js='$out';
45+
set @out=(select json_extract(@js,'$**.r_engine_stats.pages_accessed'));
46+
select cast(json_extract(@out,'$[0]') as DOUBLE) > 0 as PAGES_ACCESSED_MORE_THAN_ZERO;
47+
PAGES_ACCESSED_MORE_THAN_ZERO
48+
1
49+
#
50+
# Try an UPDATE
51+
#
52+
select '$out' as X;
53+
X
54+
{
55+
"query_block": {
56+
"select_id": 1,
57+
"r_total_time_ms": "REPLACED",
58+
"table": {
59+
"update": 1,
60+
"table_name": "t1",
61+
"access_type": "ALL",
62+
"rows": 10000,
63+
"r_rows": 10000,
64+
"r_filtered": 100,
65+
"r_total_time_ms": "REPLACED",
66+
"r_engine_stats": {
67+
"pages_accessed": "REPLACED",
68+
"pages_updated": "REPLACED"
69+
},
70+
"attached_condition": "t1.pk < 120000"
71+
}
72+
}
73+
}
74+
set @js='$out';
75+
set @out=(select json_extract(@js,'$**.r_engine_stats.pages_updated'));
76+
select cast(json_extract(@out,'$[0]') as DOUBLE) > 0 as PAGES_UPDATED_MORE_THAN_ZERO;
77+
PAGES_UPDATED_MORE_THAN_ZERO
78+
1
79+
#
80+
# Try a DELETE
81+
#
82+
select '$out' as X;
83+
X
84+
{
85+
"query_block": {
86+
"select_id": 1,
87+
"r_total_time_ms": "REPLACED",
88+
"table": {
89+
"delete": 1,
90+
"table_name": "t1",
91+
"access_type": "ALL",
92+
"rows": 10000,
93+
"r_rows": 10000,
94+
"r_filtered": 50,
95+
"r_total_time_ms": "REPLACED",
96+
"r_engine_stats": {
97+
"pages_accessed": "REPLACED",
98+
"pages_updated": "REPLACED"
99+
},
100+
"attached_condition": "t1.pk MOD 2 = 1"
101+
}
102+
}
103+
}
104+
set @js='$out';
105+
set @out=(select json_extract(@js,'$**.r_engine_stats.pages_updated'));
106+
select cast(json_extract(@out,'$[0]') as DOUBLE) > 0 as PAGES_UPDATED_MORE_THAN_ZERO;
107+
PAGES_UPDATED_MORE_THAN_ZERO
108+
1
109+
drop table t1;
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#
2+
# Tests for r_engine_stats in ANALYZE FORMAT=JSON output
3+
#
4+
--source include/analyze-format.inc
5+
--source include/have_sequence.inc
6+
--source include/have_innodb.inc
7+
8+
create table t1 (
9+
pk int not null,
10+
a varchar(64),
11+
b varchar(64),
12+
c varchar(64)
13+
) engine=innodb;
14+
15+
insert into t1 select
16+
seq, seq, seq, seq
17+
from
18+
seq_1_to_10000;
19+
20+
analyze table t1 persistent for all;
21+
22+
--echo # Note the r_engine_stats below. Only non-zero members are printed
23+
let $out=`
24+
ANALYZE FORMAT=json
25+
select * from t1 where pk < 120000;
26+
`;
27+
28+
# Don't use "source include/analyze-format.inc" as it replaces r_engine_stats
29+
# Replace the "pages_accessed" value, too, as it is different for some
30+
# platforms...
31+
--replace_regex /("(r_[a-z_]*_time(_in_progress)?_ms|r_buffer_size|pages_accessed)": )[^, \n]*/\1"REPLACED"/
32+
evalp select '$out' as X;
33+
34+
evalp set @js='$out';
35+
set @out=(select json_extract(@js,'$**.r_engine_stats.pages_accessed'));
36+
select cast(json_extract(@out,'$[0]') as DOUBLE) > 0 as PAGES_ACCESSED_MORE_THAN_ZERO;
37+
38+
--echo #
39+
--echo # Try an UPDATE
40+
--echo #
41+
42+
let $out=`analyze format=json update t1 set b = b-1 where pk < 120000`;
43+
44+
--replace_regex /("(r_[a-z_]*_time_ms|pages_accessed|pages_updated)": )[^, \n]*/\1"REPLACED"/
45+
evalp select '$out' as X;
46+
47+
evalp set @js='$out';
48+
set @out=(select json_extract(@js,'$**.r_engine_stats.pages_updated'));
49+
select cast(json_extract(@out,'$[0]') as DOUBLE) > 0 as PAGES_UPDATED_MORE_THAN_ZERO;
50+
51+
--echo #
52+
--echo # Try a DELETE
53+
--echo #
54+
let $out=`analyze format=json delete from t1 where mod(pk,2)=1`;
55+
56+
--replace_regex /("(r_[a-z_]*_time_ms|pages_accessed|pages_updated)": )[^, \n]*/\1"REPLACED"/
57+
evalp select '$out' as X;
58+
59+
evalp set @js='$out';
60+
set @out=(select json_extract(@js,'$**.r_engine_stats.pages_updated'));
61+
select cast(json_extract(@out,'$[0]') as DOUBLE) > 0 as PAGES_UPDATED_MORE_THAN_ZERO;
62+
63+
drop table t1;
64+

0 commit comments

Comments
 (0)