Skip to content

Commit

Permalink
MDEV-17441 - InnoDB transition to C++11 atomics
Browse files Browse the repository at this point in the history
Added lf_hash_size() macro, so that callers don't need to use atomic
operations.
  • Loading branch information
Sergey Vojtovich committed Dec 28, 2018
1 parent 830a7c6 commit dc90234
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 2 additions & 0 deletions include/lf.h
Expand Up @@ -167,6 +167,8 @@ void *lf_hash_search_using_hash_value(LF_HASH *hash, LF_PINS *pins,
int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen);
int lf_hash_iterate(LF_HASH *hash, LF_PINS *pins,
my_hash_walk_action action, void *argument);
#define lf_hash_size(hash) \
my_atomic_load32_explicit(&(hash)->count, MY_MEMORY_ORDER_RELAXED)
/*
shortcut macros to access underlying pinbox functions from an LF_HASH
see lf_pinbox_get_pins() and lf_pinbox_put_pins()
Expand Down
2 changes: 1 addition & 1 deletion sql/mdl.cc
Expand Up @@ -782,7 +782,7 @@ void MDL_map::destroy()
{
delete m_backup_lock;

DBUG_ASSERT(!my_atomic_load32(&m_locks.count));
DBUG_ASSERT(!lf_hash_size(&m_locks));
lf_hash_destroy(&m_locks);
}

Expand Down
2 changes: 1 addition & 1 deletion sql/table_cache.cc
Expand Up @@ -689,7 +689,7 @@ void tdc_deinit(void)

ulong tdc_records(void)
{
return my_atomic_load32_explicit(&tdc_hash.count, MY_MEMORY_ORDER_RELAXED);
return lf_hash_size(&tdc_hash);
}


Expand Down
6 changes: 1 addition & 5 deletions storage/innobase/include/trx0sys.h
Expand Up @@ -704,11 +704,7 @@ class rw_trx_hash_t
because it may change even before this method returns.
*/

uint32_t size()
{
return uint32_t(my_atomic_load32_explicit(&hash.count,
MY_MEMORY_ORDER_RELAXED));
}
uint32_t size() { return uint32_t(lf_hash_size(&hash)); }


/**
Expand Down

0 comments on commit dc90234

Please sign in to comment.