diff options
Diffstat (limited to 'sql/log.cc')
-rw-r--r-- | sql/log.cc | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/sql/log.cc b/sql/log.cc index 74dc75702ae..d0ba1ec90c3 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1495,12 +1495,19 @@ static int binlog_commit(handlerton *hton, THD *thd, bool all) YESNO(in_transaction), YESNO(thd->transaction.all.modified_non_trans_table), YESNO(thd->transaction.stmt.modified_non_trans_table))); - if (!in_transaction || all) + if (thd->options & OPTION_BIN_LOG) { - Query_log_event qev(thd, STRING_WITH_LEN("COMMIT"), TRUE, FALSE); - qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE) - error= binlog_end_trans(thd, trx_data, &qev, all); - goto end; + if (!in_transaction || all) + { + Query_log_event qev(thd, STRING_WITH_LEN("COMMIT"), TRUE, FALSE); + qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE) + error= binlog_end_trans(thd, trx_data, &qev, all); + goto end; + } + } + else + { + trx_data->reset(); } end: @@ -2351,7 +2358,12 @@ void MYSQL_BIN_LOG::init_pthread_objects() DBUG_ASSERT(inited == 0); inited= 1; (void) pthread_mutex_init(&LOCK_log, MY_MUTEX_INIT_SLOW); - (void) pthread_mutex_init(&LOCK_index, MY_MUTEX_INIT_SLOW); + /* + LOCK_index and LOCK_log are taken in wrong order + Can be seen with 'mysql-test-run ndb.ndb_binlog_basic' + */ + (void) my_pthread_mutex_init(&LOCK_index, MY_MUTEX_INIT_SLOW, "LOCK_index", + MYF_NO_DEADLOCK_DETECTION); (void) pthread_cond_init(&update_cond, 0); } @@ -4405,7 +4417,7 @@ bool MYSQL_BIN_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event) goto err; if (flush_and_sync()) goto err; - DBUG_EXECUTE_IF("half_binlogged_transaction", abort();); + DBUG_EXECUTE_IF("half_binlogged_transaction", DBUG_ABORT();); if (cache->error) // Error on read { sql_print_error(ER(ER_ERROR_ON_READ), cache->file_name, errno); @@ -4774,10 +4786,12 @@ static void print_buffer_to_file(enum loglevel level, const char *buffer) int vprint_msg_to_log(enum loglevel level, const char *format, va_list args) { char buff[1024]; - size_t length; DBUG_ENTER("vprint_msg_to_log"); - length= my_vsnprintf(buff, sizeof(buff), format, args); +#ifdef __NT__ + size_t length= +#endif + my_vsnprintf(buff, sizeof(buff), format, args); print_buffer_to_file(level, buff); #ifdef __NT__ |