Commit e8094c43 authored by heikki's avatar heikki

Merge r1067 from branches/5.0:

trx_rollback_for_mysql(), trx_commit_for_mysql():
Protect the creation of trx_dummy_sess with kernel_mutex.
This error was introduced in r1046 and r1050.
parent fedfe09e
...@@ -1624,11 +1624,6 @@ innobase_start_or_create_for_mysql(void) ...@@ -1624,11 +1624,6 @@ innobase_start_or_create_for_mysql(void)
return((int)DB_ERROR); return((int)DB_ERROR);
} }
/* Create the master thread which does purge and other utility
operations */
os_thread_create(&srv_master_thread, NULL, thread_ids
+ (1 + SRV_MAX_N_IO_THREADS));
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
/* buf_debug_prints = TRUE; */ /* buf_debug_prints = TRUE; */
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
...@@ -1736,6 +1731,29 @@ innobase_start_or_create_for_mysql(void) ...@@ -1736,6 +1731,29 @@ innobase_start_or_create_for_mysql(void)
fflush(stderr); fflush(stderr);
/* Advance the lsn and make a checkpoint so that if mysqld crashes
very quickly after the startup, InnoDB in the next startup notices
the mismatch in the lsn in the checkpoint and in ibdata1, and knows
that a crash recovery is needed. */
mutex_enter(&kernel_mutex);
/* This call advances the lsn because it writes the new trx id to
the trx sys header in ibdata1 */
trx_sys_get_new_trx_id();
mutex_exit(&kernel_mutex);
printf("DOING CHECKPOINT\n");
log_checkpoint(TRUE, FALSE);
/* Create the master thread which does purge and other utility
operations */
os_thread_create(&srv_master_thread, NULL, thread_ids
+ (1 + SRV_MAX_N_IO_THREADS));
if (trx_doublewrite_must_reset_space_ids) { if (trx_doublewrite_must_reset_space_ids) {
/* Actually, we did not change the undo log format between /* Actually, we did not change the undo log format between
4.0 and 4.1.1, and we would not need to run purge to 4.0 and 4.1.1, and we would not need to run purge to
......
...@@ -135,6 +135,8 @@ trx_rollback_for_mysql( ...@@ -135,6 +135,8 @@ trx_rollback_for_mysql(
the transaction object does not have an InnoDB session object, and we the transaction object does not have an InnoDB session object, and we
set a dummy session that we use for all MySQL transactions. */ set a dummy session that we use for all MySQL transactions. */
mutex_enter(&kernel_mutex);
if (trx->sess == NULL) { if (trx->sess == NULL) {
/* Open a dummy session */ /* Open a dummy session */
...@@ -145,6 +147,8 @@ trx_rollback_for_mysql( ...@@ -145,6 +147,8 @@ trx_rollback_for_mysql(
trx->sess = trx_dummy_sess; trx->sess = trx_dummy_sess;
} }
mutex_exit(&kernel_mutex);
err = trx_general_rollback_for_mysql(trx, FALSE, NULL); err = trx_general_rollback_for_mysql(trx, FALSE, NULL);
trx->op_info = ""; trx->op_info = "";
......
...@@ -1602,6 +1602,8 @@ trx_commit_for_mysql( ...@@ -1602,6 +1602,8 @@ trx_commit_for_mysql(
the transaction object does not have an InnoDB session object, and we the transaction object does not have an InnoDB session object, and we
set the dummy session that we use for all MySQL transactions. */ set the dummy session that we use for all MySQL transactions. */
mutex_enter(&kernel_mutex);
if (trx->sess == NULL) { if (trx->sess == NULL) {
/* Open a dummy session */ /* Open a dummy session */
...@@ -1612,6 +1614,8 @@ trx_commit_for_mysql( ...@@ -1612,6 +1614,8 @@ trx_commit_for_mysql(
trx->sess = trx_dummy_sess; trx->sess = trx_dummy_sess;
} }
mutex_exit(&kernel_mutex);
trx_start_if_not_started(trx); trx_start_if_not_started(trx);
mutex_enter(&kernel_mutex); mutex_enter(&kernel_mutex);
......
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