trx0trx.c, trx0trx.h:

  If MySQL wrote to its binlog, but for some reason trx->update_undo and trx->insert_undo were NULL in InnoDB, then trx->commit_lsn was garbage, and InnoDB could assert in the log flush of trx_commit_complete_for_mysql() (Bug #9277)
parent cf5f4362
...@@ -346,6 +346,12 @@ struct trx_struct{ ...@@ -346,6 +346,12 @@ struct trx_struct{
in MySQL's binlog write, we will in MySQL's binlog write, we will
flush the log to disk later in flush the log to disk later in
a separate call */ a separate call */
ibool must_flush_log_later;/* this flag is set to TRUE in
trx_commit_off_kernel() if
flush_log_later was TRUE, and there
were modifications by the transaction;
in that case we must flush the log
in trx_commit_complete_for_mysql() */
dulint commit_lsn; /* lsn at the time of the commit */ dulint commit_lsn; /* lsn at the time of the commit */
ibool dict_operation; /* TRUE if the trx is used to create ibool dict_operation; /* TRUE if the trx is used to create
a table, create an index, or drop a a table, create an index, or drop a
......
...@@ -96,6 +96,7 @@ trx_create( ...@@ -96,6 +96,7 @@ trx_create(
trx->check_unique_secondary = TRUE; trx->check_unique_secondary = TRUE;
trx->flush_log_later = FALSE; trx->flush_log_later = FALSE;
trx->must_flush_log_later = FALSE;
trx->dict_operation = FALSE; trx->dict_operation = FALSE;
...@@ -635,6 +636,8 @@ trx_commit_off_kernel( ...@@ -635,6 +636,8 @@ trx_commit_off_kernel(
rseg = trx->rseg; rseg = trx->rseg;
trx->must_flush_log_later = FALSE;
if (trx->insert_undo != NULL || trx->update_undo != NULL) { if (trx->insert_undo != NULL || trx->update_undo != NULL) {
mutex_exit(&kernel_mutex); mutex_exit(&kernel_mutex);
...@@ -798,6 +801,7 @@ trx_commit_off_kernel( ...@@ -798,6 +801,7 @@ trx_commit_off_kernel(
if (trx->flush_log_later) { if (trx->flush_log_later) {
/* Do nothing yet */ /* Do nothing yet */
trx->must_flush_log_later = TRUE;
} else if (srv_flush_log_at_trx_commit == 0) { } else if (srv_flush_log_at_trx_commit == 0) {
/* Do nothing */ /* Do nothing */
} else if (srv_flush_log_at_trx_commit == 1) { } else if (srv_flush_log_at_trx_commit == 1) {
...@@ -1516,7 +1520,9 @@ trx_commit_complete_for_mysql( ...@@ -1516,7 +1520,9 @@ trx_commit_complete_for_mysql(
trx->op_info = (char*)"flushing log"; trx->op_info = (char*)"flushing log";
if (srv_flush_log_at_trx_commit == 0) { if (!trx->must_flush_log_later) {
/* Do nothing */
} if (srv_flush_log_at_trx_commit == 0) {
/* Do nothing */ /* Do nothing */
} else if (srv_flush_log_at_trx_commit == 1) { } else if (srv_flush_log_at_trx_commit == 1) {
if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) { if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) {
...@@ -1538,6 +1544,8 @@ trx_commit_complete_for_mysql( ...@@ -1538,6 +1544,8 @@ trx_commit_complete_for_mysql(
ut_error; ut_error;
} }
trx->must_flush_log_later = FALSE;
trx->op_info = (char*)""; trx->op_info = (char*)"";
return(0); return(0);
......
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