summaryrefslogtreecommitdiff
path: root/sql/sql_class.h
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2015-03-16 18:44:06 +0400
committerSergey Vojtovich <svoj@mariadb.org>2015-03-16 19:07:51 +0400
commit6bd24deab46efc7d67401ac1b30194f03a03ad02 (patch)
treeb6d6667d8b12429b0ffc96a850a88df1c8a2304b /sql/sql_class.h
parent18e9c314e43271debf58f3c3e5bf454eab655799 (diff)
downloadmariadb-git-6bd24deab46efc7d67401ac1b30194f03a03ad02.tar.gz
MDEV-7728 - Improve xid cache scalability by using lock-free hash
XID cache is now based on lock-free hash. Also fixed lf_hash_destroy() to call alloc destructor. Note that previous implementation had race condition when thread was accessing XA owned by different thread. This new implementation doesn't fix it either.
Diffstat (limited to 'sql/sql_class.h')
-rw-r--r--sql/sql_class.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h
index a39ba782662..0049b971f48 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -1119,6 +1119,7 @@ struct st_savepoint {
enum xa_states {XA_NOTR=0, XA_ACTIVE, XA_IDLE, XA_PREPARED, XA_ROLLBACK_ONLY};
extern const char *xa_state_names[];
+class XID_cache_element;
typedef struct st_xid_state {
/* For now, this is only used to catch duplicated external xids */
@@ -1127,16 +1128,16 @@ typedef struct st_xid_state {
bool in_thd;
/* Error reported by the Resource Manager (RM) to the Transaction Manager. */
uint rm_error;
+ XID_cache_element *xid_cache_element;
} XID_STATE;
-extern mysql_mutex_t LOCK_xid_cache;
-extern HASH xid_cache;
-bool xid_cache_init(void);
+void xid_cache_init(void);
void xid_cache_free(void);
-XID_STATE *xid_cache_search(XID *xid);
+XID_STATE *xid_cache_search(THD *thd, XID *xid);
bool xid_cache_insert(XID *xid, enum xa_states xa_state);
-bool xid_cache_insert(XID_STATE *xid_state);
-void xid_cache_delete(XID_STATE *xid_state);
+bool xid_cache_insert(THD *thd, XID_STATE *xid_state);
+void xid_cache_delete(THD *thd, XID_STATE *xid_state);
+int xid_cache_iterate(THD *thd, my_hash_walk_action action, void *argument);
/**
@class Security_context
@@ -3800,6 +3801,8 @@ public:
}
LF_PINS *tdc_hash_pins;
+ LF_PINS *xid_hash_pins;
+ bool fix_xid_hash_pins();
inline ulong wsrep_binlog_format() const
{