summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-02-19 17:41:13 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2019-02-19 17:41:13 +0200
commitfc124778ea4e3d0d6bc35d816b367d0ed470bf0c (patch)
treeb5e694a4c6c7a73494762d7f54c9114e14c9098e /client
parenta4cd91c526933e87d78a4a3fec66a074616f3c32 (diff)
parent88b6dc4db5567951f9c0d0baa6e965d44a7130b1 (diff)
downloadmariadb-git-fc124778ea4e3d0d6bc35d816b367d0ed470bf0c.tar.gz
Merge 10.2 into 10.3
Diffstat (limited to 'client')
-rw-r--r--client/mysqlbinlog.cc23
-rw-r--r--client/mysqltest.cc66
2 files changed, 26 insertions, 63 deletions
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 14656705805..4f6f19f5f02 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -83,6 +83,7 @@ ulong mysqld_net_retry_count = 10L;
ulong open_files_limit;
ulong opt_binlog_rows_event_max_size;
ulonglong test_flags = 0;
+ulong opt_binlog_rows_event_max_encoded_size= MAX_MAX_ALLOWED_PACKET;
static uint opt_protocol= 0;
static FILE *result_file;
static char *result_file_name= 0;
@@ -852,8 +853,14 @@ 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 */
- if (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))
+ DBUG_RETURN(ERROR_STOP);
+
+ DBUG_ASSERT(print_event_info->base64_output_mode == BASE64_OUTPUT_ALWAYS);
+
+ if (ev->print_base64(body, print_event_info,
+ print_event_info->base64_output_mode !=
+ BASE64_OUTPUT_DECODE_ROWS))
DBUG_RETURN(ERROR_STOP);
/* Read data from cache and write to result file */
@@ -889,12 +896,13 @@ static bool print_base64(PRINT_EVENT_INFO *print_event_info, Log_event *ev)
type_str);
return 1;
}
+
return ev->print(result_file, print_event_info);
}
static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
- ulong table_id, bool is_stmt_end)
+ ulonglong table_id, bool is_stmt_end)
{
Table_map_log_event *ignored_map=
print_event_info->m_table_map_ignored.get_table(table_id);
@@ -1769,6 +1777,15 @@ that may lead to an endless loop.",
"This value must be a multiple of 256.",
&opt_binlog_rows_event_max_size, &opt_binlog_rows_event_max_size, 0,
GET_ULONG, REQUIRED_ARG, UINT_MAX, 256, ULONG_MAX, 0, 256, 0},
+#ifndef DBUG_OFF
+ {"debug-binlog-row-event-max-encoded-size", 0,
+ "The maximum size of base64-encoded rows-event in one BINLOG pseudo-query "
+ "instance. When the computed actual size exceeds the limit "
+ "the BINLOG's argument string is fragmented in two.",
+ &opt_binlog_rows_event_max_encoded_size,
+ &opt_binlog_rows_event_max_encoded_size, 0,
+ GET_ULONG, REQUIRED_ARG, UINT_MAX/4, 256, ULONG_MAX, 0, 256, 0},
+#endif
{"verify-binlog-checksum", 'c', "Verify checksum binlog events.",
(uchar**) &opt_verify_binlog_checksum, (uchar**) &opt_verify_binlog_checksum,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 0eb8c896ba5..82aa73939ac 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -4019,63 +4019,6 @@ void do_mkdir(struct st_command *command)
}
-/*
- Remove directory recursively.
-*/
-static int rmtree(const char *dir)
-{
- char path[FN_REFLEN];
- char sep[]={ FN_LIBCHAR, 0 };
- int err=0;
-
- MY_DIR *dir_info= my_dir(dir, MYF(MY_DONT_SORT | MY_WANT_STAT));
- if (!dir_info)
- return 1;
-
- for (uint i= 0; i < dir_info->number_of_files; i++)
- {
- FILEINFO *file= dir_info->dir_entry + i;
- /* Skip "." and ".." */
- if (!strcmp(file->name, ".") || !strcmp(file->name, ".."))
- continue;
-
- strxnmov(path, sizeof(path), dir, sep, file->name, NULL);
-
- if (!MY_S_ISDIR(file->mystat->st_mode))
- {
- err= my_delete(path, 0);
-#ifdef _WIN32
- /*
- On Windows, check and possible reset readonly attribute.
- my_delete(), or DeleteFile does not remove theses files.
- */
- if (err)
- {
- DWORD attr= GetFileAttributes(path);
- if (attr != INVALID_FILE_ATTRIBUTES &&
- (attr & FILE_ATTRIBUTE_READONLY))
- {
- SetFileAttributes(path, attr &~ FILE_ATTRIBUTE_READONLY);
- err= my_delete(path, 0);
- }
- }
-#endif
- }
- else
- err= rmtree(path);
-
- if(err)
- break;
- }
-
- my_dirend(dir_info);
-
- if (!err)
- err= rmdir(dir);
-
- return err;
-}
-
/*
SYNOPSIS
@@ -4103,7 +4046,7 @@ void do_rmdir(struct st_command *command)
DBUG_VOID_RETURN;
DBUG_PRINT("info", ("removing directory: %s", ds_dirname.str));
- if (rmtree(ds_dirname.str))
+ if (my_rmtree(ds_dirname.str, MYF(0)))
handle_command_error(command, 1, errno);
dynstr_free(&ds_dirname);
@@ -6118,7 +6061,6 @@ void do_connect(struct st_command *command)
#endif
if (opt_compress || con_compress)
mysql_options(con_slot->mysql, MYSQL_OPT_COMPRESS, NullS);
- mysql_options(con_slot->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
mysql_options(con_slot->mysql, MYSQL_SET_CHARSET_NAME,
csname?csname: charset_info->csname);
if (opt_charsets_dir)
@@ -6218,6 +6160,11 @@ void do_connect(struct st_command *command)
if (con_slot == next_con)
next_con++; /* if we used the next_con slot, advance the pointer */
}
+ else // Failed to connect. Free the memory.
+ {
+ mysql_close(con_slot->mysql);
+ con_slot->mysql= NULL;
+ }
dynstr_free(&ds_connection_name);
dynstr_free(&ds_host);
@@ -9326,7 +9273,6 @@ int main(int argc, char **argv)
(void *) &opt_connect_timeout);
if (opt_compress)
mysql_options(con->mysql,MYSQL_OPT_COMPRESS,NullS);
- mysql_options(con->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
mysql_options(con->mysql, MYSQL_SET_CHARSET_NAME,
charset_info->csname);
if (opt_charsets_dir)