MDEV-4113: Assertion (group->connection_count > 0) fails with Percona server in replication test.

Assertion happens in replication thread during THD destruction, when thread calls my_sync(), which in turn calls  thd_wait_begin() callback. Connection count can be 0, because the counter was decremented before THD destructor. 
This assertion currently reproducible only in Percona server  and not in MariaDB, due to differences in replication code.

Fixed by moving  code to decrement connection counter after the THD destructor.
This commit is contained in:
Vladislav Vaintroub 2013-01-30 17:25:02 +01:00
parent 52fbe44fbb
commit 1701ee3357

View file

@ -1247,11 +1247,12 @@ static void connection_abort(connection_t *connection)
DBUG_ENTER("connection_abort"); DBUG_ENTER("connection_abort");
thread_group_t *group= connection->thread_group; thread_group_t *group= connection->thread_group;
threadpool_remove_connection(connection->thd);
mysql_mutex_lock(&group->mutex); mysql_mutex_lock(&group->mutex);
group->connection_count--; group->connection_count--;
mysql_mutex_unlock(&group->mutex); mysql_mutex_unlock(&group->mutex);
threadpool_remove_connection(connection->thd);
my_free(connection); my_free(connection);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }