Commit 8e2a24bb authored by Monty's avatar Monty

Added s3_protocol_version=auto

parent 0765d823
...@@ -77,9 +77,9 @@ static struct my_option my_long_options[] = ...@@ -77,9 +77,9 @@ static struct my_option my_long_options[] =
&opt_block_size, &opt_block_size, 0, GET_ULONG, REQUIRED_ARG, &opt_block_size, &opt_block_size, 0, GET_ULONG, REQUIRED_ARG,
4*1024*1024, 64*1024, 16*1024*1024, MALLOC_OVERHEAD, 1024, 0 }, 4*1024*1024, 64*1024, 16*1024*1024, MALLOC_OVERHEAD, 1024, 0 },
{"s3_protocol_version", 'L', {"s3_protocol_version", 'L',
"Protocol used to communication with S3. One of \"Amazon\" or \"Original\".", "Protocol used to communication with S3. One of \"Auto\", \"Amazon\" or \"Original\".",
&opt_protocol_version, &opt_protocol_version, &s3_protocol_typelib, &opt_protocol_version, &opt_protocol_version, &s3_protocol_typelib,
GET_ENUM, REQUIRED_ARG, 1, 0, 0, 0, 0, 0}, GET_ENUM, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"force", 'f', "Force copy even if target exists", {"force", 'f', "Force copy even if target exists",
&opt_force, &opt_force, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, &opt_force, &opt_force, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Write more information", &opt_verbose, &opt_verbose, {"verbose", 'v', "Write more information", &opt_verbose, &opt_verbose,
...@@ -209,10 +209,12 @@ int main(int argc, char** argv) ...@@ -209,10 +209,12 @@ int main(int argc, char** argv)
{ {
size_t block_size= opt_block_size; size_t block_size= opt_block_size;
uint8_t protocol_version= (uint8_t) opt_protocol_version+1; 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);
ms3_set_option(global_s3_client, MS3_OPT_FORCE_PROTOCOL_VERSION,
&protocol_version); if (protocol_version)
ms3_set_option(global_s3_client, MS3_OPT_FORCE_PROTOCOL_VERSION,
&protocol_version);
} }
for (; *argv ; argv++) for (; *argv ; argv++)
......
...@@ -127,8 +127,8 @@ static MYSQL_SYSVAR_BOOL(debug, s3_debug, ...@@ -127,8 +127,8 @@ static MYSQL_SYSVAR_BOOL(debug, s3_debug,
static MYSQL_SYSVAR_ENUM(protocol_version, s3_protocol_version, static MYSQL_SYSVAR_ENUM(protocol_version, s3_protocol_version,
PLUGIN_VAR_RQCMDARG, PLUGIN_VAR_RQCMDARG,
"Protocol used to communication with S3. One of " "Protocol used to communication with S3. One of "
"\"Amazon\" or \"Original\".", "\"Auto\", \"Amazon\" or \"Original\".",
NULL, NULL, 1, &s3_protocol_typelib); NULL, NULL, 0, &s3_protocol_typelib);
static MYSQL_SYSVAR_ULONG(pagecache_age_threshold, static MYSQL_SYSVAR_ULONG(pagecache_age_threshold,
s3_pagecache_age_threshold, PLUGIN_VAR_RQCMDARG, s3_pagecache_age_threshold, PLUGIN_VAR_RQCMDARG,
...@@ -259,7 +259,7 @@ static my_bool s3_info_init(S3_INFO *info) ...@@ -259,7 +259,7 @@ static my_bool s3_info_init(S3_INFO *info)
{ {
if (!s3_usable()) if (!s3_usable())
return 1; return 1;
info->protocol_version= (uint8_t) s3_protocol_version+1; info->protocol_version= (uint8_t) s3_protocol_version;
lex_string_set(&info->host_name, s3_host_name); lex_string_set(&info->host_name, s3_host_name);
lex_string_set(&info->access_key, s3_access_key); lex_string_set(&info->access_key, s3_access_key);
lex_string_set(&info->secret_key, s3_secret_key); lex_string_set(&info->secret_key, s3_secret_key);
......
...@@ -39,7 +39,7 @@ static int s3_read_frm_from_disk(const char *filename, uchar **to, ...@@ -39,7 +39,7 @@ static int s3_read_frm_from_disk(const char *filename, uchar **to,
/* Used by ha_s3.cc and tools to define different protocol options */ /* Used by ha_s3.cc and tools to define different protocol options */
static const char *protocol_types[]= {"Original", "Amazon", NullS}; static const char *protocol_types[]= {"Auto", "Original", "Amazon", NullS};
TYPELIB s3_protocol_typelib= {array_elements(protocol_types)-1,"", TYPELIB s3_protocol_typelib= {array_elements(protocol_types)-1,"",
protocol_types, NULL}; protocol_types, NULL};
...@@ -149,8 +149,9 @@ ms3_st *s3_open_connection(S3_INFO *s3) ...@@ -149,8 +149,9 @@ ms3_st *s3_open_connection(S3_INFO *s3)
errno, ms3_error(errno)); errno, ms3_error(errno));
my_errno= HA_ERR_NO_SUCH_TABLE; my_errno= HA_ERR_NO_SUCH_TABLE;
} }
ms3_set_option(s3_client, MS3_OPT_FORCE_PROTOCOL_VERSION, if (s3->protocol_version)
&s3->protocol_version); ms3_set_option(s3_client, MS3_OPT_FORCE_PROTOCOL_VERSION,
&s3->protocol_version);
return s3_client; return s3_client;
} }
......
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