Comment 2 for bug 1425480

Yura Sorokin (yura-sorokin) wrote :

Although I did not manage to reproduce this on 5.6 (commit f3f9359). The potential problem seems to be with the following method in "binlog.cc".

void MYSQL_BIN_LOG::xlock(void)
{
  DBUG_ASSERT(!snapshot_lock_acquired);

  mysql_mutex_lock(&LOCK_log);

  if (opt_binlog_order_commits)
  {
    mysql_mutex_lock(&LOCK_commit);
  }
  else
  {
    snapshot_lock_acquired= true;
    mysql_rwlock_wrlock(&LOCK_consistent_snapshot);
  }
}

One thread may successfully call "xlock()" and set "snapshot_lock_acquired" to "true" whereas another one may call the same "xlock()" method and end up in "DBUG_ASSERT(!snapshot_lock_acquired);" assertion.

The fix would be in putting "DBUG_ASSERT(!snapshot_lock_acquired);" after "mysql_mutex_lock(&LOCK_log);"