Commit ff88633b authored by Yuchen Pei's avatar Yuchen Pei

Merge branch '10.11' into 11.2

parents cfa9784e a8c57172
...@@ -735,8 +735,8 @@ static int check_options(int argc, char **argv, char *operation) ...@@ -735,8 +735,8 @@ static int check_options(int argc, char **argv, char *operation)
{ {
int i= 0; /* loop counter */ int i= 0; /* loop counter */
int num_found= 0; /* number of options found (shortcut loop) */ int num_found= 0; /* number of options found (shortcut loop) */
char config_file[FN_REFLEN]; /* configuration file name */ char config_file[FN_REFLEN+1]; /* configuration file name */
char plugin_name[FN_REFLEN]; /* plugin name */ char plugin_name[FN_REFLEN+1]; /* plugin name */
/* Form prefix strings for the options. */ /* Form prefix strings for the options. */
const char *basedir_prefix = "--basedir="; const char *basedir_prefix = "--basedir=";
...@@ -784,8 +784,8 @@ static int check_options(int argc, char **argv, char *operation) ...@@ -784,8 +784,8 @@ static int check_options(int argc, char **argv, char *operation)
/* read the plugin config file and check for match against argument */ /* read the plugin config file and check for match against argument */
else else
{ {
if (safe_strcpy_truncated(plugin_name, sizeof plugin_name, argv[i]) || if (safe_strcpy_truncated(plugin_name, sizeof(plugin_name)-1, argv[i]) ||
safe_strcpy_truncated(config_file, sizeof config_file, argv[i]) || safe_strcpy_truncated(config_file, sizeof(config_file)-1, argv[i]) ||
safe_strcat(config_file, sizeof(config_file), ".ini")) safe_strcat(config_file, sizeof(config_file), ".ini"))
{ {
fprintf(stderr, "ERROR: argument is too long.\n"); fprintf(stderr, "ERROR: argument is too long.\n");
......
# Mask the cost value from any field that looks like
# "xxx_cost" : double_number
# Print the
# "xxx_cost" : "REPLACED"
# instead
--replace_regex /(_cost": )[0-9.e-]+/\1"REPLACED"/
#--replace_regex /(_cost": )[0-9.e-]+/"REPLACED"/
#--replace_regex /[0-9]+/BBB/
#--replace_regex /("r_engine_stats":) {[^}]*}/\1 REPLACED/
...@@ -81,8 +81,8 @@ JS ...@@ -81,8 +81,8 @@ JS
"clause": "ORDER BY", "clause": "ORDER BY",
"table": "t1", "table": "t1",
"rows_estimation": 10000, "rows_estimation": 10000,
"filesort_cost": 0.205030632, "filesort_cost": "REPLACED",
"read_cost": 1.791376632, "read_cost": "REPLACED",
"filesort_type": "priority_queue with row lookup", "filesort_type": "priority_queue with row lookup",
"fanout": 1, "fanout": 1,
"possible_keys": "possible_keys":
...@@ -103,7 +103,7 @@ JS ...@@ -103,7 +103,7 @@ JS
"direction": 1, "direction": 1,
"rows_to_examine": 10, "rows_to_examine": 10,
"range_scan": false, "range_scan": false,
"scan_cost": 0.013129232, "scan_cost": "REPLACED",
"chosen": true "chosen": true
} }
] ]
...@@ -111,9 +111,9 @@ JS ...@@ -111,9 +111,9 @@ JS
} }
], ],
"can_skip_filesort": true, "can_skip_filesort": true,
"full_join_cost": 37.9789756, "full_join_cost": "REPLACED",
"risk_ratio": 10, "risk_ratio": 10,
"shortcut_join_cost": 0.049201862, "shortcut_join_cost": "REPLACED",
"shortcut_cost_with_risk": 0.492018616, "shortcut_cost_with_risk": 0.492018616,
"use_shortcut_cost": true "use_shortcut_cost": true
} }
...@@ -163,9 +163,9 @@ JS ...@@ -163,9 +163,9 @@ JS
"test_if_skip_sort_order_early": "test_if_skip_sort_order_early":
[], [],
"can_skip_filesort": false, "can_skip_filesort": false,
"full_join_cost": 37.9789756, "full_join_cost": "REPLACED",
"risk_ratio": 10, "risk_ratio": 10,
"shortcut_join_cost": 1.94241863, "shortcut_join_cost": "REPLACED",
"shortcut_cost_with_risk": 19.4241863, "shortcut_cost_with_risk": 19.4241863,
"use_shortcut_cost": true "use_shortcut_cost": true
} }
...@@ -220,8 +220,8 @@ JS ...@@ -220,8 +220,8 @@ JS
"clause": "ORDER BY", "clause": "ORDER BY",
"table": "t1", "table": "t1",
"rows_estimation": 10000, "rows_estimation": 10000,
"filesort_cost": 1.070467741, "filesort_cost": "REPLACED",
"read_cost": 2.656813741, "read_cost": "REPLACED",
"filesort_type": "merge_sort with addon fields", "filesort_type": "merge_sort with addon fields",
"fanout": 1, "fanout": 1,
"possible_keys": "possible_keys":
...@@ -242,7 +242,7 @@ JS ...@@ -242,7 +242,7 @@ JS
"direction": 1, "direction": 1,
"rows_to_examine": 5000, "rows_to_examine": 5000,
"range_scan": false, "range_scan": false,
"scan_cost": 6.174703142, "scan_cost": "REPLACED",
"usable": false, "usable": false,
"cause": "cost" "cause": "cost"
} }
...@@ -251,9 +251,9 @@ JS ...@@ -251,9 +251,9 @@ JS
} }
], ],
"can_skip_filesort": false, "can_skip_filesort": false,
"full_join_cost": 37.9789756, "full_join_cost": "REPLACED",
"risk_ratio": 10, "risk_ratio": 10,
"shortcut_join_cost": 19.9426608, "shortcut_join_cost": "REPLACED",
"shortcut_cost_with_risk": 199.426608, "shortcut_cost_with_risk": 199.426608,
"use_shortcut_cost": false "use_shortcut_cost": false
} }
...@@ -342,8 +342,8 @@ JS ...@@ -342,8 +342,8 @@ JS
"clause": "ORDER BY", "clause": "ORDER BY",
"table": "t1", "table": "t1",
"rows_estimation": 10000, "rows_estimation": 10000,
"filesort_cost": 0.205030632, "filesort_cost": "REPLACED",
"read_cost": 1.791376632, "read_cost": "REPLACED",
"filesort_type": "priority_queue with row lookup", "filesort_type": "priority_queue with row lookup",
"fanout": 1, "fanout": 1,
"possible_keys": "possible_keys":
...@@ -364,7 +364,7 @@ JS ...@@ -364,7 +364,7 @@ JS
"direction": 1, "direction": 1,
"rows_to_examine": 10, "rows_to_examine": 10,
"range_scan": false, "range_scan": false,
"scan_cost": 0.013129232, "scan_cost": "REPLACED",
"chosen": true "chosen": true
} }
] ]
...@@ -372,9 +372,9 @@ JS ...@@ -372,9 +372,9 @@ JS
} }
], ],
"can_skip_filesort": true, "can_skip_filesort": true,
"full_join_cost": 42.02203018, "full_join_cost": "REPLACED",
"risk_ratio": 10, "risk_ratio": 10,
"shortcut_join_cost": 0.053244916, "shortcut_join_cost": "REPLACED",
"shortcut_cost_with_risk": 0.532449162, "shortcut_cost_with_risk": 0.532449162,
"use_shortcut_cost": true "use_shortcut_cost": true
} }
...@@ -430,8 +430,8 @@ JS ...@@ -430,8 +430,8 @@ JS
"clause": "ORDER BY", "clause": "ORDER BY",
"table": "t1", "table": "t1",
"rows_estimation": 10000, "rows_estimation": 10000,
"filesort_cost": 0.205030632, "filesort_cost": "REPLACED",
"read_cost": 1.791376632, "read_cost": "REPLACED",
"filesort_type": "priority_queue with row lookup", "filesort_type": "priority_queue with row lookup",
"fanout": 1, "fanout": 1,
"possible_keys": "possible_keys":
...@@ -452,7 +452,7 @@ JS ...@@ -452,7 +452,7 @@ JS
"direction": 1, "direction": 1,
"rows_to_examine": 10, "rows_to_examine": 10,
"range_scan": false, "range_scan": false,
"scan_cost": 0.013129232, "scan_cost": "REPLACED",
"chosen": true "chosen": true
} }
] ]
...@@ -460,9 +460,9 @@ JS ...@@ -460,9 +460,9 @@ JS
} }
], ],
"can_skip_filesort": true, "can_skip_filesort": true,
"full_join_cost": 37.9789756, "full_join_cost": "REPLACED",
"risk_ratio": 10, "risk_ratio": 10,
"shortcut_join_cost": 0.049201862, "shortcut_join_cost": "REPLACED",
"shortcut_cost_with_risk": 0.492018616, "shortcut_cost_with_risk": 0.492018616,
"use_shortcut_cost": true "use_shortcut_cost": true
} }
......
...@@ -68,6 +68,7 @@ set optimizer_join_limit_pref_ratio=10; ...@@ -68,6 +68,7 @@ set optimizer_join_limit_pref_ratio=10;
eval $query; eval $query;
set @trace=(select trace from information_schema.optimizer_trace); set @trace=(select trace from information_schema.optimizer_trace);
--source include/optimizer_trace_no_costs.inc
select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS;
--echo # --echo #
...@@ -95,6 +96,7 @@ set optimizer_join_limit_pref_ratio=10; ...@@ -95,6 +96,7 @@ set optimizer_join_limit_pref_ratio=10;
eval $query; eval $query;
set @trace=(select trace from information_schema.optimizer_trace); set @trace=(select trace from information_schema.optimizer_trace);
--source include/optimizer_trace_no_costs.inc
select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS;
--echo # --echo #
...@@ -121,6 +123,7 @@ set optimizer_join_limit_pref_ratio=10; ...@@ -121,6 +123,7 @@ set optimizer_join_limit_pref_ratio=10;
eval $query; eval $query;
set @trace=(select trace from information_schema.optimizer_trace); set @trace=(select trace from information_schema.optimizer_trace);
--source include/optimizer_trace_no_costs.inc
select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS;
--echo # --echo #
...@@ -140,6 +143,7 @@ limit 10; ...@@ -140,6 +143,7 @@ limit 10;
set @trace=(select trace from information_schema.optimizer_trace); set @trace=(select trace from information_schema.optimizer_trace);
--echo # This will show nothing as limit shortcut code figures that --echo # This will show nothing as limit shortcut code figures that
--echo # it's not possible to use t1 to construct shortcuts: --echo # it's not possible to use t1 to construct shortcuts:
--source include/optimizer_trace_no_costs.inc
select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS;
--echo # --echo #
...@@ -169,6 +173,7 @@ set optimizer_join_limit_pref_ratio=10; ...@@ -169,6 +173,7 @@ set optimizer_join_limit_pref_ratio=10;
eval $query; eval $query;
set @trace=(select trace from information_schema.optimizer_trace); set @trace=(select trace from information_schema.optimizer_trace);
--source include/optimizer_trace_no_costs.inc
select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS;
--echo # --echo #
...@@ -197,6 +202,7 @@ set optimizer_join_limit_pref_ratio=10; ...@@ -197,6 +202,7 @@ set optimizer_join_limit_pref_ratio=10;
eval $query; eval $query;
set @trace=(select trace from information_schema.optimizer_trace); set @trace=(select trace from information_schema.optimizer_trace);
--source include/optimizer_trace_no_costs.inc
select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS;
......
...@@ -130,16 +130,19 @@ s3_block_size X ...@@ -130,16 +130,19 @@ s3_block_size X
s3_bucket X s3_bucket X
s3_debug X s3_debug X
s3_host_name X s3_host_name X
s3_no_content_type X
s3_pagecache_age_threshold X s3_pagecache_age_threshold X
s3_pagecache_buffer_size X s3_pagecache_buffer_size X
s3_pagecache_division_limit X s3_pagecache_division_limit X
s3_pagecache_file_hash_size X s3_pagecache_file_hash_size X
s3_port X s3_port X
s3_protocol_version X s3_protocol_version X
s3_provider X
s3_region X s3_region X
s3_replicate_alter_as_create_select X s3_replicate_alter_as_create_select X
s3_secret_key X s3_secret_key X
s3_slave_ignore_updates X s3_slave_ignore_updates X
s3_ssl_no_verify X
s3_use_http X s3_use_http X
show variables like "s3_slave%"; show variables like "s3_slave%";
Variable_name Value Variable_name Value
......
...@@ -12,6 +12,8 @@ s3-secret-key=@ENV.S3_SECRET_KEY ...@@ -12,6 +12,8 @@ s3-secret-key=@ENV.S3_SECRET_KEY
s3-region=@ENV.S3_REGION s3-region=@ENV.S3_REGION
s3-port=@ENV.S3_PORT s3-port=@ENV.S3_PORT
s3-use-http=@ENV.S3_USE_HTTP s3-use-http=@ENV.S3_USE_HTTP
s3-ssl-no-verify=@ENV.S3_SSL_NO_VERIFY
s3-provider=@ENV.S3_PROVIDER
#s3-host-name=s3.amazonaws.com #s3-host-name=s3.amazonaws.com
#s3-protocol-version=Amazon #s3-protocol-version=Amazon
......
...@@ -10,6 +10,8 @@ s3-secret-key=@ENV.S3_SECRET_KEY ...@@ -10,6 +10,8 @@ s3-secret-key=@ENV.S3_SECRET_KEY
s3-region=@ENV.S3_REGION s3-region=@ENV.S3_REGION
s3-port=@ENV.S3_PORT s3-port=@ENV.S3_PORT
s3-use-http=@ENV.S3_USE_HTTP s3-use-http=@ENV.S3_USE_HTTP
s3-ssl-no-verify=@ENV.S3_SSL_NO_VERIFY
s3-provider=@ENV.S3_PROVIDER
# You can change the following when running the tests against # You can change the following when running the tests against
# your own S3 setup # your own S3 setup
......
...@@ -20,6 +20,8 @@ if(connect(SOCK, $paddr)) ...@@ -20,6 +20,8 @@ if(connect(SOCK, $paddr))
$ENV{'S3_REGION'} = ""; $ENV{'S3_REGION'} = "";
$ENV{'S3_PROTOCOL_VERSION'} = "Auto"; $ENV{'S3_PROTOCOL_VERSION'} = "Auto";
$ENV{'S3_USE_HTTP'} = "ON"; $ENV{'S3_USE_HTTP'} = "ON";
$ENV{'S3_SSL_NO_VERIFY'} = "OFF";
$ENV{'S3_PROVIDER'} = "Default";
} }
else else
{ {
...@@ -62,6 +64,17 @@ else ...@@ -62,6 +64,17 @@ else
{ {
$ENV{'S3_USE_HTTP'} = "OFF"; $ENV{'S3_USE_HTTP'} = "OFF";
} }
if (!$ENV{'S3_SSL_NO_VERIFY'})
{
$ENV{'S3_SSL_NO_VERIFY'} = "OFF";
}
if (!$ENV{'S3_PROVIDER'})
{
$ENV{'S3_PROVIDER'} = "Default";
}
} }
bless { }; bless { };
...@@ -43,7 +43,10 @@ static const char *opt_database; ...@@ -43,7 +43,10 @@ static const char *opt_database;
static const char *opt_s3_bucket="MariaDB"; static const char *opt_s3_bucket="MariaDB";
static my_bool opt_compression, opt_verbose, opt_force, opt_s3_debug; static my_bool opt_compression, opt_verbose, opt_force, opt_s3_debug;
static my_bool opt_s3_use_http; static my_bool opt_s3_use_http;
static my_bool opt_s3_ssl_no_verify;
static my_bool opt_s3_no_content_type;
static ulong opt_operation= OP_IMPOSSIBLE, opt_protocol_version= 1; static ulong opt_operation= OP_IMPOSSIBLE, opt_protocol_version= 1;
static ulong opt_provider= 0;
static ulong opt_block_size; static ulong opt_block_size;
static ulong opt_s3_port; static ulong opt_s3_port;
static char **default_argv=0; static char **default_argv=0;
...@@ -75,6 +78,13 @@ static struct my_option my_long_options[] = ...@@ -75,6 +78,13 @@ static struct my_option my_long_options[] =
{"s3_use_http", 'P', "If true, force use of HTTP protocol", {"s3_use_http", 'P', "If true, force use of HTTP protocol",
(char**) &opt_s3_use_http, (char**) &opt_s3_use_http, (char**) &opt_s3_use_http, (char**) &opt_s3_use_http,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"s3_ssl_no_verify", 's', "If true, verification of the S3 endpoint SSL "
"certificate is disabled",
(char**) &opt_s3_ssl_no_verify, (char**) &opt_s3_ssl_no_verify,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"s3_no_content_type", 'n', "If true, disables the Content-Type header",
(char**) &opt_s3_no_content_type, (char**) &opt_s3_no_content_type,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"compress", 'c', "Use compression", &opt_compression, &opt_compression, {"compress", 'c', "Use compression", &opt_compression, &opt_compression,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"op", 'o', "Operation to execute. One of 'from_s3', 'to_s3' or " {"op", 'o', "Operation to execute. One of 'from_s3', 'to_s3' or "
...@@ -94,6 +104,10 @@ static struct my_option my_long_options[] = ...@@ -94,6 +104,10 @@ static struct my_option my_long_options[] =
"Note: \"Legacy\", \"Original\" and \"Amazon\" are deprecated.", "Note: \"Legacy\", \"Original\" and \"Amazon\" are deprecated.",
&opt_protocol_version, &opt_protocol_version, &s3_protocol_typelib, &opt_protocol_version, &opt_protocol_version, &s3_protocol_typelib,
GET_ENUM, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, GET_ENUM, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"s3_provider", 'R', "Enable S3 provider specific compatibility tweaks "
"\"Default\", \"Amazon\", or \"Huawei\".",
&opt_provider, &opt_provider, &s3_provider_typelib,
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,
...@@ -216,6 +230,19 @@ int main(int argc, char** argv) ...@@ -216,6 +230,19 @@ int main(int argc, char** argv)
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);
/* Provider specific overrides */
switch (opt_provider)
{
case 0: /* Default */
break;
case 1: /* Amazon */
opt_protocol_version = 5;
break;
case 2: /* Huawei */
opt_s3_no_content_type = 1;
break;
}
if (opt_protocol_version > 2) if (opt_protocol_version > 2)
{ {
uint8_t protocol_version; uint8_t protocol_version;
...@@ -241,6 +268,11 @@ int main(int argc, char** argv) ...@@ -241,6 +268,11 @@ int main(int argc, char** argv)
if (opt_s3_use_http) if (opt_s3_use_http)
ms3_set_option(global_s3_client, MS3_OPT_USE_HTTP, NULL); ms3_set_option(global_s3_client, MS3_OPT_USE_HTTP, NULL);
if (opt_s3_ssl_no_verify)
ms3_set_option(global_s3_client, MS3_OPT_DISABLE_SSL_VERIFY, NULL);
if (opt_s3_no_content_type)
ms3_set_option(global_s3_client, MS3_OPT_NO_CONTENT_TYPE, NULL);
for (; *argv ; argv++) for (; *argv ; argv++)
{ {
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
#define DEFAULT_AWS_HOST_NAME "s3.amazonaws.com" #define DEFAULT_AWS_HOST_NAME "s3.amazonaws.com"
static PAGECACHE s3_pagecache; static PAGECACHE s3_pagecache;
static ulong s3_block_size, s3_protocol_version; static ulong s3_block_size, s3_protocol_version, s3_provider;
static ulong s3_pagecache_division_limit, s3_pagecache_age_threshold; static ulong s3_pagecache_division_limit, s3_pagecache_age_threshold;
static ulong s3_pagecache_file_hash_size; static ulong s3_pagecache_file_hash_size;
static ulonglong s3_pagecache_buffer_size; static ulonglong s3_pagecache_buffer_size;
...@@ -86,6 +86,8 @@ static char *s3_bucket, *s3_access_key=0, *s3_secret_key=0, *s3_region; ...@@ -86,6 +86,8 @@ static char *s3_bucket, *s3_access_key=0, *s3_secret_key=0, *s3_region;
static char *s3_host_name; static char *s3_host_name;
static int s3_port; static int s3_port;
static my_bool s3_use_http; static my_bool s3_use_http;
static my_bool s3_ssl_no_verify;
static my_bool s3_no_content_type;
static char *s3_tmp_access_key=0, *s3_tmp_secret_key=0; static char *s3_tmp_access_key=0, *s3_tmp_secret_key=0;
static my_bool s3_debug= 0, s3_slave_ignore_updates= 0; static my_bool s3_debug= 0, s3_slave_ignore_updates= 0;
static my_bool s3_replicate_alter_as_create_select= 0; static my_bool s3_replicate_alter_as_create_select= 0;
...@@ -222,6 +224,10 @@ static MYSQL_SYSVAR_BOOL(use_http, s3_use_http, ...@@ -222,6 +224,10 @@ static MYSQL_SYSVAR_BOOL(use_http, s3_use_http,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"If true, force use of HTTP protocol", "If true, force use of HTTP protocol",
NULL /*check*/, NULL /*update*/, 0 /*default*/); NULL /*check*/, NULL /*update*/, 0 /*default*/);
static MYSQL_SYSVAR_BOOL(ssl_no_verify, s3_ssl_no_verify,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"If true, SSL certificate verifiction for the S3 endpoint is disabled",
NULL, NULL, 0);
static MYSQL_SYSVAR_STR(access_key, s3_tmp_access_key, static MYSQL_SYSVAR_STR(access_key, s3_tmp_access_key,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY | PLUGIN_VAR_MEMALLOC, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY | PLUGIN_VAR_MEMALLOC,
"AWS access key", "AWS access key",
...@@ -234,6 +240,15 @@ static MYSQL_SYSVAR_STR(region, s3_region, ...@@ -234,6 +240,15 @@ static MYSQL_SYSVAR_STR(region, s3_region,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"AWS region", "AWS region",
0, 0, ""); 0, 0, "");
static MYSQL_SYSVAR_BOOL(no_content_type, s3_no_content_type,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"If true, disables the Content-Type header, required for some providers",
NULL, NULL, 0);
static MYSQL_SYSVAR_ENUM(provider, s3_provider,
PLUGIN_VAR_RQCMDARG,
"Enable S3 provider specific compatibility tweaks "
"\"Default\", \"Amazon\", or \"Huawei\". ",
NULL, NULL, 0, &s3_provider_typelib);
ha_create_table_option s3_table_option_list[]= ha_create_table_option s3_table_option_list[]=
{ {
...@@ -320,6 +335,9 @@ static my_bool s3_info_init(S3_INFO *info) ...@@ -320,6 +335,9 @@ static my_bool s3_info_init(S3_INFO *info)
lex_string_set(&info->host_name, s3_host_name); lex_string_set(&info->host_name, s3_host_name);
info->port= s3_port; info->port= s3_port;
info->use_http= s3_use_http; info->use_http= s3_use_http;
info->ssl_no_verify= s3_ssl_no_verify;
info->no_content_type = s3_no_content_type;
info->provider= s3_provider;
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);
lex_string_set(&info->region, s3_region); lex_string_set(&info->region, s3_region);
...@@ -1121,12 +1139,15 @@ static struct st_mysql_sys_var* system_variables[]= { ...@@ -1121,12 +1139,15 @@ static struct st_mysql_sys_var* system_variables[]= {
MYSQL_SYSVAR(host_name), MYSQL_SYSVAR(host_name),
MYSQL_SYSVAR(port), MYSQL_SYSVAR(port),
MYSQL_SYSVAR(use_http), MYSQL_SYSVAR(use_http),
MYSQL_SYSVAR(ssl_no_verify),
MYSQL_SYSVAR(bucket), MYSQL_SYSVAR(bucket),
MYSQL_SYSVAR(access_key), MYSQL_SYSVAR(access_key),
MYSQL_SYSVAR(secret_key), MYSQL_SYSVAR(secret_key),
MYSQL_SYSVAR(region), MYSQL_SYSVAR(region),
MYSQL_SYSVAR(slave_ignore_updates), MYSQL_SYSVAR(slave_ignore_updates),
MYSQL_SYSVAR(replicate_alter_as_create_select), MYSQL_SYSVAR(replicate_alter_as_create_select),
MYSQL_SYSVAR(no_content_type),
MYSQL_SYSVAR(provider),
NULL NULL
}; };
......
Subproject commit a81724ab07bd28e16bf431419c24b6362d5894fc Subproject commit 5e6aa32f96ebdbcaf32b90d6182685156f8198b5
...@@ -43,6 +43,9 @@ static const char *protocol_types[]= {"Auto", "Original", "Amazon", "Legacy", "P ...@@ -43,6 +43,9 @@ static const char *protocol_types[]= {"Auto", "Original", "Amazon", "Legacy", "P
TYPELIB s3_protocol_typelib= {array_elements(protocol_types)-1,"", TYPELIB s3_protocol_typelib= {array_elements(protocol_types)-1,"",
protocol_types, NULL}; protocol_types, NULL};
static const char *providers[]= {"Default", "Amazon", "Huawei", NullS};
TYPELIB s3_provider_typelib = {array_elements(providers)-1,"",providers, NULL};
/****************************************************************************** /******************************************************************************
Allocations handler for libmarias3 Allocations handler for libmarias3
To be removed when we do the init allocation in mysqld.cc To be removed when we do the init allocation in mysqld.cc
...@@ -154,6 +157,20 @@ ms3_st *s3_open_connection(S3_INFO *s3) ...@@ -154,6 +157,20 @@ 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;
} }
/* Provider specific overrides */
switch (s3->provider)
{
case 0: /* Default */
break;
case 1: /* Amazon */
s3->protocol_version = 5;
break;
case 2: /* Huawei */
s3->no_content_type = 1;
break;
}
if (s3->protocol_version > 2) if (s3->protocol_version > 2)
{ {
uint8_t protocol_version; uint8_t protocol_version;
...@@ -177,6 +194,12 @@ ms3_st *s3_open_connection(S3_INFO *s3) ...@@ -177,6 +194,12 @@ ms3_st *s3_open_connection(S3_INFO *s3)
if (s3->use_http) if (s3->use_http)
ms3_set_option(s3_client, MS3_OPT_USE_HTTP, NULL); ms3_set_option(s3_client, MS3_OPT_USE_HTTP, NULL);
if (s3->ssl_no_verify)
ms3_set_option(s3_client, MS3_OPT_DISABLE_SSL_VERIFY, NULL);
if (s3->no_content_type)
ms3_set_option(s3_client, MS3_OPT_NO_CONTENT_TYPE, NULL);
return s3_client; return s3_client;
} }
......
...@@ -38,6 +38,7 @@ extern struct s3_func { ...@@ -38,6 +38,7 @@ extern struct s3_func {
} s3f; } s3f;
extern TYPELIB s3_protocol_typelib; extern TYPELIB s3_protocol_typelib;
extern TYPELIB s3_provider_typelib;
/* Store information about a s3 connection */ /* Store information about a s3 connection */
...@@ -47,6 +48,8 @@ struct s3_info ...@@ -47,6 +48,8 @@ struct s3_info
LEX_CSTRING access_key, secret_key, region, bucket, host_name; LEX_CSTRING access_key, secret_key, region, bucket, host_name;
int port; // 0 means 'Use default' int port; // 0 means 'Use default'
my_bool use_http; my_bool use_http;
my_bool ssl_no_verify;
my_bool no_content_type;
/* Will be set by caller or by ma_open() */ /* Will be set by caller or by ma_open() */
LEX_CSTRING database, table; LEX_CSTRING database, table;
...@@ -63,6 +66,8 @@ struct s3_info ...@@ -63,6 +66,8 @@ struct s3_info
/* Protocol for the list bucket API call. 1 for Amazon, 2 for some others */ /* Protocol for the list bucket API call. 1 for Amazon, 2 for some others */
uint8_t protocol_version; uint8_t protocol_version;
uint8_t provider;
}; };
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -270,7 +270,6 @@ int spider_free_conn_alloc( ...@@ -270,7 +270,6 @@ int spider_free_conn_alloc(
conn->db_conn = NULL; conn->db_conn = NULL;
} }
spider_conn_done(conn); spider_conn_done(conn);
DBUG_ASSERT(!conn->mta_conn_mutex_file_pos.file_name);
pthread_mutex_destroy(&conn->mta_conn_mutex); pthread_mutex_destroy(&conn->mta_conn_mutex);
conn->default_database.free(); conn->default_database.free();
DBUG_RETURN(0); DBUG_RETURN(0);
...@@ -1462,10 +1461,6 @@ void spider_conn_clear_queue( ...@@ -1462,10 +1461,6 @@ void spider_conn_clear_queue(
) { ) {
DBUG_ENTER("spider_conn_clear_queue"); DBUG_ENTER("spider_conn_clear_queue");
DBUG_PRINT("info", ("spider conn=%p", conn)); DBUG_PRINT("info", ("spider conn=%p", conn));
/*
conn->queued_connect = FALSE;
conn->queued_ping = FALSE;
*/
conn->queued_trx_isolation = FALSE; conn->queued_trx_isolation = FALSE;
conn->queued_semi_trx_isolation = FALSE; conn->queued_semi_trx_isolation = FALSE;
conn->queued_autocommit = FALSE; conn->queued_autocommit = FALSE;
...@@ -2529,7 +2524,6 @@ void *spider_bg_conn_action( ...@@ -2529,7 +2524,6 @@ void *spider_bg_conn_action(
) { ) {
ulong sql_type; ulong sql_type;
sql_type= SPIDER_SQL_TYPE_SELECT_SQL | SPIDER_SQL_TYPE_TMP_SQL; sql_type= SPIDER_SQL_TYPE_SELECT_SQL | SPIDER_SQL_TYPE_TMP_SQL;
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (spider->use_fields) if (spider->use_fields)
{ {
if ((error_num = dbton_handler->set_sql_for_exec(sql_type, if ((error_num = dbton_handler->set_sql_for_exec(sql_type,
...@@ -2548,17 +2542,12 @@ void *spider_bg_conn_action( ...@@ -2548,17 +2542,12 @@ void *spider_bg_conn_action(
strmov(result_list->bgs_error_msg, spider_stmt_da_message(thd)); strmov(result_list->bgs_error_msg, spider_stmt_da_message(thd));
} }
} }
pthread_mutex_lock(&conn->mta_conn_mutex); /* todo: is it ok if the following statement is not locked? */
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
sql_type &= ~SPIDER_SQL_TYPE_TMP_SQL; sql_type &= ~SPIDER_SQL_TYPE_TMP_SQL;
DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
if (!result_list->bgs_error) if (!result_list->bgs_error)
{ {
conn->need_mon = &spider->need_mons[conn->link_idx]; spider_lock_before_query(conn, &spider->need_mons[conn->link_idx]);
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if (!(result_list->bgs_error = if (!(result_list->bgs_error =
spider_db_set_names(spider, conn, conn->link_idx))) spider_db_set_names(spider, conn, conn->link_idx)))
{ {
...@@ -2627,15 +2616,7 @@ void *spider_bg_conn_action( ...@@ -2627,15 +2616,7 @@ void *spider_bg_conn_action(
strmov(result_list->bgs_error_msg, strmov(result_list->bgs_error_msg,
spider_stmt_da_message(thd)); spider_stmt_da_message(thd));
} }
DBUG_ASSERT(conn->mta_conn_mutex_lock_already); spider_unlock_after_query(conn, 0);
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
} else {
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
} }
} else { } else {
spider->connection_ids[conn->link_idx] = conn->connection_id; spider->connection_ids[conn->link_idx] = conn->connection_id;
...@@ -2710,26 +2691,14 @@ void *spider_bg_conn_action( ...@@ -2710,26 +2691,14 @@ void *spider_bg_conn_action(
{ {
DBUG_PRINT("info",("spider bg exec sql start")); DBUG_PRINT("info",("spider bg exec sql start"));
spider = (ha_spider*) conn->bg_target; spider = (ha_spider*) conn->bg_target;
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); spider_lock_before_query(conn, &spider->need_mons[conn->link_idx]);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &spider->need_mons[conn->link_idx];
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
*conn->bg_error_num = spider_db_query_with_set_names( *conn->bg_error_num = spider_db_query_with_set_names(
conn->bg_sql_type, conn->bg_sql_type,
spider, spider,
conn, conn,
conn->link_idx conn->link_idx
); );
DBUG_ASSERT(conn->mta_conn_mutex_lock_already); spider_unlock_after_query(conn, 0);
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
conn->bg_exec_sql = FALSE; conn->bg_exec_sql = FALSE;
continue; continue;
} }
...@@ -3996,3 +3965,42 @@ void spider_free_ipport_conn(void *info) ...@@ -3996,3 +3965,42 @@ void spider_free_ipport_conn(void *info)
} }
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
void spider_lock_before_query(SPIDER_CONN *conn, int *need_mon)
{
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
conn->need_mon = need_mon;
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
}
int spider_unlock_after_query(SPIDER_CONN *conn, int ret)
{
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
pthread_mutex_unlock(&conn->mta_conn_mutex);
return ret;
}
int spider_unlock_after_query_1(SPIDER_CONN *conn)
{
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
return spider_db_errorno(conn);
}
int spider_unlock_after_query_2(SPIDER_CONN *conn, ha_spider *spider, int link_idx, TABLE *table)
{
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
return spider_db_store_result(spider, link_idx, table);
}
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#define SPIDER_SIMPLE_RECORDS 3 #define SPIDER_SIMPLE_RECORDS 3
#define SPIDER_SIMPLE_CHECKSUM_TABLE 4 #define SPIDER_SIMPLE_CHECKSUM_TABLE 4
struct TABLE;
/* /*
The SPIDER_CONN_LOOP_CHECK has been added to the loop_check queue to The SPIDER_CONN_LOOP_CHECK has been added to the loop_check queue to
check for self-reference. check for self-reference.
...@@ -437,3 +439,11 @@ SPIDER_CONN* spider_get_conn_from_idle_connection ...@@ -437,3 +439,11 @@ SPIDER_CONN* spider_get_conn_from_idle_connection
int *error_num int *error_num
); );
void spider_free_ipport_conn(void *info); void spider_free_ipport_conn(void *info);
void spider_lock_before_query(SPIDER_CONN *conn, int *need_mon);
int spider_unlock_after_query(SPIDER_CONN *conn, int ret);
int spider_unlock_after_query_1(SPIDER_CONN *conn);
int spider_unlock_after_query_2(SPIDER_CONN *conn, ha_spider *spider, int link_idx, TABLE *table);
This diff is collapsed.
This diff is collapsed.
...@@ -489,7 +489,6 @@ SPIDER_CONN *spider_udf_direct_sql_create_conn( ...@@ -489,7 +489,6 @@ SPIDER_CONN *spider_udf_direct_sql_create_conn(
DBUG_RETURN(conn); DBUG_RETURN(conn);
error: error:
DBUG_ASSERT(!conn->mta_conn_mutex_file_pos.file_name);
error_too_many_ipport_count: error_too_many_ipport_count:
spider_conn_done(conn); spider_conn_done(conn);
error_conn_init: error_conn_init:
......
...@@ -1180,27 +1180,15 @@ static int spider_send_query( ...@@ -1180,27 +1180,15 @@ static int spider_send_query(
} }
} else } else
{ {
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if ((error_num = dbton_hdl->set_sql_for_exec( if ((error_num = dbton_hdl->set_sql_for_exec(
SPIDER_SQL_TYPE_SELECT_SQL, link_idx, link_idx_chain))) SPIDER_SQL_TYPE_SELECT_SQL, link_idx, link_idx_chain)))
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
pthread_mutex_lock(&conn->mta_conn_mutex); spider_lock_before_query(conn, &spider->need_mons[link_idx]);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &spider->need_mons[link_idx];
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(spider, conn, if ((error_num = spider_db_set_names(spider, conn,
link_idx))) link_idx)))
if ((error_num = spider_db_set_names(spider, conn, link_idx))) if ((error_num = spider_db_set_names(spider, conn, link_idx)))
{ {
DBUG_ASSERT(conn->mta_conn_mutex_lock_already); spider_unlock_after_query(conn, 0);
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
if (spider->need_mons[link_idx]) if (spider->need_mons[link_idx])
error_num = fields->ping_table_mon_from_table(link_idx_chain); error_num = fields->ping_table_mon_from_table(link_idx_chain);
if ((error_num = spider->check_error_mode_eof(error_num)) == if ((error_num = spider->check_error_mode_eof(error_num)) ==
...@@ -1218,11 +1206,7 @@ static int spider_send_query( ...@@ -1218,11 +1206,7 @@ static int spider_send_query(
spider->result_list.quick_mode, spider->result_list.quick_mode,
&spider->need_mons[link_idx])) &spider->need_mons[link_idx]))
{ {
DBUG_ASSERT(conn->mta_conn_mutex_lock_already); error_num= spider_unlock_after_query_1(conn);
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
if (spider->need_mons[link_idx]) if (spider->need_mons[link_idx])
error_num = fields->ping_table_mon_from_table(link_idx_chain); error_num = fields->ping_table_mon_from_table(link_idx_chain);
if ((error_num = spider->check_error_mode_eof(error_num)) == if ((error_num = spider->check_error_mode_eof(error_num)) ==
...@@ -1234,13 +1218,9 @@ static int spider_send_query( ...@@ -1234,13 +1218,9 @@ static int spider_send_query(
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
} }
spider->connection_ids[link_idx] = conn->connection_id; spider->connection_ids[link_idx] = conn->connection_id;
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
if (fields->is_first_link_ok_chain(link_idx_chain)) if (fields->is_first_link_ok_chain(link_idx_chain))
{ {
if ((error_num = spider_db_store_result(spider, link_idx, table))) if ((error_num = spider_unlock_after_query_2(conn, spider, link_idx, table)))
{ {
if (error_num != HA_ERR_END_OF_FILE && spider->need_mons[link_idx]) if (error_num != HA_ERR_END_OF_FILE && spider->need_mons[link_idx])
error_num = fields->ping_table_mon_from_table(link_idx_chain); error_num = fields->ping_table_mon_from_table(link_idx_chain);
...@@ -1257,8 +1237,7 @@ static int spider_send_query( ...@@ -1257,8 +1237,7 @@ static int spider_send_query(
} else } else
{ {
spider_db_discard_result(spider, link_idx, conn); spider_db_discard_result(spider, link_idx, conn);
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); spider_unlock_after_query(conn, 0);
pthread_mutex_unlock(&conn->mta_conn_mutex);
} }
} }
} }
......
...@@ -452,11 +452,6 @@ enum spider_malloc_id { ...@@ -452,11 +452,6 @@ enum spider_malloc_id {
#define SPIDER_CONN_RESTORE_DASTATUS_AND_RESET_TMP_ERROR_NUM \ #define SPIDER_CONN_RESTORE_DASTATUS_AND_RESET_TMP_ERROR_NUM \
if (thd && conn->error_mode) {SPIDER_RESTORE_DASTATUS; tmp_error_num = 0;} if (thd && conn->error_mode) {SPIDER_RESTORE_DASTATUS; tmp_error_num = 0;}
#define SPIDER_SET_FILE_POS(A) \
{(A)->thd = current_thd; (A)->func_name = __func__; (A)->file_name = __FILE__; (A)->line_no = __LINE__;}
#define SPIDER_CLEAR_FILE_POS(A) \
{DBUG_PRINT("info", ("spider thd=%p func_name=%s file_name=%s line_no=%lu", (A)->thd, (A)->func_name ? (A)->func_name : "NULL", (A)->file_name ? (A)->file_name : "NULL", (A)->line_no)); (A)->thd = NULL; (A)->func_name = NULL; (A)->file_name = NULL; (A)->line_no = 0;}
class ha_spider; class ha_spider;
typedef struct st_spider_share SPIDER_SHARE; typedef struct st_spider_share SPIDER_SHARE;
typedef struct st_spider_table_mon_list SPIDER_TABLE_MON_LIST; typedef struct st_spider_table_mon_list SPIDER_TABLE_MON_LIST;
...@@ -478,14 +473,6 @@ typedef struct st_spider_thread ...@@ -478,14 +473,6 @@ typedef struct st_spider_thread
volatile SPIDER_SHARE *queue_last; volatile SPIDER_SHARE *queue_last;
} SPIDER_THREAD; } SPIDER_THREAD;
typedef struct st_spider_file_pos
{
THD *thd;
const char *func_name;
const char *file_name;
ulong line_no;
} SPIDER_FILE_POS;
typedef struct st_spider_link_for_hash typedef struct st_spider_link_for_hash
{ {
ha_spider *spider; ha_spider *spider;
...@@ -614,7 +601,6 @@ typedef struct st_spider_conn ...@@ -614,7 +601,6 @@ typedef struct st_spider_conn
pthread_mutex_t mta_conn_mutex; pthread_mutex_t mta_conn_mutex;
volatile bool mta_conn_mutex_lock_already; volatile bool mta_conn_mutex_lock_already;
volatile bool mta_conn_mutex_unlock_later; volatile bool mta_conn_mutex_unlock_later;
SPIDER_FILE_POS mta_conn_mutex_file_pos;
uint join_trx; uint join_trx;
int trx_isolation; int trx_isolation;
bool semi_trx_isolation_chk; bool semi_trx_isolation_chk;
......
...@@ -5473,22 +5473,10 @@ int spider_open_all_tables( ...@@ -5473,22 +5473,10 @@ int spider_open_all_tables(
} }
conn->error_mode &= spider_param_error_read_mode(thd, 0); conn->error_mode &= spider_param_error_read_mode(thd, 0);
conn->error_mode &= spider_param_error_write_mode(thd, 0); conn->error_mode &= spider_param_error_write_mode(thd, 0);
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); spider_lock_before_query(conn, &mon_val);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &mon_val;
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_before_query(conn, &mon_val))) if ((error_num = spider_db_before_query(conn, &mon_val)))
{ {
DBUG_ASSERT(conn->mta_conn_mutex_lock_already); spider_unlock_after_query(conn, 0);
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
spider_sys_index_end(table_tables); spider_sys_index_end(table_tables);
spider_sys_close_table(thd, &open_tables_backup); spider_sys_close_table(thd, &open_tables_backup);
spider_free_tmp_dbton_share(&tmp_share); spider_free_tmp_dbton_share(&tmp_share);
...@@ -5496,12 +5484,7 @@ int spider_open_all_tables( ...@@ -5496,12 +5484,7 @@ int spider_open_all_tables(
free_root(&mem_root, MYF(0)); free_root(&mem_root, MYF(0));
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
} }
DBUG_ASSERT(conn->mta_conn_mutex_lock_already); spider_unlock_after_query(conn, 0);
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
if (lock && spider_param_use_snapshot_with_flush_tables(thd) == 2) if (lock && spider_param_use_snapshot_with_flush_tables(thd) == 2)
{ {
......
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