mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge bb-10.2-ext into 10.3
This commit is contained in:
@@ -89,7 +89,8 @@ static char *result_file_name= 0;
|
||||
static const char *output_prefix= "";
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
static const char* default_dbug_option = "d:t:o,/tmp/mysqlbinlog.trace";
|
||||
static const char *default_dbug_option = "d:t:o,/tmp/mysqlbinlog.trace";
|
||||
const char *current_dbug_option= default_dbug_option;
|
||||
#endif
|
||||
static const char *load_groups[]=
|
||||
{ "mysqlbinlog", "client", "client-server", "client-mariadb", 0 };
|
||||
@@ -109,6 +110,8 @@ static char *opt_base64_output_mode_str= NullS;
|
||||
static char* database= 0;
|
||||
static char* table= 0;
|
||||
static my_bool force_opt= 0, short_form= 0, remote_opt= 0;
|
||||
static my_bool print_row_count= 0, print_row_event_positions= 0;
|
||||
static my_bool print_row_count_used= 0, print_row_event_positions_used= 0;
|
||||
static my_bool debug_info_flag, debug_check_flag;
|
||||
static my_bool force_if_open_opt= 1;
|
||||
static my_bool opt_raw_mode= 0, opt_stop_never= 0;
|
||||
@@ -224,14 +227,16 @@ void keep_annotate_event(Annotate_rows_log_event* event)
|
||||
annotate_event= event;
|
||||
}
|
||||
|
||||
void print_annotate_event(PRINT_EVENT_INFO *print_event_info)
|
||||
bool print_annotate_event(PRINT_EVENT_INFO *print_event_info)
|
||||
{
|
||||
bool error= 0;
|
||||
if (annotate_event)
|
||||
{
|
||||
annotate_event->print(result_file, print_event_info);
|
||||
error= annotate_event->print(result_file, print_event_info);
|
||||
delete annotate_event; // the event should not be printed more than once
|
||||
annotate_event= 0;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *, const char*);
|
||||
@@ -795,7 +800,7 @@ print_use_stmt(PRINT_EVENT_INFO* pinfo, const Query_log_event *ev)
|
||||
static void
|
||||
print_skip_replication_statement(PRINT_EVENT_INFO *pinfo, const Log_event *ev)
|
||||
{
|
||||
int cur_val;
|
||||
bool cur_val;
|
||||
|
||||
cur_val= (ev->flags & LOG_EVENT_SKIP_REPLICATION_F) != 0;
|
||||
if (cur_val == pinfo->skip_replication)
|
||||
@@ -847,8 +852,9 @@ write_event_header_and_base64(Log_event *ev, FILE *result_file,
|
||||
DBUG_ENTER("write_event_header_and_base64");
|
||||
|
||||
/* Write header and base64 output to cache */
|
||||
ev->print_header(head, print_event_info, FALSE);
|
||||
ev->print_base64(body, print_event_info, FALSE);
|
||||
if (ev->print_header(head, print_event_info, FALSE) ||
|
||||
ev->print_base64(body, print_event_info, FALSE))
|
||||
DBUG_RETURN(ERROR_STOP);
|
||||
|
||||
/* Read data from cache and write to result file */
|
||||
if (copy_event_cache_to_file_and_reinit(head, result_file) ||
|
||||
@@ -870,24 +876,20 @@ static bool print_base64(PRINT_EVENT_INFO *print_event_info, Log_event *ev)
|
||||
passed --short-form, because --short-form disables printing
|
||||
row events.
|
||||
*/
|
||||
|
||||
if (!print_event_info->printed_fd_event && !short_form &&
|
||||
opt_base64_output_mode != BASE64_OUTPUT_DECODE_ROWS)
|
||||
opt_base64_output_mode != BASE64_OUTPUT_DECODE_ROWS &&
|
||||
opt_base64_output_mode != BASE64_OUTPUT_NEVER)
|
||||
{
|
||||
const char* type_str= ev->get_type_str();
|
||||
if (opt_base64_output_mode == BASE64_OUTPUT_NEVER)
|
||||
error("--base64-output=never specified, but binlog contains a "
|
||||
"%s event which must be printed in base64.",
|
||||
type_str);
|
||||
else
|
||||
error("malformed binlog: it does not contain any "
|
||||
"Format_description_log_event. I now found a %s event, which "
|
||||
error("malformed binlog: it does not contain any "
|
||||
"Format_description_log_event. Found a %s event, which "
|
||||
"is not safe to process without a "
|
||||
"Format_description_log_event.",
|
||||
type_str);
|
||||
return 1;
|
||||
}
|
||||
ev->print(result_file, print_event_info);
|
||||
return print_event_info->head_cache.error == -1;
|
||||
return ev->print(result_file, print_event_info);
|
||||
}
|
||||
|
||||
|
||||
@@ -897,6 +899,8 @@ static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||
Table_map_log_event *ignored_map=
|
||||
print_event_info->m_table_map_ignored.get_table(table_id);
|
||||
bool skip_event= (ignored_map != NULL);
|
||||
char ll_buff[21];
|
||||
bool result= 0;
|
||||
|
||||
if (opt_flashback)
|
||||
{
|
||||
@@ -969,19 +973,18 @@ static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||
return 0;
|
||||
|
||||
if (!opt_flashback)
|
||||
return print_base64(print_event_info, ev);
|
||||
result= print_base64(print_event_info, ev);
|
||||
else
|
||||
{
|
||||
if (is_stmt_end)
|
||||
{
|
||||
bool res= false;
|
||||
Log_event *e= NULL;
|
||||
|
||||
// Print the row_event from the last one to the first one
|
||||
for (uint i= events_in_stmt.elements; i > 0; --i)
|
||||
{
|
||||
e= *(dynamic_element(&events_in_stmt, i - 1, Log_event**));
|
||||
res= res || print_base64(print_event_info, e);
|
||||
result= result || print_base64(print_event_info, e);
|
||||
}
|
||||
// Copy all output into the Log_event
|
||||
ev->output_buf.copy(e->output_buf);
|
||||
@@ -992,12 +995,17 @@ static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||
delete e;
|
||||
}
|
||||
reset_dynamic(&events_in_stmt);
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
if (is_stmt_end && !result)
|
||||
{
|
||||
if (print_event_info->print_row_count)
|
||||
fprintf(result_file, "# Number of rows: %s\n",
|
||||
llstr(print_event_info->row_events, ll_buff));
|
||||
print_event_info->row_events= 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -1028,7 +1036,6 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||
Log_event_type ev_type= ev->get_type_code();
|
||||
my_bool destroy_evt= TRUE;
|
||||
DBUG_ENTER("process_event");
|
||||
print_event_info->short_form= short_form;
|
||||
Exit_status retval= OK_CONTINUE;
|
||||
IO_CACHE *const head= &print_event_info->head_cache;
|
||||
|
||||
@@ -1074,7 +1081,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||
retval= OK_STOP;
|
||||
goto end;
|
||||
}
|
||||
if (!short_form && !opt_flashback)
|
||||
if (print_row_event_positions)
|
||||
fprintf(result_file, "# at %s\n",llstr(pos,ll_buff));
|
||||
|
||||
if (!opt_hexdump)
|
||||
@@ -1115,7 +1122,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||
else
|
||||
{
|
||||
print_skip_replication_statement(print_event_info, ev);
|
||||
ev->print(result_file, print_event_info);
|
||||
if (ev->print(result_file, print_event_info))
|
||||
goto err;
|
||||
}
|
||||
if (head->error == -1)
|
||||
goto err;
|
||||
@@ -1150,8 +1158,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||
else
|
||||
{
|
||||
print_skip_replication_statement(print_event_info, ev);
|
||||
ce->print(result_file, print_event_info, TRUE);
|
||||
if (head->error == -1)
|
||||
if (ce->print(result_file, print_event_info, TRUE))
|
||||
goto err;
|
||||
}
|
||||
// If this binlog is not 3.23 ; why this test??
|
||||
@@ -1174,8 +1181,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||
the subsequent call load_processor.process fails, because the
|
||||
output of Append_block_log_event::print is only a comment.
|
||||
*/
|
||||
ev->print(result_file, print_event_info);
|
||||
if (head->error == -1)
|
||||
if (ev->print(result_file, print_event_info))
|
||||
goto err;
|
||||
if ((retval= load_processor.process((Append_block_log_event*) ev)) !=
|
||||
OK_CONTINUE)
|
||||
@@ -1184,8 +1190,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||
|
||||
case EXEC_LOAD_EVENT:
|
||||
{
|
||||
ev->print(result_file, print_event_info);
|
||||
if (head->error == -1)
|
||||
if (ev->print(result_file, print_event_info))
|
||||
goto err;
|
||||
Execute_load_log_event *exv= (Execute_load_log_event*)ev;
|
||||
Create_file_log_event *ce= load_processor.grab_event(exv->file_id);
|
||||
@@ -1196,15 +1201,16 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||
*/
|
||||
if (ce)
|
||||
{
|
||||
bool error;
|
||||
/*
|
||||
We must not convert earlier, since the file is used by
|
||||
my_open() in Load_log_processor::append().
|
||||
*/
|
||||
convert_path_to_forward_slashes((char*) ce->fname);
|
||||
ce->print(result_file, print_event_info, TRUE);
|
||||
error= ce->print(result_file, print_event_info, TRUE);
|
||||
my_free((void*)ce->fname);
|
||||
delete ce;
|
||||
if (head->error == -1)
|
||||
if (error)
|
||||
goto err;
|
||||
}
|
||||
else
|
||||
@@ -1215,10 +1221,10 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||
case FORMAT_DESCRIPTION_EVENT:
|
||||
delete glob_description_event;
|
||||
glob_description_event= (Format_description_log_event*) ev;
|
||||
destroy_evt= 0;
|
||||
print_event_info->common_header_len=
|
||||
glob_description_event->common_header_len;
|
||||
ev->print(result_file, print_event_info);
|
||||
if (head->error == -1)
|
||||
if (ev->print(result_file, print_event_info))
|
||||
goto err;
|
||||
if (!remote_opt)
|
||||
{
|
||||
@@ -1248,8 +1254,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||
}
|
||||
break;
|
||||
case BEGIN_LOAD_QUERY_EVENT:
|
||||
ev->print(result_file, print_event_info);
|
||||
if (head->error == -1)
|
||||
if (ev->print(result_file, print_event_info))
|
||||
goto err;
|
||||
if ((retval= load_processor.process((Begin_load_query_log_event*) ev)) !=
|
||||
OK_CONTINUE)
|
||||
@@ -1267,11 +1272,9 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||
{
|
||||
convert_path_to_forward_slashes(fname);
|
||||
print_skip_replication_statement(print_event_info, ev);
|
||||
exlq->print(result_file, print_event_info, fname);
|
||||
if (head->error == -1)
|
||||
if (exlq->print(result_file, print_event_info, fname))
|
||||
{
|
||||
if (fname)
|
||||
my_free(fname);
|
||||
my_free(fname);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
@@ -1279,9 +1282,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||
warning("Ignoring Execute_load_query since there is no "
|
||||
"Begin_load_query event for file_id: %u", exlq->file_id);
|
||||
}
|
||||
|
||||
if (fname)
|
||||
my_free(fname);
|
||||
my_free(fname);
|
||||
break;
|
||||
}
|
||||
case ANNOTATE_ROWS_EVENT:
|
||||
@@ -1427,7 +1428,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||
print the kept Annotate event (if there is any).
|
||||
print_annotate_event() also deletes the kept Annotate event.
|
||||
*/
|
||||
print_annotate_event(print_event_info);
|
||||
if (print_annotate_event(print_event_info))
|
||||
goto err;
|
||||
|
||||
size_t len_to= 0;
|
||||
const char* db_to= binlog_filter->get_rewrite_db(map->get_db_name(), &len_to);
|
||||
@@ -1457,10 +1459,18 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||
{
|
||||
Rows_log_event *e= (Rows_log_event*) ev;
|
||||
bool is_stmt_end= e->get_flags(Rows_log_event::STMT_END_F);
|
||||
if (!print_event_info->found_row_event)
|
||||
{
|
||||
print_event_info->found_row_event= 1;
|
||||
print_event_info->row_events= 0;
|
||||
}
|
||||
if (print_row_event(print_event_info, ev, e->get_table_id(),
|
||||
e->get_flags(Rows_log_event::STMT_END_F)))
|
||||
goto err;
|
||||
if (!is_stmt_end)
|
||||
DBUG_PRINT("info", ("is_stmt_end: %d", (int) is_stmt_end));
|
||||
if (is_stmt_end)
|
||||
print_event_info->found_row_event= 0;
|
||||
else if (opt_flashback)
|
||||
destroy_evt= FALSE;
|
||||
break;
|
||||
}
|
||||
@@ -1473,7 +1483,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||
if (print_row_event(print_event_info, ev, e->get_table_id(),
|
||||
e->get_flags(Old_rows_log_event::STMT_END_F)))
|
||||
goto err;
|
||||
if (!is_stmt_end)
|
||||
DBUG_PRINT("info", ("is_stmt_end: %d", (int) is_stmt_end));
|
||||
if (!is_stmt_end && opt_flashback)
|
||||
destroy_evt= FALSE;
|
||||
break;
|
||||
}
|
||||
@@ -1482,8 +1493,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||
/* fall through */
|
||||
default:
|
||||
print_skip_replication_statement(print_event_info, ev);
|
||||
ev->print(result_file, print_event_info);
|
||||
if (head->error == -1)
|
||||
if (ev->print(result_file, print_event_info))
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
@@ -1494,7 +1504,8 @@ err:
|
||||
retval= ERROR_STOP;
|
||||
end:
|
||||
rec_count++;
|
||||
|
||||
|
||||
DBUG_PRINT("info", ("end event processing"));
|
||||
/*
|
||||
Destroy the log_event object.
|
||||
MariaDB MWL#36: mainline does this:
|
||||
@@ -1539,6 +1550,7 @@ end:
|
||||
if (destroy_evt) /* destroy it later if not set (ignored table map) */
|
||||
delete ev;
|
||||
}
|
||||
DBUG_PRINT("exit",("return: %d", retval));
|
||||
DBUG_RETURN(retval);
|
||||
}
|
||||
|
||||
@@ -1550,14 +1562,15 @@ static struct my_option my_options[] =
|
||||
{"base64-output", OPT_BASE64_OUTPUT_MODE,
|
||||
/* 'unspec' is not mentioned because it is just a placeholder. */
|
||||
"Determine when the output statements should be base64-encoded BINLOG "
|
||||
"statements: 'never' disables it and works only for binlogs without "
|
||||
"row-based events; 'decode-rows' decodes row events into commented SQL "
|
||||
"statements if the --verbose option is also given; 'auto' prints base64 "
|
||||
"only when necessary (i.e., for row-based events and format description "
|
||||
"events); 'always' prints base64 whenever possible. 'always' is "
|
||||
"deprecated, will be removed in a future version, and should not be used "
|
||||
"in a production system. --base64-output with no 'name' argument is "
|
||||
"equivalent to --base64-output=always and is also deprecated. If no "
|
||||
"statements: 'never' doesn't print binlog row events and should not be "
|
||||
"used when directing output to a MariaDB master; "
|
||||
"'decode-rows' decodes row events into commented SQL statements if the "
|
||||
"--verbose option is also given; "
|
||||
"'auto' prints base64 only when necessary (i.e., for row-based events and "
|
||||
"format description events); "
|
||||
"'always' prints base64 whenever possible. "
|
||||
"--base64-output with no 'name' argument is equivalent to "
|
||||
"--base64-output=always and is also deprecated. If no "
|
||||
"--base64-output[=name] option is given at all, the default is 'auto'.",
|
||||
&opt_base64_output_mode_str, &opt_base64_output_mode_str,
|
||||
0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
||||
@@ -1574,8 +1587,8 @@ static struct my_option my_options[] =
|
||||
&database, &database, 0, GET_STR_ALLOC, REQUIRED_ARG,
|
||||
0, 0, 0, 0, 0, 0},
|
||||
#ifndef DBUG_OFF
|
||||
{"debug", '#', "Output debug log.", &default_dbug_option,
|
||||
&default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"debug", '#', "Output debug log.", ¤t_dbug_option,
|
||||
¤t_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#endif
|
||||
{"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .",
|
||||
&debug_check_flag, &debug_check_flag, 0,
|
||||
@@ -1657,6 +1670,14 @@ static struct my_option my_options[] =
|
||||
&flashback_review_tablename, &flashback_review_tablename,
|
||||
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#endif
|
||||
{"print-row-count", OPT_PRINT_ROW_COUNT,
|
||||
"Print row counts for each row events",
|
||||
&print_row_count, &print_row_count, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0,
|
||||
0, 0},
|
||||
{"print-row-event-positions", OPT_PRINT_ROW_EVENT_POSITIONS,
|
||||
"Print row event positions",
|
||||
&print_row_event_positions, &print_row_event_positions, 0, GET_BOOL,
|
||||
NO_ARG, 1, 0, 0, 0, 0, 0},
|
||||
{"server-id", 0,
|
||||
"Extract only binlog entries created by the server having the given id.",
|
||||
&server_id, &server_id, 0, GET_ULONG,
|
||||
@@ -1670,10 +1691,11 @@ static struct my_option my_options[] =
|
||||
&shared_memory_base_name,
|
||||
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#endif
|
||||
{"short-form", 's', "Just show regular queries: no extra info and no "
|
||||
"row-based events. This is for testing only, and should not be used in "
|
||||
"production systems. If you want to suppress base64-output, consider "
|
||||
"using --base64-output=never instead.",
|
||||
{"short-form", 's', "Just show regular queries: no extra info, no "
|
||||
"row-based events and no row counts. This is mainly for testing only, "
|
||||
"and should not be used to feed to the MariaDB server. "
|
||||
"If you want to just suppress base64-output, you can instead "
|
||||
"use --base64-output=never",
|
||||
&short_form, &short_form, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
|
||||
0, 0},
|
||||
{"socket", 'S', "The socket file to use for connection.",
|
||||
@@ -1775,9 +1797,12 @@ Example: rewrite-db='from->to'.",
|
||||
*/
|
||||
static void error_or_warning(const char *format, va_list args, const char *msg)
|
||||
{
|
||||
if (result_file)
|
||||
fflush(result_file);
|
||||
fprintf(stderr, "%s: ", msg);
|
||||
vfprintf(stderr, format, args);
|
||||
fprintf(stderr, "\n");
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1830,6 +1855,7 @@ static void warning(const char *format,...)
|
||||
*/
|
||||
static void cleanup()
|
||||
{
|
||||
DBUG_ENTER("cleanup");
|
||||
my_free(pass);
|
||||
my_free(database);
|
||||
my_free(table);
|
||||
@@ -1843,12 +1869,13 @@ static void cleanup()
|
||||
delete glob_description_event;
|
||||
if (mysql)
|
||||
mysql_close(mysql);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
static void print_version()
|
||||
{
|
||||
printf("%s Ver 3.3 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
|
||||
printf("%s Ver 3.4 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
|
||||
}
|
||||
|
||||
|
||||
@@ -1899,7 +1926,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
switch (optid) {
|
||||
#ifndef DBUG_OFF
|
||||
case '#':
|
||||
DBUG_PUSH(argument ? argument : default_dbug_option);
|
||||
if (!argument)
|
||||
argument= (char*) default_dbug_option;
|
||||
current_dbug_option= argument;
|
||||
DBUG_PUSH(argument);
|
||||
break;
|
||||
#endif
|
||||
#include <sslopt-case.h>
|
||||
@@ -1931,8 +1961,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
one_table= 1;
|
||||
break;
|
||||
case OPT_MYSQL_PROTOCOL:
|
||||
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
|
||||
opt->name);
|
||||
if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib,
|
||||
opt->name)) <= 0)
|
||||
{
|
||||
sf_leaking_memory= 1; /* no memory leak reports here */
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
#ifdef WHEN_FLASHBACK_REVIEW_READY
|
||||
case opt_flashback_review:
|
||||
@@ -1950,8 +1984,15 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
opt_base64_output_mode= BASE64_OUTPUT_ALWAYS;
|
||||
else
|
||||
{
|
||||
opt_base64_output_mode= (enum_base64_output_mode)
|
||||
(find_type_or_exit(argument, &base64_output_mode_typelib, opt->name)-1);
|
||||
int val;
|
||||
|
||||
if ((val= find_type_with_warning(argument, &base64_output_mode_typelib,
|
||||
opt->name)) <= 0)
|
||||
{
|
||||
sf_leaking_memory= 1; /* no memory leak reports here */
|
||||
exit(1);
|
||||
}
|
||||
opt_base64_output_mode= (enum_base64_output_mode) (val - 1);
|
||||
}
|
||||
break;
|
||||
case OPT_REWRITE_DB: // db_from->db_to
|
||||
@@ -2001,6 +2042,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
binlog_filter->add_db_rewrite(key, val);
|
||||
break;
|
||||
}
|
||||
case OPT_PRINT_ROW_COUNT:
|
||||
print_row_count_used= 1;
|
||||
break;
|
||||
case OPT_PRINT_ROW_EVENT_POSITIONS:
|
||||
print_row_event_positions_used= 1;
|
||||
break;
|
||||
case 'v':
|
||||
if (argument == disabled_my_option)
|
||||
verbose= 0;
|
||||
@@ -2133,11 +2180,30 @@ static Exit_status dump_log_entries(const char* logname)
|
||||
fprintf(result_file, "DELIMITER /*!*/;\n");
|
||||
strmov(print_event_info.delimiter, "/*!*/;");
|
||||
|
||||
print_event_info.verbose= short_form ? 0 : verbose;
|
||||
if (short_form)
|
||||
{
|
||||
if (!print_row_event_positions_used)
|
||||
print_row_event_positions= 0;
|
||||
if (!print_row_count_used)
|
||||
print_row_count = 0;
|
||||
}
|
||||
if (opt_flashback)
|
||||
{
|
||||
if (!print_row_event_positions_used)
|
||||
print_row_event_positions= 0;
|
||||
}
|
||||
|
||||
print_event_info.verbose= short_form ? 0 : verbose;
|
||||
print_event_info.short_form= short_form;
|
||||
print_event_info.print_row_count= print_row_count;
|
||||
print_event_info.file= result_file;
|
||||
fflush(result_file);
|
||||
rc= (remote_opt ? dump_remote_log_entries(&print_event_info, logname) :
|
||||
dump_local_log_entries(&print_event_info, logname));
|
||||
|
||||
if (rc == ERROR_STOP)
|
||||
return rc;
|
||||
|
||||
/* Set delimiter back to semicolon */
|
||||
if (!opt_raw_mode && !opt_flashback)
|
||||
fprintf(result_file, "DELIMITER ;\n");
|
||||
@@ -2208,6 +2274,8 @@ static Exit_status check_master_version()
|
||||
}
|
||||
|
||||
delete glob_description_event;
|
||||
glob_description_event= NULL;
|
||||
|
||||
switch (version) {
|
||||
case 3:
|
||||
glob_description_event= new Format_description_log_event(1);
|
||||
@@ -2226,7 +2294,6 @@ static Exit_status check_master_version()
|
||||
glob_description_event= new Format_description_log_event(3);
|
||||
break;
|
||||
default:
|
||||
glob_description_event= NULL;
|
||||
error("Could not find server version: "
|
||||
"Master reported unrecognized MySQL version '%s'.", row[0]);
|
||||
goto err;
|
||||
@@ -2467,6 +2534,7 @@ static Exit_status handle_event_raw_mode(PRINT_EVENT_INFO *print_event_info,
|
||||
error("Could not write into log file '%s'", out_file_name);
|
||||
DBUG_RETURN(ERROR_STOP);
|
||||
}
|
||||
print_event_info->file= result_file;
|
||||
|
||||
delete glob_description_event;
|
||||
glob_description_event= (Format_description_log_event*) ev;
|
||||
@@ -2965,13 +3033,6 @@ int main(int argc, char** argv)
|
||||
|
||||
if (opt_base64_output_mode == BASE64_OUTPUT_UNSPEC)
|
||||
opt_base64_output_mode= BASE64_OUTPUT_AUTO;
|
||||
if (opt_base64_output_mode == BASE64_OUTPUT_ALWAYS)
|
||||
warning("The --base64-output=always flag and the --base64-output flag "
|
||||
"(with '=MODE' omitted), are deprecated. "
|
||||
"The output generated when these flags are used cannot be "
|
||||
"parsed by mysql 5.6.0 and later. "
|
||||
"The flags will be removed in a future version. "
|
||||
"Please use --base64-output=auto instead.");
|
||||
|
||||
my_set_max_open_files(open_files_limit);
|
||||
|
||||
@@ -3084,7 +3145,7 @@ int main(int argc, char** argv)
|
||||
If enable flashback, need to print the events from the end to the
|
||||
beginning
|
||||
*/
|
||||
if (opt_flashback)
|
||||
if (opt_flashback && retval != ERROR_STOP)
|
||||
{
|
||||
for (uint i= binlog_events.elements; i > 0; --i)
|
||||
{
|
||||
@@ -3099,12 +3160,15 @@ int main(int argc, char** argv)
|
||||
}
|
||||
|
||||
/* Set delimiter back to semicolon */
|
||||
if (!stop_event_string.is_empty())
|
||||
fprintf(result_file, "%s", stop_event_string.ptr());
|
||||
if (!opt_raw_mode && opt_flashback)
|
||||
fprintf(result_file, "DELIMITER ;\n");
|
||||
if (retval != ERROR_STOP)
|
||||
{
|
||||
if (!stop_event_string.is_empty())
|
||||
fprintf(result_file, "%s", stop_event_string.ptr());
|
||||
if (!opt_raw_mode && opt_flashback)
|
||||
fprintf(result_file, "DELIMITER ;\n");
|
||||
}
|
||||
|
||||
if (!opt_raw_mode)
|
||||
if (retval != ERROR_STOP && !opt_raw_mode)
|
||||
{
|
||||
/*
|
||||
Issue a ROLLBACK in case the last printed binlog was crashed and had half
|
||||
|
Reference in New Issue
Block a user