diff options
author | Sergei Krivonos <sergei.krivonos@mariadb.com> | 2021-11-02 14:01:54 +0200 |
---|---|---|
committer | Sergei Krivonos <sergeikrivonos@gmail.com> | 2021-11-09 12:06:49 +0200 |
commit | cf047efd42ab64d730e2b84c7482e56b695678ef (patch) | |
tree | 95ae4dc3baa3426c9d9f0a29ee94d766af54e242 | |
parent | 1f1ee085fb65ed98c7adecd61f4e7bd9abb6ae26 (diff) | |
download | mariadb-git-cf047efd42ab64d730e2b84c7482e56b695678ef.tar.gz |
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
-rw-r--r-- | sql/opt_range.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc index d47aa1ee41e..122b00f4d57 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -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, @@ -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; @@ -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, @@ -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 { /* |