Skip to content

Commit

Permalink
MDEV-23766: Fix get_best_disjunct_quick by assert:
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Sergei Krivonos authored and ohhmm committed Nov 9, 2021
1 parent 1f1ee08 commit cf047ef
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions sql/opt_range.cc
Expand Up @@ -371,7 +371,7 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param,
double read_time);
static
TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
double read_time);
double read_time, bool named_trace= false);
static
TABLE_READ_PLAN *merge_same_index_scans(PARAM *param, SEL_IMERGE *imerge,
TRP_INDEX_MERGE *imerge_trp,
Expand Down Expand Up @@ -5052,7 +5052,7 @@ double get_sweep_read_cost(const PARAM *param, ha_rows records)

static
TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
double read_time)
double read_time, bool named_trace)
{
SEL_TREE **ptree;
TRP_INDEX_MERGE *imerge_trp= NULL;
Expand Down Expand Up @@ -5101,7 +5101,9 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
n_child_scans)))
DBUG_RETURN(NULL);

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

if (imerge->trees_next-imerge->trees > 1)
trp= get_best_disjunct_quick(param, imerge, read_time);
trp= get_best_disjunct_quick(param, imerge, read_time, true);
else
{
/*
Expand Down

0 comments on commit cf047ef

Please sign in to comment.