mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
MDEV-34348: my_hash_get_key fixes
Partial commit of the greater MDEV-34348 scope. MDEV-34348: MariaDB is violating clang-16 -Wcast-function-type-strict Change the type of my_hash_get_key to: 1) Return const 2) Change the context parameter to be const void* Also fix casting in hash adjacent areas. Reviewed By: ============ Marko Mäkelä <marko.makela@mariadb.com>
This commit is contained in:
parent
dbfee9fc2b
commit
840fe316d4
67 changed files with 604 additions and 617 deletions
|
@ -857,11 +857,11 @@ static void write_footer(FILE *sql_file)
|
|||
} /* write_footer */
|
||||
|
||||
|
||||
uchar* get_table_key(const char *entry, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
const uchar *get_table_key(const void *entry, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
{
|
||||
*length= strlen(entry);
|
||||
return (uchar*) entry;
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1071,11 +1071,11 @@ static int get_options(int *argc, char ***argv)
|
|||
load_defaults_or_exit("my", load_default_groups, argc, argv);
|
||||
defaults_argv= *argv;
|
||||
|
||||
if (my_hash_init(PSI_NOT_INSTRUMENTED, &ignore_database, charset_info, 16, 0, 0,
|
||||
(my_hash_get_key) get_table_key, my_free, 0))
|
||||
if (my_hash_init(PSI_NOT_INSTRUMENTED, &ignore_database, charset_info, 16, 0,
|
||||
0, get_table_key, my_free, 0))
|
||||
return(EX_EOM);
|
||||
if (my_hash_init(PSI_NOT_INSTRUMENTED, &ignore_table, charset_info, 16, 0, 0,
|
||||
(my_hash_get_key) get_table_key, my_free, 0))
|
||||
get_table_key, my_free, 0))
|
||||
return(EX_EOM);
|
||||
/* Don't copy internal log tables */
|
||||
if (my_hash_insert(&ignore_table, (uchar*) my_strdup(PSI_NOT_INSTRUMENTED,
|
||||
|
@ -1091,7 +1091,7 @@ static int get_options(int *argc, char ***argv)
|
|||
return(EX_EOM);
|
||||
|
||||
if (my_hash_init(PSI_NOT_INSTRUMENTED, &ignore_data, charset_info, 16, 0, 0,
|
||||
(my_hash_get_key) get_table_key, my_free, 0))
|
||||
get_table_key, my_free, 0))
|
||||
return(EX_EOM);
|
||||
|
||||
if ((ho_error= handle_options(argc, argv, my_long_options, get_one_option)))
|
||||
|
|
|
@ -2389,13 +2389,12 @@ static void strip_parentheses(struct st_command *command)
|
|||
|
||||
C_MODE_START
|
||||
|
||||
static uchar *get_var_key(const uchar* var, size_t *len,
|
||||
my_bool __attribute__((unused)) t)
|
||||
static const uchar *get_var_key(const void *var, size_t *len, my_bool)
|
||||
{
|
||||
char* key;
|
||||
key = ((VAR*)var)->name;
|
||||
*len = ((VAR*)var)->name_len;
|
||||
return (uchar*)key;
|
||||
key= (static_cast<const VAR *>(var))->name;
|
||||
*len= (static_cast<const VAR *>(var))->name_len;
|
||||
return reinterpret_cast<const uchar *>(key);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -358,22 +358,23 @@ err:
|
|||
}
|
||||
|
||||
static
|
||||
uchar *
|
||||
get_file_entry_key(file_entry_t *entry, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
const uchar *
|
||||
get_file_entry_key(const void *entry_, size_t *length, my_bool)
|
||||
{
|
||||
*length = entry->pathlen;
|
||||
return (uchar *) entry->path;
|
||||
const file_entry_t *entry= static_cast<const file_entry_t *>(entry_);
|
||||
*length= entry->pathlen;
|
||||
return reinterpret_cast<const uchar *>(entry->path);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
file_entry_free(file_entry_t *entry)
|
||||
file_entry_free(void *entry_)
|
||||
{
|
||||
pthread_mutex_destroy(&entry->mutex);
|
||||
ds_close(entry->file);
|
||||
my_free(entry->path);
|
||||
my_free(entry);
|
||||
file_entry_t *entry= static_cast<file_entry_t *>(entry_);
|
||||
pthread_mutex_destroy(&entry->mutex);
|
||||
ds_close(entry->file);
|
||||
my_free(entry->path);
|
||||
my_free(entry);
|
||||
}
|
||||
|
||||
static
|
||||
|
@ -493,14 +494,15 @@ mode_extract(int n_threads, int argc __attribute__((unused)),
|
|||
pthread_mutex_t mutex;
|
||||
int ret = 0;
|
||||
|
||||
if (my_hash_init(PSI_NOT_INSTRUMENTED, &filehash, &my_charset_bin,
|
||||
START_FILE_HASH_SIZE, 0, 0, (my_hash_get_key) get_file_entry_key,
|
||||
(my_hash_free_key) file_entry_free, MYF(0))) {
|
||||
msg("%s: failed to initialize file hash.", my_progname);
|
||||
return 1;
|
||||
}
|
||||
if (my_hash_init(PSI_NOT_INSTRUMENTED, &filehash, &my_charset_bin,
|
||||
START_FILE_HASH_SIZE, 0, 0, get_file_entry_key,
|
||||
file_entry_free, MYF(0)))
|
||||
{
|
||||
msg("%s: failed to initialize file hash.", my_progname);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (pthread_mutex_init(&mutex, NULL)) {
|
||||
if (pthread_mutex_init(&mutex, NULL)) {
|
||||
msg("%s: failed to initialize mutex.", my_progname);
|
||||
my_hash_free(&filehash);
|
||||
return 1;
|
||||
|
|
|
@ -42,7 +42,7 @@ extern "C" {
|
|||
#define HASH_THREAD_SPECIFIC 2 /* Mark allocated memory THREAD_SPECIFIC */
|
||||
|
||||
typedef uint32 my_hash_value_type;
|
||||
typedef uchar *(*my_hash_get_key)(const uchar *,size_t*,my_bool);
|
||||
typedef const uchar *(*my_hash_get_key)(const void *, size_t *, my_bool);
|
||||
typedef my_hash_value_type (*my_hash_function)(CHARSET_INFO *,
|
||||
const uchar *, size_t);
|
||||
typedef void (*my_hash_free_key)(void *);
|
||||
|
|
|
@ -669,13 +669,12 @@ const char *my_collation_get_tailoring(uint id)
|
|||
|
||||
HASH charset_name_hash;
|
||||
|
||||
static uchar *get_charset_key(const uchar *object,
|
||||
size_t *size,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
static const uchar *get_charset_key(const void *object, size_t *size,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
{
|
||||
CHARSET_INFO *cs= (CHARSET_INFO*) object;
|
||||
CHARSET_INFO *cs= object;
|
||||
*size= strlen(cs->csname);
|
||||
return (uchar*) cs->csname;
|
||||
return (const uchar *) cs->csname;
|
||||
}
|
||||
|
||||
static void init_available_charsets(void)
|
||||
|
|
|
@ -878,8 +878,8 @@ my_bool my_hash_check(HASH *hash)
|
|||
|
||||
#define RECORDS 1000
|
||||
|
||||
uchar *test_get_key(uchar *data, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
const uchar *test_get_key(const void *data, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
{
|
||||
*length= 2;
|
||||
return data;
|
||||
|
@ -895,8 +895,8 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
|
|||
DBUG_PUSH("d:t:O,/tmp/test_hash.trace");
|
||||
|
||||
printf("my_hash_init\n");
|
||||
if (my_hash_init2(PSI_INSTRUMENT_ME, &hash_test, 100, &my_charset_bin, 20,
|
||||
0, 0, (my_hash_get_key) test_get_key, 0, 0, HASH_UNIQUE))
|
||||
if (my_hash_init2(PSI_INSTRUMENT_ME, &hash_test, 100, &my_charset_bin, 20, 0,
|
||||
0, test_get_key, 0, 0, HASH_UNIQUE))
|
||||
{
|
||||
fprintf(stderr, "hash init failed\n");
|
||||
exit(1);
|
||||
|
|
|
@ -321,7 +321,7 @@ KEY_CACHE *dflt_key_cache= &dflt_key_cache_var;
|
|||
#define FLUSH_CACHE 2000 /* sort this many blocks at once */
|
||||
|
||||
static int flush_all_key_blocks(SIMPLE_KEY_CACHE_CB *keycache);
|
||||
static void end_simple_key_cache(SIMPLE_KEY_CACHE_CB *keycache, my_bool cleanup);
|
||||
static void end_simple_key_cache(void *keycache_, my_bool cleanup);
|
||||
static void wait_on_queue(KEYCACHE_WQUEUE *wqueue,
|
||||
mysql_mutex_t *mutex);
|
||||
static void release_whole_queue(KEYCACHE_WQUEUE *wqueue);
|
||||
|
@ -473,11 +473,12 @@ static inline uint next_power(uint value)
|
|||
*/
|
||||
|
||||
static
|
||||
int init_simple_key_cache(SIMPLE_KEY_CACHE_CB *keycache,
|
||||
int init_simple_key_cache(void *keycache_,
|
||||
uint key_cache_block_size,
|
||||
size_t use_mem, uint division_limit,
|
||||
uint age_threshold, uint changed_blocks_hash_size)
|
||||
{
|
||||
SIMPLE_KEY_CACHE_CB *keycache= keycache_;
|
||||
size_t blocks, hash_links;
|
||||
size_t length;
|
||||
int error;
|
||||
|
@ -834,11 +835,12 @@ void finish_resize_simple_key_cache(SIMPLE_KEY_CACHE_CB *keycache)
|
|||
*/
|
||||
|
||||
static
|
||||
int resize_simple_key_cache(SIMPLE_KEY_CACHE_CB *keycache,
|
||||
int resize_simple_key_cache(void *keycache_,
|
||||
uint key_cache_block_size,
|
||||
size_t use_mem, uint division_limit,
|
||||
uint age_threshold, uint changed_blocks_hash_size)
|
||||
{
|
||||
SIMPLE_KEY_CACHE_CB *keycache= keycache_;
|
||||
int blocks= 0;
|
||||
DBUG_ENTER("resize_simple_key_cache");
|
||||
|
||||
|
@ -914,9 +916,10 @@ static inline void dec_counter_for_resize_op(SIMPLE_KEY_CACHE_CB *keycache)
|
|||
*/
|
||||
|
||||
static
|
||||
void change_simple_key_cache_param(SIMPLE_KEY_CACHE_CB *keycache, uint division_limit,
|
||||
void change_simple_key_cache_param(void *keycache_, uint division_limit,
|
||||
uint age_threshold)
|
||||
{
|
||||
SIMPLE_KEY_CACHE_CB *keycache= keycache_;
|
||||
DBUG_ENTER("change_simple_key_cache_param");
|
||||
keycache_pthread_mutex_lock(&keycache->cache_lock);
|
||||
if (division_limit)
|
||||
|
@ -953,8 +956,9 @@ void change_simple_key_cache_param(SIMPLE_KEY_CACHE_CB *keycache, uint division_
|
|||
*/
|
||||
|
||||
static
|
||||
void end_simple_key_cache(SIMPLE_KEY_CACHE_CB *keycache, my_bool cleanup)
|
||||
void end_simple_key_cache(void *keycache_, my_bool cleanup)
|
||||
{
|
||||
SIMPLE_KEY_CACHE_CB *keycache= keycache_;
|
||||
DBUG_ENTER("end_simple_key_cache");
|
||||
DBUG_PRINT("enter", ("key_cache: %p", keycache));
|
||||
|
||||
|
@ -2763,12 +2767,13 @@ static void read_block_secondary(SIMPLE_KEY_CACHE_CB *keycache,
|
|||
have to be a multiple of key_cache_block_size;
|
||||
*/
|
||||
|
||||
uchar *simple_key_cache_read(SIMPLE_KEY_CACHE_CB *keycache,
|
||||
uchar *simple_key_cache_read(void *keycache_,
|
||||
File file, my_off_t filepos, int level,
|
||||
uchar *buff, uint length,
|
||||
uint block_length __attribute__((unused)),
|
||||
int return_buffer __attribute__((unused)))
|
||||
{
|
||||
SIMPLE_KEY_CACHE_CB *keycache= keycache_;
|
||||
my_bool locked_and_incremented= FALSE;
|
||||
int error=0;
|
||||
uchar *start= buff;
|
||||
|
@ -3015,10 +3020,11 @@ end:
|
|||
*/
|
||||
|
||||
static
|
||||
int simple_key_cache_insert(SIMPLE_KEY_CACHE_CB *keycache,
|
||||
int simple_key_cache_insert(void *keycache_,
|
||||
File file, my_off_t filepos, int level,
|
||||
uchar *buff, uint length)
|
||||
{
|
||||
SIMPLE_KEY_CACHE_CB *keycache= keycache_;
|
||||
int error= 0;
|
||||
DBUG_ENTER("key_cache_insert");
|
||||
DBUG_PRINT("enter", ("fd: %u pos: %lu length: %u",
|
||||
|
@ -3280,13 +3286,14 @@ int simple_key_cache_insert(SIMPLE_KEY_CACHE_CB *keycache,
|
|||
*/
|
||||
|
||||
static
|
||||
int simple_key_cache_write(SIMPLE_KEY_CACHE_CB *keycache,
|
||||
int simple_key_cache_write(void *keycache_,
|
||||
File file, void *file_extra __attribute__((unused)),
|
||||
my_off_t filepos, int level,
|
||||
uchar *buff, uint length,
|
||||
uint block_length __attribute__((unused)),
|
||||
int dont_write)
|
||||
{
|
||||
SIMPLE_KEY_CACHE_CB *keycache= keycache_;
|
||||
my_bool locked_and_incremented= FALSE;
|
||||
int error=0;
|
||||
DBUG_ENTER("simple_key_cache_write");
|
||||
|
@ -4365,11 +4372,12 @@ err:
|
|||
*/
|
||||
|
||||
static
|
||||
int flush_simple_key_cache_blocks(SIMPLE_KEY_CACHE_CB *keycache,
|
||||
int flush_simple_key_cache_blocks(void *keycache_,
|
||||
File file,
|
||||
void *file_extra __attribute__((unused)),
|
||||
enum flush_type type)
|
||||
{
|
||||
SIMPLE_KEY_CACHE_CB *keycache= keycache_;
|
||||
int res= 0;
|
||||
DBUG_ENTER("flush_key_blocks");
|
||||
DBUG_PRINT("enter", ("keycache: %p", keycache));
|
||||
|
@ -4546,8 +4554,9 @@ static int flush_all_key_blocks(SIMPLE_KEY_CACHE_CB *keycache)
|
|||
|
||||
static
|
||||
int reset_simple_key_cache_counters(const char *name __attribute__((unused)),
|
||||
SIMPLE_KEY_CACHE_CB *keycache)
|
||||
void *keycache_)
|
||||
{
|
||||
SIMPLE_KEY_CACHE_CB *keycache= keycache_;
|
||||
DBUG_ENTER("reset_simple_key_cache_counters");
|
||||
if (!keycache->key_cache_inited)
|
||||
{
|
||||
|
@ -4889,10 +4898,11 @@ static int cache_empty(SIMPLE_KEY_CACHE_CB *keycache)
|
|||
*/
|
||||
|
||||
static
|
||||
void get_simple_key_cache_statistics(SIMPLE_KEY_CACHE_CB *keycache,
|
||||
void get_simple_key_cache_statistics(void *keycache_,
|
||||
uint partition_no __attribute__((unused)),
|
||||
KEY_CACHE_STATISTICS *keycache_stats)
|
||||
{
|
||||
SIMPLE_KEY_CACHE_CB *keycache= keycache_;
|
||||
DBUG_ENTER("simple_get_key_cache_statistics");
|
||||
|
||||
keycache_stats->mem_size= (longlong) keycache->key_cache_mem_size;
|
||||
|
@ -4980,12 +4990,12 @@ typedef struct st_partitioned_key_cache_cb
|
|||
} PARTITIONED_KEY_CACHE_CB;
|
||||
|
||||
static
|
||||
void end_partitioned_key_cache(PARTITIONED_KEY_CACHE_CB *keycache,
|
||||
void end_partitioned_key_cache(void *keycache_,
|
||||
my_bool cleanup);
|
||||
|
||||
static int
|
||||
reset_partitioned_key_cache_counters(const char *name,
|
||||
PARTITIONED_KEY_CACHE_CB *keycache);
|
||||
void *keycache_);
|
||||
|
||||
/*
|
||||
Determine the partition to which the index block to read is ascribed
|
||||
|
@ -5093,11 +5103,12 @@ static SIMPLE_KEY_CACHE_CB
|
|||
*/
|
||||
|
||||
static
|
||||
int init_partitioned_key_cache(PARTITIONED_KEY_CACHE_CB *keycache,
|
||||
int init_partitioned_key_cache(void *keycache_,
|
||||
uint key_cache_block_size,
|
||||
size_t use_mem, uint division_limit,
|
||||
uint age_threshold, uint changed_blocks_hash_size)
|
||||
{
|
||||
PARTITIONED_KEY_CACHE_CB *keycache= keycache_;
|
||||
int i;
|
||||
size_t mem_per_cache;
|
||||
size_t mem_decr;
|
||||
|
@ -5259,12 +5270,13 @@ int init_partitioned_key_cache(PARTITIONED_KEY_CACHE_CB *keycache,
|
|||
*/
|
||||
|
||||
static
|
||||
int resize_partitioned_key_cache(PARTITIONED_KEY_CACHE_CB *keycache,
|
||||
int resize_partitioned_key_cache(void *keycache_,
|
||||
uint key_cache_block_size,
|
||||
size_t use_mem, uint division_limit,
|
||||
uint age_threshold,
|
||||
uint changed_blocks_hash_size)
|
||||
{
|
||||
PARTITIONED_KEY_CACHE_CB *keycache= keycache_;
|
||||
uint i;
|
||||
uint partitions= keycache->partitions;
|
||||
my_bool cleanup= use_mem == 0;
|
||||
|
@ -5323,10 +5335,11 @@ int resize_partitioned_key_cache(PARTITIONED_KEY_CACHE_CB *keycache,
|
|||
*/
|
||||
|
||||
static
|
||||
void change_partitioned_key_cache_param(PARTITIONED_KEY_CACHE_CB *keycache,
|
||||
void change_partitioned_key_cache_param(void *keycache_,
|
||||
uint division_limit,
|
||||
uint age_threshold)
|
||||
{
|
||||
PARTITIONED_KEY_CACHE_CB *keycache= keycache_;
|
||||
uint i;
|
||||
uint partitions= keycache->partitions;
|
||||
DBUG_ENTER("partitioned_change_key_cache_param");
|
||||
|
@ -5365,9 +5378,10 @@ void change_partitioned_key_cache_param(PARTITIONED_KEY_CACHE_CB *keycache,
|
|||
*/
|
||||
|
||||
static
|
||||
void end_partitioned_key_cache(PARTITIONED_KEY_CACHE_CB *keycache,
|
||||
void end_partitioned_key_cache(void *keycache_,
|
||||
my_bool cleanup)
|
||||
{
|
||||
PARTITIONED_KEY_CACHE_CB *keycache= keycache_;
|
||||
uint i;
|
||||
uint partitions= keycache->partitions;
|
||||
DBUG_ENTER("partitioned_end_key_cache");
|
||||
|
@ -5432,12 +5446,13 @@ void end_partitioned_key_cache(PARTITIONED_KEY_CACHE_CB *keycache,
|
|||
*/
|
||||
|
||||
static
|
||||
uchar *partitioned_key_cache_read(PARTITIONED_KEY_CACHE_CB *keycache,
|
||||
uchar *partitioned_key_cache_read(void *keycache_,
|
||||
File file, my_off_t filepos, int level,
|
||||
uchar *buff, uint length,
|
||||
uint block_length __attribute__((unused)),
|
||||
int return_buffer __attribute__((unused)))
|
||||
{
|
||||
PARTITIONED_KEY_CACHE_CB *keycache= keycache_;
|
||||
uint r_length;
|
||||
uint offset= (uint) (filepos % keycache->key_cache_block_size);
|
||||
uchar *start= buff;
|
||||
|
@ -5510,10 +5525,11 @@ uchar *partitioned_key_cache_read(PARTITIONED_KEY_CACHE_CB *keycache,
|
|||
*/
|
||||
|
||||
static
|
||||
int partitioned_key_cache_insert(PARTITIONED_KEY_CACHE_CB *keycache,
|
||||
int partitioned_key_cache_insert(void *keycache_,
|
||||
File file, my_off_t filepos, int level,
|
||||
uchar *buff, uint length)
|
||||
{
|
||||
PARTITIONED_KEY_CACHE_CB *keycache= keycache_;
|
||||
uint w_length;
|
||||
uint offset= (uint) (filepos % keycache->key_cache_block_size);
|
||||
DBUG_ENTER("partitioned_key_cache_insert");
|
||||
|
@ -5592,13 +5608,14 @@ int partitioned_key_cache_insert(PARTITIONED_KEY_CACHE_CB *keycache,
|
|||
*/
|
||||
|
||||
static
|
||||
int partitioned_key_cache_write(PARTITIONED_KEY_CACHE_CB *keycache,
|
||||
int partitioned_key_cache_write(void *keycache_,
|
||||
File file, void *file_extra,
|
||||
my_off_t filepos, int level,
|
||||
uchar *buff, uint length,
|
||||
uint block_length __attribute__((unused)),
|
||||
int dont_write)
|
||||
{
|
||||
PARTITIONED_KEY_CACHE_CB *keycache= keycache_;
|
||||
uint w_length;
|
||||
ulonglong *part_map= (ulonglong *) file_extra;
|
||||
uint offset= (uint) (filepos % keycache->key_cache_block_size);
|
||||
|
@ -5676,10 +5693,11 @@ int partitioned_key_cache_write(PARTITIONED_KEY_CACHE_CB *keycache,
|
|||
*/
|
||||
|
||||
static
|
||||
int flush_partitioned_key_cache_blocks(PARTITIONED_KEY_CACHE_CB *keycache,
|
||||
int flush_partitioned_key_cache_blocks(void *keycache_,
|
||||
File file, void *file_extra,
|
||||
enum flush_type type)
|
||||
{
|
||||
PARTITIONED_KEY_CACHE_CB *keycache= keycache_;
|
||||
uint i;
|
||||
uint partitions= keycache->partitions;
|
||||
int err= 0;
|
||||
|
@ -5726,8 +5744,9 @@ int flush_partitioned_key_cache_blocks(PARTITIONED_KEY_CACHE_CB *keycache,
|
|||
|
||||
static int
|
||||
reset_partitioned_key_cache_counters(const char *name __attribute__((unused)),
|
||||
PARTITIONED_KEY_CACHE_CB *keycache)
|
||||
void *keycache_)
|
||||
{
|
||||
PARTITIONED_KEY_CACHE_CB *keycache= keycache_;
|
||||
uint i;
|
||||
uint partitions= keycache->partitions;
|
||||
DBUG_ENTER("partitioned_reset_key_cache_counters");
|
||||
|
@ -5768,10 +5787,11 @@ reset_partitioned_key_cache_counters(const char *name __attribute__((unused)),
|
|||
|
||||
static
|
||||
void
|
||||
get_partitioned_key_cache_statistics(PARTITIONED_KEY_CACHE_CB *keycache,
|
||||
get_partitioned_key_cache_statistics(void *keycache_,
|
||||
uint partition_no,
|
||||
KEY_CACHE_STATISTICS *keycache_stats)
|
||||
{
|
||||
PARTITIONED_KEY_CACHE_CB *keycache= keycache_;
|
||||
uint i;
|
||||
SIMPLE_KEY_CACHE_CB *partition;
|
||||
uint partitions= keycache->partitions;
|
||||
|
|
|
@ -35,11 +35,12 @@ typedef struct st_likely_entry
|
|||
ulonglong ok,fail;
|
||||
} LIKELY_ENTRY;
|
||||
|
||||
static uchar *get_likely_key(LIKELY_ENTRY *part, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
static const uchar *get_likely_key(const void *part_, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
{
|
||||
const LIKELY_ENTRY *part= (const LIKELY_ENTRY *) part_;
|
||||
*length= part->key_length;
|
||||
return (uchar*) part->key;
|
||||
return (const uchar *) part->key;
|
||||
}
|
||||
|
||||
pthread_mutex_t likely_mutex;
|
||||
|
@ -49,8 +50,7 @@ void init_my_likely()
|
|||
{
|
||||
/* Allocate big enough to avoid malloc calls */
|
||||
my_hash_init2(PSI_NOT_INSTRUMENTED, &likely_hash, 10000, &my_charset_bin,
|
||||
1024, 0, 0, (my_hash_get_key) get_likely_key, 0, free,
|
||||
HASH_UNIQUE);
|
||||
1024, 0, 0, get_likely_key, 0, free, HASH_UNIQUE);
|
||||
likely_inited= 1;
|
||||
pthread_mutex_init(&likely_mutex, MY_MUTEX_INIT_FAST);
|
||||
}
|
||||
|
|
|
@ -50,8 +50,9 @@
|
|||
This function is called by the hash object on delete
|
||||
*/
|
||||
|
||||
static void safe_hash_entry_free(SAFE_HASH_ENTRY *entry)
|
||||
static void safe_hash_entry_free(void *entry_)
|
||||
{
|
||||
SAFE_HASH_ENTRY *entry= entry_;
|
||||
DBUG_ENTER("safe_hash_entry_free");
|
||||
my_free(entry);
|
||||
DBUG_VOID_RETURN;
|
||||
|
@ -70,11 +71,13 @@ static void safe_hash_entry_free(SAFE_HASH_ENTRY *entry)
|
|||
# reference on the key
|
||||
*/
|
||||
|
||||
static uchar *safe_hash_entry_get(SAFE_HASH_ENTRY *entry, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
static const uchar *safe_hash_entry_get(const void *entry_, size_t *length,
|
||||
my_bool not_used
|
||||
__attribute__((unused)))
|
||||
{
|
||||
const SAFE_HASH_ENTRY *entry= entry_;
|
||||
*length= entry->length;
|
||||
return (uchar*) entry->key;
|
||||
return entry->key;
|
||||
}
|
||||
|
||||
|
||||
|
@ -101,8 +104,8 @@ my_bool safe_hash_init(SAFE_HASH *hash, uint elements,
|
|||
{
|
||||
DBUG_ENTER("safe_hash_init");
|
||||
if (my_hash_init(key_memory_SAFE_HASH_ENTRY, &hash->hash, &my_charset_bin,
|
||||
elements, 0, 0, (my_hash_get_key) safe_hash_entry_get,
|
||||
(void (*)(void*)) safe_hash_entry_free, 0))
|
||||
elements, 0, 0, safe_hash_entry_get, safe_hash_entry_free,
|
||||
0))
|
||||
{
|
||||
hash->default_value= 0;
|
||||
DBUG_RETURN(1);
|
||||
|
|
|
@ -449,7 +449,7 @@ void wt_init()
|
|||
sizeof_WT_RESOURCE_ID, 0, 0);
|
||||
reshash.alloc.constructor= wt_resource_create;
|
||||
reshash.alloc.destructor= wt_resource_destroy;
|
||||
reshash.initializer= (lf_hash_initializer) wt_resource_init;
|
||||
reshash.initializer= wt_resource_init;
|
||||
|
||||
bzero(wt_wait_stats, sizeof(wt_wait_stats));
|
||||
bzero(wt_cycle_stats, sizeof(wt_cycle_stats));
|
||||
|
|
|
@ -4013,12 +4013,13 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg)
|
|||
/**
|
||||
A function to return the key from a connection attribute
|
||||
*/
|
||||
uchar *
|
||||
get_attr_key(LEX_STRING *part, size_t *length,
|
||||
const uchar *
|
||||
get_attr_key(const void *part_, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
{
|
||||
const LEX_STRING *part= part_;
|
||||
*length= part[0].length;
|
||||
return (uchar *) part[0].str;
|
||||
return (const uchar *) part[0].str;
|
||||
}
|
||||
|
||||
int STDCALL
|
||||
|
@ -4067,7 +4068,7 @@ mysql_options4(MYSQL *mysql,enum mysql_option option,
|
|||
{
|
||||
if (my_hash_init(key_memory_mysql_options,
|
||||
&mysql->options.extension->connection_attributes,
|
||||
&my_charset_bin, 0, 0, 0, (my_hash_get_key)
|
||||
&my_charset_bin, 0, 0, 0,
|
||||
get_attr_key, my_free, HASH_UNIQUE))
|
||||
{
|
||||
set_mysql_error(mysql, CR_OUT_OF_MEMORY, unknown_sqlstate);
|
||||
|
|
|
@ -3368,9 +3368,9 @@ bool ha_partition::get_from_handler_file(const char *name, MEM_ROOT *mem_root,
|
|||
@return Partition name
|
||||
*/
|
||||
|
||||
static uchar *get_part_name(PART_NAME_DEF *part, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
static const uchar *get_part_name(const void *part_, size_t *length, my_bool)
|
||||
{
|
||||
auto part= reinterpret_cast<const PART_NAME_DEF *>(part_);
|
||||
*length= part->length;
|
||||
return part->partition_name;
|
||||
}
|
||||
|
@ -3456,8 +3456,7 @@ bool ha_partition::populate_partition_name_hash()
|
|||
tot_names= m_is_sub_partitioned ? m_tot_parts + num_parts : num_parts;
|
||||
if (my_hash_init(key_memory_Partition_share,
|
||||
&part_share->partition_name_hash, system_charset_info,
|
||||
tot_names, 0, 0, (my_hash_get_key) get_part_name, my_free,
|
||||
HASH_UNIQUE))
|
||||
tot_names, 0, 0, get_part_name, my_free, HASH_UNIQUE))
|
||||
{
|
||||
unlock_shared_ha_data();
|
||||
DBUG_RETURN(TRUE);
|
||||
|
|
|
@ -149,9 +149,9 @@ bool hostname_cache_init()
|
|||
Host_entry tmp;
|
||||
uint key_offset= (uint) ((char*) (&tmp.ip_key) - (char*) &tmp);
|
||||
|
||||
if (!(hostname_cache= new Hash_filo<Host_entry>(key_memory_host_cache_hostname,
|
||||
host_cache_size, key_offset, HOST_ENTRY_KEY_SIZE,
|
||||
NULL, (my_hash_free_key) free, &my_charset_bin)))
|
||||
if (!(hostname_cache= new Hash_filo<Host_entry>(
|
||||
key_memory_host_cache_hostname, host_cache_size, key_offset,
|
||||
HOST_ENTRY_KEY_SIZE, NULL, free, &my_charset_bin)))
|
||||
return 1;
|
||||
|
||||
hostname_cache->clear();
|
||||
|
|
|
@ -38,13 +38,12 @@
|
|||
#include <mysql/plugin_function.h>
|
||||
|
||||
|
||||
extern "C" uchar*
|
||||
get_native_fct_hash_key(const uchar *buff, size_t *length,
|
||||
my_bool /* unused */)
|
||||
extern "C" const uchar *get_native_fct_hash_key(const void *buff,
|
||||
size_t *length, my_bool)
|
||||
{
|
||||
Native_func_registry *func= (Native_func_registry*) buff;
|
||||
auto func= static_cast<const Native_func_registry *>(buff);
|
||||
*length= func->name.length;
|
||||
return (uchar*) func->name.str;
|
||||
return reinterpret_cast<const uchar *>(func->name.str);
|
||||
}
|
||||
|
||||
|
||||
|
@ -5708,9 +5707,8 @@ bool Native_functions_hash::init(size_t count)
|
|||
{
|
||||
DBUG_ENTER("Native_functions_hash::init");
|
||||
|
||||
if (my_hash_init(key_memory_native_functions, this,
|
||||
system_charset_info, (ulong) count, 0, 0, (my_hash_get_key)
|
||||
get_native_fct_hash_key, NULL, MYF(0)))
|
||||
if (my_hash_init(key_memory_native_functions, this, system_charset_info,
|
||||
(ulong) count, 0, 0, get_native_fct_hash_key, NULL, MYF(0)))
|
||||
DBUG_RETURN(true);
|
||||
|
||||
DBUG_RETURN(false);
|
||||
|
|
|
@ -4146,13 +4146,12 @@ public:
|
|||
|
||||
/** Extract a hash key from User_level_lock. */
|
||||
|
||||
uchar *ull_get_key(const uchar *ptr, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
const uchar *ull_get_key(const void *ptr, size_t *length, my_bool)
|
||||
{
|
||||
User_level_lock *ull = (User_level_lock*) ptr;
|
||||
MDL_key *key = ull->lock->get_key();
|
||||
*length= key->length();
|
||||
return (uchar*) key->ptr();
|
||||
return key->ptr();
|
||||
}
|
||||
|
||||
|
||||
|
|
11
sql/mdl.cc
11
sql/mdl.cc
|
@ -703,13 +703,12 @@ static MDL_map mdl_locks;
|
|||
|
||||
extern "C"
|
||||
{
|
||||
static uchar *
|
||||
mdl_locks_key(const uchar *record, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
static const uchar *mdl_locks_key(const void *record, size_t *length,
|
||||
my_bool)
|
||||
{
|
||||
MDL_lock *lock=(MDL_lock*) record;
|
||||
const MDL_lock *lock= static_cast<const MDL_lock *>(record);
|
||||
*length= lock->key.length();
|
||||
return (uchar*) lock->key.ptr();
|
||||
return lock->key.ptr();
|
||||
}
|
||||
} /* extern "C" */
|
||||
|
||||
|
@ -821,7 +820,7 @@ void MDL_map::init()
|
|||
mdl_locks_key, &my_charset_bin);
|
||||
m_locks.alloc.constructor= MDL_lock::lf_alloc_constructor;
|
||||
m_locks.alloc.destructor= MDL_lock::lf_alloc_destructor;
|
||||
m_locks.initializer= (lf_hash_initializer) MDL_lock::lf_hash_initializer;
|
||||
m_locks.initializer= MDL_lock::lf_hash_initializer;
|
||||
m_locks.hash_function= mdl_hash_function;
|
||||
}
|
||||
|
||||
|
|
|
@ -671,11 +671,11 @@ partition_element *partition_info::get_part_elem(const char *partition_name,
|
|||
Helper function to find_duplicate_name.
|
||||
*/
|
||||
|
||||
static const char *get_part_name_from_elem(const char *name, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
static const uchar *get_part_name_from_elem(const void *name, size_t *length,
|
||||
my_bool)
|
||||
{
|
||||
*length= strlen(name);
|
||||
return name;
|
||||
*length= strlen(static_cast<const char *>(name));
|
||||
return static_cast<const uchar *>(name);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -713,8 +713,8 @@ char *partition_info::find_duplicate_name()
|
|||
max_names= num_parts;
|
||||
if (is_sub_partitioned())
|
||||
max_names+= num_parts * num_subparts;
|
||||
if (my_hash_init(PSI_INSTRUMENT_ME, &partition_names, system_charset_info, max_names, 0, 0,
|
||||
(my_hash_get_key) get_part_name_from_elem, 0, HASH_UNIQUE))
|
||||
if (my_hash_init(PSI_INSTRUMENT_ME, &partition_names, system_charset_info,
|
||||
max_names, 0, 0, get_part_name_from_elem, 0, HASH_UNIQUE))
|
||||
{
|
||||
DBUG_ASSERT(0);
|
||||
curr_name= (const uchar*) "Internal failure";
|
||||
|
|
|
@ -580,16 +580,14 @@ Rpl_filter::set_ignore_db(const char* db_spec)
|
|||
}
|
||||
|
||||
|
||||
extern "C" uchar *get_table_key(const uchar *, size_t *, my_bool);
|
||||
extern "C" const uchar *get_table_key(const void *, size_t *, my_bool);
|
||||
extern "C" void free_table_ent(void* a);
|
||||
|
||||
uchar *get_table_key(const uchar* a, size_t *len,
|
||||
my_bool __attribute__((unused)))
|
||||
const uchar *get_table_key(const void *a, size_t *len, my_bool)
|
||||
{
|
||||
TABLE_RULE_ENT *e= (TABLE_RULE_ENT *) a;
|
||||
|
||||
auto e= static_cast<const TABLE_RULE_ENT *>(a);
|
||||
*len= e->key_len;
|
||||
return (uchar*)e->db;
|
||||
return reinterpret_cast<const uchar *>(e->db);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -850,12 +850,12 @@ void end_master_info(Master_info* mi)
|
|||
}
|
||||
|
||||
/* Multi-Master By P.Linux */
|
||||
uchar *get_key_master_info(Master_info *mi, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
const uchar *get_key_master_info(const void *mi_, size_t *length, my_bool)
|
||||
{
|
||||
auto mi= static_cast<const Master_info *>(mi_);
|
||||
/* Return lower case name */
|
||||
*length= mi->cmp_connection_name.length;
|
||||
return (uchar*) mi->cmp_connection_name.str;
|
||||
return reinterpret_cast<const uchar *>(mi->cmp_connection_name.str);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -865,8 +865,9 @@ uchar *get_key_master_info(Master_info *mi, size_t *length,
|
|||
Stops associated slave threads and frees master_info
|
||||
*/
|
||||
|
||||
void free_key_master_info(Master_info *mi)
|
||||
void free_key_master_info(void *mi_)
|
||||
{
|
||||
Master_info *mi= static_cast<Master_info*>(mi_);
|
||||
DBUG_ENTER("free_key_master_info");
|
||||
mysql_mutex_unlock(&LOCK_active_mi);
|
||||
|
||||
|
@ -1101,10 +1102,9 @@ bool Master_info_index::init_all_master_info()
|
|||
}
|
||||
|
||||
/* Initialize Master_info Hash Table */
|
||||
if (my_hash_init(PSI_INSTRUMENT_ME, &master_info_hash, system_charset_info,
|
||||
MAX_REPLICATION_THREAD, 0, 0,
|
||||
(my_hash_get_key) get_key_master_info,
|
||||
(my_hash_free_key)free_key_master_info, HASH_UNIQUE))
|
||||
if (my_hash_init(PSI_INSTRUMENT_ME, &master_info_hash, system_charset_info,
|
||||
MAX_REPLICATION_THREAD, 0, 0, get_key_master_info,
|
||||
free_key_master_info, HASH_UNIQUE))
|
||||
{
|
||||
sql_print_error("Initializing Master_info hash table failed");
|
||||
DBUG_RETURN(1);
|
||||
|
|
|
@ -556,12 +556,12 @@ void Session_sysvars_tracker::mark_as_changed(THD *thd, const sys_var *var)
|
|||
@return Pointer to the key buffer.
|
||||
*/
|
||||
|
||||
uchar *Session_sysvars_tracker::sysvars_get_key(const char *entry,
|
||||
size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
const uchar *Session_sysvars_tracker::sysvars_get_key(const void *entry,
|
||||
size_t *length, my_bool)
|
||||
{
|
||||
*length= sizeof(sys_var *);
|
||||
return (uchar *) &(((sysvar_node_st *) entry)->m_svar);
|
||||
return reinterpret_cast<const uchar *>(
|
||||
&((static_cast<const sysvar_node_st *>(entry))->m_svar));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -145,8 +145,9 @@ class Session_sysvars_tracker: public State_tracker
|
|||
void init()
|
||||
{
|
||||
my_hash_init(PSI_INSTRUMENT_ME, &m_registered_sysvars, &my_charset_bin,
|
||||
0, 0, 0, (my_hash_get_key) sysvars_get_key, my_free,
|
||||
HASH_UNIQUE | (mysqld_server_initialized ? HASH_THREAD_SPECIFIC : 0));
|
||||
0, 0, 0, sysvars_get_key, my_free,
|
||||
HASH_UNIQUE |
|
||||
(mysqld_server_initialized ? HASH_THREAD_SPECIFIC : 0));
|
||||
}
|
||||
void free_hash()
|
||||
{
|
||||
|
@ -216,8 +217,8 @@ public:
|
|||
void mark_as_changed(THD *thd, const sys_var *var);
|
||||
void deinit() { orig_list.deinit(); }
|
||||
/* callback */
|
||||
static uchar *sysvars_get_key(const char *entry, size_t *length,
|
||||
my_bool not_used __attribute__((unused)));
|
||||
static const uchar *sysvars_get_key(const void *entry, size_t *length,
|
||||
my_bool);
|
||||
|
||||
friend bool sysvartrack_global_update(THD *thd, char *str, size_t len);
|
||||
};
|
||||
|
|
|
@ -48,11 +48,12 @@ static ulonglong system_variable_hash_version= 0;
|
|||
Return variable name and length for hashing of variables.
|
||||
*/
|
||||
|
||||
static uchar *get_sys_var_length(const sys_var *var, size_t *length,
|
||||
my_bool first)
|
||||
static const uchar *get_sys_var_length(const void *var_, size_t *length,
|
||||
my_bool)
|
||||
{
|
||||
auto var= static_cast<const sys_var *>(var_);
|
||||
*length= var->name.length;
|
||||
return (uchar*) var->name.str;
|
||||
return reinterpret_cast<const uchar *>(var->name.str);
|
||||
}
|
||||
|
||||
sys_var_chain all_sys_vars = { NULL, NULL };
|
||||
|
@ -64,8 +65,9 @@ int sys_var_init()
|
|||
/* Must be already initialized. */
|
||||
DBUG_ASSERT(system_charset_info != NULL);
|
||||
|
||||
if (my_hash_init(PSI_INSTRUMENT_ME, &system_variable_hash, system_charset_info, 700, 0,
|
||||
0, (my_hash_get_key) get_sys_var_length, 0, HASH_UNIQUE))
|
||||
if (my_hash_init(PSI_INSTRUMENT_ME, &system_variable_hash,
|
||||
system_charset_info, 700, 0, 0, get_sys_var_length, 0,
|
||||
HASH_UNIQUE))
|
||||
goto error;
|
||||
|
||||
if (mysql_add_sys_var_chain(all_sys_vars.first))
|
||||
|
|
|
@ -2281,12 +2281,11 @@ Sp_handler::sp_exist_routines(THD *thd, TABLE_LIST *routines) const
|
|||
}
|
||||
|
||||
|
||||
extern "C" uchar* sp_sroutine_key(const uchar *ptr, size_t *plen,
|
||||
my_bool first)
|
||||
extern "C" const uchar *sp_sroutine_key(const void *ptr, size_t *plen, my_bool)
|
||||
{
|
||||
Sroutine_hash_entry *rn= (Sroutine_hash_entry *)ptr;
|
||||
auto rn= static_cast<const Sroutine_hash_entry *>(ptr);
|
||||
*plen= rn->mdl_request.key.length();
|
||||
return (uchar *)rn->mdl_request.key.ptr();
|
||||
return rn->mdl_request.key.ptr();
|
||||
}
|
||||
|
||||
|
||||
|
|
4
sql/sp.h
4
sql/sp.h
|
@ -648,8 +648,8 @@ void sp_update_stmt_used_routines(THD *thd, Query_tables_list *prelocking_ctx,
|
|||
SQL_I_List<Sroutine_hash_entry> *src,
|
||||
TABLE_LIST *belong_to_view);
|
||||
|
||||
extern "C" uchar* sp_sroutine_key(const uchar *ptr, size_t *plen,
|
||||
my_bool first);
|
||||
extern "C" const uchar *sp_sroutine_key(const void *ptr, size_t *plen,
|
||||
my_bool);
|
||||
|
||||
/*
|
||||
Routines which allow open/lock and close mysql.proc table even when
|
||||
|
|
|
@ -269,16 +269,15 @@ sp_cache_enforce_limit(sp_cache *c, ulong upper_limit_for_elements)
|
|||
Internal functions
|
||||
*************************************************************************/
|
||||
|
||||
extern "C" uchar *hash_get_key_for_sp_head(const uchar *ptr, size_t *plen,
|
||||
my_bool first);
|
||||
extern "C" const uchar *hash_get_key_for_sp_head(const void *ptr, size_t *plen,
|
||||
my_bool);
|
||||
extern "C" void hash_free_sp_head(void *p);
|
||||
|
||||
uchar *hash_get_key_for_sp_head(const uchar *ptr, size_t *plen,
|
||||
my_bool first)
|
||||
const uchar *hash_get_key_for_sp_head(const void *ptr, size_t *plen, my_bool)
|
||||
{
|
||||
sp_head *sp= (sp_head *)ptr;
|
||||
auto sp= static_cast<const sp_head *>(ptr);
|
||||
*plen= sp->m_qname.length;
|
||||
return (uchar*) sp->m_qname.str;
|
||||
return reinterpret_cast<const uchar *>(sp->m_qname.str);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ void init_sp_psi_keys()
|
|||
#define MYSQL_RUN_SP(SP, CODE) do { CODE; } while(0)
|
||||
#endif
|
||||
|
||||
extern "C" uchar *sp_table_key(const uchar *ptr, size_t *plen, my_bool first);
|
||||
extern "C" const uchar *sp_table_key(const void *ptr, size_t *plen, my_bool);
|
||||
|
||||
/**
|
||||
Helper function which operates on a THD object to set the query start_time to
|
||||
|
@ -4977,11 +4977,11 @@ typedef struct st_sp_table
|
|||
} SP_TABLE;
|
||||
|
||||
|
||||
uchar *sp_table_key(const uchar *ptr, size_t *plen, my_bool first)
|
||||
const uchar *sp_table_key(const void *ptr, size_t *plen, my_bool)
|
||||
{
|
||||
SP_TABLE *tab= (SP_TABLE *)ptr;
|
||||
auto tab= static_cast<const SP_TABLE *>(ptr);
|
||||
*plen= tab->qname.length;
|
||||
return (uchar *)tab->qname.str;
|
||||
return reinterpret_cast<const uchar *>(tab->qname.str);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -538,18 +538,20 @@ public:
|
|||
};
|
||||
|
||||
|
||||
static uchar* acl_entry_get_key(acl_entry *entry, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
static const uchar *acl_entry_get_key(const void *entry_, size_t *length,
|
||||
my_bool)
|
||||
{
|
||||
auto entry= static_cast<const acl_entry *>(entry_);
|
||||
*length=(uint) entry->length;
|
||||
return (uchar*) entry->key;
|
||||
return reinterpret_cast<const uchar *>(entry->key);
|
||||
}
|
||||
|
||||
static uchar* acl_role_get_key(ACL_ROLE *entry, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
static const uchar *acl_role_get_key(const void *entry_, size_t *length,
|
||||
my_bool)
|
||||
{
|
||||
auto entry= static_cast<const ACL_ROLE *>(entry_);
|
||||
*length=(uint) entry->user.length;
|
||||
return (uchar*) entry->user.str;
|
||||
return reinterpret_cast<const uchar *>(entry->user.str);
|
||||
}
|
||||
|
||||
struct ROLE_GRANT_PAIR : public Sql_alloc
|
||||
|
@ -564,11 +566,12 @@ struct ROLE_GRANT_PAIR : public Sql_alloc
|
|||
const char *rolename, bool with_admin_option);
|
||||
};
|
||||
|
||||
static uchar* acl_role_map_get_key(ROLE_GRANT_PAIR *entry, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
static const uchar *acl_role_map_get_key(const void *entry_, size_t *length,
|
||||
my_bool)
|
||||
{
|
||||
auto entry= static_cast<const ROLE_GRANT_PAIR *>(entry_);
|
||||
*length=(uint) entry->hashkey.length;
|
||||
return (uchar*) entry->hashkey.str;
|
||||
return reinterpret_cast<const uchar *>(entry->hashkey.str);
|
||||
}
|
||||
|
||||
bool ROLE_GRANT_PAIR::init(MEM_ROOT *mem, const char *username,
|
||||
|
@ -2202,13 +2205,15 @@ static bool is_invalid_role_name(const char *str)
|
|||
}
|
||||
|
||||
|
||||
static void free_acl_user(ACL_USER *user)
|
||||
static void free_acl_user(void *user_)
|
||||
{
|
||||
ACL_USER *user= static_cast<ACL_USER *>(user_);
|
||||
delete_dynamic(&(user->role_grants));
|
||||
}
|
||||
|
||||
static void free_acl_role(ACL_ROLE *role)
|
||||
static void free_acl_role(void *role_)
|
||||
{
|
||||
ACL_ROLE *role= static_cast<ACL_ROLE *>(role_);
|
||||
delete_dynamic(&(role->role_grants));
|
||||
delete_dynamic(&(role->parent_grantee));
|
||||
}
|
||||
|
@ -2481,10 +2486,9 @@ bool acl_init(bool dont_read_acl_tables)
|
|||
bool return_val;
|
||||
DBUG_ENTER("acl_init");
|
||||
|
||||
acl_cache= new Hash_filo<acl_entry>(key_memory_acl_cache, ACL_CACHE_SIZE, 0, 0,
|
||||
(my_hash_get_key) acl_entry_get_key,
|
||||
(my_hash_free_key) my_free,
|
||||
&my_charset_utf8mb3_bin);
|
||||
acl_cache= new Hash_filo<acl_entry>(key_memory_acl_cache, ACL_CACHE_SIZE, 0,
|
||||
0, acl_entry_get_key, my_free,
|
||||
&my_charset_utf8mb3_bin);
|
||||
|
||||
/*
|
||||
cache built-in native authentication plugins,
|
||||
|
@ -2924,12 +2928,11 @@ bool acl_reload(THD *thd)
|
|||
my_init_dynamic_array(key_memory_acl_mem, &acl_users, sizeof(ACL_USER), 50, 100, MYF(0));
|
||||
acl_dbs.init(key_memory_acl_mem, 50, 100);
|
||||
my_init_dynamic_array(key_memory_acl_mem, &acl_proxy_users, sizeof(ACL_PROXY_USER), 50, 100, MYF(0));
|
||||
my_hash_init2(key_memory_acl_mem, &acl_roles,50, &my_charset_utf8mb3_bin,
|
||||
0, 0, 0, (my_hash_get_key) acl_role_get_key, 0,
|
||||
(void (*)(void *))free_acl_role, 0);
|
||||
my_hash_init2(key_memory_acl_mem, &acl_roles, 50, &my_charset_utf8mb3_bin, 0,
|
||||
0, 0, acl_role_get_key, 0, free_acl_role, 0);
|
||||
my_hash_init2(key_memory_acl_mem, &acl_roles_mappings, 50,
|
||||
&my_charset_utf8mb3_bin, 0, 0, 0, (my_hash_get_key)
|
||||
acl_role_map_get_key, 0, 0, 0);
|
||||
&my_charset_utf8mb3_bin, 0, 0, 0, acl_role_map_get_key, 0, 0,
|
||||
0);
|
||||
old_mem= acl_memroot;
|
||||
delete_dynamic(&acl_wild_hosts);
|
||||
my_hash_free(&acl_check_hosts);
|
||||
|
@ -3429,11 +3432,11 @@ int acl_setrole(THD *thd, const char *rolename, privilege_t access)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static uchar* check_get_key(ACL_USER *buff, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
static const uchar *check_get_key(const void *buff_, size_t *length, my_bool)
|
||||
{
|
||||
auto buff= static_cast<const ACL_USER *>(buff_);
|
||||
*length=buff->hostname_length;
|
||||
return (uchar*) buff->host.hostname;
|
||||
return reinterpret_cast<const uchar *>(buff->host.hostname);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3745,9 +3748,9 @@ static void init_check_host(void)
|
|||
(void) my_init_dynamic_array(key_memory_acl_mem, &acl_wild_hosts,
|
||||
sizeof(struct acl_host_and_ip),
|
||||
acl_users.elements, 1, MYF(0));
|
||||
(void) my_hash_init(key_memory_acl_mem, &acl_check_hosts,system_charset_info,
|
||||
acl_users.elements, 0, 0,
|
||||
(my_hash_get_key) check_get_key, 0, 0);
|
||||
(void) my_hash_init(key_memory_acl_mem, &acl_check_hosts,
|
||||
system_charset_info, acl_users.elements, 0, 0,
|
||||
check_get_key, 0, 0);
|
||||
if (!allow_all_hosts)
|
||||
{
|
||||
for (uint i=0 ; i < acl_users.elements ; i++)
|
||||
|
@ -5342,11 +5345,12 @@ public:
|
|||
};
|
||||
|
||||
|
||||
static uchar* get_key_column(GRANT_COLUMN *buff, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
static const uchar *get_key_column(const void *buff_, size_t *length, my_bool)
|
||||
{
|
||||
auto buff=
|
||||
static_cast<const GRANT_COLUMN *>(buff_);
|
||||
*length=buff->key_length;
|
||||
return (uchar*) buff->column;
|
||||
return reinterpret_cast<const uchar *>(buff->column);
|
||||
}
|
||||
|
||||
class GRANT_NAME :public Sql_alloc
|
||||
|
@ -5390,7 +5394,7 @@ public:
|
|||
void init_hash()
|
||||
{
|
||||
my_hash_init2(key_memory_acl_memex, &hash_columns, 4, system_charset_info,
|
||||
0, 0, 0, (my_hash_get_key) get_key_column, 0, 0, 0);
|
||||
0, 0, 0, get_key_column, 0, 0, 0);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -5573,16 +5577,17 @@ GRANT_TABLE::~GRANT_TABLE()
|
|||
}
|
||||
|
||||
|
||||
static uchar* get_grant_table(GRANT_NAME *buff, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
static const uchar *get_grant_table(const void *buff_, size_t *length, my_bool)
|
||||
{
|
||||
auto buff= static_cast<const GRANT_NAME *>(buff_);
|
||||
*length=buff->key_length;
|
||||
return (uchar*) buff->hash_key;
|
||||
return reinterpret_cast<const uchar *>(buff->hash_key);
|
||||
}
|
||||
|
||||
|
||||
static void free_grant_table(GRANT_TABLE *grant_table)
|
||||
static void free_grant_table(void *grant_table_)
|
||||
{
|
||||
GRANT_TABLE *grant_table= static_cast<GRANT_TABLE *>(grant_table_);
|
||||
grant_table->~GRANT_TABLE();
|
||||
}
|
||||
|
||||
|
@ -6506,10 +6511,11 @@ static int traverse_role_graph_down(ACL_USER_BASE *user, void *context,
|
|||
entries using the role hash. We put all these "interesting"
|
||||
entries in a (suposedly small) dynamic array and them use it for merging.
|
||||
*/
|
||||
static uchar* role_key(const ACL_ROLE *role, size_t *klen, my_bool)
|
||||
static const uchar *role_key(const void *role_, size_t *klen, my_bool)
|
||||
{
|
||||
auto role= static_cast<const ACL_ROLE *>(role_);
|
||||
*klen= role->user.length;
|
||||
return (uchar*) role->user.str;
|
||||
return reinterpret_cast<const uchar *>(role->user.str);
|
||||
}
|
||||
typedef Hash_set<ACL_ROLE> role_hash_t;
|
||||
|
||||
|
@ -7988,20 +7994,16 @@ static bool grant_load(THD *thd,
|
|||
Sql_mode_instant_remove sms(thd, MODE_PAD_CHAR_TO_FULL_LENGTH);
|
||||
|
||||
(void) my_hash_init(key_memory_acl_memex, &column_priv_hash,
|
||||
&my_charset_utf8mb3_bin, 0,0,0, (my_hash_get_key)
|
||||
get_grant_table, (my_hash_free_key) free_grant_table, 0);
|
||||
&my_charset_utf8mb3_bin, 0, 0, 0, get_grant_table,
|
||||
free_grant_table, 0);
|
||||
(void) my_hash_init(key_memory_acl_memex, &proc_priv_hash,
|
||||
&my_charset_utf8mb3_bin, 0,0,0, (my_hash_get_key)
|
||||
get_grant_table, 0,0);
|
||||
&my_charset_utf8mb3_bin, 0, 0, 0, get_grant_table, 0, 0);
|
||||
(void) my_hash_init(key_memory_acl_memex, &func_priv_hash,
|
||||
&my_charset_utf8mb3_bin, 0,0,0, (my_hash_get_key)
|
||||
get_grant_table, 0,0);
|
||||
&my_charset_utf8mb3_bin, 0, 0, 0, get_grant_table, 0, 0);
|
||||
(void) my_hash_init(key_memory_acl_memex, &package_spec_priv_hash,
|
||||
&my_charset_utf8mb3_bin, 0,0,0, (my_hash_get_key)
|
||||
get_grant_table, 0,0);
|
||||
&my_charset_utf8mb3_bin, 0, 0, 0, get_grant_table, 0, 0);
|
||||
(void) my_hash_init(key_memory_acl_memex, &package_body_priv_hash,
|
||||
&my_charset_utf8mb3_bin, 0,0,0, (my_hash_get_key)
|
||||
get_grant_table, 0,0);
|
||||
&my_charset_utf8mb3_bin, 0, 0, 0, get_grant_table, 0, 0);
|
||||
init_sql_alloc(key_memory_acl_mem, &grant_memroot, ACL_ALLOC_BLOCK_SIZE, 0, MYF(0));
|
||||
|
||||
t_table= tables_priv.table();
|
||||
|
|
|
@ -840,13 +840,13 @@ void Query_cache_block::destroy()
|
|||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
uint Query_cache_block::headers_len()
|
||||
uint Query_cache_block::headers_len() const
|
||||
{
|
||||
return (ALIGN_SIZE(sizeof(Query_cache_block_table)*n_tables) +
|
||||
ALIGN_SIZE(sizeof(Query_cache_block)));
|
||||
}
|
||||
|
||||
uchar* Query_cache_block::data(void)
|
||||
uchar* Query_cache_block::data(void) const
|
||||
{
|
||||
return (uchar*)( ((uchar*)this) + headers_len() );
|
||||
}
|
||||
|
@ -893,14 +893,14 @@ Query_cache_block_table * Query_cache_block::table(TABLE_COUNTER_TYPE n)
|
|||
|
||||
extern "C"
|
||||
{
|
||||
uchar *query_cache_table_get_key(const uchar *record, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
const uchar *query_cache_table_get_key(const void *record, size_t *length,
|
||||
my_bool)
|
||||
{
|
||||
Query_cache_block* table_block = (Query_cache_block*) record;
|
||||
*length = (table_block->used - table_block->headers_len() -
|
||||
ALIGN_SIZE(sizeof(Query_cache_table)));
|
||||
return (((uchar *) table_block->data()) +
|
||||
ALIGN_SIZE(sizeof(Query_cache_table)));
|
||||
auto table_block= static_cast<const Query_cache_block *>(record);
|
||||
*length= (table_block->used - table_block->headers_len() -
|
||||
ALIGN_SIZE(sizeof(Query_cache_table)));
|
||||
return reinterpret_cast<const uchar *>(
|
||||
((table_block->data()) + ALIGN_SIZE(sizeof(Query_cache_table))));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -991,14 +991,14 @@ void Query_cache_query::unlock_n_destroy()
|
|||
|
||||
extern "C"
|
||||
{
|
||||
uchar *query_cache_query_get_key(const uchar *record, size_t *length,
|
||||
my_bool not_used)
|
||||
const uchar *query_cache_query_get_key(const void *record, size_t *length,
|
||||
my_bool)
|
||||
{
|
||||
Query_cache_block *query_block = (Query_cache_block*) record;
|
||||
*length = (query_block->used - query_block->headers_len() -
|
||||
ALIGN_SIZE(sizeof(Query_cache_query)));
|
||||
return (((uchar *) query_block->data()) +
|
||||
ALIGN_SIZE(sizeof(Query_cache_query)));
|
||||
auto query_block= static_cast<const Query_cache_block *>(record);
|
||||
*length= (query_block->used - query_block->headers_len() -
|
||||
ALIGN_SIZE(sizeof(Query_cache_query)));
|
||||
return reinterpret_cast<const uchar *>
|
||||
(((query_block->data()) + ALIGN_SIZE(sizeof(Query_cache_query))));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4326,10 +4326,10 @@ my_bool Query_cache::move_by_type(uchar **border,
|
|||
*new_block =(Query_cache_block *) *border;
|
||||
size_t tablename_offset = block->table()->table() - block->table()->db();
|
||||
char *data = (char*) block->data();
|
||||
uchar *key;
|
||||
const uchar *key;
|
||||
size_t key_length;
|
||||
key=query_cache_table_get_key((uchar*) block, &key_length, 0);
|
||||
my_hash_first(&tables, (uchar*) key, key_length, &record_idx);
|
||||
key=query_cache_table_get_key( block, &key_length, 0);
|
||||
my_hash_first(&tables, key, key_length, &record_idx);
|
||||
|
||||
block->destroy();
|
||||
new_block->init(len);
|
||||
|
@ -4386,10 +4386,10 @@ my_bool Query_cache::move_by_type(uchar **border,
|
|||
char *data = (char*) block->data();
|
||||
Query_cache_block *first_result_block = ((Query_cache_query *)
|
||||
block->data())->result();
|
||||
uchar *key;
|
||||
const uchar *key;
|
||||
size_t key_length;
|
||||
key=query_cache_query_get_key((uchar*) block, &key_length, 0);
|
||||
my_hash_first(&queries, (uchar*) key, key_length, &record_idx);
|
||||
key=query_cache_query_get_key( block, &key_length, 0);
|
||||
my_hash_first(&queries, key, key_length, &record_idx);
|
||||
block->query()->unlock_n_destroy();
|
||||
block->destroy();
|
||||
// Move table of used tables
|
||||
|
@ -5043,9 +5043,9 @@ my_bool Query_cache::check_integrity(bool locked)
|
|||
DBUG_PRINT("qcache", ("block %p, type %u...",
|
||||
block, (uint) block->type));
|
||||
size_t length;
|
||||
uchar *key = query_cache_query_get_key((uchar*) block, &length, 0);
|
||||
const uchar *key= query_cache_query_get_key(block, &length, 0);
|
||||
uchar* val = my_hash_search(&queries, key, length);
|
||||
if (((uchar*)block) != val)
|
||||
if ((reinterpret_cast<uchar *>(block)) != val)
|
||||
{
|
||||
DBUG_PRINT("error", ("block %p found in queries hash like %p",
|
||||
block, val));
|
||||
|
@ -5078,9 +5078,9 @@ my_bool Query_cache::check_integrity(bool locked)
|
|||
DBUG_PRINT("qcache", ("block %p, type %u...",
|
||||
block, (uint) block->type));
|
||||
size_t length;
|
||||
uchar *key = query_cache_table_get_key((uchar*) block, &length, 0);
|
||||
const uchar *key= query_cache_table_get_key(block, &length, 0);
|
||||
uchar* val = my_hash_search(&tables, key, length);
|
||||
if (((uchar*)block) != val)
|
||||
if (reinterpret_cast<uchar *>(block) != val)
|
||||
{
|
||||
DBUG_PRINT("error", ("block %p found in tables hash like %p",
|
||||
block, val));
|
||||
|
|
|
@ -141,8 +141,8 @@ struct Query_cache_block
|
|||
inline bool is_free(void) { return type == FREE; }
|
||||
void init(size_t length);
|
||||
void destroy();
|
||||
uint headers_len();
|
||||
uchar* data(void);
|
||||
uint headers_len() const;
|
||||
uchar* data(void) const;
|
||||
Query_cache_query *query();
|
||||
Query_cache_table *table();
|
||||
Query_cache_result *result();
|
||||
|
@ -256,10 +256,10 @@ struct Query_cache_result
|
|||
|
||||
extern "C"
|
||||
{
|
||||
uchar *query_cache_query_get_key(const uchar *record, size_t *length,
|
||||
my_bool not_used);
|
||||
uchar *query_cache_table_get_key(const uchar *record, size_t *length,
|
||||
my_bool not_used);
|
||||
const uchar *query_cache_query_get_key(const void *record, size_t *length,
|
||||
my_bool);
|
||||
const uchar *query_cache_table_get_key(const void *record, size_t *length,
|
||||
my_bool);
|
||||
}
|
||||
extern "C" void query_cache_invalidate_by_MyISAM_filename(const char* filename);
|
||||
|
||||
|
|
|
@ -89,15 +89,17 @@ const char * const THD::DEFAULT_WHERE= "field list";
|
|||
** User variables
|
||||
****************************************************************************/
|
||||
|
||||
extern "C" uchar *get_var_key(user_var_entry *entry, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
extern "C" const uchar *get_var_key(const void *entry_, size_t *length,
|
||||
my_bool)
|
||||
{
|
||||
auto entry= static_cast<const user_var_entry *>(entry_);
|
||||
*length= entry->name.length;
|
||||
return (uchar*) entry->name.str;
|
||||
return reinterpret_cast<const uchar *>(entry->name.str);
|
||||
}
|
||||
|
||||
extern "C" void free_user_var(user_var_entry *entry)
|
||||
extern "C" void free_user_var(void *entry_)
|
||||
{
|
||||
user_var_entry *entry= static_cast<user_var_entry *>(entry_);
|
||||
char *pos= (char*) entry+ALIGN_SIZE(sizeof(*entry));
|
||||
if (entry->value && entry->value != pos)
|
||||
my_free(entry->value);
|
||||
|
@ -106,18 +108,17 @@ extern "C" void free_user_var(user_var_entry *entry)
|
|||
|
||||
/* Functions for last-value-from-sequence hash */
|
||||
|
||||
extern "C" uchar *get_sequence_last_key(SEQUENCE_LAST_VALUE *entry,
|
||||
size_t *length,
|
||||
my_bool not_used
|
||||
__attribute__((unused)))
|
||||
extern "C" const uchar *get_sequence_last_key(const void *entry_,
|
||||
size_t *length, my_bool)
|
||||
{
|
||||
auto *entry= static_cast<const SEQUENCE_LAST_VALUE *>(entry_);
|
||||
*length= entry->length;
|
||||
return (uchar*) entry->key;
|
||||
return entry->key;
|
||||
}
|
||||
|
||||
extern "C" void free_sequence_last(SEQUENCE_LAST_VALUE *entry)
|
||||
extern "C" void free_sequence_last(void *entry)
|
||||
{
|
||||
delete entry;
|
||||
delete static_cast<SEQUENCE_LAST_VALUE *>(entry);
|
||||
}
|
||||
|
||||
|
||||
|
@ -621,8 +622,9 @@ handle_condition(THD *thd,
|
|||
timeouts at end of query (and thus before THD is destroyed)
|
||||
*/
|
||||
|
||||
extern "C" void thd_kill_timeout(THD* thd)
|
||||
extern "C" void thd_kill_timeout(void *thd_)
|
||||
{
|
||||
THD *thd= static_cast<THD *>(thd_);
|
||||
thd->status_var.max_statement_time_exceeded++;
|
||||
/* Kill queries that can't cause data corruptions */
|
||||
thd->awake(KILL_TIMEOUT);
|
||||
|
@ -853,12 +855,11 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
|
|||
#endif
|
||||
user_connect=(USER_CONN *)0;
|
||||
my_hash_init(key_memory_user_var_entry, &user_vars, system_charset_info,
|
||||
USER_VARS_HASH_SIZE, 0, 0, (my_hash_get_key) get_var_key,
|
||||
(my_hash_free_key) free_user_var, HASH_THREAD_SPECIFIC);
|
||||
my_hash_init(PSI_INSTRUMENT_ME, &sequences, Lex_ident_fs::charset_info(),
|
||||
SEQUENCES_HASH_SIZE, 0, 0, (my_hash_get_key)
|
||||
get_sequence_last_key, (my_hash_free_key) free_sequence_last,
|
||||
USER_VARS_HASH_SIZE, 0, 0, get_var_key, free_user_var,
|
||||
HASH_THREAD_SPECIFIC);
|
||||
my_hash_init(PSI_INSTRUMENT_ME, &sequences, Lex_ident_fs::charset_info(),
|
||||
SEQUENCES_HASH_SIZE, 0, 0, get_sequence_last_key,
|
||||
free_sequence_last, HASH_THREAD_SPECIFIC);
|
||||
|
||||
/* For user vars replication*/
|
||||
if (opt_bin_log)
|
||||
|
@ -1448,12 +1449,11 @@ void THD::change_user(void)
|
|||
init();
|
||||
stmt_map.reset();
|
||||
my_hash_init(key_memory_user_var_entry, &user_vars, system_charset_info,
|
||||
USER_VARS_HASH_SIZE, 0, 0, (my_hash_get_key) get_var_key,
|
||||
(my_hash_free_key) free_user_var, HASH_THREAD_SPECIFIC);
|
||||
USER_VARS_HASH_SIZE, 0, 0, get_var_key, free_user_var,
|
||||
HASH_THREAD_SPECIFIC);
|
||||
my_hash_init(key_memory_user_var_entry, &sequences,
|
||||
Lex_ident_fs::charset_info(),
|
||||
SEQUENCES_HASH_SIZE, 0, 0, (my_hash_get_key)
|
||||
get_sequence_last_key, (my_hash_free_key) free_sequence_last,
|
||||
Lex_ident_fs::charset_info(), SEQUENCES_HASH_SIZE, 0, 0,
|
||||
get_sequence_last_key, free_sequence_last,
|
||||
HASH_THREAD_SPECIFIC);
|
||||
sp_caches_clear();
|
||||
opt_trace.delete_traces();
|
||||
|
@ -4094,13 +4094,12 @@ Statement::~Statement() = default;
|
|||
|
||||
C_MODE_START
|
||||
|
||||
static uchar *
|
||||
get_statement_id_as_hash_key(const uchar *record, size_t *key_length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
static const uchar *get_statement_id_as_hash_key(const void *record,
|
||||
size_t *key_length, my_bool)
|
||||
{
|
||||
const Statement *statement= (const Statement *) record;
|
||||
auto statement= static_cast<const Statement *>(record);
|
||||
*key_length= sizeof(statement->id);
|
||||
return (uchar *) &((const Statement *) statement)->id;
|
||||
return reinterpret_cast<const uchar *>(&(statement)->id);
|
||||
}
|
||||
|
||||
static void delete_statement_as_hash_key(void *key)
|
||||
|
@ -4108,11 +4107,12 @@ static void delete_statement_as_hash_key(void *key)
|
|||
delete (Statement *) key;
|
||||
}
|
||||
|
||||
static uchar *get_stmt_name_hash_key(Statement *entry, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
static const uchar *get_stmt_name_hash_key(const void *entry_, size_t *length,
|
||||
my_bool)
|
||||
{
|
||||
auto entry= static_cast<const Statement *>(entry_);
|
||||
*length= entry->name.length;
|
||||
return (uchar*) entry->name.str;
|
||||
return reinterpret_cast<const uchar *>(entry->name.str);
|
||||
}
|
||||
|
||||
C_MODE_END
|
||||
|
@ -4128,9 +4128,9 @@ Statement_map::Statement_map() :
|
|||
my_hash_init(key_memory_prepared_statement_map, &st_hash, &my_charset_bin,
|
||||
START_STMT_HASH_SIZE, 0, 0, get_statement_id_as_hash_key,
|
||||
delete_statement_as_hash_key, MYF(0));
|
||||
my_hash_init(key_memory_prepared_statement_map, &names_hash, system_charset_info, START_NAME_HASH_SIZE, 0, 0,
|
||||
(my_hash_get_key) get_stmt_name_hash_key,
|
||||
NULL, MYF(0));
|
||||
my_hash_init(key_memory_prepared_statement_map, &names_hash,
|
||||
system_charset_info, START_NAME_HASH_SIZE, 0, 0,
|
||||
get_stmt_name_hash_key, NULL, MYF(0));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -305,17 +305,12 @@ end:
|
|||
started with corresponding variable that is greater then 0.
|
||||
*/
|
||||
|
||||
extern "C" uchar *get_key_conn(user_conn *buff, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
extern "C" const uchar *get_key_conn(const void *buff_, size_t *length,
|
||||
my_bool)
|
||||
{
|
||||
auto buff= static_cast<const user_conn *>(buff_);
|
||||
*length= buff->len;
|
||||
return (uchar*) buff->user;
|
||||
}
|
||||
|
||||
|
||||
extern "C" void free_user(struct user_conn *uc)
|
||||
{
|
||||
my_free(uc);
|
||||
return reinterpret_cast<const uchar *>(buff->user);
|
||||
}
|
||||
|
||||
|
||||
|
@ -323,8 +318,8 @@ void init_max_user_conn(void)
|
|||
{
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
my_hash_init(key_memory_user_conn, &hash_user_connections,
|
||||
system_charset_info, max_connections, 0, 0, (my_hash_get_key)
|
||||
get_key_conn, (my_hash_free_key) free_user, 0);
|
||||
system_charset_info, max_connections, 0, 0, get_key_conn,
|
||||
my_free, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -403,16 +398,12 @@ static const char *get_client_host(THD *client)
|
|||
client->security_ctx->host ? client->security_ctx->host : "";
|
||||
}
|
||||
|
||||
extern "C" uchar *get_key_user_stats(USER_STATS *user_stats, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
extern "C" const uchar *get_key_user_stats(const void *user_stats_,
|
||||
size_t *length, my_bool)
|
||||
{
|
||||
auto user_stats= static_cast<const USER_STATS *>(user_stats_);
|
||||
*length= user_stats->user_name_length;
|
||||
return (uchar*) user_stats->user;
|
||||
}
|
||||
|
||||
void free_user_stats(USER_STATS* user_stats)
|
||||
{
|
||||
my_free(user_stats);
|
||||
return reinterpret_cast<const uchar *>(user_stats->user);
|
||||
}
|
||||
|
||||
void init_user_stats(USER_STATS *user_stats,
|
||||
|
@ -483,56 +474,44 @@ void init_user_stats(USER_STATS *user_stats,
|
|||
|
||||
void init_global_user_stats(void)
|
||||
{
|
||||
my_hash_init(PSI_INSTRUMENT_ME, &global_user_stats, system_charset_info, max_connections,
|
||||
0, 0, (my_hash_get_key) get_key_user_stats,
|
||||
(my_hash_free_key) free_user_stats, 0);
|
||||
my_hash_init(PSI_INSTRUMENT_ME, &global_user_stats, system_charset_info,
|
||||
max_connections, 0, 0, get_key_user_stats, my_free, 0);
|
||||
}
|
||||
|
||||
void init_global_client_stats(void)
|
||||
{
|
||||
my_hash_init(PSI_INSTRUMENT_ME, &global_client_stats, system_charset_info, max_connections,
|
||||
0, 0, (my_hash_get_key) get_key_user_stats,
|
||||
(my_hash_free_key) free_user_stats, 0);
|
||||
my_hash_init(PSI_INSTRUMENT_ME, &global_client_stats, system_charset_info,
|
||||
max_connections, 0, 0, get_key_user_stats, my_free, 0);
|
||||
}
|
||||
|
||||
extern "C" uchar *get_key_table_stats(TABLE_STATS *table_stats, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
extern "C" const uchar *get_key_table_stats(const void *table_stats_,
|
||||
size_t *length, my_bool)
|
||||
{
|
||||
auto table_stats= static_cast<const TABLE_STATS *>(table_stats_);
|
||||
*length= table_stats->table_name_length;
|
||||
return (uchar*) table_stats->table;
|
||||
}
|
||||
|
||||
extern "C" void free_table_stats(TABLE_STATS* table_stats)
|
||||
{
|
||||
my_free(table_stats);
|
||||
return reinterpret_cast<const uchar *>(table_stats->table);
|
||||
}
|
||||
|
||||
void init_global_table_stats(void)
|
||||
{
|
||||
my_hash_init(PSI_INSTRUMENT_ME, &global_table_stats,
|
||||
Lex_ident_fs::charset_info(),
|
||||
max_connections, 0, 0, (my_hash_get_key) get_key_table_stats,
|
||||
(my_hash_free_key) free_table_stats, 0);
|
||||
Lex_ident_fs::charset_info(), max_connections, 0, 0,
|
||||
get_key_table_stats, my_free, 0);
|
||||
}
|
||||
|
||||
extern "C" uchar *get_key_index_stats(INDEX_STATS *index_stats, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
extern "C" const uchar *get_key_index_stats(const void *index_stats_,
|
||||
size_t *length, my_bool)
|
||||
{
|
||||
auto index_stats= static_cast<const INDEX_STATS *>(index_stats_);
|
||||
*length= index_stats->index_name_length;
|
||||
return (uchar*) index_stats->index;
|
||||
}
|
||||
|
||||
extern "C" void free_index_stats(INDEX_STATS* index_stats)
|
||||
{
|
||||
my_free(index_stats);
|
||||
return reinterpret_cast<const uchar *>(index_stats->index);
|
||||
}
|
||||
|
||||
void init_global_index_stats(void)
|
||||
{
|
||||
my_hash_init(PSI_INSTRUMENT_ME, &global_index_stats,
|
||||
Lex_ident_fs::charset_info(),
|
||||
max_connections, 0, 0, (my_hash_get_key) get_key_index_stats,
|
||||
(my_hash_free_key) free_index_stats, 0);
|
||||
Lex_ident_fs::charset_info(), max_connections, 0, 0,
|
||||
get_key_index_stats, my_free, 0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -109,14 +109,14 @@ cmp_db_names(LEX_CSTRING *db1_name, const LEX_CSTRING *db2_name)
|
|||
Function we use in the creation of our hash to get key.
|
||||
*/
|
||||
|
||||
extern "C" uchar* dboptions_get_key(my_dbopt_t *opt, size_t *length,
|
||||
my_bool not_used);
|
||||
extern "C" const uchar *dboptions_get_key(const void *opt, size_t *length,
|
||||
my_bool);
|
||||
|
||||
uchar* dboptions_get_key(my_dbopt_t *opt, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
const uchar *dboptions_get_key(const void *opt_, size_t *length, my_bool)
|
||||
{
|
||||
auto opt= static_cast<const my_dbopt_t *>(opt_);
|
||||
*length= opt->name_length;
|
||||
return (uchar*) opt->name;
|
||||
return reinterpret_cast<const uchar *>(opt->name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -187,8 +187,8 @@ bool my_dboptions_cache_init(void)
|
|||
{
|
||||
dboptions_init= 1;
|
||||
error= my_hash_init(key_memory_dboptions_hash, &dboptions,
|
||||
table_alias_charset, 32, 0, 0, (my_hash_get_key)
|
||||
dboptions_get_key, free_dbopt, 0);
|
||||
table_alias_charset, 32, 0, 0, dboptions_get_key,
|
||||
free_dbopt, 0);
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ void my_dbopt_cleanup(void)
|
|||
mysql_rwlock_wrlock(&LOCK_dboptions);
|
||||
my_hash_free(&dboptions);
|
||||
my_hash_init(key_memory_dboptions_hash, &dboptions, table_alias_charset, 32,
|
||||
0, 0, (my_hash_get_key) dboptions_get_key, free_dbopt, 0);
|
||||
0, 0, dboptions_get_key, free_dbopt, 0);
|
||||
mysql_rwlock_unlock(&LOCK_dboptions);
|
||||
}
|
||||
|
||||
|
|
|
@ -112,11 +112,12 @@ SQL_HANDLER::~SQL_HANDLER()
|
|||
Pointer to the TABLE_LIST struct.
|
||||
*/
|
||||
|
||||
static char *mysql_ha_hash_get_key(SQL_HANDLER *table, size_t *key_len,
|
||||
my_bool first __attribute__((unused)))
|
||||
static const uchar *mysql_ha_hash_get_key(const void *table_, size_t *key_len,
|
||||
my_bool)
|
||||
{
|
||||
auto table= static_cast<const SQL_HANDLER *>(table_);
|
||||
*key_len= table->handler_name.length + 1 ; /* include '\0' in comparisons */
|
||||
return (char*) table->handler_name.str;
|
||||
return reinterpret_cast<const uchar *>(table->handler_name.str);
|
||||
}
|
||||
|
||||
|
||||
|
@ -134,9 +135,9 @@ static char *mysql_ha_hash_get_key(SQL_HANDLER *table, size_t *key_len,
|
|||
Nothing
|
||||
*/
|
||||
|
||||
static void mysql_ha_hash_free(SQL_HANDLER *table)
|
||||
static void mysql_ha_hash_free(void *table)
|
||||
{
|
||||
delete table;
|
||||
delete static_cast<SQL_HANDLER *>(table);
|
||||
}
|
||||
|
||||
static void mysql_ha_close_childs(THD *thd, TABLE_LIST *current_table_list,
|
||||
|
@ -291,8 +292,7 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, SQL_HANDLER *reopen)
|
|||
*/
|
||||
if (my_hash_init(key_memory_THD_handler_tables_hash,
|
||||
&thd->handler_tables_hash, &my_charset_latin1,
|
||||
HANDLER_TABLES_HASH_SIZE, 0, 0, (my_hash_get_key)
|
||||
mysql_ha_hash_get_key, (my_hash_free_key)
|
||||
HANDLER_TABLES_HASH_SIZE, 0, 0, mysql_ha_hash_get_key,
|
||||
mysql_ha_hash_free, 0))
|
||||
{
|
||||
DBUG_PRINT("exit",("ERROR"));
|
||||
|
|
|
@ -31,11 +31,12 @@ public:
|
|||
Constructs an empty hash. Does not allocate memory, it is done upon
|
||||
the first insert. Thus does not cause or return errors.
|
||||
*/
|
||||
Hash_set(PSI_memory_key psi_key, uchar *(*K)(const T *, size_t *, my_bool),
|
||||
Hash_set(PSI_memory_key psi_key,
|
||||
const uchar *(*K)(const void *, size_t *, my_bool),
|
||||
CHARSET_INFO *cs= &my_charset_bin)
|
||||
{
|
||||
my_hash_clear(&m_hash);
|
||||
m_hash.get_key= (my_hash_get_key)K;
|
||||
m_hash.get_key= K;
|
||||
m_hash.charset= cs;
|
||||
m_hash.array.m_psi_key= psi_key;
|
||||
}
|
||||
|
|
|
@ -1513,25 +1513,23 @@ static int plugin_initialize(MEM_ROOT *tmp_root, struct st_plugin_int *plugin,
|
|||
}
|
||||
|
||||
|
||||
extern "C" uchar *get_plugin_hash_key(const uchar *, size_t *, my_bool);
|
||||
extern "C" uchar *get_bookmark_hash_key(const uchar *, size_t *, my_bool);
|
||||
extern "C" const uchar *get_plugin_hash_key(const void *, size_t *, my_bool);
|
||||
extern "C" const uchar *get_bookmark_hash_key(const void *, size_t *, my_bool);
|
||||
|
||||
|
||||
uchar *get_plugin_hash_key(const uchar *buff, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
const uchar *get_plugin_hash_key(const void *buff, size_t *length, my_bool)
|
||||
{
|
||||
struct st_plugin_int *plugin= (st_plugin_int *)buff;
|
||||
*length= (uint)plugin->name.length;
|
||||
return((uchar *)plugin->name.str);
|
||||
auto plugin= static_cast<const st_plugin_int *>(buff);
|
||||
*length= plugin->name.length;
|
||||
return reinterpret_cast<const uchar *>(plugin->name.str);
|
||||
}
|
||||
|
||||
|
||||
uchar *get_bookmark_hash_key(const uchar *buff, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
const uchar *get_bookmark_hash_key(const void *buff, size_t *length, my_bool)
|
||||
{
|
||||
struct st_bookmark *var= (st_bookmark *)buff;
|
||||
auto var= static_cast<const st_bookmark *>(buff);
|
||||
*length= var->name_len + 1;
|
||||
return (uchar*) var->key;
|
||||
return reinterpret_cast<const uchar *>(var->key);
|
||||
}
|
||||
|
||||
static inline void convert_dash_to_underscore(char *str, size_t len)
|
||||
|
|
|
@ -81,16 +81,17 @@ static int update_server_record_in_cache(FOREIGN_SERVER *existing,
|
|||
/* utility functions */
|
||||
static void merge_server_struct(FOREIGN_SERVER *from, FOREIGN_SERVER *to);
|
||||
|
||||
static uchar *servers_cache_get_key(FOREIGN_SERVER *server, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
static const uchar *servers_cache_get_key(const void *server_, size_t *length,
|
||||
my_bool)
|
||||
{
|
||||
auto server= static_cast<const FOREIGN_SERVER *>(server_);
|
||||
DBUG_ENTER("servers_cache_get_key");
|
||||
DBUG_PRINT("info", ("server_name_length %zd server_name %s",
|
||||
server->server_name_length,
|
||||
server->server_name));
|
||||
|
||||
*length= (uint) server->server_name_length;
|
||||
DBUG_RETURN((uchar*) server->server_name);
|
||||
*length= server->server_name_length;
|
||||
DBUG_RETURN(reinterpret_cast<const uchar *>(server->server_name));
|
||||
}
|
||||
|
||||
static PSI_memory_key key_memory_servers;
|
||||
|
@ -232,8 +233,8 @@ bool servers_init(bool dont_read_servers_table)
|
|||
DBUG_RETURN(TRUE);
|
||||
|
||||
/* initialise our servers cache */
|
||||
if (my_hash_init(key_memory_servers, &servers_cache, system_charset_info, 32, 0, 0,
|
||||
(my_hash_get_key) servers_cache_get_key, 0, 0))
|
||||
if (my_hash_init(key_memory_servers, &servers_cache, system_charset_info, 32,
|
||||
0, 0, servers_cache_get_key, 0, 0))
|
||||
{
|
||||
return_val= TRUE; /* we failed, out of memory? */
|
||||
goto end;
|
||||
|
|
|
@ -609,14 +609,13 @@ ignore_db_dirs_init()
|
|||
@return a pointer to the key
|
||||
*/
|
||||
|
||||
static uchar *
|
||||
db_dirs_hash_get_key(const uchar *data, size_t *len_ret,
|
||||
my_bool __attribute__((unused)))
|
||||
static const uchar *db_dirs_hash_get_key(const void *data, size_t *len_ret,
|
||||
my_bool)
|
||||
{
|
||||
LEX_CSTRING *e= (LEX_CSTRING *) data;
|
||||
auto e= static_cast<const LEX_CSTRING *>(data);
|
||||
|
||||
*len_ret= e->length;
|
||||
return (uchar *) e->str;
|
||||
return reinterpret_cast<const uchar *>(e->str);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -104,12 +104,11 @@ static const char *init_syms(udf_func *tmp, char *nm)
|
|||
}
|
||||
|
||||
|
||||
extern "C" uchar* get_hash_key(const uchar *buff, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
extern "C" const uchar *get_hash_key(const void *buff, size_t *length, my_bool)
|
||||
{
|
||||
udf_func *udf=(udf_func*) buff;
|
||||
*length=(uint) udf->name.length;
|
||||
return (uchar*) udf->name.str;
|
||||
auto udf= static_cast<const udf_func *>(buff);
|
||||
*length= udf->name.length;
|
||||
return reinterpret_cast<const uchar *>(udf->name.str);
|
||||
}
|
||||
|
||||
static PSI_memory_key key_memory_udf_mem;
|
||||
|
|
10
sql/table.cc
10
sql/table.cc
|
@ -241,11 +241,11 @@ View_creation_ctx * View_creation_ctx::create(THD *thd,
|
|||
|
||||
/* Get column name from column hash */
|
||||
|
||||
static uchar *get_field_name(Field **buff, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
static const uchar *get_field_name(const void *buff_, size_t *length, my_bool)
|
||||
{
|
||||
*length= (uint) (*buff)->field_name.length;
|
||||
return (uchar*) (*buff)->field_name.str;
|
||||
auto buff= static_cast<const Field *const *>(buff_);
|
||||
*length= (*buff)->field_name.length;
|
||||
return reinterpret_cast<const uchar *>((*buff)->field_name.str);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2251,7 +2251,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
|
|||
if (use_hash)
|
||||
use_hash= !my_hash_init(PSI_INSTRUMENT_ME, &share->name_hash,
|
||||
system_charset_info, share->fields, 0, 0,
|
||||
(my_hash_get_key) get_field_name, 0, 0);
|
||||
get_field_name, 0, 0);
|
||||
|
||||
if (share->mysql_version >= 50700 && share->mysql_version < 100000 &&
|
||||
vcol_screen_length)
|
||||
|
|
|
@ -578,12 +578,11 @@ static void tdc_hash_initializer(LF_HASH *,
|
|||
}
|
||||
|
||||
|
||||
static uchar *tdc_hash_key(const unsigned char *_element, size_t *length,
|
||||
my_bool)
|
||||
static const uchar *tdc_hash_key(const void *element_, size_t *length, my_bool)
|
||||
{
|
||||
const TDC_element *element= (const TDC_element *) _element;
|
||||
auto element= static_cast<const TDC_element *>(element_);
|
||||
*length= element->m_key_length;
|
||||
return (uchar*) element->m_key;
|
||||
return reinterpret_cast<const uchar *>(element->m_key);
|
||||
}
|
||||
|
||||
|
||||
|
@ -604,14 +603,13 @@ bool tdc_init(void)
|
|||
tdc_inited= true;
|
||||
mysql_mutex_init(key_LOCK_unused_shares, &LOCK_unused_shares,
|
||||
MY_MUTEX_INIT_FAST);
|
||||
lf_hash_init(&tdc_hash, sizeof(TDC_element) +
|
||||
sizeof(Share_free_tables) * (tc_instances - 1),
|
||||
LF_HASH_UNIQUE, 0, 0,
|
||||
(my_hash_get_key) tdc_hash_key,
|
||||
&my_charset_bin);
|
||||
lf_hash_init(&tdc_hash,
|
||||
sizeof(TDC_element) +
|
||||
sizeof(Share_free_tables) * (tc_instances - 1),
|
||||
LF_HASH_UNIQUE, 0, 0, tdc_hash_key, &my_charset_bin);
|
||||
tdc_hash.alloc.constructor= lf_alloc_constructor;
|
||||
tdc_hash.alloc.destructor= lf_alloc_destructor;
|
||||
tdc_hash.initializer= (lf_hash_initializer) tdc_hash_initializer;
|
||||
tdc_hash.initializer= tdc_hash_initializer;
|
||||
DBUG_RETURN(false);
|
||||
}
|
||||
|
||||
|
@ -1125,12 +1123,12 @@ struct eliminate_duplicates_arg
|
|||
};
|
||||
|
||||
|
||||
static uchar *eliminate_duplicates_get_key(const uchar *element, size_t *length,
|
||||
my_bool)
|
||||
static const uchar *eliminate_duplicates_get_key(const void *element,
|
||||
size_t *length, my_bool)
|
||||
{
|
||||
LEX_STRING *key= (LEX_STRING *) element;
|
||||
auto key= static_cast<const LEX_STRING *>(element);
|
||||
*length= key->length;
|
||||
return (uchar *) key->str;
|
||||
return reinterpret_cast<const uchar *>(key->str);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1498,21 +1498,20 @@ public:
|
|||
they should obey C calling conventions.
|
||||
*/
|
||||
|
||||
extern "C" uchar *
|
||||
my_tz_names_get_key(Tz_names_entry *entry, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
static const uchar *my_tz_names_get_key(const void *entry_, size_t *length,
|
||||
my_bool)
|
||||
{
|
||||
auto entry= static_cast<const Tz_names_entry *>(entry_);
|
||||
*length= entry->name.length();
|
||||
return (uchar*) entry->name.ptr();
|
||||
return reinterpret_cast<const uchar *>(entry->name.ptr());
|
||||
}
|
||||
|
||||
extern "C" uchar *
|
||||
my_offset_tzs_get_key(Time_zone_offset *entry,
|
||||
size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
static const uchar *my_offset_tzs_get_key(const void *entry_,
|
||||
size_t *length, my_bool)
|
||||
{
|
||||
auto entry= static_cast<const Time_zone_offset *>(entry_);
|
||||
*length= sizeof(long);
|
||||
return (uchar*) &entry->offset;
|
||||
return reinterpret_cast<const uchar *>(&entry->offset);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1626,13 +1625,13 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap)
|
|||
|
||||
/* Init all memory structures that require explicit destruction */
|
||||
if (my_hash_init(key_memory_tz_storage, &tz_names, &my_charset_latin1, 20, 0,
|
||||
0, (my_hash_get_key) my_tz_names_get_key, 0, 0))
|
||||
0, my_tz_names_get_key, 0, 0))
|
||||
{
|
||||
sql_print_error("Fatal error: OOM while initializing time zones");
|
||||
goto end;
|
||||
}
|
||||
if (my_hash_init(key_memory_tz_storage, &offset_tzs, &my_charset_latin1, 26,
|
||||
0, 0, (my_hash_get_key)my_offset_tzs_get_key, 0, 0))
|
||||
0, 0, my_offset_tzs_get_key, 0, 0))
|
||||
{
|
||||
sql_print_error("Fatal error: OOM while initializing time zones");
|
||||
my_hash_free(&tz_names);
|
||||
|
|
|
@ -147,7 +147,7 @@ public:
|
|||
DBUG_ASSERT(!reinterpret_cast<XID_cache_element*>(ptr + LF_HASH_OVERHEAD)
|
||||
->is_set(ACQUIRED));
|
||||
}
|
||||
static uchar *key(const unsigned char *el, size_t *length, my_bool)
|
||||
static const uchar *key(const void *el, size_t *length, my_bool)
|
||||
{
|
||||
const XID &xid= reinterpret_cast<const XID_cache_element*>(el)->xid;
|
||||
*length= xid.key_length();
|
||||
|
|
|
@ -354,17 +354,18 @@ static void free_share(st_blackhole_share *share)
|
|||
mysql_mutex_unlock(&blackhole_mutex);
|
||||
}
|
||||
|
||||
static void blackhole_free_key(st_blackhole_share *share)
|
||||
static void blackhole_free_key(void *share)
|
||||
{
|
||||
thr_lock_delete(&share->lock);
|
||||
thr_lock_delete(&static_cast<st_blackhole_share *>(share)->lock);
|
||||
my_free(share);
|
||||
}
|
||||
|
||||
static uchar* blackhole_get_key(st_blackhole_share *share, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
static const uchar *blackhole_get_key(const void *share_, size_t *length,
|
||||
my_bool)
|
||||
{
|
||||
auto share= static_cast<const st_blackhole_share *>(share_);
|
||||
*length= share->table_name_length;
|
||||
return (uchar*) share->table_name;
|
||||
return reinterpret_cast<const uchar *>(share->table_name);
|
||||
}
|
||||
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
|
@ -405,9 +406,8 @@ static int blackhole_init(void *p)
|
|||
mysql_mutex_init(bh_key_mutex_blackhole,
|
||||
&blackhole_mutex, MY_MUTEX_INIT_FAST);
|
||||
(void) my_hash_init(PSI_INSTRUMENT_ME, &blackhole_open_tables,
|
||||
system_charset_info, 32, 0, 0,
|
||||
(my_hash_get_key) blackhole_get_key,
|
||||
(my_hash_free_key) blackhole_free_key, 0);
|
||||
system_charset_info, 32, 0, 0, blackhole_get_key,
|
||||
blackhole_free_key, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -203,11 +203,12 @@ Cassandra_status_vars cassandra_counters;
|
|||
Function we use in the creation of our hash to get key.
|
||||
*/
|
||||
|
||||
static uchar* cassandra_get_key(CASSANDRA_SHARE *share, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
static const uchar *cassandra_get_key(const void *share_, size_t *length,
|
||||
my_bool)
|
||||
{
|
||||
auto share= static_cast<const CASSANDRA_SHARE *>(share_);
|
||||
*length=share->table_name_length;
|
||||
return (uchar*) share->table_name;
|
||||
return reinterpret_cast<const uchar *>(share->table_name);
|
||||
}
|
||||
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
|
@ -242,8 +243,8 @@ static int cassandra_init_func(void *p)
|
|||
|
||||
cassandra_hton= (handlerton *)p;
|
||||
mysql_mutex_init(ex_key_mutex_example, &cassandra_mutex, MY_MUTEX_INIT_FAST);
|
||||
(void) my_hash_init(PSI_INSTRUMENT_ME, &cassandra_open_tables,system_charset_info,32,0,0,
|
||||
(my_hash_get_key) cassandra_get_key,0,0);
|
||||
(void) my_hash_init(PSI_INSTRUMENT_ME, &cassandra_open_tables,
|
||||
system_charset_info, 32, 0, 0, cassandra_get_key, 0, 0);
|
||||
|
||||
cassandra_hton->create= cassandra_create_handler;
|
||||
/*
|
||||
|
|
|
@ -107,11 +107,11 @@ int sort_set (const void *a_, const void *b_)
|
|||
return ( a->begin > b->begin ? 1 : ( a->begin < b->begin ? -1 : 0 ) );
|
||||
}
|
||||
|
||||
static uchar* tina_get_key(TINA_SHARE *share, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
static const uchar *tina_get_key(const void *share_, size_t *length, my_bool)
|
||||
{
|
||||
const TINA_SHARE *share= static_cast<const TINA_SHARE *>(share_);
|
||||
*length=share->table_name_length;
|
||||
return (uchar*) share->table_name;
|
||||
return reinterpret_cast<const uchar *>(share->table_name);
|
||||
}
|
||||
|
||||
static PSI_memory_key csv_key_memory_tina_share;
|
||||
|
@ -186,9 +186,8 @@ static int tina_init_func(void *p)
|
|||
tina_hton= (handlerton *)p;
|
||||
mysql_mutex_init(csv_key_mutex_tina, &tina_mutex, MY_MUTEX_INIT_FAST);
|
||||
(void) my_hash_init(csv_key_memory_tina_share, &tina_open_tables,
|
||||
Lex_ident_table::charset_info(),
|
||||
32, 0, 0, (my_hash_get_key)
|
||||
tina_get_key, 0, 0);
|
||||
Lex_ident_table::charset_info(), 32, 0, 0, tina_get_key,
|
||||
0, 0);
|
||||
tina_hton->db_type= DB_TYPE_CSV_DB;
|
||||
tina_hton->create= tina_create_handler;
|
||||
tina_hton->flags= (HTON_CAN_RECREATE | HTON_SUPPORT_LOG_TABLES |
|
||||
|
|
|
@ -430,11 +430,12 @@ static handler *federated_create_handler(handlerton *hton,
|
|||
|
||||
/* Function we use in the creation of our hash to get key */
|
||||
|
||||
static uchar *federated_get_key(FEDERATED_SHARE *share, size_t *length,
|
||||
my_bool not_used __attribute__ ((unused)))
|
||||
static const uchar *federated_get_key(const void *share_, size_t *length,
|
||||
my_bool)
|
||||
{
|
||||
auto share= static_cast<const FEDERATED_SHARE *>(share_);
|
||||
*length= share->share_key_length;
|
||||
return (uchar*) share->share_key;
|
||||
return reinterpret_cast<const uchar *>(share->share_key);
|
||||
}
|
||||
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
|
@ -498,7 +499,7 @@ int federated_db_init(void *p)
|
|||
&federated_mutex, MY_MUTEX_INIT_FAST))
|
||||
goto error;
|
||||
if (!my_hash_init(PSI_INSTRUMENT_ME, &federated_open_tables, &my_charset_bin,
|
||||
32, 0, 0, (my_hash_get_key) federated_get_key, 0, 0))
|
||||
32, 0, 0, federated_get_key, 0, 0))
|
||||
{
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
|
|
@ -363,21 +363,20 @@ static handler *federatedx_create_handler(handlerton *hton,
|
|||
|
||||
/* Function we use in the creation of our hash to get key */
|
||||
|
||||
static uchar *
|
||||
federatedx_share_get_key(FEDERATEDX_SHARE *share, size_t *length,
|
||||
my_bool not_used __attribute__ ((unused)))
|
||||
static const uchar *federatedx_share_get_key(const void *share_,
|
||||
size_t *length, my_bool)
|
||||
{
|
||||
auto share= static_cast<const FEDERATEDX_SHARE *>(share_);
|
||||
*length= share->share_key_length;
|
||||
return (uchar*) share->share_key;
|
||||
return reinterpret_cast<const uchar *>(share->share_key);
|
||||
}
|
||||
|
||||
|
||||
static uchar *
|
||||
federatedx_server_get_key(FEDERATEDX_SERVER *server, size_t *length,
|
||||
my_bool not_used __attribute__ ((unused)))
|
||||
static const uchar *federatedx_server_get_key(const void *server_,
|
||||
size_t *length, my_bool)
|
||||
{
|
||||
auto server= static_cast<const FEDERATEDX_SERVER *>(server_);
|
||||
*length= server->key_length;
|
||||
return server->key;
|
||||
return reinterpret_cast<const uchar *>(server->key);
|
||||
}
|
||||
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
|
@ -447,10 +446,12 @@ int federatedx_db_init(void *p)
|
|||
if (mysql_mutex_init(fe_key_mutex_federatedx,
|
||||
&federatedx_mutex, MY_MUTEX_INIT_FAST))
|
||||
goto error;
|
||||
if (!my_hash_init(PSI_INSTRUMENT_ME, &federatedx_open_tables, &my_charset_bin, 32, 0, 0,
|
||||
(my_hash_get_key) federatedx_share_get_key, 0, 0) &&
|
||||
!my_hash_init(PSI_INSTRUMENT_ME, &federatedx_open_servers, &my_charset_bin, 32, 0, 0,
|
||||
(my_hash_get_key) federatedx_server_get_key, 0, 0))
|
||||
if (!my_hash_init(PSI_INSTRUMENT_ME, &federatedx_open_tables,
|
||||
&my_charset_bin, 32, 0, 0, federatedx_share_get_key, 0,
|
||||
0) &&
|
||||
!my_hash_init(PSI_INSTRUMENT_ME, &federatedx_open_servers,
|
||||
&my_charset_bin, 32, 0, 0, federatedx_server_get_key, 0,
|
||||
0))
|
||||
{
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
|
|
@ -333,11 +333,12 @@ static void usage(void)
|
|||
}
|
||||
|
||||
|
||||
static uchar* my_hash_get_string(const uchar *record, size_t *length,
|
||||
my_bool first __attribute__ ((unused)))
|
||||
static const uchar *my_hash_get_string(const void *record_, size_t *length,
|
||||
my_bool first __attribute__((unused)))
|
||||
{
|
||||
*length= (size_t) (strcend((const char*) record,',')- (const char*) record);
|
||||
return (uchar*) record;
|
||||
const char *record= record_;
|
||||
*length= (strcend(record, ',') - record);
|
||||
return record_;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,8 +22,9 @@
|
|||
#include "ma_checkpoint.h"
|
||||
#include <hash.h>
|
||||
|
||||
void history_state_free(MARIA_STATE_HISTORY_CLOSED *closed_history)
|
||||
void history_state_free(void *closed_history_)
|
||||
{
|
||||
MARIA_STATE_HISTORY_CLOSED *closed_history= closed_history_;
|
||||
MARIA_STATE_HISTORY *history, *next;
|
||||
|
||||
/*
|
||||
|
@ -72,7 +73,7 @@ int maria_init(void)
|
|||
maria_create_trn_hook= dummy_maria_create_trn_hook;
|
||||
}
|
||||
my_hash_init(PSI_INSTRUMENT_ME, &maria_stored_state, &my_charset_bin, 32, 0,
|
||||
sizeof(LSN), 0, (my_hash_free_key) history_state_free, 0);
|
||||
sizeof(LSN), 0, history_state_free, 0);
|
||||
DBUG_PRINT("info",("dummy_transaction_object: %p", &dummy_transaction_object));
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -126,11 +126,12 @@ default_trnman_end_trans_hook(TRN *trn __attribute__ ((unused)),
|
|||
}
|
||||
|
||||
|
||||
static uchar *trn_get_hash_key(const uchar *trn, size_t *len,
|
||||
my_bool unused __attribute__ ((unused)))
|
||||
static const uchar *trn_get_hash_key(const void *trn_, size_t *len,
|
||||
my_bool unused __attribute__((unused)))
|
||||
{
|
||||
const TRN *const *trn= trn_;
|
||||
*len= sizeof(TrID);
|
||||
return (uchar *) & ((*((TRN **)trn))->trid);
|
||||
return (const uchar *) &((*trn)->trid);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -597,25 +597,22 @@ static const char *mrn_inspect_extra_function(enum ha_extra_function operation)
|
|||
}
|
||||
#endif
|
||||
|
||||
static uchar *mrn_open_tables_get_key(const uchar *record,
|
||||
size_t *length,
|
||||
my_bool not_used __attribute__ ((unused)))
|
||||
static const uchar *mrn_open_tables_get_key(const void *record, size_t *length,
|
||||
my_bool)
|
||||
{
|
||||
MRN_DBUG_ENTER_FUNCTION();
|
||||
MRN_SHARE *share = reinterpret_cast<MRN_SHARE *>(const_cast<uchar *>(record));
|
||||
auto share = static_cast<const MRN_SHARE *>(record);
|
||||
*length = share->table_name_length;
|
||||
DBUG_RETURN(reinterpret_cast<uchar *>(share->table_name));
|
||||
DBUG_RETURN(reinterpret_cast<const uchar *>(share->table_name));
|
||||
}
|
||||
|
||||
static uchar *mrn_long_term_share_get_key(const uchar *record,
|
||||
size_t *length,
|
||||
my_bool not_used __attribute__ ((unused)))
|
||||
static const uchar *mrn_long_term_share_get_key(const void *record,
|
||||
size_t *length, my_bool)
|
||||
{
|
||||
MRN_DBUG_ENTER_FUNCTION();
|
||||
MRN_LONG_TERM_SHARE *long_term_share =
|
||||
reinterpret_cast<MRN_LONG_TERM_SHARE *>(const_cast<uchar *>(record));
|
||||
auto long_term_share= static_cast<const MRN_LONG_TERM_SHARE *>(record);
|
||||
*length = long_term_share->table_name_length;
|
||||
DBUG_RETURN(reinterpret_cast<uchar *>(long_term_share->table_name));
|
||||
DBUG_RETURN(reinterpret_cast<const uchar *>(long_term_share->table_name));
|
||||
}
|
||||
|
||||
/* status */
|
||||
|
@ -693,13 +690,12 @@ static grn_logger mrn_logger = {
|
|||
NULL
|
||||
};
|
||||
|
||||
static uchar *mrn_allocated_thds_get_key(const uchar *record,
|
||||
size_t *length,
|
||||
my_bool not_used __attribute__ ((unused)))
|
||||
static const uchar *mrn_allocated_thds_get_key(const void *record,
|
||||
size_t *length, my_bool)
|
||||
{
|
||||
MRN_DBUG_ENTER_FUNCTION();
|
||||
*length = sizeof(THD *);
|
||||
DBUG_RETURN(const_cast<uchar *>(record));
|
||||
DBUG_RETURN(static_cast<const uchar *>(record));
|
||||
}
|
||||
|
||||
/* system functions */
|
||||
|
|
|
@ -67,19 +67,19 @@ void cleanup_account(void)
|
|||
}
|
||||
|
||||
C_MODE_START
|
||||
static uchar *account_hash_get_key(const uchar *entry, size_t *length,
|
||||
my_bool)
|
||||
static const uchar *account_hash_get_key(const void *entry, size_t *length,
|
||||
my_bool)
|
||||
{
|
||||
const PFS_account * const *typed_entry;
|
||||
const PFS_account *account;
|
||||
const void *result;
|
||||
typed_entry= reinterpret_cast<const PFS_account* const *> (entry);
|
||||
typed_entry= static_cast<const PFS_account* const *> (entry);
|
||||
assert(typed_entry != NULL);
|
||||
account= *typed_entry;
|
||||
assert(account != NULL);
|
||||
*length= account->m_key.m_key_length;
|
||||
result= account->m_key.m_hash_key;
|
||||
return const_cast<uchar*> (reinterpret_cast<const uchar*> (result));
|
||||
return reinterpret_cast<const uchar *>(result);
|
||||
}
|
||||
C_MODE_END
|
||||
|
||||
|
|
|
@ -145,19 +145,19 @@ void cleanup_digest(void)
|
|||
}
|
||||
|
||||
C_MODE_START
|
||||
static uchar *digest_hash_get_key(const uchar *entry, size_t *length,
|
||||
my_bool)
|
||||
static const uchar *digest_hash_get_key(const void *entry, size_t *length,
|
||||
my_bool)
|
||||
{
|
||||
const PFS_statements_digest_stat * const *typed_entry;
|
||||
const PFS_statements_digest_stat *digest;
|
||||
const void *result;
|
||||
typed_entry= reinterpret_cast<const PFS_statements_digest_stat*const*>(entry);
|
||||
typed_entry= static_cast<const PFS_statements_digest_stat*const*>(entry);
|
||||
assert(typed_entry != NULL);
|
||||
digest= *typed_entry;
|
||||
assert(digest != NULL);
|
||||
*length= sizeof (PFS_digest_key);
|
||||
result= & digest->m_digest_key;
|
||||
return const_cast<uchar*> (reinterpret_cast<const uchar*> (result));
|
||||
return reinterpret_cast<const uchar *>(result);
|
||||
}
|
||||
C_MODE_END
|
||||
|
||||
|
|
|
@ -64,19 +64,19 @@ void cleanup_host(void)
|
|||
}
|
||||
|
||||
C_MODE_START
|
||||
static uchar *host_hash_get_key(const uchar *entry, size_t *length,
|
||||
my_bool)
|
||||
static const uchar *host_hash_get_key(const void *entry, size_t *length,
|
||||
my_bool)
|
||||
{
|
||||
const PFS_host * const *typed_entry;
|
||||
const PFS_host *host;
|
||||
const void *result;
|
||||
typed_entry= reinterpret_cast<const PFS_host* const *> (entry);
|
||||
typed_entry= static_cast<const PFS_host* const *> (entry);
|
||||
assert(typed_entry != NULL);
|
||||
host= *typed_entry;
|
||||
assert(host != NULL);
|
||||
*length= host->m_key.m_key_length;
|
||||
result= host->m_key.m_hash_key;
|
||||
return const_cast<uchar*> (reinterpret_cast<const uchar*> (result));
|
||||
return reinterpret_cast<const uchar *>(result);
|
||||
}
|
||||
C_MODE_END
|
||||
|
||||
|
|
|
@ -252,19 +252,19 @@ void cleanup_instruments(void)
|
|||
|
||||
C_MODE_START
|
||||
/** Get hash table key for instrumented files. */
|
||||
static uchar *filename_hash_get_key(const uchar *entry, size_t *length,
|
||||
my_bool)
|
||||
static const uchar *filename_hash_get_key(const void *entry, size_t *length,
|
||||
my_bool)
|
||||
{
|
||||
const PFS_file * const *typed_entry;
|
||||
const PFS_file *file;
|
||||
const void *result;
|
||||
typed_entry= reinterpret_cast<const PFS_file* const *> (entry);
|
||||
typed_entry= static_cast<const PFS_file* const *> (entry);
|
||||
assert(typed_entry != NULL);
|
||||
file= *typed_entry;
|
||||
assert(file != NULL);
|
||||
*length= file->m_filename_length;
|
||||
result= file->m_filename;
|
||||
return const_cast<uchar*> (reinterpret_cast<const uchar*> (result));
|
||||
return reinterpret_cast<const uchar *>(result);
|
||||
}
|
||||
C_MODE_END
|
||||
|
||||
|
|
|
@ -403,19 +403,19 @@ void cleanup_table_share(void)
|
|||
|
||||
C_MODE_START
|
||||
/** get_key function for @c table_share_hash. */
|
||||
static uchar *table_share_hash_get_key(const uchar *entry, size_t *length,
|
||||
my_bool)
|
||||
static const uchar *table_share_hash_get_key(const void *entry, size_t *length,
|
||||
my_bool)
|
||||
{
|
||||
const PFS_table_share * const *typed_entry;
|
||||
const PFS_table_share *share;
|
||||
const void *result;
|
||||
typed_entry= reinterpret_cast<const PFS_table_share* const *> (entry);
|
||||
typed_entry= static_cast<const PFS_table_share* const *> (entry);
|
||||
assert(typed_entry != NULL);
|
||||
share= *typed_entry;
|
||||
assert(share != NULL);
|
||||
*length= share->m_key.m_key_length;
|
||||
result= &share->m_key.m_hash_key[0];
|
||||
return const_cast<uchar*> (reinterpret_cast<const uchar*> (result));
|
||||
return reinterpret_cast<const uchar *>(result);
|
||||
}
|
||||
C_MODE_END
|
||||
|
||||
|
|
|
@ -63,19 +63,19 @@ void cleanup_program(void)
|
|||
}
|
||||
|
||||
C_MODE_START
|
||||
static uchar *program_hash_get_key(const uchar *entry, size_t *length,
|
||||
my_bool)
|
||||
static const uchar *program_hash_get_key(const void *entry, size_t *length,
|
||||
my_bool)
|
||||
{
|
||||
const PFS_program * const *typed_entry;
|
||||
const PFS_program *program;
|
||||
const void *result;
|
||||
typed_entry= reinterpret_cast<const PFS_program* const *> (entry);
|
||||
typed_entry= static_cast<const PFS_program* const *> (entry);
|
||||
assert(typed_entry != NULL);
|
||||
program= *typed_entry;
|
||||
assert(program != NULL);
|
||||
*length= program->m_key.m_key_length;
|
||||
result= program->m_key.m_hash_key;
|
||||
return const_cast<uchar*> (reinterpret_cast<const uchar*> (result));
|
||||
return reinterpret_cast<const uchar *>(result);
|
||||
}
|
||||
C_MODE_END
|
||||
|
||||
|
|
|
@ -63,19 +63,19 @@ void cleanup_setup_actor(void)
|
|||
}
|
||||
|
||||
C_MODE_START
|
||||
static uchar *setup_actor_hash_get_key(const uchar *entry, size_t *length,
|
||||
my_bool)
|
||||
static const uchar *setup_actor_hash_get_key(const void *entry, size_t *length,
|
||||
my_bool)
|
||||
{
|
||||
const PFS_setup_actor * const *typed_entry;
|
||||
const PFS_setup_actor *setup_actor;
|
||||
const void *result;
|
||||
typed_entry= reinterpret_cast<const PFS_setup_actor* const *> (entry);
|
||||
typed_entry= static_cast<const PFS_setup_actor* const *> (entry);
|
||||
assert(typed_entry != NULL);
|
||||
setup_actor= *typed_entry;
|
||||
assert(setup_actor != NULL);
|
||||
*length= setup_actor->m_key.m_key_length;
|
||||
result= setup_actor->m_key.m_hash_key;
|
||||
return const_cast<uchar*> (reinterpret_cast<const uchar*> (result));
|
||||
return reinterpret_cast<const uchar *>(result);
|
||||
}
|
||||
C_MODE_END
|
||||
|
||||
|
|
|
@ -63,19 +63,19 @@ void cleanup_setup_object(void)
|
|||
}
|
||||
|
||||
C_MODE_START
|
||||
static uchar *setup_object_hash_get_key(const uchar *entry, size_t *length,
|
||||
my_bool)
|
||||
static const uchar *setup_object_hash_get_key(const void *entry,
|
||||
size_t *length, my_bool)
|
||||
{
|
||||
const PFS_setup_object * const *typed_entry;
|
||||
const PFS_setup_object *setup_object;
|
||||
const void *result;
|
||||
typed_entry= reinterpret_cast<const PFS_setup_object* const *> (entry);
|
||||
typed_entry= static_cast<const PFS_setup_object* const *> (entry);
|
||||
assert(typed_entry != NULL);
|
||||
setup_object= *typed_entry;
|
||||
assert(setup_object != NULL);
|
||||
*length= setup_object->m_key.m_key_length;
|
||||
result= setup_object->m_key.m_hash_key;
|
||||
return const_cast<uchar*> (reinterpret_cast<const uchar*> (result));
|
||||
return reinterpret_cast<const uchar *>(result);
|
||||
}
|
||||
C_MODE_END
|
||||
|
||||
|
|
|
@ -64,19 +64,19 @@ void cleanup_user(void)
|
|||
}
|
||||
|
||||
C_MODE_START
|
||||
static uchar *user_hash_get_key(const uchar *entry, size_t *length,
|
||||
my_bool)
|
||||
static const uchar *user_hash_get_key(const void *entry, size_t *length,
|
||||
my_bool)
|
||||
{
|
||||
const PFS_user * const *typed_entry;
|
||||
const PFS_user *user;
|
||||
const void *result;
|
||||
typed_entry= reinterpret_cast<const PFS_user* const *> (entry);
|
||||
typed_entry= static_cast<const PFS_user* const *> (entry);
|
||||
assert(typed_entry != NULL);
|
||||
user= *typed_entry;
|
||||
assert(user != NULL);
|
||||
*length= user->m_key.m_key_length;
|
||||
result= user->m_key.m_hash_key;
|
||||
return const_cast<uchar*> (reinterpret_cast<const uchar*> (result));
|
||||
return reinterpret_cast<const uchar *>(result);
|
||||
}
|
||||
C_MODE_END
|
||||
|
||||
|
|
|
@ -720,11 +720,12 @@ typedef size_t GetKeyLength_t;
|
|||
typedef uint GetKeyLength_t;
|
||||
#endif
|
||||
|
||||
static byte * sphinx_get_key ( const byte * pSharePtr, GetKeyLength_t * pLength, my_bool )
|
||||
static const uchar *sphinx_get_key(const void *pSharePtr,
|
||||
GetKeyLength_t *pLength, my_bool)
|
||||
{
|
||||
CSphSEShare * pShare = (CSphSEShare *) pSharePtr;
|
||||
*pLength = (size_t) pShare->m_iTableNameLen;
|
||||
return (byte*) pShare->m_sTable;
|
||||
const CSphSEShare *pShare= static_cast<const CSphSEShare *>(pSharePtr);
|
||||
*pLength= pShare->m_iTableNameLen;
|
||||
return reinterpret_cast<const uchar *>(pShare->m_sTable);
|
||||
}
|
||||
|
||||
#if MYSQL_VERSION_ID<50100
|
||||
|
|
|
@ -104,49 +104,53 @@ ulong spider_open_connections_line_no;
|
|||
pthread_mutex_t spider_conn_mutex;
|
||||
|
||||
/* for spider_open_connections and trx_conn_hash */
|
||||
uchar *spider_conn_get_key(
|
||||
SPIDER_CONN *conn,
|
||||
const uchar *spider_conn_get_key(
|
||||
const void *conn_,
|
||||
size_t *length,
|
||||
my_bool not_used __attribute__ ((unused))
|
||||
my_bool
|
||||
) {
|
||||
auto conn= static_cast<const SPIDER_CONN *>(conn_);
|
||||
DBUG_ENTER("spider_conn_get_key");
|
||||
*length = conn->conn_key_length;
|
||||
DBUG_PRINT("info",("spider conn_kind=%u", conn->conn_kind));
|
||||
#ifdef DBUG_TRACE
|
||||
spider_print_keys(conn->conn_key, conn->conn_key_length);
|
||||
#endif
|
||||
DBUG_RETURN((uchar*) conn->conn_key);
|
||||
DBUG_RETURN(reinterpret_cast<const uchar *>(conn->conn_key));
|
||||
}
|
||||
|
||||
uchar *spider_ipport_conn_get_key(
|
||||
SPIDER_IP_PORT_CONN *ip_port,
|
||||
const uchar *spider_ipport_conn_get_key(
|
||||
const void *ip_port_,
|
||||
size_t *length,
|
||||
my_bool not_used __attribute__ ((unused))
|
||||
my_bool
|
||||
)
|
||||
{
|
||||
auto ip_port= static_cast<const SPIDER_IP_PORT_CONN *>(ip_port_);
|
||||
DBUG_ENTER("spider_ipport_conn_get_key");
|
||||
*length = ip_port->key_len;
|
||||
DBUG_RETURN((uchar*) ip_port->key);
|
||||
DBUG_RETURN(reinterpret_cast<const uchar *>(ip_port->key));
|
||||
}
|
||||
|
||||
static uchar *spider_loop_check_full_get_key(
|
||||
SPIDER_CONN_LOOP_CHECK *ptr,
|
||||
static const uchar *spider_loop_check_full_get_key(
|
||||
const void *ptr_,
|
||||
size_t *length,
|
||||
my_bool not_used __attribute__ ((unused))
|
||||
my_bool
|
||||
) {
|
||||
auto ptr= static_cast<const SPIDER_CONN_LOOP_CHECK *>(ptr_);
|
||||
DBUG_ENTER("spider_loop_check_full_get_key");
|
||||
*length = ptr->full_name.length;
|
||||
DBUG_RETURN((uchar*) ptr->full_name.str);
|
||||
DBUG_RETURN(reinterpret_cast<const uchar *>(ptr->full_name.str));
|
||||
}
|
||||
|
||||
static uchar *spider_loop_check_to_get_key(
|
||||
SPIDER_CONN_LOOP_CHECK *ptr,
|
||||
static const uchar *spider_loop_check_to_get_key(
|
||||
const void *ptr_,
|
||||
size_t *length,
|
||||
my_bool not_used __attribute__ ((unused))
|
||||
my_bool
|
||||
) {
|
||||
auto ptr= static_cast<const SPIDER_CONN_LOOP_CHECK *>(ptr_);
|
||||
DBUG_ENTER("spider_loop_check_to_get_key");
|
||||
*length = ptr->to_name.length;
|
||||
DBUG_RETURN((uchar*) ptr->to_name.str);
|
||||
DBUG_RETURN(reinterpret_cast<const uchar *>(ptr->to_name.str));
|
||||
}
|
||||
|
||||
int spider_conn_init(
|
||||
|
@ -159,10 +163,10 @@ int spider_conn_init(
|
|||
{
|
||||
goto error_loop_check_mutex_init;
|
||||
}
|
||||
if (
|
||||
my_hash_init(PSI_INSTRUMENT_ME, &conn->loop_checked, spd_charset_utf8mb3_bin, 32, 0, 0,
|
||||
(my_hash_get_key) spider_loop_check_full_get_key, 0, 0)
|
||||
) {
|
||||
if (my_hash_init(PSI_INSTRUMENT_ME, &conn->loop_checked,
|
||||
spd_charset_utf8mb3_bin, 32, 0, 0,
|
||||
spider_loop_check_full_get_key, 0, 0))
|
||||
{
|
||||
goto error_loop_checked_hash_init;
|
||||
}
|
||||
spider_alloc_calc_mem_init(conn->loop_checked, SPD_MID_CONN_INIT_1);
|
||||
|
@ -170,10 +174,10 @@ int spider_conn_init(
|
|||
conn->loop_checked,
|
||||
conn->loop_checked.array.max_element *
|
||||
conn->loop_checked.array.size_of_element);
|
||||
if (
|
||||
my_hash_init(PSI_INSTRUMENT_ME, &conn->loop_check_queue, spd_charset_utf8mb3_bin, 32, 0, 0,
|
||||
(my_hash_get_key) spider_loop_check_to_get_key, 0, 0)
|
||||
) {
|
||||
if (my_hash_init(PSI_INSTRUMENT_ME, &conn->loop_check_queue,
|
||||
spd_charset_utf8mb3_bin, 32, 0, 0,
|
||||
spider_loop_check_to_get_key, 0, 0))
|
||||
{
|
||||
goto error_loop_check_queue_hash_init;
|
||||
}
|
||||
spider_alloc_calc_mem_init(conn->loop_check_queue, SPD_MID_CONN_INIT_2);
|
||||
|
|
|
@ -82,16 +82,16 @@ typedef struct st_spider_conn_loop_check
|
|||
LEX_CSTRING merged_value;
|
||||
} SPIDER_CONN_LOOP_CHECK;
|
||||
|
||||
uchar *spider_conn_get_key(
|
||||
SPIDER_CONN *conn,
|
||||
const uchar *spider_conn_get_key(
|
||||
const void *conn,
|
||||
size_t *length,
|
||||
my_bool not_used __attribute__ ((unused))
|
||||
my_bool
|
||||
);
|
||||
|
||||
uchar *spider_ipport_conn_get_key(
|
||||
SPIDER_IP_PORT_CONN *ip_port,
|
||||
const uchar *spider_ipport_conn_get_key(
|
||||
const void *ip_port,
|
||||
size_t *length,
|
||||
my_bool not_used __attribute__ ((unused))
|
||||
my_bool
|
||||
);
|
||||
|
||||
int spider_conn_init(
|
||||
|
|
|
@ -1853,10 +1853,10 @@ int spider_db_mbase::init()
|
|||
{
|
||||
DBUG_ENTER("spider_db_mbase::init");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
if (
|
||||
my_hash_init(PSI_INSTRUMENT_ME, &lock_table_hash, spd_charset_utf8mb3_bin, 32, 0, 0,
|
||||
(my_hash_get_key) spider_link_get_key, 0, 0)
|
||||
) {
|
||||
if (my_hash_init(PSI_INSTRUMENT_ME, &lock_table_hash,
|
||||
spd_charset_utf8mb3_bin, 32, 0, 0, spider_link_get_key, 0,
|
||||
0))
|
||||
{
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
}
|
||||
spider_alloc_calc_mem_init(lock_table_hash, SPD_MID_DB_MBASE_INIT_1);
|
||||
|
|
|
@ -376,76 +376,73 @@ static char spider_unique_id_buf[1 + 12 + 1 + (16 * 2) + 1 + 1];
|
|||
LEX_CSTRING spider_unique_id;
|
||||
|
||||
// for spider_open_tables
|
||||
uchar *spider_tbl_get_key(
|
||||
SPIDER_SHARE *share,
|
||||
const uchar *spider_tbl_get_key(
|
||||
const void *share_,
|
||||
size_t *length,
|
||||
my_bool not_used __attribute__ ((unused))
|
||||
my_bool
|
||||
) {
|
||||
auto share= static_cast<const SPIDER_SHARE *>(share_);
|
||||
DBUG_ENTER("spider_tbl_get_key");
|
||||
*length = share->table_name_length;
|
||||
DBUG_RETURN((uchar*) share->table_name);
|
||||
DBUG_RETURN(reinterpret_cast<const uchar *>(share->table_name));
|
||||
}
|
||||
|
||||
uchar *spider_wide_share_get_key(
|
||||
SPIDER_WIDE_SHARE *share,
|
||||
const uchar *spider_wide_share_get_key(
|
||||
const void *share_,
|
||||
size_t *length,
|
||||
my_bool not_used __attribute__ ((unused))
|
||||
my_bool
|
||||
) {
|
||||
auto share= static_cast<const SPIDER_WIDE_SHARE *>(share_);
|
||||
DBUG_ENTER("spider_wide_share_get_key");
|
||||
*length = share->table_name_length;
|
||||
DBUG_RETURN((uchar*) share->table_name);
|
||||
DBUG_RETURN(reinterpret_cast<const uchar *>(share->table_name));
|
||||
}
|
||||
|
||||
uchar *spider_lgtm_tblhnd_share_hash_get_key(
|
||||
SPIDER_LGTM_TBLHND_SHARE *share,
|
||||
const uchar *spider_lgtm_tblhnd_share_hash_get_key(
|
||||
const void *share_,
|
||||
size_t *length,
|
||||
my_bool not_used __attribute__ ((unused))
|
||||
my_bool
|
||||
) {
|
||||
auto share= static_cast<const SPIDER_LGTM_TBLHND_SHARE *>(share_);
|
||||
DBUG_ENTER("spider_lgtm_tblhnd_share_hash_get_key");
|
||||
*length = share->table_name_length;
|
||||
DBUG_RETURN((uchar*) share->table_name);
|
||||
DBUG_RETURN(reinterpret_cast<const uchar *>(share->table_name));
|
||||
}
|
||||
|
||||
uchar *spider_link_get_key(
|
||||
SPIDER_LINK_FOR_HASH *link_for_hash,
|
||||
const uchar *spider_link_get_key(
|
||||
const void *link_for_hash_,
|
||||
size_t *length,
|
||||
my_bool not_used __attribute__ ((unused))
|
||||
my_bool
|
||||
) {
|
||||
auto link_for_hash=
|
||||
static_cast<const SPIDER_LINK_FOR_HASH *>(link_for_hash_);
|
||||
DBUG_ENTER("spider_link_get_key");
|
||||
*length = link_for_hash->db_table_str->length();
|
||||
DBUG_RETURN((uchar*) link_for_hash->db_table_str->ptr());
|
||||
DBUG_RETURN(reinterpret_cast<const uchar *>(link_for_hash->db_table_str->ptr()));
|
||||
}
|
||||
|
||||
uchar *spider_ha_get_key(
|
||||
ha_spider *spider,
|
||||
const uchar *spider_udf_tbl_mon_list_key(
|
||||
const void *table_mon_list_,
|
||||
size_t *length,
|
||||
my_bool not_used __attribute__ ((unused))
|
||||
) {
|
||||
DBUG_ENTER("spider_ha_get_key");
|
||||
*length = spider->share->table_name_length;
|
||||
DBUG_RETURN((uchar*) spider->share->table_name);
|
||||
}
|
||||
|
||||
uchar *spider_udf_tbl_mon_list_key(
|
||||
SPIDER_TABLE_MON_LIST *table_mon_list,
|
||||
size_t *length,
|
||||
my_bool not_used __attribute__ ((unused))
|
||||
my_bool
|
||||
) {
|
||||
auto table_mon_list=
|
||||
static_cast<const SPIDER_TABLE_MON_LIST *>(table_mon_list_);
|
||||
DBUG_ENTER("spider_udf_tbl_mon_list_key");
|
||||
DBUG_PRINT("info",("spider hash key=%s", table_mon_list->key));
|
||||
DBUG_PRINT("info",("spider hash key length=%u", table_mon_list->key_length));
|
||||
*length = table_mon_list->key_length;
|
||||
DBUG_RETURN((uchar*) table_mon_list->key);
|
||||
DBUG_RETURN(reinterpret_cast<const uchar *>(table_mon_list->key));
|
||||
}
|
||||
|
||||
uchar *spider_allocated_thds_get_key(
|
||||
THD *thd,
|
||||
const uchar *spider_allocated_thds_get_key(
|
||||
const void *thd,
|
||||
size_t *length,
|
||||
my_bool not_used __attribute__ ((unused))
|
||||
my_bool
|
||||
) {
|
||||
DBUG_ENTER("spider_allocated_thds_get_key");
|
||||
*length = sizeof(THD *);
|
||||
DBUG_RETURN((uchar*) thd);
|
||||
DBUG_RETURN(reinterpret_cast<const uchar *>(thd));
|
||||
}
|
||||
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
|
@ -6333,8 +6330,9 @@ int spider_db_init(
|
|||
&spider_mem_calc_mutex, MY_MUTEX_INIT_FAST))
|
||||
goto error_mem_calc_mutex_init;
|
||||
|
||||
if (my_hash_init(PSI_INSTRUMENT_ME, &spider_open_tables, spd_charset_utf8mb3_bin, 32, 0, 0,
|
||||
(my_hash_get_key) spider_tbl_get_key, 0, 0))
|
||||
if (my_hash_init(PSI_INSTRUMENT_ME, &spider_open_tables,
|
||||
spd_charset_utf8mb3_bin, 32, 0, 0, spider_tbl_get_key, 0,
|
||||
0))
|
||||
goto error_open_tables_hash_init;
|
||||
|
||||
spider_alloc_calc_mem_init(spider_open_tables, SPD_MID_DB_INIT_1);
|
||||
|
@ -6342,8 +6340,9 @@ int spider_db_init(
|
|||
spider_open_tables,
|
||||
spider_open_tables.array.max_element *
|
||||
spider_open_tables.array.size_of_element);
|
||||
if (my_hash_init(PSI_INSTRUMENT_ME, &spider_init_error_tables, spd_charset_utf8mb3_bin, 32, 0, 0,
|
||||
(my_hash_get_key) spider_tbl_get_key, 0, 0))
|
||||
if (my_hash_init(PSI_INSTRUMENT_ME, &spider_init_error_tables,
|
||||
spd_charset_utf8mb3_bin, 32, 0, 0, spider_tbl_get_key, 0,
|
||||
0))
|
||||
goto error_init_error_tables_hash_init;
|
||||
|
||||
spider_alloc_calc_mem_init(spider_init_error_tables, SPD_MID_DB_INIT_2);
|
||||
|
@ -6352,10 +6351,9 @@ int spider_db_init(
|
|||
spider_init_error_tables.array.max_element *
|
||||
spider_init_error_tables.array.size_of_element);
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
if(
|
||||
my_hash_init(PSI_INSTRUMENT_ME, &spider_open_wide_share, spd_charset_utf8mb3_bin, 32, 0, 0,
|
||||
(my_hash_get_key) spider_wide_share_get_key, 0, 0)
|
||||
)
|
||||
if (my_hash_init(PSI_INSTRUMENT_ME, &spider_open_wide_share,
|
||||
spd_charset_utf8mb3_bin, 32, 0, 0,
|
||||
spider_wide_share_get_key, 0, 0))
|
||||
goto error_open_wide_share_hash_init;
|
||||
|
||||
spider_alloc_calc_mem_init(spider_open_wide_share, SPD_MID_DB_INIT_3);
|
||||
|
@ -6366,7 +6364,7 @@ int spider_db_init(
|
|||
#endif
|
||||
if (my_hash_init(PSI_INSTRUMENT_ME, &spider_lgtm_tblhnd_share_hash,
|
||||
spd_charset_utf8mb3_bin, 32, 0, 0,
|
||||
(my_hash_get_key) spider_lgtm_tblhnd_share_hash_get_key, 0, 0))
|
||||
spider_lgtm_tblhnd_share_hash_get_key, 0, 0))
|
||||
goto error_lgtm_tblhnd_share_hash_init;
|
||||
|
||||
spider_alloc_calc_mem_init(spider_lgtm_tblhnd_share_hash, SPD_MID_DB_INIT_4);
|
||||
|
@ -6374,22 +6372,24 @@ int spider_db_init(
|
|||
spider_lgtm_tblhnd_share_hash,
|
||||
spider_lgtm_tblhnd_share_hash.array.max_element *
|
||||
spider_lgtm_tblhnd_share_hash.array.size_of_element);
|
||||
if (my_hash_init(PSI_INSTRUMENT_ME, &spider_open_connections, spd_charset_utf8mb3_bin, 32, 0, 0,
|
||||
(my_hash_get_key) spider_conn_get_key, 0, 0))
|
||||
if (my_hash_init(PSI_INSTRUMENT_ME, &spider_open_connections,
|
||||
spd_charset_utf8mb3_bin, 32, 0, 0, spider_conn_get_key, 0,
|
||||
0))
|
||||
goto error_open_connections_hash_init;
|
||||
|
||||
if (my_hash_init(PSI_INSTRUMENT_ME, &spider_ipport_conns, spd_charset_utf8mb3_bin, 32, 0, 0,
|
||||
(my_hash_get_key) spider_ipport_conn_get_key,
|
||||
spider_free_ipport_conn, 0))
|
||||
goto error_ipport_conn__hash_init;
|
||||
if (my_hash_init(PSI_INSTRUMENT_ME, &spider_ipport_conns,
|
||||
spd_charset_utf8mb3_bin, 32, 0, 0,
|
||||
spider_ipport_conn_get_key, spider_free_ipport_conn, 0))
|
||||
goto error_ipport_conn__hash_init;
|
||||
|
||||
spider_alloc_calc_mem_init(spider_open_connections, SPD_MID_DB_INIT_5);
|
||||
spider_alloc_calc_mem(NULL,
|
||||
spider_open_connections,
|
||||
spider_open_connections.array.max_element *
|
||||
spider_open_connections.array.size_of_element);
|
||||
if (my_hash_init(PSI_INSTRUMENT_ME, &spider_allocated_thds, spd_charset_utf8mb3_bin, 32, 0, 0,
|
||||
(my_hash_get_key) spider_allocated_thds_get_key, 0, 0))
|
||||
if (my_hash_init(PSI_INSTRUMENT_ME, &spider_allocated_thds,
|
||||
spd_charset_utf8mb3_bin, 32, 0, 0,
|
||||
spider_allocated_thds_get_key, 0, 0))
|
||||
goto error_allocated_thds_hash_init;
|
||||
|
||||
spider_alloc_calc_mem_init(spider_allocated_thds, SPD_MID_DB_INIT_8);
|
||||
|
@ -6440,9 +6440,10 @@ int spider_db_init(
|
|||
roop_count < (int) spider_param_udf_table_mon_mutex_count();
|
||||
roop_count++)
|
||||
{
|
||||
if (my_hash_init(PSI_INSTRUMENT_ME, &spider_udf_table_mon_list_hash[roop_count],
|
||||
spd_charset_utf8mb3_bin, 32, 0, 0,
|
||||
(my_hash_get_key) spider_udf_tbl_mon_list_key, 0, 0))
|
||||
if (my_hash_init(PSI_INSTRUMENT_ME,
|
||||
&spider_udf_table_mon_list_hash[roop_count],
|
||||
spd_charset_utf8mb3_bin, 32, 0, 0,
|
||||
spider_udf_tbl_mon_list_key, 0, 0))
|
||||
goto error_init_udf_table_mon_list_hash;
|
||||
|
||||
spider_alloc_calc_mem_init(spider_udf_table_mon_list_hash, SPD_MID_DB_INIT_11);
|
||||
|
|
|
@ -47,28 +47,22 @@ typedef struct st_spider_param_string_parse
|
|||
bool locate_param_def(char*& start_param);
|
||||
} SPIDER_PARAM_STRING_PARSE;
|
||||
|
||||
uchar *spider_tbl_get_key(
|
||||
SPIDER_SHARE *share,
|
||||
const uchar *spider_tbl_get_key(
|
||||
const void *share,
|
||||
size_t *length,
|
||||
my_bool not_used __attribute__ ((unused))
|
||||
my_bool
|
||||
);
|
||||
|
||||
uchar *spider_wide_share_get_key(
|
||||
SPIDER_WIDE_SHARE *share,
|
||||
const uchar *spider_wide_share_get_key(
|
||||
const void *share,
|
||||
size_t *length,
|
||||
my_bool not_used __attribute__ ((unused))
|
||||
my_bool
|
||||
);
|
||||
|
||||
uchar *spider_link_get_key(
|
||||
SPIDER_LINK_FOR_HASH *link_for_hash,
|
||||
const uchar *spider_link_get_key(
|
||||
const void *link_for_hash,
|
||||
size_t *length,
|
||||
my_bool not_used __attribute__ ((unused))
|
||||
);
|
||||
|
||||
uchar *spider_ha_get_key(
|
||||
ha_spider *spider,
|
||||
size_t *length,
|
||||
my_bool not_used __attribute__ ((unused))
|
||||
my_bool
|
||||
);
|
||||
|
||||
int spider_get_server(
|
||||
|
|
|
@ -62,29 +62,31 @@ extern ulong spider_allocated_thds_line_no;
|
|||
extern pthread_mutex_t spider_allocated_thds_mutex;
|
||||
|
||||
// for spider_alter_tables
|
||||
uchar *spider_alter_tbl_get_key(
|
||||
SPIDER_ALTER_TABLE *alter_table,
|
||||
const uchar *spider_alter_tbl_get_key(
|
||||
const void *alter_table_,
|
||||
size_t *length,
|
||||
my_bool not_used __attribute__ ((unused))
|
||||
my_bool
|
||||
) {
|
||||
auto alter_table= static_cast<const SPIDER_ALTER_TABLE *>(alter_table_);
|
||||
DBUG_ENTER("spider_alter_tbl_get_key");
|
||||
*length = alter_table->table_name_length;
|
||||
DBUG_PRINT("info",("spider table_name_length=%zu", *length));
|
||||
DBUG_PRINT("info",("spider table_name=%s", alter_table->table_name));
|
||||
DBUG_RETURN((uchar*) alter_table->table_name);
|
||||
DBUG_RETURN(reinterpret_cast<const uchar *>(alter_table->table_name));
|
||||
}
|
||||
|
||||
// for SPIDER_TRX_HA
|
||||
uchar *spider_trx_ha_get_key(
|
||||
SPIDER_TRX_HA *trx_ha,
|
||||
const uchar *spider_trx_ha_get_key(
|
||||
const void *trx_ha_,
|
||||
size_t *length,
|
||||
my_bool not_used __attribute__ ((unused))
|
||||
my_bool
|
||||
) {
|
||||
auto trx_ha= static_cast<const SPIDER_TRX_HA *>(trx_ha_);
|
||||
DBUG_ENTER("spider_trx_ha_get_key");
|
||||
*length = trx_ha->table_name_length;
|
||||
DBUG_PRINT("info",("spider table_name_length=%zu", *length));
|
||||
DBUG_PRINT("info",("spider table_name=%s", trx_ha->table_name));
|
||||
DBUG_RETURN((uchar*) trx_ha->table_name);
|
||||
DBUG_RETURN(reinterpret_cast<const uchar *>(trx_ha->table_name));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1121,11 +1123,9 @@ SPIDER_TRX *spider_get_trx(
|
|||
goto error_init_udf_table_mutex;
|
||||
}
|
||||
|
||||
if (
|
||||
my_hash_init(PSI_INSTRUMENT_ME, &trx->trx_conn_hash,
|
||||
spd_charset_utf8mb3_bin, 32, 0, 0, (my_hash_get_key)
|
||||
spider_conn_get_key, 0, 0)
|
||||
)
|
||||
if (my_hash_init(PSI_INSTRUMENT_ME, &trx->trx_conn_hash,
|
||||
spd_charset_utf8mb3_bin, 32, 0, 0, spider_conn_get_key, 0,
|
||||
0))
|
||||
goto error_init_hash;
|
||||
spider_alloc_calc_mem_init(trx->trx_conn_hash, SPD_MID_GET_TRX_2);
|
||||
spider_alloc_calc_mem(
|
||||
|
@ -1134,11 +1134,9 @@ SPIDER_TRX *spider_get_trx(
|
|||
trx->trx_conn_hash.array.max_element *
|
||||
trx->trx_conn_hash.array.size_of_element);
|
||||
|
||||
if (
|
||||
my_hash_init(PSI_INSTRUMENT_ME, &trx->trx_another_conn_hash,
|
||||
spd_charset_utf8mb3_bin, 32, 0, 0, (my_hash_get_key)
|
||||
spider_conn_get_key, 0, 0)
|
||||
)
|
||||
if (my_hash_init(PSI_INSTRUMENT_ME, &trx->trx_another_conn_hash,
|
||||
spd_charset_utf8mb3_bin, 32, 0, 0, spider_conn_get_key, 0,
|
||||
0))
|
||||
goto error_init_another_hash;
|
||||
spider_alloc_calc_mem_init(trx->trx_another_conn_hash, SPD_MID_GET_TRX_3);
|
||||
spider_alloc_calc_mem(
|
||||
|
@ -1147,13 +1145,9 @@ SPIDER_TRX *spider_get_trx(
|
|||
trx->trx_another_conn_hash.array.max_element *
|
||||
trx->trx_another_conn_hash.array.size_of_element);
|
||||
|
||||
|
||||
|
||||
if (
|
||||
my_hash_init(PSI_INSTRUMENT_ME, &trx->trx_alter_table_hash,
|
||||
spd_charset_utf8mb3_bin, 32, 0, 0, (my_hash_get_key)
|
||||
spider_alter_tbl_get_key, 0, 0)
|
||||
)
|
||||
if (my_hash_init(PSI_INSTRUMENT_ME, &trx->trx_alter_table_hash,
|
||||
spd_charset_utf8mb3_bin, 32, 0, 0,
|
||||
spider_alter_tbl_get_key, 0, 0))
|
||||
goto error_init_alter_hash;
|
||||
spider_alloc_calc_mem_init(trx->trx_alter_table_hash, SPD_MID_GET_TRX_8);
|
||||
spider_alloc_calc_mem(
|
||||
|
@ -1162,11 +1156,9 @@ SPIDER_TRX *spider_get_trx(
|
|||
trx->trx_alter_table_hash.array.max_element *
|
||||
trx->trx_alter_table_hash.array.size_of_element);
|
||||
|
||||
if (
|
||||
my_hash_init(PSI_INSTRUMENT_ME, &trx->trx_ha_hash,
|
||||
spd_charset_utf8mb3_bin, 32, 0, 0, (my_hash_get_key)
|
||||
spider_trx_ha_get_key, 0, 0)
|
||||
)
|
||||
if (my_hash_init(PSI_INSTRUMENT_ME, &trx->trx_ha_hash,
|
||||
spd_charset_utf8mb3_bin, 32, 0, 0, spider_trx_ha_get_key,
|
||||
0, 0))
|
||||
goto error_init_trx_ha_hash;
|
||||
spider_alloc_calc_mem_init(trx->trx_ha_hash, SPD_MID_GET_TRX_9);
|
||||
spider_alloc_calc_mem(
|
||||
|
|
Loading…
Reference in a new issue