diff options
Diffstat (limited to 'client/mysqlbinlog.cc')
-rw-r--r-- | client/mysqlbinlog.cc | 47 |
1 files changed, 39 insertions, 8 deletions
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index a248ade353e..cf56713ec0d 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -78,6 +78,9 @@ static const char* host = 0; static int port= 0; static uint my_end_arg; static const char* sock= 0; +#ifdef HAVE_SMEM +static char *shared_memory_base_name= 0; +#endif static const char* user = 0; static char* pass = 0; static char *charset= 0; @@ -439,6 +442,7 @@ Exit_status Load_log_processor::process_first_event(const char *bname, { error("Could not construct local filename %s%s.", target_dir_name,bname); + my_free(fname, MYF(0)); delete ce; DBUG_RETURN(ERROR_STOP); } @@ -446,9 +450,15 @@ Exit_status Load_log_processor::process_first_event(const char *bname, rec.fname= fname; rec.event= ce; + /* + fname is freed in process_event() + after Execute_load_query_log_event or Execute_load_log_event + will have been processed, otherwise in Load_log_processor::destroy() + */ if (set_dynamic(&file_names, (uchar*)&rec, file_id)) { error("Out of memory."); + my_free(fname, MYF(0)); delete ce; DBUG_RETURN(ERROR_STOP); } @@ -828,7 +838,17 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, print_event_info->common_header_len= glob_description_event->common_header_len; ev->print(result_file, print_event_info); - ev->temp_buf= 0; // as the event ref is zeroed + if (!remote_opt) + { + ev->free_temp_buf(); // free memory allocated in dump_local_log_entries + } + else + { + /* + disassociate but not free dump_remote_log_entries time memory + */ + ev->temp_buf= 0; + } /* We don't want this event to be deleted now, so let's hide it (I (Guilhem) should later see if this triggers a non-serious Valgrind @@ -992,13 +1012,13 @@ static struct my_option my_long_options[] = /* '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; 'auto' is the default and prints base64 only when " - "necessary (i.e., for row-based events and format description events); " - "'decode-rows' suppresses BINLOG statements for row events, but does " - "not exit as an error if a row event is found, unlike 'never'; " - "'always' prints base64 whenever possible. 'always' is for debugging " - "only and should not be used in a production system. The default is " - "'auto'. --base64-output is a short form for --base64-output=always." + "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 for " + "debugging only and should not be used in a production system. If this " + "argument is not given, the default is 'auto'; if it is given with no " + "argument, 'always' is used." ,(uchar**) &opt_base64_output_mode_str, (uchar**) &opt_base64_output_mode_str, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, @@ -1077,6 +1097,12 @@ static struct my_option my_long_options[] = {"set-charset", OPT_SET_CHARSET, "Add 'SET NAMES character_set' to the output.", (uchar**) &charset, (uchar**) &charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, +#ifdef HAVE_SMEM + {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME, + "Base name of shared memory.", (uchar**) &shared_memory_base_name, + (uchar**) &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 " @@ -1378,6 +1404,11 @@ static Exit_status safe_connect() if (opt_protocol) mysql_options(mysql, MYSQL_OPT_PROTOCOL, (char*) &opt_protocol); +#ifdef HAVE_SMEM + if (shared_memory_base_name) + mysql_options(mysql, MYSQL_SHARED_MEMORY_BASE_NAME, + shared_memory_base_name); +#endif if (!mysql_real_connect(mysql, host, user, pass, 0, port, sock, 0)) { error("Failed on connect: %s", mysql_error(mysql)); |