summaryrefslogtreecommitdiff
path: root/innobase/trx
diff options
context:
space:
mode:
Diffstat (limited to 'innobase/trx')
-rw-r--r--innobase/trx/Makefile.am2
-rw-r--r--innobase/trx/trx0sys.c13
-rw-r--r--innobase/trx/trx0trx.c52
3 files changed, 58 insertions, 9 deletions
diff --git a/innobase/trx/Makefile.am b/innobase/trx/Makefile.am
index 63b2c52da33..9e2b3c398e3 100644
--- a/innobase/trx/Makefile.am
+++ b/innobase/trx/Makefile.am
@@ -17,7 +17,7 @@
include ../include/Makefile.i
-libs_LIBRARIES = libtrx.a
+noinst_LIBRARIES = libtrx.a
libtrx_a_SOURCES = trx0purge.c trx0rec.c trx0roll.c trx0rseg.c\
trx0sys.c trx0trx.c trx0undo.c
diff --git a/innobase/trx/trx0sys.c b/innobase/trx/trx0sys.c
index 1ae9f00ae1f..b9e4a9fea4b 100644
--- a/innobase/trx/trx0sys.c
+++ b/innobase/trx/trx0sys.c
@@ -340,7 +340,6 @@ trx_sys_doublewrite_restore_corrupt_pages(void)
/* It is an unwritten doublewrite buffer page:
do nothing */
-
} else {
/* Read in the actual page from the data files */
@@ -357,9 +356,19 @@ trx_sys_doublewrite_restore_corrupt_pages(void)
"InnoDB: Trying to recover it from the doublewrite buffer.\n");
if (buf_page_is_corrupted(page)) {
+ fprintf(stderr,
+ "InnoDB: Dump of the page:\n");
+ buf_page_print(read_buf);
+ fprintf(stderr,
+ "InnoDB: Dump of corresponding page in doublewrite buffer:\n");
+ buf_page_print(page);
+
fprintf(stderr,
"InnoDB: Also the page in the doublewrite buffer is corrupt.\n"
- "InnoDB: Cannot continue operation.\n");
+ "InnoDB: Cannot continue operation.\n"
+ "InnoDB: You can try to recover the database with the my.cnf\n"
+ "InnoDB: option:\n"
+ "InnoDB: set-variable=innodb_force_recovery=6\n");
exit(1);
}
diff --git a/innobase/trx/trx0trx.c b/innobase/trx/trx0trx.c
index 5ac49397c90..5753b5b338e 100644
--- a/innobase/trx/trx0trx.c
+++ b/innobase/trx/trx0trx.c
@@ -89,6 +89,8 @@ trx_create(
trx->check_foreigns = TRUE;
trx->check_unique_secondary = TRUE;
+ trx->flush_log_later = FALSE;
+
trx->dict_operation = FALSE;
trx->mysql_thd = NULL;
@@ -102,8 +104,6 @@ trx_create(
trx->mysql_master_log_file_name = "";
trx->mysql_master_log_pos = 0;
- trx->ignore_duplicates_in_insert = FALSE;
-
mutex_create(&(trx->undo_mutex));
mutex_set_level(&(trx->undo_mutex), SYNC_TRX_UNDO);
@@ -782,13 +782,26 @@ trx_commit_off_kernel(
/*-------------------------------------*/
- /* Most MySQL users run with srv_flush_.. set to FALSE: */
+ /* Most MySQL users run with srv_flush_.. set to 0: */
- if (srv_flush_log_at_trx_commit) {
-
- log_flush_up_to(lsn, LOG_WAIT_ONE_GROUP);
+ if (srv_flush_log_at_trx_commit != 0) {
+ if (srv_unix_file_flush_method != SRV_UNIX_NOSYNC
+ && srv_flush_log_at_trx_commit != 2
+ && !trx->flush_log_later) {
+
+ /* Write the log to the log files AND flush
+ them to disk */
+
+ log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE);
+ } else {
+ /* Write the log but do not flush it to disk */
+
+ log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, FALSE);
+ }
}
+ trx->commit_lsn = lsn;
+
/*-------------------------------------*/
mutex_enter(&kernel_mutex);
@@ -1470,6 +1483,33 @@ trx_commit_for_mysql(
}
/**************************************************************************
+If required, flushes the log to disk if we called trx_commit_for_mysql()
+with trx->flush_log_later == TRUE. */
+
+ulint
+trx_commit_complete_for_mysql(
+/*==========================*/
+ /* out: 0 or error number */
+ trx_t* trx) /* in: trx handle */
+{
+ ut_a(trx);
+
+ if (srv_flush_log_at_trx_commit == 1
+ && srv_unix_file_flush_method != SRV_UNIX_NOSYNC) {
+
+ trx->op_info = (char *) "flushing log";
+
+ /* Flush the log files to disk */
+
+ log_write_up_to(trx->commit_lsn, LOG_WAIT_ONE_GROUP, TRUE);
+
+ trx->op_info = (char *) "";
+ }
+
+ return(0);
+}
+
+/**************************************************************************
Marks the latest SQL statement ended. */
void