#!!! notice !!!
# Any small change to this file in the main branch
# should be done or reviewed by the maintainer!
-diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
---- a/storage/innobase/handler/ha_innodb.cc 2010-12-03 15:37:45.516105468 +0900
-+++ b/storage/innobase/handler/ha_innodb.cc 2010-12-03 15:38:20.318952987 +0900
+--- a/storage/innobase/handler/ha_innodb.cc
++++ b/storage/innobase/handler/ha_innodb.cc
@@ -42,6 +42,8 @@
#pragma implementation // gcc: Class implementation
#endif
#include <sql_table.h> // explain_filename, nz2, EXPLAIN_PARTITIONS_AS_COMMENT,
// EXPLAIN_FILENAME_MAX_EXTRA_LENGTH
-@@ -52,6 +54,15 @@
- #include <mysql/innodb_priv.h>
+@@ -53,6 +55,15 @@
#include <mysql/psi/psi.h>
+ #include <my_sys.h>
+#ifdef MYSQL_SERVER
+#include <rpl_mi.h>
static my_bool innobase_rollback_on_timeout = FALSE;
static my_bool innobase_create_status_file = FALSE;
static my_bool innobase_stats_on_metadata = TRUE;
-@@ -2201,6 +2221,89 @@
+@@ -2282,6 +2302,89 @@
}
- #endif /* UNIV_DEBUG */
+ #endif /* DBUG_OFF */
+#ifndef MYSQL_SERVER
+ innodb_overwrite_relay_log_info = FALSE;
+
+ fprintf(stderr,
+ "InnoDB: Warning: innodb_overwrite_relay_log_info is enabled."
-+ " Updates in other storage engines may have problem with consistency.\n");
++ " Updates by other storage engines may not be synchronized.\n");
+
+ bzero((char*) &info_file, sizeof(info_file));
+ fn_format(fname, relay_log_info_file, mysql_data_home, "", 4+32);
/* Check that values don't overflow on 32-bit systems. */
if (sizeof(ulint) == 4) {
if (innobase_buffer_pool_size > UINT_MAX32) {
-@@ -2499,6 +2602,76 @@
+@@ -2580,6 +2683,76 @@
goto mem_free_and_error;
}
+ /* If InnoDB progressed from relay-log.info, overwrite it */
+ if (fname[0] == '\0') {
+ fprintf(stderr,
-+ "InnoDB: something wrong with relay-info.log. InnoDB will not overwrite it.\n");
++ "InnoDB: Something is wrong with the file relay-info.log. InnoDB will not overwrite it.\n");
+ } else if (0 != strcmp(fname, trx_sys_mysql_master_log_name)
+ || pos != trx_sys_mysql_master_log_pos) {
+ /* Overwrite relay-log.info */
+skip_overwrite:
+ if (error) {
+ fprintf(stderr,
-+ "InnoDB: ERROR: error occured during overwriting relay-log.info.\n");
++ "InnoDB: ERROR: An error occurred while overwriting relay-log.info.\n");
+ } else {
+ fprintf(stderr,
-+ "InnoDB: relay-log.info was overwritten.\n");
++ "InnoDB: The file relay-log.info was successfully overwritten.\n");
+ }
+ } else {
+ fprintf(stderr,
innobase_old_blocks_pct = buf_LRU_old_ratio_update(
innobase_old_blocks_pct, TRUE);
-@@ -2611,6 +2784,25 @@
+@@ -2693,6 +2866,25 @@
trx_t* trx) /*!< in: transaction handle */
{
if (trx_is_started(trx)) {
trx_commit_for_mysql(trx);
}
-@@ -10919,6 +11111,12 @@
+@@ -11130,6 +11322,12 @@
"The common part for InnoDB table spaces.",
NULL, NULL, NULL);
-+static MYSQL_SYSVAR_BOOL(overwrite_relay_log_info, innobase_overwrite_relay_log_info,
++static MYSQL_SYSVAR_BOOL(recovery_update_relay_log, innobase_overwrite_relay_log_info,
+ PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
+ "During InnoDB crash recovery on slave overwrite relay-log.info "
+ "to align master log file position if information in InnoDB and relay-log.info is different.",
static MYSQL_SYSVAR_BOOL(doublewrite, innobase_use_doublewrite,
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
"Enable InnoDB doublewrite buffer (enabled by default). "
-@@ -11375,6 +11573,7 @@
+@@ -11647,6 +11845,7 @@
MYSQL_SYSVAR(old_blocks_pct),
MYSQL_SYSVAR(old_blocks_time),
MYSQL_SYSVAR(open_files),
-+ MYSQL_SYSVAR(overwrite_relay_log_info),
++ MYSQL_SYSVAR(recovery_update_relay_log),
MYSQL_SYSVAR(rollback_on_timeout),
MYSQL_SYSVAR(stats_on_metadata),
MYSQL_SYSVAR(stats_sample_pages),
-diff -ruN a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h
---- a/storage/innobase/include/trx0sys.h 2010-11-03 07:01:13.000000000 +0900
-+++ b/storage/innobase/include/trx0sys.h 2010-12-03 15:38:20.321953297 +0900
-@@ -52,6 +52,9 @@
+--- a/storage/innobase/include/trx0sys.h
++++ b/storage/innobase/include/trx0sys.h
+@@ -53,6 +53,9 @@
extern ib_int64_t trx_sys_mysql_master_log_pos;
/* @} */
/** If this MySQL server uses binary logging, after InnoDB has been inited
and if it has done a crash recovery, we store the binlog file name and position
here. */
-@@ -293,7 +296,8 @@
+@@ -298,7 +301,8 @@
void
trx_sys_update_mysql_binlog_offset(
/*===============================*/
ib_int64_t offset, /*!< in: position in that log file */
ulint field, /*!< in: offset of the MySQL log info field in
the trx sys header */
-@@ -488,6 +492,7 @@
+@@ -493,6 +497,7 @@
@see trx_sys_mysql_master_log_name
@see trx_sys_mysql_bin_log_name */
#define TRX_SYS_MYSQL_LOG_NAME_LEN 512
/** Contents of TRX_SYS_MYSQL_LOG_MAGIC_N_FLD */
#define TRX_SYS_MYSQL_LOG_MAGIC_N 873422344
-@@ -497,6 +502,7 @@
+@@ -502,6 +507,7 @@
/** The offset of the MySQL replication info in the trx system header;
this contains the same fields as TRX_SYS_MYSQL_LOG_INFO below */
#define TRX_SYS_MYSQL_MASTER_LOG_INFO (UNIV_PAGE_SIZE - 2000)
/** The offset of the MySQL binlog offset info in the trx system header */
#define TRX_SYS_MYSQL_LOG_INFO (UNIV_PAGE_SIZE - 1000)
-diff -ruN a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
---- a/storage/innobase/include/trx0trx.h 2010-12-03 15:18:48.894955550 +0900
-+++ b/storage/innobase/include/trx0trx.h 2010-12-03 15:38:20.323953416 +0900
-@@ -569,6 +569,21 @@
+--- a/storage/innobase/include/trx0trx.h
++++ b/storage/innobase/include/trx0trx.h
+@@ -580,6 +580,20 @@
ib_int64_t mysql_log_offset;/* if MySQL binlog is used, this field
contains the end offset of the binlog
entry */
+ replication has processed */
+ const char* mysql_relay_log_file_name;
+ ib_int64_t mysql_relay_log_pos;
-+
- os_thread_id_t mysql_thread_id;/* id of the MySQL thread associated
- with this transaction object */
- ulint mysql_process_no;/* since in Linux, 'top' reports
-diff -ruN a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c
---- a/storage/innobase/trx/trx0sys.c 2010-11-03 07:01:13.000000000 +0900
-+++ b/storage/innobase/trx/trx0sys.c 2010-12-03 15:38:20.325956917 +0900
-@@ -75,13 +75,16 @@
+ /*------------------------------*/
+ ulint n_mysql_tables_in_use; /* number of Innobase tables
+ used in the processing of the current
+--- a/storage/innobase/trx/trx0sys.c
++++ b/storage/innobase/trx/trx0sys.c
+@@ -76,13 +76,16 @@
file name and position here. */
/* @{ */
/** Master binlog file name */
/** If this MySQL server uses binary logging, after InnoDB has been inited
and if it has done a crash recovery, we store the binlog file name and position
here. */
-@@ -683,23 +686,25 @@
+@@ -684,23 +687,25 @@
void
trx_sys_update_mysql_binlog_offset(
/*===============================*/
if (mach_read_from_4(sys_header + field
+ TRX_SYS_MYSQL_LOG_MAGIC_N_FLD)
!= TRX_SYS_MYSQL_LOG_MAGIC_N) {
-@@ -821,13 +826,26 @@
+@@ -822,13 +827,26 @@
+ TRX_SYS_MYSQL_LOG_OFFSET_LOW),
sys_header + TRX_SYS_MYSQL_MASTER_LOG_INFO
+ TRX_SYS_MYSQL_LOG_NAME);
trx_sys_mysql_master_log_pos
= (((ib_int64_t) mach_read_from_4(
-@@ -836,6 +854,19 @@
+@@ -837,6 +855,19 @@
+ ((ib_int64_t) mach_read_from_4(
sys_header + TRX_SYS_MYSQL_MASTER_LOG_INFO
+ TRX_SYS_MYSQL_LOG_OFFSET_LOW));
mtr_commit(&mtr);
}
-diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
---- a/storage/innobase/trx/trx0trx.c 2010-12-03 15:37:45.549028990 +0900
-+++ b/storage/innobase/trx/trx0trx.c 2010-12-03 15:38:20.328957217 +0900
-@@ -135,6 +135,10 @@
+--- a/storage/innobase/trx/trx0trx.c
++++ b/storage/innobase/trx/trx0trx.c
+@@ -138,6 +138,10 @@
trx->mysql_log_file_name = NULL;
trx->mysql_log_offset = 0;
mutex_create(trx_undo_mutex_key, &trx->undo_mutex, SYNC_TRX_UNDO);
-@@ -732,6 +736,7 @@
- trx_rseg_t* rseg;
- trx_undo_t* undo;
+@@ -820,6 +824,7 @@
+ {
mtr_t mtr;
+ trx_rseg_t* rseg;
+ trx_sysf_t* sys_header = NULL;
- ut_ad(mutex_own(&kernel_mutex));
+ ut_ad(!mutex_own(&kernel_mutex));
-@@ -787,13 +792,35 @@
+@@ -873,8 +878,12 @@
- if (trx->mysql_log_file_name
- && trx->mysql_log_file_name[0] != '\0') {
-+ if (!sys_header) {
-+ sys_header = trx_sysf_get(&mtr);
-+ }
- trx_sys_update_mysql_binlog_offset(
-+ sys_header,
- trx->mysql_log_file_name,
- trx->mysql_log_offset,
- TRX_SYS_MYSQL_LOG_INFO, &mtr);
- trx->mysql_log_file_name = NULL;
- }
+ if (trx->mysql_log_file_name
+ && trx->mysql_log_file_name[0] != '\0') {
++ if (!sys_header) {
++ sys_header = trx_sysf_get(&mtr);
++ }
-+ if (trx->mysql_master_log_file_name[0] != '\0') {
-+ /* This database server is a MySQL replication slave */
-+ if (!sys_header) {
-+ sys_header = trx_sysf_get(&mtr);
-+ }
-+ trx_sys_update_mysql_binlog_offset(
-+ sys_header,
-+ trx->mysql_relay_log_file_name,
-+ trx->mysql_relay_log_pos,
-+ TRX_SYS_MYSQL_RELAY_LOG_INFO, &mtr);
-+ trx_sys_update_mysql_binlog_offset(
-+ sys_header,
-+ trx->mysql_master_log_file_name,
-+ trx->mysql_master_log_pos,
-+ TRX_SYS_MYSQL_MASTER_LOG_INFO, &mtr);
-+ trx->mysql_master_log_file_name = "";
+ trx_sys_update_mysql_binlog_offset(
++ sys_header,
+ trx->mysql_log_file_name,
+ trx->mysql_log_offset,
+ TRX_SYS_MYSQL_LOG_INFO, &mtr);
+@@ -882,6 +891,27 @@
+ trx->mysql_log_file_name = NULL;
+ }
+
++ if (trx->mysql_master_log_file_name[0] != '\0') {
++ /* This database server is a MySQL replication slave */
++ if (!sys_header) {
++ sys_header = trx_sysf_get(&mtr);
+ }
+
- /* The following call commits the mini-transaction, making the
- whole transaction committed in the file-based world, at this
- log sequence number. The transaction becomes 'durable' when
++ trx_sys_update_mysql_binlog_offset(
++ sys_header,
++ trx->mysql_relay_log_file_name,
++ trx->mysql_relay_log_pos,
++ TRX_SYS_MYSQL_RELAY_LOG_INFO, &mtr);
++
++ trx_sys_update_mysql_binlog_offset(
++ sys_header,
++ trx->mysql_master_log_file_name,
++ trx->mysql_master_log_pos,
++ TRX_SYS_MYSQL_MASTER_LOG_INFO, &mtr);
++
++ trx->mysql_master_log_file_name = "";
++ }
++
+ /* The following call commits the mini-transaction, making the
+ whole transaction committed in the file-based world, at this
+ log sequence number. The transaction becomes 'durable' when