mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-22910: SIGSEGV in Opt_trace_context::is_started & SIGSEGV in Json_writer::add_table_name (on optimized builds)
Make sure to initialize members of TABLE::reginfo when TABLE::init is called. In this case the problem was that table->reginfo.join_tab was set for the SELECT query and then was reused by the UPDATE query. This case occurred only when the SELECT query had a degenerate join.
This commit is contained in:
@ -8559,5 +8559,36 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns'))
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# MDEV-22910:SIGSEGV in Opt_trace_context::is_started & SIGSEGV in Json_writer::add_table_name
|
||||||
|
# (on optimized builds)
|
||||||
|
#
|
||||||
|
CREATE TABLE t1( a INT, b INT, PRIMARY KEY( a ) );
|
||||||
|
SELECT sum(b), row_number() OVER (order by b) FROM t1 WHERE a = 101;
|
||||||
|
sum(b) row_number() OVER (order by b)
|
||||||
|
NULL 1
|
||||||
|
UPDATE t1 SET b=10 WHERE a=1;
|
||||||
|
SELECT JSON_DETAILED(JSON_EXTRACT(trace, '$**.range_scan_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||||
|
JSON_DETAILED(JSON_EXTRACT(trace, '$**.range_scan_alternatives'))
|
||||||
|
[
|
||||||
|
|
||||||
|
[
|
||||||
|
|
||||||
|
{
|
||||||
|
"index": "PRIMARY",
|
||||||
|
"ranges":
|
||||||
|
[
|
||||||
|
"(1) <= (a) <= (1)"
|
||||||
|
],
|
||||||
|
"rowid_ordered": true,
|
||||||
|
"using_mrr": false,
|
||||||
|
"index_only": false,
|
||||||
|
"rows": 0,
|
||||||
|
"cost": 1.125,
|
||||||
|
"chosen": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
DROP TABLE t1;
|
||||||
set optimizer_trace='enabled=off';
|
set optimizer_trace='enabled=off';
|
||||||
# End of 10.4 tests
|
# End of 10.4 tests
|
||||||
|
@ -611,5 +611,16 @@ EXPLAIN EXTENDED SELECT * from t1 WHERE b >= 10 and b < 25;
|
|||||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-22910:SIGSEGV in Opt_trace_context::is_started & SIGSEGV in Json_writer::add_table_name
|
||||||
|
--echo # (on optimized builds)
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1( a INT, b INT, PRIMARY KEY( a ) );
|
||||||
|
SELECT sum(b), row_number() OVER (order by b) FROM t1 WHERE a = 101;
|
||||||
|
UPDATE t1 SET b=10 WHERE a=1;
|
||||||
|
SELECT JSON_DETAILED(JSON_EXTRACT(trace, '$**.range_scan_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
set optimizer_trace='enabled=off';
|
set optimizer_trace='enabled=off';
|
||||||
--echo # End of 10.4 tests
|
--echo # End of 10.4 tests
|
||||||
|
@ -2690,10 +2690,8 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
|
|||||||
DBUG_PRINT("info",("Time to scan table: %g", read_time));
|
DBUG_PRINT("info",("Time to scan table: %g", read_time));
|
||||||
|
|
||||||
Json_writer_object table_records(thd);
|
Json_writer_object table_records(thd);
|
||||||
if (head->reginfo.join_tab)
|
table_records.add_table_name(head);
|
||||||
table_records.add_table_name(head->reginfo.join_tab);
|
|
||||||
else
|
|
||||||
table_records.add_table_name(head);
|
|
||||||
Json_writer_object trace_range(thd, "range_analysis");
|
Json_writer_object trace_range(thd, "range_analysis");
|
||||||
{
|
{
|
||||||
Json_writer_object table_rec(thd, "table_scan");
|
Json_writer_object table_rec(thd, "table_scan");
|
||||||
|
@ -5160,6 +5160,8 @@ void TABLE::init(THD *thd, TABLE_LIST *tl)
|
|||||||
fulltext_searched= 0;
|
fulltext_searched= 0;
|
||||||
file->ft_handler= 0;
|
file->ft_handler= 0;
|
||||||
reginfo.impossible_range= 0;
|
reginfo.impossible_range= 0;
|
||||||
|
reginfo.join_tab= NULL;
|
||||||
|
reginfo.not_exists_optimize= FALSE;
|
||||||
created= TRUE;
|
created= TRUE;
|
||||||
cond_selectivity= 1.0;
|
cond_selectivity= 1.0;
|
||||||
cond_selectivity_sampling_explain= NULL;
|
cond_selectivity_sampling_explain= NULL;
|
||||||
|
Reference in New Issue
Block a user