summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/suite/innodb/r/group_commit_binlog_pos.result2
-rw-r--r--mysql-test/suite/innodb/r/group_commit_binlog_pos_no_optimize_thread.result2
-rw-r--r--mysql-test/suite/innodb/t/group_commit_binlog_pos.test4
-rw-r--r--mysql-test/suite/innodb/t/group_commit_binlog_pos_no_optimize_thread.test4
-rw-r--r--storage/innobase/include/trx0sys.h14
-rw-r--r--storage/innobase/trx/trx0sys.cc94
-rw-r--r--storage/innobase/trx/trx0trx.cc1
7 files changed, 43 insertions, 78 deletions
diff --git a/mysql-test/suite/innodb/r/group_commit_binlog_pos.result b/mysql-test/suite/innodb/r/group_commit_binlog_pos.result
index 616790c8b37..4de7cc8e43a 100644
--- a/mysql-test/suite/innodb/r/group_commit_binlog_pos.result
+++ b/mysql-test/suite/innodb/r/group_commit_binlog_pos.result
@@ -43,6 +43,6 @@ a
1
2
3
-InnoDB: Last MySQL binlog file position 0 <pos>, file name ./master-bin.000001
+InnoDB: Last binlog file './master-bin.000001', position <pos>
SET DEBUG_SYNC= 'RESET';
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/group_commit_binlog_pos_no_optimize_thread.result b/mysql-test/suite/innodb/r/group_commit_binlog_pos_no_optimize_thread.result
index f338761aea8..faf57de1750 100644
--- a/mysql-test/suite/innodb/r/group_commit_binlog_pos_no_optimize_thread.result
+++ b/mysql-test/suite/innodb/r/group_commit_binlog_pos_no_optimize_thread.result
@@ -44,6 +44,6 @@ a
1
2
3
-InnoDB: Last MySQL binlog file position 0 <pos>, file name ./master-bin.000001
+InnoDB: Last binlog file './master-bin.000001', position <pos>
SET DEBUG_SYNC= 'RESET';
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/group_commit_binlog_pos.test b/mysql-test/suite/innodb/t/group_commit_binlog_pos.test
index 7148733dc43..801895e825d 100644
--- a/mysql-test/suite/innodb/t/group_commit_binlog_pos.test
+++ b/mysql-test/suite/innodb/t/group_commit_binlog_pos.test
@@ -9,7 +9,7 @@
# Don't test this under valgrind, memory leaks will occur as we crash
--source include/not_valgrind.inc
-# The test case currently uses grep and tail, which may be unavailable on
+# The test case currently uses sed and tail, which may be unavailable on
# some windows systems. But see MWL#191 for how to remove the need for grep.
--source include/not_windows.inc
@@ -99,7 +99,7 @@ SELECT * FROM t1 ORDER BY a;
let $MYSQLD_DATADIR= `SELECT @@datadir`;
let pos=`select $binlog_start_pos + 730`;
--replace_result $pos <pos>
---exec grep 'InnoDB: Last MySQL binlog file position' $MYSQLD_DATADIR/../../log/mysqld.1.err | tail -1
+--exec sed -ne 's/.*\(InnoDB: Last binlog file .* position.*\)/\1/p' $MYSQLD_DATADIR/../../log/mysqld.1.err | tail -1
SET DEBUG_SYNC= 'RESET';
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/group_commit_binlog_pos_no_optimize_thread.test b/mysql-test/suite/innodb/t/group_commit_binlog_pos_no_optimize_thread.test
index a2dab551cec..116bc54441e 100644
--- a/mysql-test/suite/innodb/t/group_commit_binlog_pos_no_optimize_thread.test
+++ b/mysql-test/suite/innodb/t/group_commit_binlog_pos_no_optimize_thread.test
@@ -9,7 +9,7 @@
# Don't test this under valgrind, memory leaks will occur as we crash
--source include/not_valgrind.inc
-# The test case currently uses grep and tail, which may be unavailable on
+# The test case currently uses sed and tail, which may be unavailable on
# some windows systems. But see MWL#191 for how to remove the need for grep.
--source include/not_windows.inc
@@ -100,6 +100,6 @@ SELECT * FROM t1 ORDER BY a;
let $MYSQLD_DATADIR= `SELECT @@datadir`;
let pos=`select $binlog_start_pos + 730`;
--replace_result $pos <pos>
---exec grep 'InnoDB: Last MySQL binlog file position' $MYSQLD_DATADIR/../../log/mysqld.1.err | tail -1
+--exec sed -ne 's/.*\(InnoDB: Last binlog file .* position.*\)/\1/p' $MYSQLD_DATADIR/../../log/mysqld.1.err | tail -1
SET DEBUG_SYNC= 'RESET';
DROP TABLE t1;
diff --git a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h
index 48eca018a86..e2b4e4d30fd 100644
--- a/storage/innobase/include/trx0sys.h
+++ b/storage/innobase/include/trx0sys.h
@@ -236,16 +236,12 @@ trx_sys_update_mysql_binlog_offset(
/*===============================*/
const char* file_name,/*!< in: MySQL log file name */
int64_t offset, /*!< in: position in that log file */
- ulint field, /*!< in: offset of the MySQL log info field in
- the trx sys header */
trx_sysf_t* sys_header, /*!< in: trx sys header */
mtr_t* mtr); /*!< in: mtr */
-/*****************************************************************//**
-Prints to stderr the MySQL binlog offset info in the trx system header if
-the magic number shows it valid. */
+/** Display the MySQL binlog offset info if it is present in the trx
+system header. */
void
-trx_sys_print_mysql_binlog_offset(void);
-/*===================================*/
+trx_sys_print_mysql_binlog_offset();
#ifdef WITH_WSREP
/** Update WSREP checkpoint XID in sys header. */
void
@@ -420,9 +416,7 @@ impose the 7 bit restriction. e.g., mach_write_to_3() */
TRX_SYS_MYSQL_LOG_MAGIC_N
if we have valid data in the
MySQL binlog info */
-#define TRX_SYS_MYSQL_LOG_OFFSET_HIGH 4 /*!< high 4 bytes of the offset
- within that file */
-#define TRX_SYS_MYSQL_LOG_OFFSET_LOW 8 /*!< low 4 bytes of the offset
+#define TRX_SYS_MYSQL_LOG_OFFSET 4 /*!< the 64-bit offset
within that file */
#define TRX_SYS_MYSQL_LOG_NAME 12 /*!< MySQL log file name */
diff --git a/storage/innobase/trx/trx0sys.cc b/storage/innobase/trx/trx0sys.cc
index ec144db5feb..c35faede4b9 100644
--- a/storage/innobase/trx/trx0sys.cc
+++ b/storage/innobase/trx/trx0sys.cc
@@ -176,95 +176,67 @@ trx_sys_update_mysql_binlog_offset(
/*===============================*/
const char* file_name,/*!< in: MySQL log file name */
int64_t offset, /*!< in: position in that log file */
- ulint field, /*!< in: offset of the MySQL log info field in
- the trx sys header */
trx_sysf_t* sys_header, /*!< in: trx sys header */
mtr_t* mtr) /*!< in: mtr */
{
DBUG_PRINT("InnoDB",("trx_mysql_binlog_offset: %lld", (longlong) offset));
- if (ut_strlen(file_name) >= TRX_SYS_MYSQL_LOG_NAME_LEN) {
+ const size_t len = strlen(file_name) + 1;
+
+ if (len > TRX_SYS_MYSQL_LOG_NAME_LEN) {
/* We cannot fit the name to the 512 bytes we have reserved */
return;
}
- if (mach_read_from_4(sys_header + field
- + TRX_SYS_MYSQL_LOG_MAGIC_N_FLD)
+ if (mach_read_from_4(TRX_SYS_MYSQL_LOG_MAGIC_N_FLD
+ + TRX_SYS_MYSQL_LOG_INFO + sys_header)
!= TRX_SYS_MYSQL_LOG_MAGIC_N) {
- mlog_write_ulint(sys_header + field
- + TRX_SYS_MYSQL_LOG_MAGIC_N_FLD,
+ mlog_write_ulint(TRX_SYS_MYSQL_LOG_MAGIC_N_FLD
+ + TRX_SYS_MYSQL_LOG_INFO + sys_header,
TRX_SYS_MYSQL_LOG_MAGIC_N,
MLOG_4BYTES, mtr);
}
- if (0 != strcmp((char*) (sys_header + field + TRX_SYS_MYSQL_LOG_NAME),
- file_name)) {
-
- mlog_write_string(sys_header + field
- + TRX_SYS_MYSQL_LOG_NAME,
- (byte*) file_name, 1 + ut_strlen(file_name),
- mtr);
- }
-
- if (mach_read_from_4(sys_header + field
- + TRX_SYS_MYSQL_LOG_OFFSET_HIGH) > 0
- || (offset >> 32) > 0) {
-
- mlog_write_ulint(sys_header + field
- + TRX_SYS_MYSQL_LOG_OFFSET_HIGH,
- (ulint)(offset >> 32),
- MLOG_4BYTES, mtr);
+ if (memcmp(file_name, TRX_SYS_MYSQL_LOG_NAME + TRX_SYS_MYSQL_LOG_INFO
+ + sys_header, len)) {
+ mlog_write_string(TRX_SYS_MYSQL_LOG_NAME
+ + TRX_SYS_MYSQL_LOG_INFO
+ + sys_header,
+ reinterpret_cast<const byte*>(file_name),
+ len, mtr);
}
- mlog_write_ulint(sys_header + field
- + TRX_SYS_MYSQL_LOG_OFFSET_LOW,
- (ulint)(offset & 0xFFFFFFFFUL),
- MLOG_4BYTES, mtr);
+ mlog_write_ull(TRX_SYS_MYSQL_LOG_INFO + TRX_SYS_MYSQL_LOG_OFFSET
+ + sys_header, offset, mtr);
}
-/*****************************************************************//**
-Stores the MySQL binlog offset info in the trx system header if
-the magic number shows it valid, and print the info to stderr */
+/** Display the MySQL binlog offset info if it is present in the trx
+system header. */
void
-trx_sys_print_mysql_binlog_offset(void)
-/*===================================*/
+trx_sys_print_mysql_binlog_offset()
{
- trx_sysf_t* sys_header;
mtr_t mtr;
- ulint trx_sys_mysql_bin_log_pos_high;
- ulint trx_sys_mysql_bin_log_pos_low;
- mtr_start(&mtr);
-
- sys_header = trx_sysf_get(&mtr);
-
- if (mach_read_from_4(sys_header + TRX_SYS_MYSQL_LOG_INFO
- + TRX_SYS_MYSQL_LOG_MAGIC_N_FLD)
- != TRX_SYS_MYSQL_LOG_MAGIC_N) {
-
- mtr_commit(&mtr);
+ mtr.start();
- return;
+ const trx_sysf_t* sys_header = trx_sysf_get(&mtr);
+
+ if (mach_read_from_4(TRX_SYS_MYSQL_LOG_INFO
+ + TRX_SYS_MYSQL_LOG_MAGIC_N_FLD + sys_header)
+ == TRX_SYS_MYSQL_LOG_MAGIC_N) {
+ ib::info() << "Last binlog file '"
+ << TRX_SYS_MYSQL_LOG_INFO + TRX_SYS_MYSQL_LOG_NAME
+ + sys_header
+ << "', position "
+ << mach_read_from_8(TRX_SYS_MYSQL_LOG_INFO
+ + TRX_SYS_MYSQL_LOG_OFFSET
+ + sys_header);
}
- trx_sys_mysql_bin_log_pos_high = mach_read_from_4(
- sys_header + TRX_SYS_MYSQL_LOG_INFO
- + TRX_SYS_MYSQL_LOG_OFFSET_HIGH);
- trx_sys_mysql_bin_log_pos_low = mach_read_from_4(
- sys_header + TRX_SYS_MYSQL_LOG_INFO
- + TRX_SYS_MYSQL_LOG_OFFSET_LOW);
-
- fprintf(stderr,
- "InnoDB: Last MySQL binlog file position " ULINTPF " " ULINTPF
- ", file name %s\n",
- trx_sys_mysql_bin_log_pos_high, trx_sys_mysql_bin_log_pos_low,
- sys_header + TRX_SYS_MYSQL_LOG_INFO
- + TRX_SYS_MYSQL_LOG_NAME);
-
- mtr_commit(&mtr);
+ mtr.commit();
}
#ifdef WITH_WSREP
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index b84bc6b961a..d397a2d2880 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -1496,7 +1496,6 @@ trx_write_serialisation_history(
trx_sys_update_mysql_binlog_offset(
trx->mysql_log_file_name,
trx->mysql_log_offset,
- TRX_SYS_MYSQL_LOG_INFO,
sys_header,
mtr);