mirror of
https://github.com/MariaDB/server.git
synced 2026-05-17 20:37:12 +02:00
MDEV-25281: Switch to use non-atomic (vs atomic) distributed counter to
track page-access counter As part of MDEV-21212, n_page_gets that is meant to track page access, is ported to use distributed counter that default uses atomic sub-counters. n_page_gets originally was a non-atomic counter that represented an approximate value of pages tracked. Using the said analogy it doesn't need to be an atomic distributed counter. This patch introduces an interface that allows distributed counter to be used with atomic and non-atomic sub-counter (through template) and also port n_page_gets to use non-atomic distributed counter using the said updated interface.
This commit is contained in:
parent
8048831a5b
commit
0f6f72965b
3 changed files with 27 additions and 17 deletions
|
|
@ -45,6 +45,7 @@ public:
|
|||
Type operator=(const Type val)
|
||||
{ m.store(val, std::memory_order_relaxed); return val; }
|
||||
Type operator=(const Atomic_relaxed<Type> &rhs) { return *this= Type{rhs}; }
|
||||
Type operator+=(const Type i) { return fetch_add(i); }
|
||||
Type fetch_add(const Type i, std::memory_order o= std::memory_order_relaxed)
|
||||
{ return m.fetch_add(i, o); }
|
||||
Type fetch_sub(const Type i, std::memory_order o= std::memory_order_relaxed)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue