Skip to content

Commit

Permalink
MDEV-20857: perf schema conflict name filename_hash
Browse files Browse the repository at this point in the history
filename_hash is a function from libiberty.a from the system
but also an expored name in the perf schema static library.

We'll use a different name.
  • Loading branch information
grooverdan committed Feb 24, 2021
1 parent ad0f0d2 commit 2628fa2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions storage/perfschema/pfs_engine_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1233,11 +1233,11 @@ bool pfs_show_status(handlerton *hton, THD *thd,
break;
case 141:
name= "(filename_hash).count";
size= filename_hash.count;
size= pfs_filename_hash.count;
break;
case 142:
name= "(filename_hash).size";
size= filename_hash.size;
size= pfs_filename_hash.size;
break;
case 143:
name= "(host_hash).count";
Expand Down
20 changes: 10 additions & 10 deletions storage/perfschema/pfs_instr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ PFS_thread *thread_array= NULL;
File instrumentation instances array.
@sa file_max
@sa file_lost
@sa filename_hash
@sa pfs_filename_hash
*/
PFS_file *file_array= NULL;

Expand Down Expand Up @@ -189,8 +189,8 @@ static unsigned char *history_stmts_digest_token_array= NULL;
static char *thread_session_connect_attrs_array= NULL;

/** Hash table for instrumented files. */
LF_HASH filename_hash;
/** True if filename_hash is initialized. */
LF_HASH pfs_filename_hash;
/** True if pfs_filename_hash is initialized. */
static bool filename_hash_inited= false;

/**
Expand Down Expand Up @@ -586,7 +586,7 @@ int init_file_hash(void)
{
if ((! filename_hash_inited) && (file_max > 0))
{
lf_hash_init(&filename_hash, sizeof(PFS_file*), LF_HASH_UNIQUE,
lf_hash_init(&pfs_filename_hash, sizeof(PFS_file*), LF_HASH_UNIQUE,
0, 0, filename_hash_get_key, &my_charset_bin);
/* filename_hash.size= file_max; */
filename_hash_inited= true;
Expand All @@ -599,7 +599,7 @@ void cleanup_file_hash(void)
{
if (filename_hash_inited)
{
lf_hash_destroy(&filename_hash);
lf_hash_destroy(&pfs_filename_hash);
filename_hash_inited= false;
}
}
Expand Down Expand Up @@ -1186,7 +1186,7 @@ void destroy_thread(PFS_thread *pfs)
}

/**
Get the hash pins for @filename_hash.
Get the hash pins for @pfs_filename_hash.
@param thread The running thread.
@returns The LF_HASH pins for the thread.
*/
Expand All @@ -1196,7 +1196,7 @@ LF_PINS* get_filename_hash_pins(PFS_thread *thread)
{
if (! filename_hash_inited)
return NULL;
thread->m_filename_hash_pins= lf_hash_get_pins(&filename_hash);
thread->m_filename_hash_pins= lf_hash_get_pins(&pfs_filename_hash);
}
return thread->m_filename_hash_pins;
}
Expand Down Expand Up @@ -1314,7 +1314,7 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass,
search:

entry= reinterpret_cast<PFS_file**>
(lf_hash_search(&filename_hash, pins,
(lf_hash_search(&pfs_filename_hash, pins,
normalized_filename, normalized_length));
if (entry && (entry != MY_ERRPTR))
{
Expand Down Expand Up @@ -1359,7 +1359,7 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass,
pfs->m_identity= (const void *)pfs;

int res;
res= lf_hash_insert(&filename_hash, thread->m_filename_hash_pins,
res= lf_hash_insert(&pfs_filename_hash, thread->m_filename_hash_pins,
&pfs);
if (likely(res == 0))
{
Expand Down Expand Up @@ -1426,7 +1426,7 @@ void destroy_file(PFS_thread *thread, PFS_file *pfs)
LF_PINS *pins= get_filename_hash_pins(thread);
DBUG_ASSERT(pins != NULL);

lf_hash_delete(&filename_hash, pins,
lf_hash_delete(&pfs_filename_hash, pins,
pfs->m_filename, pfs->m_filename_length);
if (klass->is_singleton())
klass->m_singleton= NULL;
Expand Down
2 changes: 1 addition & 1 deletion storage/perfschema/pfs_instr.h
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ void update_socket_derived_flags();
/** Update derived flags for all instruments. */
void update_instruments_derived_flags();

extern LF_HASH filename_hash;
extern LF_HASH pfs_filename_hash;

/** @} */
#endif
Expand Down

0 comments on commit 2628fa2

Please sign in to comment.