diff options
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r-- | sql/opt_range.cc | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 38dbed92a22..c7c0ba25efe 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1595,7 +1595,7 @@ int QUICK_ROR_INTERSECT_SELECT::init_ror_merged_scan(bool reuse_handler, selects. */ int error= quick->init_ror_merged_scan(TRUE, local_alloc); - if (error) + if (unlikely(error)) DBUG_RETURN(error); quick->file->extra(HA_EXTRA_KEYREAD_PRESERVE_FIELDS); } @@ -1619,7 +1619,8 @@ int QUICK_ROR_INTERSECT_SELECT::init_ror_merged_scan(bool reuse_handler, quick->record= head->record[0]; } - if (need_to_fetch_row && head->file->ha_rnd_init_with_error(false)) + if (need_to_fetch_row && + unlikely(head->file->ha_rnd_init_with_error(false))) { DBUG_PRINT("error", ("ROR index_merge rnd_init call failed")); DBUG_RETURN(1); @@ -1793,9 +1794,9 @@ int QUICK_ROR_UNION_SELECT::reset() List_iterator_fast<QUICK_SELECT_I> it(quick_selects); while ((quick= it++)) { - if ((error= quick->reset())) + if (unlikely((error= quick->reset()))) DBUG_RETURN(error); - if ((error= quick->get_next())) + if (unlikely((error= quick->get_next()))) { if (error == HA_ERR_END_OF_FILE) continue; @@ -1805,12 +1806,12 @@ int QUICK_ROR_UNION_SELECT::reset() queue_insert(&queue, (uchar*)quick); } /* Prepare for ha_rnd_pos calls. */ - if (head->file->inited && (error= head->file->ha_rnd_end())) + if (head->file->inited && unlikely((error= head->file->ha_rnd_end()))) { DBUG_PRINT("error", ("ROR index_merge rnd_end call failed")); DBUG_RETURN(error); } - if ((error= head->file->ha_rnd_init(false))) + if (unlikely((error= head->file->ha_rnd_init(false)))) { DBUG_PRINT("error", ("ROR index_merge rnd_init call failed")); DBUG_RETURN(error); @@ -10835,8 +10836,9 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, goto err; quick->records= records; - if ((cp_buffer_from_ref(thd, table, ref) && thd->is_fatal_error) || - !(range= new(alloc) QUICK_RANGE())) + if ((cp_buffer_from_ref(thd, table, ref) && + unlikely(thd->is_fatal_error)) || + unlikely(!(range= new(alloc) QUICK_RANGE()))) goto err; // out of memory range->min_key= range->max_key= ref->key_buff; @@ -10845,8 +10847,8 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, make_prev_keypart_map(ref->key_parts); range->flag= EQ_RANGE; - if (!(quick->key_parts=key_part=(KEY_PART *) - alloc_root(&quick->alloc,sizeof(KEY_PART)*ref->key_parts))) + if (unlikely(!(quick->key_parts=key_part=(KEY_PART *) + alloc_root(&quick->alloc,sizeof(KEY_PART)*ref->key_parts)))) goto err; max_used_key_len=0; @@ -11178,7 +11180,7 @@ int QUICK_ROR_INTERSECT_SELECT::get_next() error= quick->get_next(); } } - if (error) + if (unlikely(error)) DBUG_RETURN(error); /* Save the read key tuple */ @@ -11203,7 +11205,7 @@ int QUICK_ROR_INTERSECT_SELECT::get_next() { DBUG_EXECUTE_IF("innodb_quick_report_deadlock", DBUG_SET("+d,innodb_report_deadlock");); - if ((error= quick->get_next())) + if (unlikely((error= quick->get_next()))) { /* On certain errors like deadlock, trx might be rolled back.*/ if (!thd->transaction_rollback_request) @@ -11231,7 +11233,7 @@ int QUICK_ROR_INTERSECT_SELECT::get_next() while (!cpk_quick->row_in_ranges()) { quick->file->unlock_row(); /* row not in range; unlock */ - if ((error= quick->get_next())) + if (unlikely((error= quick->get_next()))) { /* On certain errors like deadlock, trx might be rolled back.*/ if (!thd->transaction_rollback_request) @@ -11363,7 +11365,7 @@ int QUICK_RANGE_SELECT::reset() if (file->inited == handler::RND) { /* Handler could be left in this state by MRR */ - if ((error= file->ha_rnd_end())) + if (unlikely((error= file->ha_rnd_end()))) DBUG_RETURN(error); } @@ -11375,7 +11377,7 @@ int QUICK_RANGE_SELECT::reset() { DBUG_EXECUTE_IF("bug14365043_2", DBUG_SET("+d,ha_index_init_fail");); - if ((error= file->ha_index_init(index,1))) + if (unlikely((error= file->ha_index_init(index,1)))) { file->print_error(error, MYF(0)); goto err; @@ -11718,7 +11720,7 @@ int QUICK_SELECT_DESC::get_next() if (last_range->flag & NO_MAX_RANGE) // Read last record { int local_error; - if ((local_error= file->ha_index_last(record))) + if (unlikely((local_error= file->ha_index_last(record)))) DBUG_RETURN(local_error); // Empty table if (cmp_prev(last_range) == 0) DBUG_RETURN(0); |