[Commits] fec94a6: MDEV-7728 - Improve xid cache scalability by using lock-free hash

svoj at mariadb.org svoj at mariadb.org
Mon Mar 16 20:57:35 EET 2015


revision-id: fec94a6b44902092ac0294e1b51e1c7d5ee11cc8
parent(s): e6f67c64cda4e4ca4f1463ae65f301358ed356a7
committer: Sergey Vojtovich
branch nick: 10.1
timestamp: 2015-03-16 22:54:43 +0400
message:

MDEV-7728 - Improve xid cache scalability by using lock-free hash

This is an addition to original patch. Some platforms are strict about atomic
op argument signedness.

---
 sql/sql_class.cc | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 39737a3..3071ba6 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -5182,8 +5182,9 @@ void mark_transaction_to_rollback(THD *thd, bool all)
 class XID_cache_element
 {
   /*
-    bits 1..31 are reference counter
-    bit 32 is UNINITIALIZED flag
+    bits 1..30 are reference counter
+    bit 31 is UNINITIALIZED flag
+    bit 32 is unused
 
     Newly allocated and deleted elements have UNINITIALIZED flag set.
 
@@ -5204,8 +5205,8 @@ class XID_cache_element
     Currently m_state is only used to prevent elements from being deleted while
     XA RECOVER iterates xid cache.
   */
-  uint32 m_state;
-  static const uint32 UNINITIALIZED= 1 << 31;
+  int32 m_state;
+  static const int32 UNINITIALIZED= 1 << 30;
 public:
   XID_STATE *m_xid_state;
   bool lock()
@@ -5224,7 +5225,7 @@ class XID_cache_element
   }
   void mark_uninitialized()
   {
-    uint old= 0;
+    int32 old= 0;
     while (!my_atomic_cas32_weak_explicit(&m_state, &old, UNINITIALIZED,
                                           MY_MEMORY_ORDER_RELAXED,
                                           MY_MEMORY_ORDER_RELAXED))


More information about the commits mailing list