Commit 45131a5b authored by unknown's avatar unknown

MWL#116: Efficient group commit: Fix assertion by moving init/deinit out of...

MWL#116: Efficient group commit: Fix assertion by moving init/deinit out of constructor in global static object.
parent dcb111ff
...@@ -5927,12 +5927,22 @@ int TC_LOG_unordered::log_and_order(THD *thd, my_xid xid, bool all, ...@@ -5927,12 +5927,22 @@ int TC_LOG_unordered::log_and_order(THD *thd, my_xid xid, bool all,
TC_LOG_group_commit::TC_LOG_group_commit() TC_LOG_group_commit::TC_LOG_group_commit()
: num_commits(0), num_group_commits(0) : num_commits(0), num_group_commits(0)
{
}
TC_LOG_group_commit::~TC_LOG_group_commit()
{
}
void
TC_LOG_group_commit::init()
{ {
my_pthread_mutex_init(&LOCK_group_commit, MY_MUTEX_INIT_SLOW, my_pthread_mutex_init(&LOCK_group_commit, MY_MUTEX_INIT_SLOW,
"LOCK_group_commit", MYF(0)); "LOCK_group_commit", MYF(0));
} }
TC_LOG_group_commit::~TC_LOG_group_commit() void
TC_LOG_group_commit::deinit()
{ {
pthread_mutex_destroy(&LOCK_group_commit); pthread_mutex_destroy(&LOCK_group_commit);
} }
...@@ -6591,6 +6601,7 @@ int TC_LOG_BINLOG::open(const char *opt_name) ...@@ -6591,6 +6601,7 @@ int TC_LOG_BINLOG::open(const char *opt_name)
DBUG_ASSERT(total_ha_2pc > 1); DBUG_ASSERT(total_ha_2pc > 1);
DBUG_ASSERT(opt_name && opt_name[0]); DBUG_ASSERT(opt_name && opt_name[0]);
TC_LOG_group_commit::init();
pthread_mutex_init(&LOCK_prep_xids, MY_MUTEX_INIT_FAST); pthread_mutex_init(&LOCK_prep_xids, MY_MUTEX_INIT_FAST);
pthread_cond_init (&COND_prep_xids, 0); pthread_cond_init (&COND_prep_xids, 0);
...@@ -6674,6 +6685,7 @@ void TC_LOG_BINLOG::close() ...@@ -6674,6 +6685,7 @@ void TC_LOG_BINLOG::close()
DBUG_ASSERT(prepared_xids==0); DBUG_ASSERT(prepared_xids==0);
pthread_mutex_destroy(&LOCK_prep_xids); pthread_mutex_destroy(&LOCK_prep_xids);
pthread_cond_destroy (&COND_prep_xids); pthread_cond_destroy (&COND_prep_xids);
TC_LOG_group_commit::deinit();
} }
/* /*
......
...@@ -150,6 +150,8 @@ class TC_LOG_group_commit: public TC_LOG_queued ...@@ -150,6 +150,8 @@ class TC_LOG_group_commit: public TC_LOG_queued
public: public:
TC_LOG_group_commit(); TC_LOG_group_commit();
~TC_LOG_group_commit(); ~TC_LOG_group_commit();
void init();
void deinit();
int log_and_order(THD *thd, my_xid xid, bool all, int log_and_order(THD *thd, my_xid xid, bool all,
bool need_prepare_ordered, bool need_commit_ordered); bool need_prepare_ordered, bool need_commit_ordered);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment