Skip to content

Commit cf047ef

Browse files
Sergei Krivonosohhmm
authored andcommitted
MDEV-23766: Fix get_best_disjunct_quick by assert:
in test main.range_vs_index_merge one path requires named JSON object: assert.c:0(.annobin_assert.c_end)[0x7fe9d2270a76] sql/my_json_writer.cc:43(Json_writer::on_start_object())[0x555e284f048a] sql/my_json_writer.cc:59(Json_writer::start_object())[0x555e284ee6e8] sql/my_json_writer.h:377(Json_writer_object::Json_writer_object(THD*))[0x555e281dce11] sql/opt_range.cc:5137(get_best_disjunct_quick(PARAM*, SEL_IMERGE*, double))[0x555e287c576b] sql/opt_range.cc:5492(merge_same_index_scans(PARAM*, SEL_IMERGE*, TRP_INDEX_MERGE*, double))[0x555e287c6cf6] sql/opt_range.cc:5287(get_best_disjunct_quick(PARAM*, SEL_IMERGE*, double))[0x555e287c607a] sql/opt_range.cc:3000(SQL_SELECT::test_quick_select another one requires unnamed JSON: mariadbd: /home/name/server/sql/my_json_writer.cc:379: bool Single_line_formatting_helper::on_add_member(const char*, size_t): Assertion `state== INACTIVE || state == assert.c:0(.annobin_assert.c_end)[0x7f33d8df8a76] sql/my_json_writer.cc:380(Single_line_formatting_helper::on_add_member(char const*, unsigned long))[0x558362f6a717] sql/my_json_writer.cc:150(Json_writer::add_member(char const*, unsigned long))[0x558362f69a91] sql/my_json_writer.cc:146(Json_writer::add_member(char const*))[0x558362f69a5f] sql/my_json_writer.h:383(Json_writer_object::Json_writer_object(THD*, char const*))[0x558362ceccaa] sql/opt_range.cc:5139(get_best_disjunct_quick(PARAM*, SEL_IMERGE*, double))[0x5583632407d0] sql/opt_range.cc:3000(SQL_SELECT::test_quick_select
1 parent 1f1ee08 commit cf047ef

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

sql/opt_range.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param,
371371
double read_time);
372372
static
373373
TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
374-
double read_time);
374+
double read_time, bool named_trace= false);
375375
static
376376
TABLE_READ_PLAN *merge_same_index_scans(PARAM *param, SEL_IMERGE *imerge,
377377
TRP_INDEX_MERGE *imerge_trp,
@@ -5052,7 +5052,7 @@ double get_sweep_read_cost(const PARAM *param, ha_rows records)
50525052

50535053
static
50545054
TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
5055-
double read_time)
5055+
double read_time, bool named_trace)
50565056
{
50575057
SEL_TREE **ptree;
50585058
TRP_INDEX_MERGE *imerge_trp= NULL;
@@ -5101,7 +5101,9 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
51015101
n_child_scans)))
51025102
DBUG_RETURN(NULL);
51035103

5104-
Json_writer_object trace_best_disjunct(thd);
5104+
Json_writer_object trace_best_disjunct = named_trace
5105+
? Json_writer_object(thd, "best_disjunct_quick")
5106+
: Json_writer_object(thd);
51055107
Json_writer_array to_merge(thd, "indexes_to_merge");
51065108
/*
51075109
Collect best 'range' scan for each of disjuncts, and, while doing so,
@@ -5459,7 +5461,7 @@ TABLE_READ_PLAN *merge_same_index_scans(PARAM *param, SEL_IMERGE *imerge,
54595461
DBUG_ASSERT(imerge->trees_next>imerge->trees);
54605462

54615463
if (imerge->trees_next-imerge->trees > 1)
5462-
trp= get_best_disjunct_quick(param, imerge, read_time);
5464+
trp= get_best_disjunct_quick(param, imerge, read_time, true);
54635465
else
54645466
{
54655467
/*

0 commit comments

Comments
 (0)