Loading innobase/btr/btr0sea.c +8 −6 Original line number Diff line number Diff line Loading @@ -59,9 +59,6 @@ before hash index building is started */ #define BTR_SEARCH_BUILD_LIMIT 100 /* How many cells to check before temporarily releasing btr_search_latch */ #define BTR_CHUNK_SIZE 10000 /************************************************************************ Builds a hash index on a page with the given parameters. If the page already has a hash index with different parameters, the old hash index is removed. Loading Loading @@ -1607,6 +1604,11 @@ btr_search_validate(void) mem_heap_t* heap = NULL; ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint* offsets = offsets_; /* How many cells to check before temporarily releasing btr_search_latch. */ ulint chunk_size = 10000; *offsets_ = (sizeof offsets_) / sizeof *offsets_; rw_lock_x_lock(&btr_search_latch); Loading @@ -1616,7 +1618,7 @@ btr_search_validate(void) for (i = 0; i < cell_count; i++) { /* We release btr_search_latch every once in a while to give other queries a chance to run. */ if ((i != 0) && ((i % BTR_CHUNK_SIZE) == 0)) { if ((i != 0) && ((i % chunk_size) == 0)) { rw_lock_x_unlock(&btr_search_latch); os_thread_yield(); rw_lock_x_lock(&btr_search_latch); Loading Loading @@ -1675,8 +1677,8 @@ btr_search_validate(void) } } for (i = 0; i < cell_count; i += BTR_CHUNK_SIZE) { ulint end_index = ut_min(i + BTR_CHUNK_SIZE - 1, cell_count - 1); for (i = 0; i < cell_count; i += chunk_size) { ulint end_index = ut_min(i + chunk_size - 1, cell_count - 1); /* We release btr_search_latch every once in a while to give other queries a chance to run. */ Loading mysql-test/r/group_min_max.result +9 −0 Original line number Diff line number Diff line Loading @@ -1954,6 +1954,15 @@ id select_type table type possible_keys key key_len ref rows Extra explain select sum(ord(a1)) from t1 where (a1 > 'a') group by a1,a2,b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 128 Using where; Using index explain select distinct(a1) from t1 where ord(a2) = 98; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL idx_t1_1 163 NULL 128 Using where; Using index select distinct(a1) from t1 where ord(a2) = 98; a1 a b c d explain select a1 from t1 where a2 = 'b' group by a1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range NULL idx_t1_1 130 NULL 5 Using where; Using index for group-by Loading mysql-test/t/group_min_max.test +8 −0 Original line number Diff line number Diff line Loading @@ -641,6 +641,14 @@ explain select a1,a2,count(a2) from t1 group by a1,a2,b; explain select a1,a2,count(a2) from t1 where (a1 > 'a') group by a1,a2,b; explain select sum(ord(a1)) from t1 where (a1 > 'a') group by a1,a2,b; # # Bug #16710: select distinct doesn't return all it should # explain select distinct(a1) from t1 where ord(a2) = 98; select distinct(a1) from t1 where ord(a2) = 98; # # BUG#11044: DISTINCT or GROUP BY queries with equality predicates instead of MIN/MAX. # Loading sql/ha_innodb.cc +8 −2 Original line number Diff line number Diff line Loading @@ -989,7 +989,6 @@ innobase_query_caching_of_table_permitted( mutex_enter_noninline(&kernel_mutex); trx_print(stderr, trx, 1024); mutex_exit_noninline(&kernel_mutex); ut_error; } innobase_release_stat_resources(trx); Loading Loading @@ -3833,6 +3832,13 @@ ha_innobase::unlock_row(void) ut_error; } /* Consistent read does not take any locks, thus there is nothing to unlock. */ if (prebuilt->select_lock_type == LOCK_NONE) { DBUG_VOID_RETURN; } if (srv_locks_unsafe_for_binlog) { row_unlock_for_mysql(prebuilt, FALSE); } Loading sql/item.cc +34 −1 Original line number Diff line number Diff line Loading @@ -496,7 +496,7 @@ bool Item_ident::remove_dependence_processor(byte * arg) arguments in a condition the method must return false. RETURN false to force the evaluation of collect_item_field_processor FALSE to force the evaluation of collect_item_field_processor for the subsequent items. */ Loading @@ -517,6 +517,39 @@ bool Item_field::collect_item_field_processor(byte *arg) } /* Check if an Item_field references some field from a list of fields. SYNOPSIS Item_field::find_item_in_field_list_processor arg Field being compared, arg must be of type Field DESCRIPTION Check whether the Item_field represented by 'this' references any of the fields in the keyparts passed via 'arg'. Used with the method Item::walk() to test whether any keypart in a sequence of keyparts is referenced in an expression. RETURN TRUE if 'this' references the field 'arg' FALSE otherwise */ bool Item_field::find_item_in_field_list_processor(byte *arg) { KEY_PART_INFO *first_non_group_part= *((KEY_PART_INFO **) arg); KEY_PART_INFO *last_part= *(((KEY_PART_INFO **) arg) + 1); KEY_PART_INFO *cur_part; for (cur_part= first_non_group_part; cur_part != last_part; cur_part++) { if (field->eq(cur_part->field)) return TRUE; } return FALSE; } bool Item::check_cols(uint c) { if (c != 1) Loading Loading
innobase/btr/btr0sea.c +8 −6 Original line number Diff line number Diff line Loading @@ -59,9 +59,6 @@ before hash index building is started */ #define BTR_SEARCH_BUILD_LIMIT 100 /* How many cells to check before temporarily releasing btr_search_latch */ #define BTR_CHUNK_SIZE 10000 /************************************************************************ Builds a hash index on a page with the given parameters. If the page already has a hash index with different parameters, the old hash index is removed. Loading Loading @@ -1607,6 +1604,11 @@ btr_search_validate(void) mem_heap_t* heap = NULL; ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint* offsets = offsets_; /* How many cells to check before temporarily releasing btr_search_latch. */ ulint chunk_size = 10000; *offsets_ = (sizeof offsets_) / sizeof *offsets_; rw_lock_x_lock(&btr_search_latch); Loading @@ -1616,7 +1618,7 @@ btr_search_validate(void) for (i = 0; i < cell_count; i++) { /* We release btr_search_latch every once in a while to give other queries a chance to run. */ if ((i != 0) && ((i % BTR_CHUNK_SIZE) == 0)) { if ((i != 0) && ((i % chunk_size) == 0)) { rw_lock_x_unlock(&btr_search_latch); os_thread_yield(); rw_lock_x_lock(&btr_search_latch); Loading Loading @@ -1675,8 +1677,8 @@ btr_search_validate(void) } } for (i = 0; i < cell_count; i += BTR_CHUNK_SIZE) { ulint end_index = ut_min(i + BTR_CHUNK_SIZE - 1, cell_count - 1); for (i = 0; i < cell_count; i += chunk_size) { ulint end_index = ut_min(i + chunk_size - 1, cell_count - 1); /* We release btr_search_latch every once in a while to give other queries a chance to run. */ Loading
mysql-test/r/group_min_max.result +9 −0 Original line number Diff line number Diff line Loading @@ -1954,6 +1954,15 @@ id select_type table type possible_keys key key_len ref rows Extra explain select sum(ord(a1)) from t1 where (a1 > 'a') group by a1,a2,b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 128 Using where; Using index explain select distinct(a1) from t1 where ord(a2) = 98; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL idx_t1_1 163 NULL 128 Using where; Using index select distinct(a1) from t1 where ord(a2) = 98; a1 a b c d explain select a1 from t1 where a2 = 'b' group by a1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range NULL idx_t1_1 130 NULL 5 Using where; Using index for group-by Loading
mysql-test/t/group_min_max.test +8 −0 Original line number Diff line number Diff line Loading @@ -641,6 +641,14 @@ explain select a1,a2,count(a2) from t1 group by a1,a2,b; explain select a1,a2,count(a2) from t1 where (a1 > 'a') group by a1,a2,b; explain select sum(ord(a1)) from t1 where (a1 > 'a') group by a1,a2,b; # # Bug #16710: select distinct doesn't return all it should # explain select distinct(a1) from t1 where ord(a2) = 98; select distinct(a1) from t1 where ord(a2) = 98; # # BUG#11044: DISTINCT or GROUP BY queries with equality predicates instead of MIN/MAX. # Loading
sql/ha_innodb.cc +8 −2 Original line number Diff line number Diff line Loading @@ -989,7 +989,6 @@ innobase_query_caching_of_table_permitted( mutex_enter_noninline(&kernel_mutex); trx_print(stderr, trx, 1024); mutex_exit_noninline(&kernel_mutex); ut_error; } innobase_release_stat_resources(trx); Loading Loading @@ -3833,6 +3832,13 @@ ha_innobase::unlock_row(void) ut_error; } /* Consistent read does not take any locks, thus there is nothing to unlock. */ if (prebuilt->select_lock_type == LOCK_NONE) { DBUG_VOID_RETURN; } if (srv_locks_unsafe_for_binlog) { row_unlock_for_mysql(prebuilt, FALSE); } Loading
sql/item.cc +34 −1 Original line number Diff line number Diff line Loading @@ -496,7 +496,7 @@ bool Item_ident::remove_dependence_processor(byte * arg) arguments in a condition the method must return false. RETURN false to force the evaluation of collect_item_field_processor FALSE to force the evaluation of collect_item_field_processor for the subsequent items. */ Loading @@ -517,6 +517,39 @@ bool Item_field::collect_item_field_processor(byte *arg) } /* Check if an Item_field references some field from a list of fields. SYNOPSIS Item_field::find_item_in_field_list_processor arg Field being compared, arg must be of type Field DESCRIPTION Check whether the Item_field represented by 'this' references any of the fields in the keyparts passed via 'arg'. Used with the method Item::walk() to test whether any keypart in a sequence of keyparts is referenced in an expression. RETURN TRUE if 'this' references the field 'arg' FALSE otherwise */ bool Item_field::find_item_in_field_list_processor(byte *arg) { KEY_PART_INFO *first_non_group_part= *((KEY_PART_INFO **) arg); KEY_PART_INFO *last_part= *(((KEY_PART_INFO **) arg) + 1); KEY_PART_INFO *cur_part; for (cur_part= first_non_group_part; cur_part != last_part; cur_part++) { if (field->eq(cur_part->field)) return TRUE; } return FALSE; } bool Item::check_cols(uint c) { if (c != 1) Loading