diff options
Diffstat (limited to 'sql/sql_join_cache.cc')
-rw-r--r-- | sql/sql_join_cache.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc index 2ee63171..b80f3861 100644 --- a/sql/sql_join_cache.cc +++ b/sql/sql_join_cache.cc @@ -919,7 +919,12 @@ int JOIN_CACHE::alloc_buffer() buff= NULL; buff_size= get_max_join_buffer_size(optimize_buff_size, min_buff_size); - for (tab= start_tab; tab!= join_tab; + /* + Compute the total buffer usage for all join buffers up to + and including the current one. + */ + for (tab= first_linear_tab(join, WITHOUT_BUSH_ROOTS, WITHOUT_CONST_TABLES); + tab != join_tab; tab= next_linear_tab(join, tab, WITHOUT_BUSH_ROOTS)) { cache= tab->cache; @@ -2171,12 +2176,12 @@ enum_nested_loop_state JOIN_CACHE::join_records(bool skip_last) if (!join_tab->first_unmatched) { - bool pfs_batch_update= join_tab->pfs_batch_update(join); - if (pfs_batch_update) + DBUG_ASSERT(join_tab->cached_pfs_batch_update == join_tab->pfs_batch_update()); + if (join_tab->cached_pfs_batch_update) join_tab->table->file->start_psi_batch_mode(); /* Find all records from join_tab that match records from join buffer */ rc= join_matching_records(skip_last); - if (pfs_batch_update) + if (join_tab->cached_pfs_batch_update) join_tab->table->file->end_psi_batch_mode(); if (rc != NESTED_LOOP_OK && rc != NESTED_LOOP_NO_MORE_ROWS) goto finish; @@ -2346,7 +2351,8 @@ enum_nested_loop_state JOIN_CACHE::join_matching_records(bool skip_last) if ((rc= join_tab_execution_startup(join_tab)) < 0) goto finish2; - if (join_tab->build_range_rowid_filter_if_needed()) + if (join_tab->need_to_build_rowid_filter && + join_tab->build_range_rowid_filter()) { rc= NESTED_LOOP_ERROR; goto finish2; |