mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
MDEV-13826: Floating point exception in Filesort_tracker::print_json_members(Json_writer*)
Whenever Filesort_tracker has r_loops=0, r_ouptut_rows would be 0, so we should add the value zero to the member "r_output_rows" explicitly
This commit is contained in:
parent
52a5bfa078
commit
9b4d281ecd
3 changed files with 88 additions and 5 deletions
|
@ -757,3 +757,63 @@ ANALYZE
|
|||
}
|
||||
}
|
||||
drop table t1,t2,t3;
|
||||
#
|
||||
# MDEV-13286: Floating point exception in Filesort_tracker::print_json_members(Json_writer*)
|
||||
#
|
||||
create table t0(a int);
|
||||
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
create table t1 (a int, b int, c int);
|
||||
insert into t1 select a,a,a from t0;
|
||||
create table t2 as select * from t1;
|
||||
analyze format=json select a, (select t2.b from t2 where t2.a<t1.a order by t2.c limit 1) from t1 where t1.a<0;
|
||||
ANALYZE
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"r_loops": 1,
|
||||
"r_total_time_ms": "REPLACED",
|
||||
"table": {
|
||||
"table_name": "t1",
|
||||
"access_type": "ALL",
|
||||
"r_loops": 1,
|
||||
"rows": 10,
|
||||
"r_rows": 10,
|
||||
"r_total_time_ms": "REPLACED",
|
||||
"filtered": 100,
|
||||
"r_filtered": 0,
|
||||
"attached_condition": "t1.a < 0"
|
||||
},
|
||||
"subqueries": [
|
||||
{
|
||||
"expression_cache": {
|
||||
"state": "uninitialized",
|
||||
"r_loops": 0,
|
||||
"query_block": {
|
||||
"select_id": 2,
|
||||
"read_sorted_file": {
|
||||
"r_rows": null,
|
||||
"filesort": {
|
||||
"sort_key": "t2.c",
|
||||
"r_loops": null,
|
||||
"r_limit": null,
|
||||
"r_used_priority_queue": null,
|
||||
"r_output_rows": null,
|
||||
"table": {
|
||||
"table_name": "t2",
|
||||
"access_type": "ALL",
|
||||
"r_loops": 0,
|
||||
"rows": 10,
|
||||
"r_rows": null,
|
||||
"filtered": 100,
|
||||
"r_filtered": null,
|
||||
"attached_condition": "t2.a < t1.a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
drop table t0,t1,t2;
|
||||
|
|
|
@ -212,3 +212,15 @@ GROUP BY sq ORDER BY gc;
|
|||
|
||||
drop table t1,t2,t3;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-13286: Floating point exception in Filesort_tracker::print_json_members(Json_writer*)
|
||||
--echo #
|
||||
create table t0(a int);
|
||||
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
create table t1 (a int, b int, c int);
|
||||
insert into t1 select a,a,a from t0;
|
||||
create table t2 as select * from t1;
|
||||
--source include/analyze-format.inc
|
||||
analyze format=json select a, (select t2.b from t2 where t2.a<t1.a order by t2.c limit 1) from t1 where t1.a<0;
|
||||
drop table t0,t1,t2;
|
||||
|
|
|
@ -26,7 +26,11 @@
|
|||
void Filesort_tracker::print_json_members(Json_writer *writer)
|
||||
{
|
||||
const char *varied_str= "(varied across executions)";
|
||||
writer->add_member("r_loops").add_ll(get_r_loops());
|
||||
|
||||
if (!get_r_loops())
|
||||
writer->add_member("r_loops").add_null();
|
||||
else
|
||||
writer->add_member("r_loops").add_ll(get_r_loops());
|
||||
|
||||
if (get_r_loops() && time_tracker.timed)
|
||||
{
|
||||
|
@ -36,22 +40,29 @@ void Filesort_tracker::print_json_members(Json_writer *writer)
|
|||
if (r_limit != HA_POS_ERROR)
|
||||
{
|
||||
writer->add_member("r_limit");
|
||||
if (r_limit == 0)
|
||||
if (!get_r_loops())
|
||||
writer->add_null();
|
||||
else if (r_limit == 0)
|
||||
writer->add_str(varied_str);
|
||||
else
|
||||
writer->add_ll((longlong) rint(r_limit/get_r_loops()));
|
||||
}
|
||||
|
||||
writer->add_member("r_used_priority_queue");
|
||||
if (r_used_pq == get_r_loops())
|
||||
if (!get_r_loops())
|
||||
writer->add_null();
|
||||
else if (r_used_pq == get_r_loops())
|
||||
writer->add_bool(true);
|
||||
else if (r_used_pq == 0)
|
||||
writer->add_bool(false);
|
||||
else
|
||||
writer->add_str(varied_str);
|
||||
|
||||
writer->add_member("r_output_rows").add_ll((longlong) rint(r_output_rows /
|
||||
get_r_loops()));
|
||||
if (!get_r_loops())
|
||||
writer->add_member("r_output_rows").add_null();
|
||||
else
|
||||
writer->add_member("r_output_rows").add_ll((longlong) rint(r_output_rows /
|
||||
get_r_loops()));
|
||||
|
||||
if (sort_passes)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue