| 1 | /* Copyright (C) 2019 MariaDB corporation |
| 2 | |
| 3 | This program is free software; you can redistribute it and/or modify |
| 4 | it under the terms of the GNU General Public License as published by |
| 5 | the Free Software Foundation; version 2 of the License. |
| 6 | |
| 7 | This program is distributed in the hope that it will be useful, |
| 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | GNU General Public License for more details. |
| 11 | |
| 12 | You should have received a copy of the GNU General Public License |
| 13 | along with this program; if not, write to the Free Software Foundation, |
| 14 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ |
| 15 | |
| 16 | /* |
| 17 | Allow copying of Aria tables to and from S3 and also delete them from S3 |
| 18 | */ |
| 19 | |
| 20 | #define VERcxx . . $ `storage/maria/aria_s3_copy.cc:20:9`! "1.0" |
| 21 | #include <my_global.h>cxx . . $ `<file>/include/my_global.h`/ |
| 22 | #include <m_string.h>cxx . . $ `<file>/include/m_string.h`/ |
| 23 | #include "maria_def.h"cxx . . $ `<file>/storage/maria/maria_def.h`/ |
| 24 | #include <aria_backup.h>cxx . . $ `<file>/include/aria_backup.h`/ |
| 25 | #include <my_getopt.h>cxx . . $ `<file>/include/my_getopt.h`/ |
| 26 | #include <my_check_opt.h>cxx . . $ `<file>/include/my_check_opt.h`/ |
| 27 | #include <mysys_err.h>cxx . . $ `<file>/include/mysys_err.h`/ |
| 28 | #include <mysqld_error.h>cxx . . $ `<file>/build/include/mysqld_error.h`/ |
| 29 | #include <zlib.h> |
| 30 | #include <libmarias3/marias3.h>cxx . . $ `<file>/storage/maria/libmarias3/libmarias3/marias3.h`/ |
| 31 | #include "s3_func.h"cxx . . $ `<file>/storage/maria/s3_func.h`/ |
| 32 | #include <welcome_copyright_notice.h>cxx . . $ `<file>/include/welcome_copyright_notice.h`/ |
| 33 | |
| 34 | static const char *op_typescxx . . $ op_types.[]= {"to_s3", "from_s3", "delete_from_s3", NullScxx . . $ `include/my_global.h:844:9`!}; |
| 35 | static TYPELIB op_typelibcxx . . $ op_typelib.= CREATE_TYPELIB_FORcxx . . $ `include/typelib.h:37:9`!(op_types); |
| 36 | #define OP_IMPOSSIBLEcxx . . $ `storage/maria/aria_s3_copy.cc:36:9`! array_elementscxx . . $ `include/my_global.h:472:9`!(op_types) |
| 37 | |
| 38 | static const char *load_default_groupscxx . . $ load_default_groups.[]= { "aria_s3_copy", 0 }; |
| 39 | static const char *opt_s3_access_keycxx . . $ opt_s3_access_key., *opt_s3_secret_keycxx . . $ opt_s3_secret_key.; |
| 40 | static const char *opt_s3_regioncxx . . $ opt_s3_region.="eu-north-1"; |
| 41 | static const char *opt_s3_host_namecxx . . $ opt_s3_host_name.= DEFAULT_AWS_HOST_NAMEcxx . . $ `storage/maria/s3_func.h:26:9`!; |
| 42 | static const char *opt_databasecxx . . $ opt_database.; |
| 43 | static const char *opt_s3_bucketcxx . . $ opt_s3_bucket.="MariaDB"; |
| 44 | static my_boolcxx . . $ my_bool# opt_compressioncxx . . $ opt_compression., opt_verbosecxx . . $ opt_verbose., opt_forcecxx . . $ opt_force., opt_s3_debugcxx . . $ opt_s3_debug.; |
| 45 | static my_boolcxx . . $ my_bool# opt_s3_use_httpcxx . . $ opt_s3_use_http.; |
| 46 | static my_boolcxx . . $ my_bool# opt_s3_ssl_no_verifycxx . . $ opt_s3_ssl_no_verify.; |
| 47 | static my_boolcxx . . $ my_bool# opt_s3_no_content_typecxx . . $ opt_s3_no_content_type.; |
| 48 | static ulong opt_operationcxx . . $ opt_operation.= OP_IMPOSSIBLEcxx . . $ `storage/maria/aria_s3_copy.cc:36:9`!, opt_protocol_versioncxx . . $ opt_protocol_version.= 1; |
| 49 | static ulong opt_providercxx . . $ opt_provider.= 0; |
| 50 | static ulong opt_block_sizecxx . . $ opt_block_size.; |
| 51 | static ulong opt_s3_portcxx . . $ opt_s3_port.; |
| 52 | static char **default_argvcxx . . $ default_argv.=0; |
| 53 | static ms3_st *global_s3_clientcxx . . $ global_s3_client.= 0; |
| 54 | |
| 55 | |
| 56 | static struct my_option my_long_optionscxx . . $ my_long_options.[] = |
| 57 | { |
| 58 | {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARGcxx . . $ `include/my_getopt.h:28:9`!, NO_ARG, 0, |
| 59 | 0, 0, 0, 0, 0}, |
| 60 | {"s3_access_key", 'k', "AWS access key ID", |
| 61 | (char**) &opt_s3_access_keycxx . . $ opt_s3_access_key., (char**) &opt_s3_access_keycxx . . $ opt_s3_access_key., 0, |
| 62 | GET_STRcxx . . $ `include/my_getopt.h:36:9`!, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
| 63 | {"s3_region", 'r', "AWS region", |
| 64 | (char**) &opt_s3_regioncxx . . $ opt_s3_region., (char**) &opt_s3_regioncxx . . $ opt_s3_region., 0, |
| 65 | GET_STRcxx . . $ `include/my_getopt.h:36:9`!, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
| 66 | {"s3_secret_key", 'K', "AWS secret access key ID", |
| 67 | (char**) &opt_s3_secret_keycxx . . $ opt_s3_secret_key., (char**) &opt_s3_secret_keycxx . . $ opt_s3_secret_key., 0, |
| 68 | GET_STRcxx . . $ `include/my_getopt.h:36:9`!, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
| 69 | {"s3_bucket", 'b', "AWS prefix for tables", |
| 70 | (char**) &opt_s3_bucketcxx . . $ opt_s3_bucket., (char**) &opt_s3_bucketcxx . . $ opt_s3_bucket., 0, |
| 71 | GET_STRcxx . . $ `include/my_getopt.h:36:9`!, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
| 72 | {"s3_host_name", 'h', "Host name to S3 provider", |
| 73 | (char**) &opt_s3_host_namecxx . . $ opt_s3_host_name., (char**) &opt_s3_host_namecxx . . $ opt_s3_host_name., 0, |
| 74 | GET_STRcxx . . $ `include/my_getopt.h:36:9`!, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
| 75 | {"s3_port", 'p', "Port number to connect to (0 means use default)", |
| 76 | (char**) &opt_s3_portcxx . . $ opt_s3_port., (char**) &opt_s3_portcxx . . $ opt_s3_port., 0, GET_ULONGcxx . . $ `include/my_getopt.h:33:9`!, REQUIRED_ARG, |
| 77 | 0, 0, 65536, 0, 1, 0 }, |
| 78 | {"s3_use_http", 'P', "If true, force use of HTTP protocol", |
| 79 | (char**) &opt_s3_use_httpcxx . . $ opt_s3_use_http., (char**) &opt_s3_use_httpcxx . . $ opt_s3_use_http., |
| 80 | 0, GET_BOOLcxx . . $ `include/my_getopt.h:29:9`!, NO_ARG, 0, 0, 0, 0, 0, 0}, |
| 81 | {"s3_ssl_no_verify", 's', "If true, verification of the S3 endpoint SSL " |
| 82 | "certificate is disabled", |
| 83 | (char**) &opt_s3_ssl_no_verifycxx . . $ opt_s3_ssl_no_verify., (char**) &opt_s3_ssl_no_verifycxx . . $ opt_s3_ssl_no_verify., |
| 84 | 0, GET_BOOLcxx . . $ `include/my_getopt.h:29:9`!, NO_ARG, 0, 0, 0, 0, 0, 0}, |
| 85 | {"s3_no_content_type", 'n', "If true, disables the Content-Type header", |
| 86 | (char**) &opt_s3_no_content_typecxx . . $ opt_s3_no_content_type., (char**) &opt_s3_no_content_typecxx . . $ opt_s3_no_content_type., |
| 87 | 0, GET_BOOLcxx . . $ `include/my_getopt.h:29:9`!, NO_ARG, 0, 0, 0, 0, 0, 0}, |
| 88 | {"compress", 'c', "Use compression", &opt_compressioncxx . . $ opt_compression., &opt_compressioncxx . . $ opt_compression., |
| 89 | 0, GET_BOOLcxx . . $ `include/my_getopt.h:29:9`!, NO_ARG, 0, 0, 0, 0, 0, 0}, |
| 90 | {"op", 'o', "Operation to execute. One of 'from_s3', 'to_s3' or " |
| 91 | "'delete_from_s3'", |
| 92 | &opt_operationcxx . . $ opt_operation., &opt_operationcxx . . $ opt_operation., &op_typelibcxx . . $ op_typelib., |
| 93 | GET_ENUMcxx . . $ `include/my_getopt.h:39:9`!, REQUIRED_ARG, OP_IMPOSSIBLEcxx . . $ `storage/maria/aria_s3_copy.cc:36:9`!, 0, 0, 0, 0, 0}, |
| 94 | {"database", 'd', |
| 95 | "Database for copied table (second prefix). " |
| 96 | "If not given, the directory of the table file is used", |
| 97 | &opt_databasecxx . . $ opt_database., &opt_databasecxx . . $ opt_database., 0, GET_STRcxx . . $ `include/my_getopt.h:36:9`!, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
| 98 | {"s3_block_size", 'B', "Block size for data/index blocks in s3", |
| 99 | &opt_block_sizecxx . . $ opt_block_size., &opt_block_sizecxx . . $ opt_block_size., 0, GET_ULONGcxx . . $ `include/my_getopt.h:33:9`!, REQUIRED_ARG, |
| 100 | 4*1024*1024, 64*1024, 16*1024*1024, 0, 1024, 0 }, |
| 101 | {"s3_protocol_version", 'L', |
| 102 | "Protocol used to communication with S3. One of \"Auto\", \"Legacy\", " |
| 103 | "\"Original\", \"Amazon\", \"Path\" or \"Domain\". " |
| 104 | "Note: \"Legacy\", \"Original\" and \"Amazon\" are deprecated.", |
| 105 | &opt_protocol_versioncxx . . $ opt_protocol_version., &opt_protocol_versioncxx . . $ opt_protocol_version., &s3_protocol_typelib, |
| 106 | GET_ENUMcxx . . $ `include/my_getopt.h:39:9`!, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
| 107 | {"s3_provider", 'R', "Enable S3 provider specific compatibility tweaks " |
| 108 | "\"Default\", \"Amazon\", or \"Huawei\".", |
| 109 | &opt_providercxx . . $ opt_provider., &opt_providercxx . . $ opt_provider., &s3_provider_typelib, |
| 110 | GET_ENUMcxx . . $ `include/my_getopt.h:39:9`!, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
| 111 | {"force", 'f', "Force copy even if target exists", |
| 112 | &opt_forcecxx . . $ opt_force., &opt_forcecxx . . $ opt_force., 0, GET_BOOLcxx . . $ `include/my_getopt.h:29:9`!, NO_ARG, 0, 0, 0, 0, 0, 0}, |
| 113 | {"verbose", 'v', "Write more information", &opt_verbosecxx . . $ opt_verbose., &opt_verbosecxx . . $ opt_verbose., |
| 114 | 0, GET_BOOLcxx . . $ `include/my_getopt.h:29:9`!, NO_ARG, 0, 0, 0, 0, 0, 0}, |
| 115 | {"version", 'V', "Print version and exit.", |
| 116 | 0, 0, 0, GET_NO_ARGcxx . . $ `include/my_getopt.h:28:9`!, NO_ARG, 0, 0, 0, 0, 0, 0}, |
| 117 | #ifndef DBUG_OFFcxx . . $ `<built-in>:485:9`! |
| 118 | {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", |
| 119 | 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, |
| 120 | #endif |
| 121 | {"s3_debug",0, "Output debug log from marias3 to stdout", |
| 122 | &opt_s3_debugcxx . . $ opt_s3_debug., &opt_s3_debugcxx . . $ opt_s3_debug., 0, GET_BOOLcxx . . $ `include/my_getopt.h:29:9`!, NO_ARG, 0, 0, 0, 0, 0, 0}, |
| 123 | { 0, 0, 0, 0, 0, 0, GET_NO_ARGcxx . . $ `include/my_getopt.h:28:9`!, NO_ARG, 0, 0, 0, 0, 0, 0}, |
| 124 | }; |
| 125 | |
| 126 | |
| 127 | static bool get_database_from_pathcxx . . $ get_database_from_path(ce5fb99c0288e0ff).(char *to, size_t to_length, const char *path); |
| 128 | |
| 129 | |
| 130 | static void usagecxx . . $ usage(49f6e7a06ebc5aa8).(void) |
| 131 | { |
| 132 | print_versioncxx . . $ print_version(49f6e7a06ebc5aa8).(); |
| 133 | puts("\nThis software comes with NO WARRANTY: " |
| 134 | " see the PUBLIC for details.\n"); |
| 135 | puts("Copy an Aria table to and from s3"); |
| 136 | printf("Usage: %s --aws-access-key=# --aws-secret-access-key=# --aws-region=# " |
| 137 | "--op=(from_s3 | to_s3 | delete_from_s3) [OPTIONS] tables[.MAI]\n", |
| 138 | my_progname_short); |
| 139 | print_defaults("my", load_default_groupscxx . . $ load_default_groups.); |
| 140 | puts(""); |
| 141 | my_print_help(my_long_optionscxx . . $ my_long_options.); |
| 142 | my_print_variables(my_long_optionscxx . . $ my_long_options.); |
| 143 | } |
| 144 | |
| 145 | |
| 146 | ATTRIBUTE_NORETURNcxx . . $ `include/my_compiler.h:156:10`! static void my_exitcxx . . $ my_exit(3ca292c338df9bb3).(int exit_code) |
| 147 | { |
| 148 | if (global_s3_clientcxx . . $ global_s3_client.) |
| 149 | { |
| 150 | ms3_deinit(global_s3_clientcxx . . $ global_s3_client.); |
| 151 | global_s3_clientcxx . . $ global_s3_client.= 0; |
| 152 | } |
| 153 | free_defaults(default_argvcxx . . $ default_argv.); |
| 154 | s3_deinit_library(); |
| 155 | my_end(MY_CHECK_ERRORcxx . . $ `include/my_sys.h:101:9`!); |
| 156 | exitcxx . . $ exit(44ed87f96534fad7).(exit_code); |
| 157 | } |
| 158 | |
| 159 | extern "C" my_boolcxx . . $ my_bool# get_one_option(const struct my_option *opt |
| 160 | __attribute__((unused)), |
| 161 | const char *argument, const char *filename) |
| 162 | { |
| 163 | switch (opt->id) { |
| 164 | case 'V': |
| 165 | print_versioncxx . . $ print_version(49f6e7a06ebc5aa8).(); |
| 166 | my_exitcxx . . $ my_exit(3ca292c338df9bb3).(0); |
| 167 | case '?': |
| 168 | usagecxx . . $ usage(49f6e7a06ebc5aa8).(); |
| 169 | my_exitcxx . . $ my_exit(3ca292c338df9bb3).(0); |
| 170 | case '#': |
| 171 | DBUG_SET_INITIALcxx . . $ `include/my_dbug.h:179:9`!(argument ? argument : "d:t:o,/tmp/aria_s3_copy.trace"); |
| 172 | break; |
| 173 | } |
| 174 | return 0; |
| 175 | } |
| 176 | |
| 177 | |
| 178 | static void get_optionscxx . . $ get_options(49aaaae07c8bf5c4).(int *argc, char ***argv) |
| 179 | { |
| 180 | int ho_error; |
| 181 | |
| 182 | load_defaults_or_exitcxx . . $ `include/my_default.h:40:9`!("my", load_default_groups, argc, argv); |
| 183 | default_argvcxx . . $ default_argv.= *argv; |
| 184 | |
| 185 | if ((ho_error=handle_options(argc, argv, my_long_optionscxx . . $ my_long_options., get_one_option))) |
| 186 | my_exitcxx . . $ my_exit(3ca292c338df9bb3).(ho_error); |
| 187 | |
| 188 | if (*argc == 0) |
| 189 | { |
| 190 | usagecxx . . $ usage(49f6e7a06ebc5aa8).(); |
| 191 | my_exitcxx . . $ my_exit(3ca292c338df9bb3).(-1); |
| 192 | } |
| 193 | |
| 194 | if (!opt_s3_access_keycxx . . $ opt_s3_access_key.) |
| 195 | { |
| 196 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "--aws-access-key was not given\n"); |
| 197 | my_exitcxx . . $ my_exit(3ca292c338df9bb3).(-1); |
| 198 | } |
| 199 | if (!opt_s3_secret_keycxx . . $ opt_s3_secret_key.) |
| 200 | { |
| 201 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "--aws-secret-access-key was not given\n"); |
| 202 | my_exitcxx . . $ my_exit(3ca292c338df9bb3).(-1); |
| 203 | } |
| 204 | if (opt_operationcxx . . $ opt_operation. == OP_IMPOSSIBLEcxx . . $ `storage/maria/aria_s3_copy.cc:36:9`!) |
| 205 | { |
| 206 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "You must specify an operation with --op=[from_s3|to_s3|delete_from_s3]\n"); |
| 207 | my_exitcxx . . $ my_exit(3ca292c338df9bb3).(-1); |
| 208 | } |
| 209 | if (opt_s3_debugcxx . . $ opt_s3_debug.) |
| 210 | ms3_debug(1); |
| 211 | |
| 212 | } /* get_options */ |
| 213 | |
| 214 | |
| 215 | int maincxx . . $ main(afcd3168fc1188a4).(int argc, char** argv) |
| 216 | { |
| 217 | MY_INITcxx . . $ `include/my_sys.h:36:9`!(argv[0]); |
| 218 | get_optionscxx . . $ get_options(49aaaae07c8bf5c4).(&argc,(char***) &argv); |
| 219 | size_t block_size= opt_block_sizecxx . . $ opt_block_size.; |
| 220 | |
| 221 | s3_init_library(); |
| 222 | if (!(global_s3_clientcxx . . $ global_s3_client.= ms3_init(opt_s3_access_keycxx . . $ opt_s3_access_key., |
| 223 | opt_s3_secret_keycxx . . $ opt_s3_secret_key., |
| 224 | opt_s3_regioncxx . . $ opt_s3_region., opt_s3_host_namecxx . . $ opt_s3_host_name.))) |
| 225 | { |
| 226 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Can't open connection to S3, error: %d %s", errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!, |
| 227 | ms3_error(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 228 | my_exitcxx . . $ my_exit(3ca292c338df9bb3).(1); |
| 229 | } |
| 230 | |
| 231 | ms3_set_option(global_s3_clientcxx . . $ global_s3_client., MS3_OPT_BUFFER_CHUNK_SIZE, &block_size); |
| 232 | |
| 233 | /* Provider specific overrides */ |
| 234 | switch (opt_providercxx . . $ opt_provider.) |
| 235 | { |
| 236 | case 0: /* Default */ |
| 237 | break; |
| 238 | case 1: /* Amazon */ |
| 239 | opt_protocol_versioncxx . . $ opt_protocol_version. = 5; |
| 240 | break; |
| 241 | case 2: /* Huawei */ |
| 242 | opt_s3_no_content_typecxx . . $ opt_s3_no_content_type. = 1; |
| 243 | break; |
| 244 | } |
| 245 | |
| 246 | if (opt_protocol_versioncxx . . $ opt_protocol_version. > 2) |
| 247 | { |
| 248 | uint8_t protocol_version; |
| 249 | switch (opt_protocol_versioncxx . . $ opt_protocol_version.) |
| 250 | { |
| 251 | case 3: /* Legacy means v1 */ |
| 252 | case 4: /* Path means v1 */ |
| 253 | protocol_version= 1; |
| 254 | break; |
| 255 | case 5: /* Domain means v2 */ |
| 256 | protocol_version= 2; |
| 257 | break; |
| 258 | } |
| 259 | |
| 260 | ms3_set_option(global_s3_clientcxx . . $ global_s3_client., MS3_OPT_FORCE_PROTOCOL_VERSION, |
| 261 | &protocol_version); |
| 262 | } |
| 263 | if (opt_s3_portcxx . . $ opt_s3_port.) |
| 264 | { |
| 265 | int port= (int) opt_s3_portcxx . . $ opt_s3_port.; |
| 266 | ms3_set_option(global_s3_clientcxx . . $ global_s3_client., MS3_OPT_PORT_NUMBER, &port); |
| 267 | } |
| 268 | if (opt_s3_use_httpcxx . . $ opt_s3_use_http.) |
| 269 | ms3_set_option(global_s3_clientcxx . . $ global_s3_client., MS3_OPT_USE_HTTP, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 270 | |
| 271 | if (opt_s3_ssl_no_verifycxx . . $ opt_s3_ssl_no_verify.) |
| 272 | ms3_set_option(global_s3_clientcxx . . $ global_s3_client., MS3_OPT_DISABLE_SSL_VERIFY, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 273 | |
| 274 | if (opt_s3_no_content_typecxx . . $ opt_s3_no_content_type.) |
| 275 | ms3_set_option(global_s3_clientcxx . . $ global_s3_client., MS3_OPT_NO_CONTENT_TYPE, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 276 | |
| 277 | for (; *argv ; argv++) |
| 278 | { |
| 279 | char database[FN_REFLENcxx . . $ `include/my_global.h:603:9`!], table_name[FN_REFLENcxx . . $ `include/my_global.h:603:9`!], *path; |
| 280 | const char *db; |
| 281 | |
| 282 | path= *argv; |
| 283 | |
| 284 | fn_format(table_name, path, "", "", MY_REPLACE_DIRcxx . . $ `include/my_sys.h:113:9`! | MY_REPLACE_EXTcxx . . $ `include/my_sys.h:114:9`!); |
| 285 | |
| 286 | /* Get database from option, path or current directory */ |
| 287 | if (!(db= opt_databasecxx . . $ opt_database.)) |
| 288 | { |
| 289 | if (get_database_from_pathcxx . . $ get_database_from_path(ce5fb99c0288e0ff).(database, sizeof(database), path)) |
| 290 | { |
| 291 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Aborting copying of %s\n", path); |
| 292 | my_exitcxx . . $ my_exit(3ca292c338df9bb3).(-1); |
| 293 | } |
| 294 | db= database; |
| 295 | } |
| 296 | |
| 297 | switch (opt_operationcxx . . $ opt_operation.) { |
| 298 | case 0: |
| 299 | /* Don't copy .frm file for partioned table */ |
| 300 | if (aria_copy_to_s3(global_s3_clientcxx . . $ global_s3_client., opt_s3_bucketcxx . . $ opt_s3_bucket., path, |
| 301 | db, table_name, opt_block_sizecxx . . $ opt_block_size., opt_compressioncxx . . $ opt_compression., |
| 302 | opt_forcecxx . . $ opt_force., opt_verbosecxx . . $ opt_verbose., !strstr(table_name, "#P#"))) |
| 303 | { |
| 304 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Aborting copying of %s\n", path); |
| 305 | my_exitcxx . . $ my_exit(3ca292c338df9bb3).(-1); |
| 306 | } |
| 307 | break; |
| 308 | case 1: |
| 309 | if (aria_copy_from_s3(global_s3_clientcxx . . $ global_s3_client., opt_s3_bucketcxx . . $ opt_s3_bucket., path, |
| 310 | db, opt_compressioncxx . . $ opt_compression., opt_forcecxx . . $ opt_force., opt_verbosecxx . . $ opt_verbose.)) |
| 311 | { |
| 312 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Aborting copying of %s\n", path); |
| 313 | my_exitcxx . . $ my_exit(3ca292c338df9bb3).(-1); |
| 314 | } |
| 315 | break; |
| 316 | case 2: |
| 317 | if (aria_delete_from_s3(global_s3_clientcxx . . $ global_s3_client., opt_s3_bucketcxx . . $ opt_s3_bucket., db, |
| 318 | table_name, opt_verbosecxx . . $ opt_verbose.)) |
| 319 | { |
| 320 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Aborting copying of %s\n", path); |
| 321 | my_exitcxx . . $ my_exit(3ca292c338df9bb3).(-1); |
| 322 | } |
| 323 | break; |
| 324 | } |
| 325 | } |
| 326 | my_exitcxx . . $ my_exit(3ca292c338df9bb3).(0); |
| 327 | return 0; |
| 328 | } |
| 329 | |
| 330 | |
| 331 | /** |
| 332 | Calculate database name base on path of Aria file |
| 333 | |
| 334 | @return 0 ok |
| 335 | @return 1 error |
| 336 | */ |
| 337 | |
| 338 | static bool get_database_from_pathcxx . . $ get_database_from_path(ce5fb99c0288e0ff).(char *to, size_t to_length, |
| 339 | const char *path) |
| 340 | { |
| 341 | S3_INFO s3; |
| 342 | if (!set_database_and_table_from_path(&s3, path)) |
| 343 | { |
| 344 | strmake(to, s3.databasecxx . . $ s3_info#database..str, MY_MINcxx . . $ `include/my_global.h:1108:9`!(s3.database.length, to_length-1)); |
| 345 | return 0; |
| 346 | } |
| 347 | |
| 348 | if (my_getwd(to, to_length-1, MYFcxx . . $ `include/my_global.h:986:9`!(MY_WMEcxx . . $ `include/my_sys.h:57:9`!))) |
| 349 | return 1; |
| 350 | return get_database_from_pathcxx . . $ get_database_from_path(ce5fb99c0288e0ff).(to, to_length, to); |
| 351 | } |
| 352 | |
| 353 | |
| 354 | #include "ma_check_standalone.h"cxx . . $ `<file>/storage/maria/ma_check_standalone.h`/ |
| 355 | |
| 356 | /* |
| 357 | Declare all symbols from libmyisam.a, to ensure that we don't have |
| 358 | to include the library as it pulls in ha_myisam.cc |
| 359 | */ |
| 360 | |
| 361 | const char *ft_boolean_syntaxcxx . . $ ft_boolean_syntax.= 0; |
| 362 | ulong ft_min_word_lencxx . . $ ft_min_word_len.=0, ft_max_word_lencxx . . $ ft_max_word_len.=0; |
| 363 | const HA_KEYSEG ft_keysegscxx . . $ ft_keysegs.[FT_SEGScxx . . $ `include/ft_global.h:98:9`!]= { |
| 364 | { |
| 365 | 0, /* charset */ |
| 366 | HA_FT_WLENcxx . . $ `include/ft_global.h:97:9`!, /* start */ |
| 367 | 0, /* null_pos */ |
| 368 | 0, /* Bit pos */ |
| 369 | HA_VAR_LENGTH_PARTcxx . . $ `include/my_base.h:333:9`! | HA_PACK_KEYcxx . . $ `include/my_base.h:286:9`!, /* flag */ |
| 370 | HA_FT_MAXBYTELENcxx . . $ `include/ft_global.h:31:9`!, /* length */ |
| 371 | 63, /* language (will be overwritten |
| 372 | ) */ |
| 373 | HA_KEYTYPE_VARTEXT2cxx . . $ HA_KEYTYPE_VARTEXT2., /* type */ |
| 374 | 0, /* null_bit */ |
| 375 | 2, 0 /* bit_start, bit_length */ |
| 376 | }, |
| 377 | { |
| 378 | 0, 0, 0, 0, HA_NO_SORTcxx . . $ `include/my_base.h:338:9`!, HA_FT_WLENcxx . . $ `include/ft_global.h:97:9`!, 63, HA_FT_WTYPEcxx . . $ `include/ft_global.h:96:9`!, 0, 0, 0 |
| 379 | } |
| 380 | }; |
| 381 | |
| 382 | struct st_mysql_ftparser ft_default_parsercxx . . $ ft_default_parser.= |
| 383 | { |
| 384 | MYSQL_FTPARSER_INTERFACE_VERSIONcxx . . $ `include/mysql/plugin_ftparser.h:29:9`!, 0, 0, 0 |
| 385 | }; |
| 386 | |
| 387 | C_MODE_STARTcxx . . $ `include/my_global.h:75:9`! |
| 388 | int is_stopword(const char *word, size_t len) { return 0; } |
| 389 | C_MODE_ENDcxx . . $ `include/my_global.h:76:9`! |