diff --git a/storage/maria/aria_s3_copy.cc b/storage/maria/aria_s3_copy.cc index f324c0896e5..77c41ba4572 100644 --- a/storage/maria/aria_s3_copy.cc +++ b/storage/maria/aria_s3_copy.cc @@ -40,8 +40,10 @@ static const char *opt_s3_host_name= DEFAULT_AWS_HOST_NAME; static const char *opt_database; static const char *opt_s3_bucket="MariaDB"; static my_bool opt_compression, opt_verbose, opt_force, opt_s3_debug; +static my_bool opt_s3_use_http; static ulong opt_operation= OP_IMPOSSIBLE, opt_protocol_version= 1; static ulong opt_block_size; +static ulong opt_s3_port; static char **default_argv=0; static ms3_st *global_s3_client= 0; @@ -65,6 +67,12 @@ static struct my_option my_long_options[] = {"s3_host_name", 'h', "Host name to S3 provider", (char**) &opt_s3_host_name, (char**) &opt_s3_host_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"s3_port", 'p', "Port number to connect to (0 means use default)", + (char**) &opt_s3_port, (char**) &opt_s3_port, 0, GET_ULONG, REQUIRED_ARG, + 0, 0, 65536, 0, 1, 0 }, + {"s3_use_http", 'P', "If true, force use of HTTP protocol", + (char**) &opt_s3_use_http, (char**) &opt_s3_use_http, + 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"compress", 'c', "Use compression", &opt_compression, &opt_compression, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"op", 'o', "Operation to execute. One of 'from_s3', 'to_s3' or " @@ -196,6 +204,7 @@ int main(int argc, char** argv) { MY_INIT(argv[0]); get_options(&argc,(char***) &argv); + size_t block_size= opt_block_size; s3_init_library(); if (!(global_s3_client= ms3_init(opt_s3_access_key, @@ -207,15 +216,22 @@ int main(int argc, char** argv) my_exit(1); } - { - size_t block_size= opt_block_size; - uint8_t protocol_version= (uint8_t) opt_protocol_version; - ms3_set_option(global_s3_client, MS3_OPT_BUFFER_CHUNK_SIZE, &block_size); + ms3_set_option(global_s3_client, MS3_OPT_BUFFER_CHUNK_SIZE, &block_size); - if (protocol_version) - ms3_set_option(global_s3_client, MS3_OPT_FORCE_PROTOCOL_VERSION, - &protocol_version); + if (opt_protocol_version) + { + uint8_t protocol_version= (uint8_t) opt_protocol_version; + ms3_set_option(global_s3_client, MS3_OPT_FORCE_PROTOCOL_VERSION, + &protocol_version); } + if (opt_s3_port) + { + int port= (int) opt_s3_port; + ms3_set_option(global_s3_client, MS3_OPT_PORT_NUMBER, &port); + } + if (opt_s3_use_http) + ms3_set_option(global_s3_client, MS3_OPT_USE_HTTP, NULL); + for (; *argv ; argv++) { diff --git a/storage/maria/s3_func.c b/storage/maria/s3_func.c index 9f40790a371..06178c1c0c2 100644 --- a/storage/maria/s3_func.c +++ b/storage/maria/s3_func.c @@ -583,8 +583,8 @@ int aria_copy_from_s3(ms3_st *s3_client, const char *aws_bucket, if (s3_get_object(s3_client, aws_bucket, aws_path, &block, 0, 0)) { - my_printf_error(EE_FILENOTFOUND, "Table %s doesn't exist in s3", MYF(0), - filename); + my_printf_error(EE_FILENOTFOUND, "File %s/%s doesn't exist in s3", MYF(0), + database,filename); goto err; } if (block.length < MARIA_STATE_INFO_SIZE)