@@ -2414,7 +2414,8 @@ find_filter_in_hashtable(
2414
2414
)
2415
2415
{
2416
2416
xb_filter_entry_t * found = NULL ;
2417
- HASH_SEARCH (name_hash, table, ut_fold_string (name),
2417
+ const ulint fold = my_crc32c (0 , name, strlen (name));
2418
+ HASH_SEARCH (name_hash, table, fold,
2418
2419
xb_filter_entry_t *,
2419
2420
found, (void ) 0 ,
2420
2421
!strcmp (found->name , name));
@@ -3874,22 +3875,16 @@ new hash table */
3874
3875
static
3875
3876
xb_filter_entry_t *
3876
3877
xb_add_filter (
3877
- /* ========================*/
3878
3878
const char * name, /* !< in: name of table/database */
3879
3879
hash_table_t * hash) /* !< in/out: hash to insert into */
3880
3880
{
3881
- xb_filter_entry_t * entry;
3882
-
3883
- entry = xb_new_filter_entry (name);
3881
+ xb_filter_entry_t * entry = xb_new_filter_entry (name);
3884
3882
3885
3883
if (UNIV_UNLIKELY (!hash->array )) {
3886
3884
hash->create (1000 );
3887
3885
}
3888
- HASH_INSERT (xb_filter_entry_t ,
3889
- name_hash, hash,
3890
- ut_fold_string (entry->name ),
3891
- entry);
3892
-
3886
+ const ulint fold = my_crc32c (0 , entry->name , strlen (entry->name ));
3887
+ HASH_INSERT (xb_filter_entry_t , name_hash, hash, fold, entry);
3893
3888
return entry;
3894
3889
}
3895
3890
@@ -3943,8 +3938,9 @@ xb_register_filter_entry(
3943
3938
dbname[p - name] = 0 ;
3944
3939
3945
3940
if (databases_hash && databases_hash->array ) {
3941
+ const ulint fold = my_crc32c (0 , dbname, p - name);
3946
3942
HASH_SEARCH (name_hash, databases_hash,
3947
- ut_fold_string (dbname) ,
3943
+ fold ,
3948
3944
xb_filter_entry_t *,
3949
3945
db_entry, (void ) 0 ,
3950
3946
!strcmp (db_entry->name , dbname));
@@ -4153,9 +4149,10 @@ xb_filter_hash_free(hash_table_t* hash)
4153
4149
4154
4150
table = static_cast <xb_filter_entry_t *>
4155
4151
(HASH_GET_NEXT (name_hash, prev_table));
4156
-
4152
+ const ulint fold = my_crc32c (0 , prev_table->name ,
4153
+ strlen (prev_table->name ));
4157
4154
HASH_DELETE (xb_filter_entry_t , name_hash, hash,
4158
- ut_fold_string (prev_table-> name ) , prev_table);
4155
+ fold , prev_table);
4159
4156
free (prev_table);
4160
4157
}
4161
4158
}
@@ -5049,15 +5046,17 @@ xb_delta_open_matching_space(
5049
5046
return file;
5050
5047
}
5051
5048
5049
+ const size_t len = strlen (dest_space_name);
5052
5050
/* remember space name for further reference */
5053
5051
table = static_cast <xb_filter_entry_t *>
5054
5052
(malloc (sizeof (xb_filter_entry_t ) +
5055
- strlen (dest_space_name) + 1 ));
5053
+ len + 1 ));
5056
5054
5057
5055
table->name = ((char *)table) + sizeof (xb_filter_entry_t );
5058
- strcpy (table->name , dest_space_name);
5056
+ memcpy (table->name , dest_space_name, len + 1 );
5057
+ const ulint fold = my_crc32c (0 , dest_space_name, len);
5059
5058
HASH_INSERT (xb_filter_entry_t , name_hash, &inc_dir_tables_hash,
5060
- ut_fold_string (table-> name ) , table);
5059
+ fold , table);
5061
5060
5062
5061
mysql_mutex_lock (&fil_system.mutex );
5063
5062
fil_space = fil_space_get_by_name (dest_space_name);
@@ -5458,8 +5457,10 @@ static ibool prepare_handle_new_files(const char *data_home_dir,
5458
5457
(malloc (sizeof (xb_filter_entry_t ) + table_name.size () + 1 ));
5459
5458
table->name = ((char *)table) + sizeof (xb_filter_entry_t );
5460
5459
strcpy (table->name , table_name.c_str ());
5460
+ const ulint fold = my_crc32c (0 , table->name ,
5461
+ table_name.size ());
5461
5462
HASH_INSERT (xb_filter_entry_t , name_hash, &inc_dir_tables_hash,
5462
- ut_fold_string (table-> name ) , table);
5463
+ fold , table);
5463
5464
}
5464
5465
5465
5466
return TRUE ;
@@ -5482,9 +5483,11 @@ rm_if_not_found(
5482
5483
5483
5484
snprintf (name, FN_REFLEN, " %s/%s" , db_name, file_name);
5484
5485
/* Truncate ".ibd" */
5485
- name[strlen (name) - 4 ] = ' \0 ' ;
5486
+ const size_t len = strlen (name) - 4 ;
5487
+ name[len] = ' \0 ' ;
5488
+ const ulint fold = my_crc32c (0 , name, len);
5486
5489
5487
- HASH_SEARCH (name_hash, &inc_dir_tables_hash, ut_fold_string (name) ,
5490
+ HASH_SEARCH (name_hash, &inc_dir_tables_hash, fold ,
5488
5491
xb_filter_entry_t *,
5489
5492
table, (void ) 0 ,
5490
5493
!strcmp (table->name , name));
0 commit comments