Commit f91eb71e authored by Varun Gupta's avatar Varun Gupta

MDEV-8840: ANALYZE FORMAT=JSON produces wrong data with BKA

The issue was that r_loops, r_rows and r_filtered in ANALYZE FORMAT= JSON were not
calculated for the table on which we were performing the MRR scan in the BKA join
Fixed this by adding respective counter in the JOIN_TAB_SCAN_MRR::open and JOIN_TAB_SCAN_MRR::next
parent ea2162b6
...@@ -1524,12 +1524,12 @@ ANALYZE ...@@ -1524,12 +1524,12 @@ ANALYZE
"key_length": "5", "key_length": "5",
"used_key_parts": ["a"], "used_key_parts": ["a"],
"ref": ["test.t3.a"], "ref": ["test.t3.a"],
"r_loops": 0, "r_loops": 1,
"rows": 1, "rows": 1,
"r_rows": null, "r_rows": 10,
"r_total_time_ms": "REPLACED", "r_total_time_ms": "REPLACED",
"filtered": 100, "filtered": 100,
"r_filtered": null, "r_filtered": 100,
"index_condition_bka": "((t4.b + 1) <= (t3.b + 1))" "index_condition_bka": "((t4.b + 1) <= (t3.b + 1))"
}, },
"buffer_type": "flat", "buffer_type": "flat",
......
...@@ -3877,6 +3877,7 @@ int JOIN_TAB_SCAN_MRR::open() ...@@ -3877,6 +3877,7 @@ int JOIN_TAB_SCAN_MRR::open()
/* Dynamic range access is never used with BKA */ /* Dynamic range access is never used with BKA */
DBUG_ASSERT(join_tab->use_quick != 2); DBUG_ASSERT(join_tab->use_quick != 2);
join_tab->tracker->r_scans++;
save_or_restore_used_tabs(join_tab, FALSE); save_or_restore_used_tabs(join_tab, FALSE);
init_mrr_buff(); init_mrr_buff();
...@@ -3920,6 +3921,8 @@ int JOIN_TAB_SCAN_MRR::next() ...@@ -3920,6 +3921,8 @@ int JOIN_TAB_SCAN_MRR::next()
int rc= join_tab->table->file->multi_range_read_next((range_id_t*)ptr) ? -1 : 0; int rc= join_tab->table->file->multi_range_read_next((range_id_t*)ptr) ? -1 : 0;
if (!rc) if (!rc)
{ {
join_tab->tracker->r_rows++;
join_tab->tracker->r_rows_after_where++;
/* /*
If a record in in an incremental cache contains no fields then the If a record in in an incremental cache contains no fields then the
association for the last record in cache will be equal to cache->end_pos association for the last record in cache will be equal to cache->end_pos
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment