Commit 762df2d0 authored by Alexander Barkov's avatar Alexander Barkov

Additional fix for bug#31455 (rpl decoder)

- Implementing --base64-format=decode-rows, to display
  SQL-alike decoded row events without their BINLOG statements.
- Adding --base64-format=decode-rows into tests when
  calling mysqlbinlog to avoid non-deterministic results
- Removing resetting of last_table_id in "RESET MASTER",
  which appeared to be dangerous.
parent 0c5bc2ea
...@@ -64,7 +64,8 @@ static void warning(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2); ...@@ -64,7 +64,8 @@ static void warning(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
static bool one_database=0, to_last_remote_log= 0, disable_log_bin= 0; static bool one_database=0, to_last_remote_log= 0, disable_log_bin= 0;
static bool opt_hexdump= 0; static bool opt_hexdump= 0;
const char *base64_output_mode_names[]= {"NEVER", "AUTO", "ALWAYS", NullS}; const char *base64_output_mode_names[]=
{"NEVER", "AUTO", "ALWAYS", "UNSPEC", "DECODE-ROWS", NullS};
TYPELIB base64_output_mode_typelib= TYPELIB base64_output_mode_typelib=
{ array_elements(base64_output_mode_names) - 1, "", { array_elements(base64_output_mode_names) - 1, "",
base64_output_mode_names, NULL }; base64_output_mode_names, NULL };
......
...@@ -1650,8 +1650,8 @@ FLUSH LOGS; ...@@ -1650,8 +1650,8 @@ FLUSH LOGS;
--echo # --echo #
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/
--exec $MYSQL_BINLOG -v -v $MYSQLTEST_VARDIR/log/master-bin.000001 --exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLTEST_VARDIR/log/master-bin.000001
--echo # --echo #
--echo # Cleanup. --echo # Cleanup.
...@@ -1730,8 +1730,8 @@ FLUSH LOGS; ...@@ -1730,8 +1730,8 @@ FLUSH LOGS;
--echo # --echo #
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/
--exec $MYSQL_BINLOG -v -v $MYSQLTEST_VARDIR/log/master-bin.000001 --exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLTEST_VARDIR/log/master-bin.000001
--echo # --echo #
--echo # Cleanup. --echo # Cleanup.
...@@ -1853,8 +1853,8 @@ FLUSH LOGS; ...@@ -1853,8 +1853,8 @@ FLUSH LOGS;
--echo # --echo #
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/
--exec $MYSQL_BINLOG -v -v $MYSQLTEST_VARDIR/log/master-bin.000001 --exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLTEST_VARDIR/log/master-bin.000001
--echo # --echo #
--echo # Cleanup. --echo # Cleanup.
...@@ -1911,8 +1911,8 @@ FLUSH LOGS; ...@@ -1911,8 +1911,8 @@ FLUSH LOGS;
--echo # --echo #
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/
--exec $MYSQL_BINLOG -v -v $MYSQLTEST_VARDIR/log/master-bin.000001 --exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLTEST_VARDIR/log/master-bin.000001
--echo # --echo #
--echo # Cleanup. --echo # Cleanup.
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -442,5 +442,5 @@ flush logs; ...@@ -442,5 +442,5 @@ flush logs;
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /thread_id=[0-9]*/thread_id=#/ --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/
--exec $MYSQL_BINLOG -v -v $MYSQLTEST_VARDIR/log/master-bin.000001 --exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLTEST_VARDIR/log/master-bin.000001
...@@ -115,7 +115,7 @@ FLUSH LOGS; ...@@ -115,7 +115,7 @@ FLUSH LOGS;
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/
--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/$mysqlbinlog_output --exec $MYSQL_BINLOG -v -v $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/$mysqlbinlog_output
--echo # --echo #
--echo # Cleanup. --echo # Cleanup.
......
...@@ -150,8 +150,8 @@ FLUSH LOGS; ...@@ -150,8 +150,8 @@ FLUSH LOGS;
--echo # --echo #
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/
--exec $MYSQL_BINLOG -v -v $MYSQLTEST_VARDIR/log/master-bin.000001 --exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLTEST_VARDIR/log/master-bin.000001
--echo # --echo #
--echo # Cleanup. --echo # Cleanup.
......
...@@ -1910,6 +1910,8 @@ void Log_event::print_base64(IO_CACHE* file, ...@@ -1910,6 +1910,8 @@ void Log_event::print_base64(IO_CACHE* file,
DBUG_ASSERT(0); DBUG_ASSERT(0);
} }
if (print_event_info->base64_output_mode != BASE64_OUTPUT_DECODE_ROWS)
{
if (my_b_tell(file) == 0) if (my_b_tell(file) == 0)
my_b_printf(file, "\nBINLOG '\n"); my_b_printf(file, "\nBINLOG '\n");
...@@ -1917,6 +1919,7 @@ void Log_event::print_base64(IO_CACHE* file, ...@@ -1917,6 +1919,7 @@ void Log_event::print_base64(IO_CACHE* file,
if (!more) if (!more)
my_b_printf(file, "'%s\n", print_event_info->delimiter); my_b_printf(file, "'%s\n", print_event_info->delimiter);
}
if (print_event_info->verbose) if (print_event_info->verbose)
{ {
...@@ -3249,6 +3252,7 @@ void Start_log_event_v3::print(FILE* file, PRINT_EVENT_INFO* print_event_info) ...@@ -3249,6 +3252,7 @@ void Start_log_event_v3::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
print_event_info->base64_output_mode != BASE64_OUTPUT_NEVER && print_event_info->base64_output_mode != BASE64_OUTPUT_NEVER &&
!print_event_info->short_form) !print_event_info->short_form)
{ {
if (print_event_info->base64_output_mode != BASE64_OUTPUT_DECODE_ROWS)
my_b_printf(&cache, "BINLOG '\n"); my_b_printf(&cache, "BINLOG '\n");
print_base64(&cache, print_event_info, FALSE); print_base64(&cache, print_event_info, FALSE);
print_event_info->printed_fd_event= TRUE; print_event_info->printed_fd_event= TRUE;
......
...@@ -580,6 +580,7 @@ enum enum_base64_output_mode { ...@@ -580,6 +580,7 @@ enum enum_base64_output_mode {
BASE64_OUTPUT_AUTO= 1, BASE64_OUTPUT_AUTO= 1,
BASE64_OUTPUT_ALWAYS= 2, BASE64_OUTPUT_ALWAYS= 2,
BASE64_OUTPUT_UNSPEC= 3, BASE64_OUTPUT_UNSPEC= 3,
BASE64_OUTPUT_DECODE_ROWS= 4,
/* insert new output modes here */ /* insert new output modes here */
BASE64_OUTPUT_MODE_COUNT BASE64_OUTPUT_MODE_COUNT
}; };
......
...@@ -1078,7 +1078,6 @@ void table_cache_free(void); ...@@ -1078,7 +1078,6 @@ void table_cache_free(void);
bool table_def_init(void); bool table_def_init(void);
void table_def_free(void); void table_def_free(void);
void assign_new_table_id(TABLE_SHARE *share); void assign_new_table_id(TABLE_SHARE *share);
void reset_table_id_sequence();
uint cached_open_tables(void); uint cached_open_tables(void);
uint cached_table_definitions(void); uint cached_table_definitions(void);
void kill_mysql(void); void kill_mysql(void);
......
...@@ -3720,13 +3720,6 @@ void assign_new_table_id(TABLE_SHARE *share) ...@@ -3720,13 +3720,6 @@ void assign_new_table_id(TABLE_SHARE *share)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
void reset_table_id_sequence()
{
pthread_mutex_lock(&LOCK_open);
last_table_id= ~0UL;
pthread_mutex_unlock(&LOCK_open);
}
/** /**
Compare metadata versions of an element obtained from the table Compare metadata versions of an element obtained from the table
definition cache and its corresponding node in the parse tree. definition cache and its corresponding node in the parse tree.
......
...@@ -1285,16 +1285,13 @@ bool change_master(THD* thd, Master_info* mi) ...@@ -1285,16 +1285,13 @@ bool change_master(THD* thd, Master_info* mi)
int reset_master(THD* thd) int reset_master(THD* thd)
{ {
int rc;
if (!mysql_bin_log.is_open()) if (!mysql_bin_log.is_open())
{ {
my_message(ER_FLUSH_MASTER_BINLOG_CLOSED, my_message(ER_FLUSH_MASTER_BINLOG_CLOSED,
ER(ER_FLUSH_MASTER_BINLOG_CLOSED), MYF(ME_BELL+ME_WAITTANG)); ER(ER_FLUSH_MASTER_BINLOG_CLOSED), MYF(ME_BELL+ME_WAITTANG));
return 1; return 1;
} }
if (!(rc= mysql_bin_log.reset_logs(thd))) return mysql_bin_log.reset_logs(thd);
reset_table_id_sequence();
return rc;
} }
int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1, int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1,
......
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