diff options
Diffstat (limited to 'storage/spider')
260 files changed, 12919 insertions, 1809 deletions
diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 0f222577515..988c2305b04 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -1,4 +1,5 @@ -/* Copyright (C) 2008-2018 Kentoku Shiba +/* Copyright (C) 2008-2019 Kentoku Shiba + Copyright (C) 2019 MariaDB corp This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -116,7 +117,7 @@ ha_spider::ha_spider( use_fields = FALSE; #endif use_pre_call = FALSE; - use_pre_records = FALSE; + use_pre_action = FALSE; #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS do_direct_update = FALSE; #if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET) @@ -228,7 +229,7 @@ ha_spider::ha_spider( use_fields = FALSE; #endif use_pre_call = FALSE; - use_pre_records = FALSE; + use_pre_action = FALSE; #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS do_direct_update = FALSE; #if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET) @@ -1805,7 +1806,7 @@ int ha_spider::reset() high_priority = FALSE; insert_delayed = FALSE; use_pre_call = FALSE; - use_pre_records = FALSE; + use_pre_action = FALSE; pre_bitmap_checked = FALSE; bulk_insert = FALSE; clone_bitmap_init = FALSE; @@ -1831,6 +1832,7 @@ int ha_spider::reset() multi_range_keys = NULL; } #endif + multi_range_num = 0; ft_handler = NULL; ft_current = NULL; ft_count = 0; @@ -4423,6 +4425,64 @@ int ha_spider::read_range_next() DBUG_RETURN(check_ha_range_eof()); } +void ha_spider::reset_no_where_cond() +{ + uint roop_count; + DBUG_ENTER("ha_spider::reset_no_where_cond"); +#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET) + if (sql_kinds & (SPIDER_SQL_KIND_SQL | SPIDER_SQL_KIND_HANDLER)) + { +#endif + for (roop_count = 0; roop_count < share->use_sql_dbton_count; roop_count++) + { + dbton_handler[share->use_sql_dbton_ids[roop_count]]->no_where_cond = + FALSE; + } +#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET) + } + if (sql_kinds & SPIDER_SQL_KIND_HS) + { + for (roop_count = 0; roop_count < share->use_hs_dbton_count; roop_count++) + { + dbton_handler[share->use_hs_dbton_ids[roop_count]]->no_where_cond = + FALSE; + } + } +#endif + DBUG_VOID_RETURN; +} + +bool ha_spider::check_no_where_cond() +{ + uint roop_count; + DBUG_ENTER("ha_spider::check_no_where_cond"); +#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET) + if (sql_kinds & (SPIDER_SQL_KIND_SQL | SPIDER_SQL_KIND_HANDLER)) + { +#endif + for (roop_count = 0; roop_count < share->use_sql_dbton_count; roop_count++) + { + if (dbton_handler[share->use_sql_dbton_ids[roop_count]]->no_where_cond) + { + DBUG_RETURN(TRUE); + } + } +#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET) + } + if (sql_kinds & SPIDER_SQL_KIND_HS) + { + for (roop_count = 0; roop_count < share->use_hs_dbton_count; roop_count++) + { + if (dbton_handler[share->use_hs_dbton_ids[roop_count]]->no_where_cond) + { + DBUG_RETURN(TRUE); + } + } + } +#endif + DBUG_RETURN(FALSE); +} + #ifdef HA_MRR_USE_DEFAULT_IMPL #if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000 ha_rows ha_spider::multi_range_read_info_const( @@ -4566,6 +4626,7 @@ int ha_spider::multi_range_read_init( DBUG_PRINT("info",("spider n_ranges=%u", n_ranges)); multi_range_num = n_ranges; mrr_have_range = FALSE; + reset_no_where_cond(); DBUG_RETURN( handler::multi_range_read_init( seq, @@ -5052,6 +5113,10 @@ int ha_spider::read_multi_range_first_internal( result_list.current = result_list.current->prev; } } + if (check_no_where_cond()) + { + DBUG_RETURN(check_error_mode_eof(0)); + } set_where_to_pos_sql(SPIDER_SQL_TYPE_SELECT_SQL); set_where_to_pos_sql(SPIDER_SQL_TYPE_HANDLER); } @@ -5527,6 +5592,15 @@ int ha_spider::read_multi_range_first_internal( DBUG_PRINT("info",("spider range_res8=%d", range_res)); } #endif + if (check_no_where_cond()) + { +#ifdef HA_MRR_USE_DEFAULT_IMPL + range_res = 1; +#else + multi_range_curr = multi_range_end; +#endif + break; + } } #ifdef HA_MRR_USE_DEFAULT_IMPL while (!range_res); @@ -5955,6 +6029,10 @@ int ha_spider::read_multi_range_first_internal( } else DBUG_RETURN(error_num); } + if (check_no_where_cond()) + { + DBUG_RETURN(check_error_mode_eof(0)); + } multi_range_cnt = 0; if ((error_num = reset_sql_sql( SPIDER_SQL_TYPE_SELECT_SQL | SPIDER_SQL_TYPE_HANDLER))) @@ -6176,6 +6254,10 @@ int ha_spider::read_multi_range_next( #ifdef HA_MRR_USE_DEFAULT_IMPL DBUG_PRINT("info",("spider range_res2=%d", range_res)); #endif + if (check_no_where_cond()) + { + DBUG_RETURN(check_error_mode_eof(0)); + } set_where_to_pos_sql(SPIDER_SQL_TYPE_SELECT_SQL); set_where_to_pos_sql(SPIDER_SQL_TYPE_HANDLER); result_list.limit_num = @@ -6610,6 +6692,10 @@ int ha_spider::read_multi_range_next( #endif ) DBUG_RETURN(error_num); + if (check_no_where_cond()) + { + DBUG_RETURN(check_error_mode_eof(0)); + } spider_db_free_one_result_for_start_next(this); spider_first_split_read_param(this); #ifndef WITHOUT_SPIDER_BG_SEARCH @@ -7432,6 +7518,10 @@ int ha_spider::read_multi_range_next( } else DBUG_RETURN(error_num); } + if (check_no_where_cond()) + { + DBUG_RETURN(check_error_mode_eof(0)); + } multi_range_cnt = 0; if ((error_num = reset_sql_sql( SPIDER_SQL_TYPE_SELECT_SQL | SPIDER_SQL_TYPE_HANDLER))) @@ -8919,22 +9009,24 @@ int ha_spider::info( } if (flag & HA_STATUS_TIME) - stats.update_time = (ulong) share->update_time; + stats.update_time = (ulong) share->stat.update_time; if (flag & (HA_STATUS_CONST | HA_STATUS_VARIABLE)) { - stats.max_data_file_length = share->max_data_file_length; - stats.create_time = (ulong) share->create_time; + stats.max_data_file_length = share->stat.max_data_file_length; + stats.create_time = share->stat.create_time; stats.block_size = spider_param_block_size(thd); } if (flag & HA_STATUS_VARIABLE) { - stats.data_file_length = share->data_file_length; - stats.index_file_length = share->index_file_length; - stats.records = share->records; - stats.mean_rec_length = share->mean_rec_length; - stats.check_time = (ulong) share->check_time; + stats.data_file_length = share->stat.data_file_length; + stats.index_file_length = share->stat.index_file_length; + stats.records = share->stat.records; + stats.mean_rec_length = share->stat.mean_rec_length; + stats.check_time = share->stat.check_time; if (stats.records <= 1 /* && (flag & HA_STATUS_NO_LOCK) */ ) stats.records = 2; + stats.checksum = share->stat.checksum; + stats.checksum_null = share->stat.checksum_null; } if (flag & HA_STATUS_AUTO) { @@ -9173,7 +9265,7 @@ ha_rows ha_spider::records_in_range( key_part_map tgt_key_part_map; KEY_PART_INFO *key_part; Field *field = NULL; - double rows = (double) share->records; + double rows = (double) share->stat.records; double weight, rate; DBUG_PRINT("info",("spider rows1=%f", rows)); if (start_key) @@ -9482,11 +9574,12 @@ int ha_spider::pre_records() result_list.casual_read[search_link_idx] = spider_param_casual_read(thd, share->casual_read); } - if ((error_num = spider_db_show_records(this, search_link_idx, TRUE))) + if ((error_num = spider_db_simple_action(SPIDER_SIMPLE_RECORDS, this, + search_link_idx, TRUE))) { DBUG_RETURN(check_error_mode(error_num)); } - use_pre_records = TRUE; + use_pre_action = TRUE; DBUG_RETURN(0); } @@ -9498,14 +9591,14 @@ ha_rows ha_spider::records() DBUG_PRINT("info",("spider this=%p", this)); if (sql_command == SQLCOM_ALTER_TABLE) { - use_pre_records = FALSE; + use_pre_action = FALSE; DBUG_RETURN(0); } if (!(share->additional_table_flags & HA_HAS_RECORDS) && !this->result_list.direct_limit_offset) { DBUG_RETURN(handler::records()); } - if (!use_pre_records && !this->result_list.direct_limit_offset) + if (!use_pre_action && !this->result_list.direct_limit_offset) { THD *thd = trx->thd; if ( @@ -9516,17 +9609,84 @@ ha_rows ha_spider::records() spider_param_casual_read(thd, share->casual_read); } } - if ((error_num = spider_db_show_records(this, search_link_idx, FALSE))) + if ((error_num = spider_db_simple_action(SPIDER_SIMPLE_RECORDS, this, + search_link_idx, FALSE))) { - use_pre_records = FALSE; + use_pre_action = FALSE; check_error_mode(error_num); DBUG_RETURN(HA_POS_ERROR); } - use_pre_records = FALSE; - share->records = table_rows; + use_pre_action = FALSE; + share->stat.records = table_rows; DBUG_RETURN(table_rows); } +#ifdef HA_HAS_CHECKSUM_EXTENDED +int ha_spider::pre_calculate_checksum() +{ + int error_num; + backup_error_status(); + DBUG_ENTER("ha_spider::pre_calculate_checksum"); + DBUG_PRINT("info",("spider this=%p", this)); + THD *thd = trx->thd; + if ( + spider_param_sync_autocommit(thd) && + (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) + ) { + result_list.casual_read[search_link_idx] = + spider_param_casual_read(thd, share->casual_read); + } + action_flags = T_EXTEND; + if ((error_num = spider_db_simple_action(SPIDER_SIMPLE_CHECKSUM_TABLE, this, + search_link_idx, TRUE))) + { + DBUG_RETURN(check_error_mode(error_num)); + } + use_pre_action = TRUE; + DBUG_RETURN(0); +} + +int ha_spider::calculate_checksum() +{ + int error_num; + backup_error_status(); + DBUG_ENTER("ha_spider::calculate_checksum"); + DBUG_PRINT("info",("spider this=%p", this)); + if (!use_pre_action && !this->result_list.direct_limit_offset) + { + THD *thd = trx->thd; + if ( + spider_param_sync_autocommit(thd) && + (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) + ) { + result_list.casual_read[search_link_idx] = + spider_param_casual_read(thd, share->casual_read); + } + } + action_flags = T_EXTEND; + if ((error_num = spider_db_simple_action(SPIDER_SIMPLE_CHECKSUM_TABLE, this, + search_link_idx, FALSE))) + { + use_pre_action = FALSE; + DBUG_RETURN(check_error_mode(error_num)); + } + use_pre_action = FALSE; + if (checksum_null) + { + share->stat.checksum_null = TRUE; + share->stat.checksum = 0; + stats.checksum_null = TRUE; + stats.checksum = 0; + } else { + share->stat.checksum_null = FALSE; + share->stat.checksum = (ha_checksum) checksum_val; + stats.checksum_null = FALSE; + stats.checksum = (ha_checksum) checksum_val; + } + DBUG_RETURN(0); +} +#endif + const char *ha_spider::table_type() const { DBUG_ENTER("ha_spider::table_type"); @@ -9556,8 +9716,8 @@ ulonglong ha_spider::table_flags() const HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE | HA_PARTIAL_COLUMN_READ | -#ifdef HA_CMP_REF_IS_EXPENSIVE - HA_CMP_REF_IS_EXPENSIVE | +#ifdef HA_SLOW_CMP_REF + HA_SLOW_CMP_REF | #endif #ifdef SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON HA_CAN_TABLE_CONDITION_PUSHDOWN | @@ -9587,7 +9747,7 @@ ulonglong ha_spider::table_flags() const const char *ha_spider::index_type( uint key_number ) { - KEY *key_info = &table->s->key_info[key_number]; + KEY *key_info = &table->key_info[key_number]; DBUG_ENTER("ha_spider::index_type"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider flags=%ld", key_info->flags)); @@ -9866,6 +10026,7 @@ void ha_spider::start_bulk_insert( bulk_insert = TRUE; bulk_size = -1; store_last_insert_id = 0; + bzero(©_info, sizeof(copy_info)); DBUG_VOID_RETURN; } @@ -9878,13 +10039,13 @@ int ha_spider::end_bulk_insert() bulk_insert = FALSE; if (bulk_size == -1) DBUG_RETURN(0); - if ((error_num = spider_db_bulk_insert(this, table, TRUE))) + if ((error_num = spider_db_bulk_insert(this, table, ©_info, TRUE))) DBUG_RETURN(check_error_mode(error_num)); DBUG_RETURN(0); } int ha_spider::write_row( - uchar *buf + const uchar *buf ) { int error_num; THD *thd = ha_thd(); @@ -10012,7 +10173,7 @@ int ha_spider::write_row( else bulk_size = 0; } - if ((error_num = spider_db_bulk_insert(this, table, FALSE))) + if ((error_num = spider_db_bulk_insert(this, table, ©_info, FALSE))) DBUG_RETURN(check_error_mode(error_num)); #ifdef HA_CAN_BULK_ACCESS @@ -10637,7 +10798,8 @@ int ha_spider::direct_update_rows( uint range_count, bool sorted, uchar *new_data, - ha_rows *update_rows + ha_rows *update_rows, + ha_rows *found_rows ) { int error_num; THD *thd = ha_thd(); @@ -10664,17 +10826,17 @@ int ha_spider::direct_update_rows( if (is_bulk_access_clone) { bulk_access_pre_called = FALSE; - DBUG_RETURN(spider_db_bulk_direct_update(this, update_rows)); + DBUG_RETURN(spider_db_bulk_direct_update(this, update_rows, found_rows)); } DBUG_RETURN(bulk_access_link_exec_tgt->spider->ha_direct_update_rows( - ranges, range_count, sorted, new_data, update_rows)); + ranges, range_count, sorted, new_data, update_rows, found_rows)); } #endif if ( (active_index != MAX_KEY && (error_num = index_handler_init())) || (active_index == MAX_KEY && (error_num = rnd_handler_init())) || (error_num = spider_db_direct_update(this, table, ranges, range_count, - update_rows)) + update_rows, found_rows)) ) DBUG_RETURN(check_error_mode(error_num)); @@ -10682,14 +10844,15 @@ int ha_spider::direct_update_rows( if (bulk_access_executing && is_bulk_access_clone) { bulk_req_exec(); - DBUG_RETURN(spider_db_bulk_direct_update(this, update_rows)); + DBUG_RETURN(spider_db_bulk_direct_update(this, update_rows, found_rows)); } #endif DBUG_RETURN(0); } #else int ha_spider::direct_update_rows( - ha_rows *update_rows + ha_rows *update_rows, + ha_rows *found_rows ) { int error_num; THD *thd = ha_thd(); @@ -10716,16 +10879,16 @@ int ha_spider::direct_update_rows( if (is_bulk_access_clone) { bulk_access_pre_called = FALSE; - DBUG_RETURN(spider_db_bulk_direct_update(this, update_rows)); + DBUG_RETURN(spider_db_bulk_direct_update(this, update_rows, found_rows)); } DBUG_RETURN(bulk_access_link_exec_tgt->spider->ha_direct_update_rows( - update_rows)); + update_rows, found_rows)); } #endif if ( (active_index != MAX_KEY && (error_num = index_handler_init())) || (active_index == MAX_KEY && (error_num = rnd_handler_init())) || - (error_num = spider_db_direct_update(this, table, update_rows)) + (error_num = spider_db_direct_update(this, table, update_rows, found_rows)) ) DBUG_RETURN(check_error_mode(error_num)); @@ -10733,7 +10896,7 @@ int ha_spider::direct_update_rows( if (bulk_access_executing && is_bulk_access_clone) { bulk_req_exec(); - DBUG_RETURN(spider_db_bulk_direct_update(this, update_rows)); + DBUG_RETURN(spider_db_bulk_direct_update(this, update_rows, found_rows)); } #endif DBUG_RETURN(0); @@ -10747,21 +10910,23 @@ int ha_spider::pre_direct_update_rows( uint range_count, bool sorted, uchar *new_data, - ha_rows *update_rows + ha_rows *update_rows, + ha_rows *found_rows ) { DBUG_ENTER("ha_spider::pre_direct_update_rows"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(bulk_access_link_current->spider->ha_direct_update_rows(ranges, - range_count, sorted, new_data, update_rows)); + range_count, sorted, new_data, update_rows, found_rows)); } #else int ha_spider::pre_direct_update_rows() { uint update_rows; + uint found_rows; DBUG_ENTER("ha_spider::pre_direct_update_rows"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(bulk_access_link_current->spider->ha_direct_update_rows( - &update_rows)); + &update_rows, &found_rows)); } #endif #endif @@ -11336,8 +11501,9 @@ double ha_spider::scan_time() DBUG_ENTER("ha_spider::scan_time"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider scan_time = %.6f", - share->scan_rate * share->records * share->mean_rec_length + 2)); - DBUG_RETURN(share->scan_rate * share->records * share->mean_rec_length + 2); + share->scan_rate * share->stat.records * share->stat.mean_rec_length + 2)); + DBUG_RETURN(share->scan_rate * share->stat.records * + share->stat.mean_rec_length + 2); } double ha_spider::read_time( @@ -11350,14 +11516,14 @@ double ha_spider::read_time( if (keyread) { DBUG_PRINT("info",("spider read_time(keyread) = %.6f", - share->read_rate * table->s->key_info[index].key_length * + share->read_rate * table->key_info[index].key_length * rows / 2 + 2)); - DBUG_RETURN(share->read_rate * table->s->key_info[index].key_length * + DBUG_RETURN(share->read_rate * table->key_info[index].key_length * rows / 2 + 2); } else { DBUG_PRINT("info",("spider read_time = %.6f", - share->read_rate * share->mean_rec_length * rows + 2)); - DBUG_RETURN(share->read_rate * share->mean_rec_length * rows + 2); + share->read_rate * share->stat.mean_rec_length * rows + 2)); + DBUG_RETURN(share->read_rate * share->stat.mean_rec_length * rows + 2); } } diff --git a/storage/spider/ha_spider.h b/storage/spider/ha_spider.h index 9ffe49754e8..cb0a2abcc06 100644 --- a/storage/spider/ha_spider.h +++ b/storage/spider/ha_spider.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2008-2018 Kentoku Shiba +/* Copyright (C) 2008-2019 Kentoku Shiba + Copyright (C) 2019 MariaDB corp This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -170,7 +171,7 @@ public: bool high_priority; bool insert_delayed; bool use_pre_call; - bool use_pre_records; + bool use_pre_action; bool pre_bitmap_checked; enum thr_lock_type lock_type; int lock_mode; @@ -243,6 +244,11 @@ public: SPIDER_ITEM_HLD *direct_aggregate_item_current; #endif ha_rows table_rows; +#ifdef HA_HAS_CHECKSUM_EXTENDED + ha_checksum checksum_val; + bool checksum_null; + uint action_flags; +#endif /* for fulltext search */ bool ft_init_and_first; @@ -349,6 +355,8 @@ public: bool sorted ); int read_range_next(); + void reset_no_where_cond(); + bool check_no_where_cond(); #ifdef HA_MRR_USE_DEFAULT_IMPL #if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000 ha_rows multi_range_read_info_const( @@ -512,6 +520,10 @@ public: int check_crd(); int pre_records(); ha_rows records(); +#ifdef HA_HAS_CHECKSUM_EXTENDED + int pre_calculate_checksum(); + int calculate_checksum(); +#endif const char *table_type() const; ulonglong table_flags() const; const char *index_type( @@ -558,7 +570,7 @@ public: #endif int end_bulk_insert(); int write_row( - uchar *buf + const uchar *buf ); #ifdef HA_CAN_BULK_ACCESS int pre_write_row( @@ -675,20 +687,22 @@ public: #endif #endif #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS - inline int direct_update_rows(ha_rows *update_rows) + inline int direct_update_rows(ha_rows *update_rows, ha_rows *found_rows) { - return direct_update_rows(NULL, 0, FALSE, NULL, update_rows); + return direct_update_rows(NULL, 0, FALSE, NULL, update_rows, found_rows); } int direct_update_rows( KEY_MULTI_RANGE *ranges, uint range_count, bool sorted, uchar *new_data, - ha_rows *update_rows + ha_rows *update_rows, + ha_rows *found_row ); #else int direct_update_rows( - ha_rows *update_rows + ha_rows *update_rows, + ha_rows *found_row ); #endif #ifdef HA_CAN_BULK_ACCESS @@ -696,15 +710,18 @@ public: inline int pre_direct_update_rows() { ha_rows update_rows; + ha_rows found_rows; - return pre_direct_update_rows(NULL, 0, FALSE, NULL, &update_rows); + return pre_direct_update_rows(NULL, 0, FALSE, NULL, &update_rows, + &found_rows); } int pre_direct_update_rows( KEY_MULTI_RANGE *ranges, uint range_count, bool sorted, uchar *new_data, - ha_rows *update_rows + ha_rows *update_rows, + ha_rows *found_row ); #else int pre_direct_update_rows(); diff --git a/storage/spider/mysql-test/spider/bugfix/include/checksum_table_with_quick_mode_3_init.inc b/storage/spider/mysql-test/spider/bugfix/include/checksum_table_with_quick_mode_3_init.inc index bf2d9163b9a..123410380ab 100644 --- a/storage/spider/mysql-test/spider/bugfix/include/checksum_table_with_quick_mode_3_init.inc +++ b/storage/spider/mysql-test/spider/bugfix/include/checksum_table_with_quick_mode_3_init.inc @@ -21,7 +21,7 @@ let $CHILD2_1_CREATE_TABLES= let $CHILD2_1_SELECT_TABLES= SELECT pkey FROM tbl_a ORDER BY pkey; let $CHILD2_1_SELECT_ARGUMENT1= - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE argument LIKE '%checksum %'; --connection master_1 set @old_spider_quick_mode= @@spider_quick_mode; set session spider_quick_mode= 3; diff --git a/storage/spider/mysql-test/spider/bugfix/include/cp932_column_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/cp932_column_deinit.inc new file mode 100644 index 00000000000..930cde889a4 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/cp932_column_deinit.inc @@ -0,0 +1,13 @@ +--connection master_1 +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP +--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP +--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP +--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/bugfix/include/cp932_column_init.inc b/storage/spider/mysql-test/spider/bugfix/include/cp932_column_init.inc new file mode 100644 index 00000000000..ba412b567f8 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/cp932_column_init.inc @@ -0,0 +1,29 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_init.inc +--enable_result_log +--enable_query_log +--enable_warnings +--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1 +let $MASTER_1_COMMENT_2_1= + COMMENT='table "tbl_a", srv "s_2_1"'; +--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES +let $CHILD2_1_DROP_TABLES= + DROP TABLE IF EXISTS tbl_a; +--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES +let $CHILD2_1_CREATE_TABLES= + CREATE TABLE tbl_a ( + pkey int NOT NULL, + txt_utf8 char(8) NOT NULL, + txt_cp932 char(8) NOT NULL COLLATE cp932_japanese_ci, + PRIMARY KEY (pkey) + ) $CHILD2_1_ENGINE DEFAULT CHARACTER SET utf8; +--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES +let $CHILD2_1_SELECT_TABLES= + SELECT pkey, txt_utf8, txt_cp932 FROM tbl_a ORDER BY pkey; +let $CHILD2_1_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %' OR argument LIKE '%update %'; +--connection master_1 +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 1; diff --git a/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_deinit.inc new file mode 100644 index 00000000000..4ea789feae8 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_deinit.inc @@ -0,0 +1,13 @@ +--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP +--connection master_1 +set session binlog_format= @old_binlog_format; +--connection slave1_1 +--disable_warnings +--disable_query_log +--disable_result_log +--source ../include/deinit_spider.inc +--source ../t/slave_test_deinit.inc +--source ../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_init.inc b/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_init.inc new file mode 100644 index 00000000000..f2f8635f9e3 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_init.inc @@ -0,0 +1,24 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_init.inc +--source ../t/slave_test_init.inc +--enable_result_log +--enable_query_log +--enable_warnings +--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES +let $CHILD2_1_SELECT_TABLES= + SELECT pkey, f FROM tbl_a ORDER BY pkey; +let $CHILD2_1_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE argument LIKE '%delete %'; +--connection slave1_1 +--disable_warnings +--disable_query_log +--disable_result_log +--source ../include/init_spider.inc +--enable_result_log +--enable_query_log +--enable_warnings +--connection master_1 +set @old_binlog_format= @@binlog_format; +set session binlog_format= 'ROW'; diff --git a/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_mariadb_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_mariadb_deinit.inc new file mode 100644 index 00000000000..4fd217a5676 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_mariadb_deinit.inc @@ -0,0 +1,4 @@ +--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP +--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP +--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP +--source delete_with_float_column_deinit.inc diff --git a/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_mariadb_init.inc b/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_mariadb_init.inc new file mode 100644 index 00000000000..9d3961491e6 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_mariadb_init.inc @@ -0,0 +1,14 @@ +--source delete_with_float_column_init.inc +--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1 +let $MASTER_1_COMMENT_2_1= + COMMENT='table "tbl_a", srv "s_2_1", wrapper "mariadb"'; +--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES +let $CHILD2_1_DROP_TABLES= + DROP TABLE IF EXISTS tbl_a; +--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES +let $CHILD2_1_CREATE_TABLES= + CREATE TABLE tbl_a ( + pkey int NOT NULL, + f float DEFAULT NULL, + PRIMARY KEY (pkey) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; diff --git a/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_mysql_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_mysql_deinit.inc new file mode 100644 index 00000000000..4fd217a5676 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_mysql_deinit.inc @@ -0,0 +1,4 @@ +--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP +--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP +--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP +--source delete_with_float_column_deinit.inc diff --git a/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_mysql_init.inc b/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_mysql_init.inc new file mode 100644 index 00000000000..d98f3c12397 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_mysql_init.inc @@ -0,0 +1,16 @@ +--source delete_with_float_column_init.inc +--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1 +let $MASTER_1_COMMENT_2_1= + COMMENT='table "tbl_a", srv "s_2_1", wrapper "mysql"'; +--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES +let $CHILD2_1_DROP_TABLES= + DROP TABLE IF EXISTS tbl_a $STR_SEMICOLON + DROP FUNCTION to_float; +--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES +let $CHILD2_1_CREATE_TABLES= + CREATE TABLE tbl_a ( + pkey int NOT NULL, + f float DEFAULT NULL, + PRIMARY KEY (pkey) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET $STR_SEMICOLON + CREATE FUNCTION to_float(a decimal(20,6)) RETURNS float RETURN cast(a as double); diff --git a/storage/spider/mysql-test/spider/bugfix/include/direct_sql_with_comma_pwd_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/direct_sql_with_comma_pwd_deinit.inc new file mode 100644 index 00000000000..27682e43441 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/direct_sql_with_comma_pwd_deinit.inc @@ -0,0 +1,9 @@ +--connection child2_1 +DROP USER tu@'%'; +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/bugfix/include/direct_sql_with_comma_pwd_init.inc b/storage/spider/mysql-test/spider/bugfix/include/direct_sql_with_comma_pwd_init.inc new file mode 100644 index 00000000000..c87af2d02e4 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/direct_sql_with_comma_pwd_init.inc @@ -0,0 +1,11 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_init.inc +--enable_result_log +--enable_query_log +--enable_warnings +let $DIRECT_SQL_COMMAND= + SELECT spider_direct_sql('SELECT 22', 'tmp_a', 'srv "s_2_1", database "test", password "pass,1234", user "tu"'); +--connection child2_1 +GRANT ALL ON *.* TO tu@'%' IDENTIFIED BY 'pass,1234'; diff --git a/storage/spider/mysql-test/spider/bugfix/include/group_by_order_by_limit_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/group_by_order_by_limit_deinit.inc new file mode 100644 index 00000000000..9d255152dd8 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/group_by_order_by_limit_deinit.inc @@ -0,0 +1,14 @@ +--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP +--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP +--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP +--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP +--let $CHILD2_2_DROP_TABLES= $CHILD2_2_DROP_TABLES_BACKUP +--let $CHILD2_2_CREATE_TABLES= $CHILD2_2_CREATE_TABLES_BACKUP +--let $CHILD2_2_SELECT_TABLES= $CHILD2_2_SELECT_TABLES_BACKUP +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/bugfix/include/group_by_order_by_limit_init.inc b/storage/spider/mysql-test/spider/bugfix/include/group_by_order_by_limit_init.inc new file mode 100644 index 00000000000..ac60580f463 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/group_by_order_by_limit_init.inc @@ -0,0 +1,54 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_init.inc +if (!$HAVE_PARTITION) +{ + --source group_by_order_by_limit_deinit.inc + --enable_result_log + --enable_query_log + --enable_warnings + skip Test requires partitioning; +} +--enable_result_log +--enable_query_log +--enable_warnings +--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1 +let $MASTER_1_COMMENT_2_1= + COMMENT='table "tbl_a"' + PARTITION BY KEY(pkey) ( + PARTITION pt1 COMMENT='srv "s_2_1"', + PARTITION pt2 COMMENT='srv "s_2_2"' + ); +--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES +let $CHILD2_1_DROP_TABLES= + DROP TABLE IF EXISTS tbl_a; +--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES +let $CHILD2_1_CREATE_TABLES= + CREATE TABLE tbl_a ( + pkey int NOT NULL, + skey int NOT NULL, + PRIMARY KEY (pkey), + KEY idx1 (skey) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; +--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES +let $CHILD2_1_SELECT_TABLES= + SELECT pkey, skey FROM tbl_a ORDER BY pkey; +let $CHILD2_1_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; +--let $CHILD2_2_DROP_TABLES_BACKUP= $CHILD2_2_DROP_TABLES +let $CHILD2_2_DROP_TABLES= + DROP TABLE IF EXISTS tbl_a; +--let $CHILD2_2_CREATE_TABLES_BACKUP= $CHILD2_2_CREATE_TABLES +let $CHILD2_2_CREATE_TABLES= + CREATE TABLE tbl_a ( + pkey int NOT NULL, + skey int NOT NULL, + PRIMARY KEY (pkey), + KEY idx1 (skey) + ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; +--let $CHILD2_2_SELECT_TABLES_BACKUP= $CHILD2_2_SELECT_TABLES +let $CHILD2_2_SELECT_TABLES= + SELECT pkey, skey FROM tbl_a ORDER BY pkey; +let $CHILD2_2_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; diff --git a/storage/spider/mysql-test/spider/bugfix/include/mdev_19866_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/mdev_19866_deinit.inc new file mode 100644 index 00000000000..9d255152dd8 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/mdev_19866_deinit.inc @@ -0,0 +1,14 @@ +--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP +--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP +--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP +--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP +--let $CHILD2_2_DROP_TABLES= $CHILD2_2_DROP_TABLES_BACKUP +--let $CHILD2_2_CREATE_TABLES= $CHILD2_2_CREATE_TABLES_BACKUP +--let $CHILD2_2_SELECT_TABLES= $CHILD2_2_SELECT_TABLES_BACKUP +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/bugfix/include/mdev_19866_init.inc b/storage/spider/mysql-test/spider/bugfix/include/mdev_19866_init.inc new file mode 100644 index 00000000000..dceae8226b0 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/mdev_19866_init.inc @@ -0,0 +1,52 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_init.inc +if (!$HAVE_PARTITION) +{ + --source group_by_order_by_limit_deinit.inc + --enable_result_log + --enable_query_log + --enable_warnings + skip Test requires partitioning; +} +--enable_result_log +--enable_query_log +--enable_warnings +--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1 +let $MASTER_1_COMMENT_2_1= + COMMENT='table "tbl_a"' + PARTITION BY KEY(pkey) ( + PARTITION pt1 COMMENT='srv "s_2_1"', + PARTITION pt2 COMMENT='srv "s_2_2"' + ); +--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES +let $CHILD2_1_DROP_TABLES= + DROP TABLE IF EXISTS tbl_a; +--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES +let $CHILD2_1_CREATE_TABLES= + CREATE TABLE tbl_a ( + pkey int NOT NULL, + val char(1) NOT NULL, + PRIMARY KEY (pkey) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; +--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES +let $CHILD2_1_SELECT_TABLES= + SELECT pkey, val FROM tbl_a ORDER BY pkey; +let $CHILD2_1_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; +--let $CHILD2_2_DROP_TABLES_BACKUP= $CHILD2_2_DROP_TABLES +let $CHILD2_2_DROP_TABLES= + DROP TABLE IF EXISTS tbl_a; +--let $CHILD2_2_CREATE_TABLES_BACKUP= $CHILD2_2_CREATE_TABLES +let $CHILD2_2_CREATE_TABLES= + CREATE TABLE tbl_a ( + pkey int NOT NULL, + val char(1) NOT NULL, + PRIMARY KEY (pkey) + ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; +--let $CHILD2_2_SELECT_TABLES_BACKUP= $CHILD2_2_SELECT_TABLES +let $CHILD2_2_SELECT_TABLES= + SELECT pkey, val FROM tbl_a ORDER BY pkey; +let $CHILD2_2_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; diff --git a/storage/spider/mysql-test/spider/bugfix/include/mdev_22246_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/mdev_22246_deinit.inc new file mode 100644 index 00000000000..9d255152dd8 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/mdev_22246_deinit.inc @@ -0,0 +1,14 @@ +--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP +--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP +--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP +--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP +--let $CHILD2_2_DROP_TABLES= $CHILD2_2_DROP_TABLES_BACKUP +--let $CHILD2_2_CREATE_TABLES= $CHILD2_2_CREATE_TABLES_BACKUP +--let $CHILD2_2_SELECT_TABLES= $CHILD2_2_SELECT_TABLES_BACKUP +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/bugfix/include/mdev_22246_init.inc b/storage/spider/mysql-test/spider/bugfix/include/mdev_22246_init.inc new file mode 100644 index 00000000000..48226ba2811 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/mdev_22246_init.inc @@ -0,0 +1,48 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_init.inc +if (!$HAVE_PARTITION) +{ + --source group_by_order_by_limit_deinit.inc + --enable_result_log + --enable_query_log + --enable_warnings + skip Test requires partitioning; +} +--enable_result_log +--enable_query_log +--enable_warnings +--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1 +let $MASTER_1_COMMENT_2_1= + COMMENT='table "tbl_a"' + PARTITION BY HASH(id) ( + PARTITION pt1 COMMENT='srv "s_2_1"', + PARTITION pt2 COMMENT='srv "s_2_2"' + ); +--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES +let $CHILD2_1_DROP_TABLES= + DROP TABLE IF EXISTS tbl_a; +--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES +let $CHILD2_1_CREATE_TABLES= + CREATE TABLE tbl_a ( + id bigint NOT NULL, + node text, + PRIMARY KEY (id) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; +--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES +let $CHILD2_1_SELECT_TABLES= + SELECT * FROM tbl_a ORDER BY id; +--let $CHILD2_2_DROP_TABLES_BACKUP= $CHILD2_2_DROP_TABLES +let $CHILD2_2_DROP_TABLES= + DROP TABLE IF EXISTS tbl_a; +--let $CHILD2_2_CREATE_TABLES_BACKUP= $CHILD2_2_CREATE_TABLES +let $CHILD2_2_CREATE_TABLES= + CREATE TABLE tbl_a ( + id bigint NOT NULL, + node text, + PRIMARY KEY (id) + ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; +--let $CHILD2_2_SELECT_TABLES_BACKUP= $CHILD2_2_SELECT_TABLES +let $CHILD2_2_SELECT_TABLES= + SELECT * FROM tbl_a ORDER BY id; diff --git a/storage/spider/mysql-test/spider/bugfix/include/return_found_rows_insert_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/return_found_rows_insert_deinit.inc new file mode 100644 index 00000000000..76b7582abfe --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/return_found_rows_insert_deinit.inc @@ -0,0 +1,11 @@ +--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP +--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP +--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP +--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/bugfix/include/return_found_rows_insert_init.inc b/storage/spider/mysql-test/spider/bugfix/include/return_found_rows_insert_init.inc new file mode 100644 index 00000000000..da6778de504 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/return_found_rows_insert_init.inc @@ -0,0 +1,27 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_init.inc +--enable_result_log +--enable_query_log +--enable_warnings +--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1 +let $MASTER_1_COMMENT_2_1= + COMMENT='table "tbl_a", srv "s_2_1"'; +--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES +let $CHILD2_1_DROP_TABLES= + DROP TABLE IF EXISTS tbl_a; +--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES +let $CHILD2_1_CREATE_TABLES= + CREATE TABLE tbl_a ( + skey int NOT NULL, + dt date NOT NULL, + tm time NOT NULL, + PRIMARY KEY (skey) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; +--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES +let $CHILD2_1_SELECT_TABLES= + SELECT skey, dt, tm FROM tbl_a ORDER BY skey; +let $CHILD2_1_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %' OR argument LIKE '%replace %'; +--let $MASTER_1_SET_COMMAND=set session spider_direct_dup_insert=1 $STR_SEMICOLON diff --git a/storage/spider/mysql-test/spider/bugfix/include/return_found_rows_update_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/return_found_rows_update_deinit.inc new file mode 100644 index 00000000000..76b7582abfe --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/return_found_rows_update_deinit.inc @@ -0,0 +1,11 @@ +--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP +--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP +--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP +--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/bugfix/include/return_found_rows_update_init.inc b/storage/spider/mysql-test/spider/bugfix/include/return_found_rows_update_init.inc new file mode 100644 index 00000000000..884ef74c47e --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/return_found_rows_update_init.inc @@ -0,0 +1,26 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_init.inc +--enable_result_log +--enable_query_log +--enable_warnings +--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1 +let $MASTER_1_COMMENT_2_1= + COMMENT='table "tbl_a", srv "s_2_1"'; +--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES +let $CHILD2_1_DROP_TABLES= + DROP TABLE IF EXISTS tbl_a; +--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES +let $CHILD2_1_CREATE_TABLES= + CREATE TABLE tbl_a ( + skey int NOT NULL, + dt date NOT NULL, + tm time NOT NULL, + KEY idx1 (skey,dt) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; +--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES +let $CHILD2_1_SELECT_TABLES= + SELECT skey, dt, tm FROM tbl_a ORDER BY skey; +let $CHILD2_1_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE argument LIKE '%update %'; diff --git a/storage/spider/mysql-test/spider/bugfix/include/same_server_link_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/same_server_link_deinit.inc new file mode 100644 index 00000000000..a4e8a10db19 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/same_server_link_deinit.inc @@ -0,0 +1,11 @@ +--connection master_1 +set global spider_same_server_link= @old_global_spider_same_server_link; +set session spider_same_server_link= @old_session_spider_same_server_link; +--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/bugfix/include/same_server_link_init.inc b/storage/spider/mysql-test/spider/bugfix/include/same_server_link_init.inc new file mode 100644 index 00000000000..2c8150c905d --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/same_server_link_init.inc @@ -0,0 +1,15 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_init.inc +--enable_result_log +--enable_query_log +--enable_warnings +--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1 +let $MASTER_1_COMMENT_2_1= + COMMENT='table "tbl_b", host "127.0.0.1", port "$MASTER_1_MYPORT", user "root"'; +--connection master_1 +set @old_global_spider_same_server_link= @@global.spider_same_server_link; +set @old_session_spider_same_server_link= @@session.spider_same_server_link; +set global spider_same_server_link= 0; +set session spider_same_server_link= 0; diff --git a/storage/spider/mysql-test/spider/bugfix/include/select_with_backquote_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/select_with_backquote_deinit.inc new file mode 100644 index 00000000000..76b7582abfe --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/select_with_backquote_deinit.inc @@ -0,0 +1,11 @@ +--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP +--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP +--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP +--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/bugfix/include/select_with_backquote_init.inc b/storage/spider/mysql-test/spider/bugfix/include/select_with_backquote_init.inc new file mode 100644 index 00000000000..37bf690c066 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/select_with_backquote_init.inc @@ -0,0 +1,25 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_init.inc +--enable_result_log +--enable_query_log +--enable_warnings +--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1 +let $MASTER_1_COMMENT_2_1= + COMMENT='table "tbl_a", srv "s_2_1"'; +--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES +let $CHILD2_1_DROP_TABLES= + DROP TABLE IF EXISTS tbl_a; +--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES +let $CHILD2_1_CREATE_TABLES= + CREATE TABLE tbl_a ( + pkey int NOT NULL, + txt_utf8 char(8) NOT NULL, + PRIMARY KEY (pkey) + ) $CHILD2_1_ENGINE DEFAULT CHARACTER SET utf8; +--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES +let $CHILD2_1_SELECT_TABLES= + SELECT pkey, txt_utf8 FROM tbl_a ORDER BY pkey; +let $CHILD2_1_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; diff --git a/storage/spider/mysql-test/spider/bugfix/include/slave_transaction_retry_errors_5digit_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/slave_transaction_retry_errors_5digit_deinit.inc new file mode 100644 index 00000000000..5ac67cdf783 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/slave_transaction_retry_errors_5digit_deinit.inc @@ -0,0 +1,10 @@ +--connection slave1_1 +--disable_warnings +--disable_query_log +--disable_result_log +--source ../include/deinit_spider.inc +--source ../t/slave_test_deinit.inc +--source ../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/bugfix/include/slave_transaction_retry_errors_5digit_init.inc b/storage/spider/mysql-test/spider/bugfix/include/slave_transaction_retry_errors_5digit_init.inc new file mode 100644 index 00000000000..052d6ebb2eb --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/slave_transaction_retry_errors_5digit_init.inc @@ -0,0 +1,10 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_init.inc +--source ../t/slave_test_init.inc +--connection slave1_1 +--source ../include/init_spider.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/bugfix/include/spider_table_sts_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/spider_table_sts_deinit.inc new file mode 100644 index 00000000000..01645e85f32 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/spider_table_sts_deinit.inc @@ -0,0 +1,12 @@ +--connection master_1 +alter table mysql.spider_table_sts add column checksum bigint unsigned default null after update_time; +DROP DATABASE IF EXISTS auto_test_local; + +--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/bugfix/include/spider_table_sts_init.inc b/storage/spider/mysql-test/spider/bugfix/include/spider_table_sts_init.inc new file mode 100644 index 00000000000..1e438812af7 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/spider_table_sts_init.inc @@ -0,0 +1,13 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_init.inc +--enable_result_log +--enable_query_log +--enable_warnings +--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1 +let $MASTER_1_COMMENT_2_1= + COMMENT='table "tbl_a", host "127.0.0.1", port "$MASTER_1_MYPORT", user "root"'; +--connection master_1 +alter table mysql.spider_table_sts drop column checksum; +insert into mysql.spider_table_sts values ('auto_test_local', 'tbl_a', 0, 0, 0, 0, 0, '2019-01-01 00:00:00', '2019-01-01 00:00:00', '2019-01-01 00:00:00'); diff --git a/storage/spider/mysql-test/spider/bugfix/include/sql_mode_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/sql_mode_deinit.inc new file mode 100644 index 00000000000..07f4d39a184 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/sql_mode_deinit.inc @@ -0,0 +1,13 @@ +--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP +--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP +--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP +--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP +--connection master_1 +set session sql_mode= @old_sql_mode; +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/bugfix/include/sql_mode_init.inc b/storage/spider/mysql-test/spider/bugfix/include/sql_mode_init.inc new file mode 100644 index 00000000000..65e2f9102e7 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/sql_mode_init.inc @@ -0,0 +1,40 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_init.inc +--enable_result_log +--enable_query_log +--enable_warnings +--let $SQL_MODES= real_as_float,pipes_as_concat,ansi_quotes,ignore_space,ignore_bad_table_options,only_full_group_by,no_unsigned_subtraction,no_dir_in_create,postgresql,oracle,mssql,db2,maxdb,no_key_options,no_table_options,no_field_options,mysql323,mysql40,ansi,no_auto_value_on_zero,no_backslash_escapes,strict_trans_tables,strict_all_tables,no_zero_in_date,no_zero_date,allow_invalid_dates,error_for_division_by_zero,traditional,no_auto_create_user,high_not_precedence,no_engine_substitution,pad_char_to_full_length +if (`SELECT IF(STRCMP('$SERVER_NAME', 'MariaDB') = 0, 1, 0)`) +{ + if (`SELECT IF($SERVER_MAJOR_VERSION = 10, 1, 0)`) + { + if (`SELECT IF($SERVER_MINOR_VERSION >= 3, 1, 0)`) + { + --let $SQL_MODES= $SQL_MODES,empty_string_is_null,simultaneous_assignment + } + if (`SELECT IF($SERVER_MINOR_VERSION >= 4, 1, 0)`) + { + --let $SQL_MODES= $SQL_MODES,time_round_fractional + } + } +} +--connection master_1 +set @old_sql_mode= @@sql_mode; +eval set session sql_mode= '$SQL_MODES'; +--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1 +--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES +let $CHILD2_1_DROP_TABLES= + DROP TABLE IF EXISTS tbl_a; +--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES +let $CHILD2_1_CREATE_TABLES= + CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; +--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES +let $CHILD2_1_SELECT_TABLES= + SELECT pkey FROM tbl_a ORDER BY pkey; +let $CHILD2_1_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE argument LIKE '%sql_mode%'; diff --git a/storage/spider/mysql-test/spider/bugfix/include/sql_mode_mariadb_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/sql_mode_mariadb_deinit.inc new file mode 100644 index 00000000000..0dbff811c95 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/sql_mode_mariadb_deinit.inc @@ -0,0 +1 @@ +--source sql_mode_deinit.inc diff --git a/storage/spider/mysql-test/spider/bugfix/include/sql_mode_mariadb_init.inc b/storage/spider/mysql-test/spider/bugfix/include/sql_mode_mariadb_init.inc new file mode 100644 index 00000000000..8e03b94b160 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/sql_mode_mariadb_init.inc @@ -0,0 +1,3 @@ +--source sql_mode_init.inc +let $MASTER_1_COMMENT_2_1= + COMMENT='table "tbl_a", srv "s_2_1", wrapper "mariadb"'; diff --git a/storage/spider/mysql-test/spider/bugfix/include/sql_mode_mysql_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/sql_mode_mysql_deinit.inc new file mode 100644 index 00000000000..0dbff811c95 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/sql_mode_mysql_deinit.inc @@ -0,0 +1 @@ +--source sql_mode_deinit.inc diff --git a/storage/spider/mysql-test/spider/bugfix/include/sql_mode_mysql_init.inc b/storage/spider/mysql-test/spider/bugfix/include/sql_mode_mysql_init.inc new file mode 100644 index 00000000000..2cdd56bc689 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/sql_mode_mysql_init.inc @@ -0,0 +1,3 @@ +--source sql_mode_init.inc +let $MASTER_1_COMMENT_2_1= + COMMENT='table "tbl_a", srv "s_2_1", wrapper "mysql"'; diff --git a/storage/spider/mysql-test/spider/bugfix/include/wait_timeout_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/wait_timeout_deinit.inc new file mode 100644 index 00000000000..e66247c89c5 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/wait_timeout_deinit.inc @@ -0,0 +1,18 @@ +--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP +--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP +--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP +--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP +--let $CHILD2_2_DROP_TABLES= $CHILD2_2_DROP_TABLES_BACKUP +--let $CHILD2_2_CREATE_TABLES= $CHILD2_2_CREATE_TABLES_BACKUP +--let $CHILD2_2_SELECT_TABLES= $CHILD2_2_SELECT_TABLES_BACKUP +--connection child2_1 +set global wait_timeout= @old_wait_timeout; +--connection child2_2 +set global wait_timeout= @old_wait_timeout; +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/bugfix/include/wait_timeout_init.inc b/storage/spider/mysql-test/spider/bugfix/include/wait_timeout_init.inc new file mode 100644 index 00000000000..d56d7a20940 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/wait_timeout_init.inc @@ -0,0 +1,56 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_init.inc +if (!$HAVE_PARTITION) +{ + --source wait_timeout_deinit.inc + --enable_result_log + --enable_query_log + --enable_warnings + skip Test requires partitioning; +} +--enable_result_log +--enable_query_log +--enable_warnings +--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1 +let $MASTER_1_COMMENT_2_1= + COMMENT='table "tbl_a"' + PARTITION BY KEY(pkey) ( + PARTITION pt1 COMMENT='srv "s_2_1"', + PARTITION pt2 COMMENT='srv "s_2_2"' + ); +--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES +let $CHILD2_1_DROP_TABLES= + DROP TABLE IF EXISTS tbl_a; +--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES +let $CHILD2_1_CREATE_TABLES= + CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; +--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES +let $CHILD2_1_SELECT_TABLES= + SELECT pkey FROM tbl_a ORDER BY pkey; +let $CHILD2_1_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; +--let $CHILD2_2_DROP_TABLES_BACKUP= $CHILD2_2_DROP_TABLES +let $CHILD2_2_DROP_TABLES= + DROP TABLE IF EXISTS tbl_a; +--let $CHILD2_2_CREATE_TABLES_BACKUP= $CHILD2_2_CREATE_TABLES +let $CHILD2_2_CREATE_TABLES= + CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) + ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; +--let $CHILD2_2_SELECT_TABLES_BACKUP= $CHILD2_2_SELECT_TABLES +let $CHILD2_2_SELECT_TABLES= + SELECT pkey FROM tbl_a ORDER BY pkey; +let $CHILD2_2_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; +--connection child2_1 +set @old_wait_timeout= @@wait_timeout; +set global wait_timeout= 1; +--connection child2_2 +set @old_wait_timeout= @@wait_timeout; +set global wait_timeout= 1; diff --git a/storage/spider/mysql-test/spider/bugfix/include/xa_cmd_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/xa_cmd_deinit.inc new file mode 100644 index 00000000000..76b7582abfe --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/xa_cmd_deinit.inc @@ -0,0 +1,11 @@ +--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP +--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP +--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP +--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/bugfix/include/xa_cmd_init.inc b/storage/spider/mysql-test/spider/bugfix/include/xa_cmd_init.inc new file mode 100644 index 00000000000..5c607bd1ff5 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/xa_cmd_init.inc @@ -0,0 +1,24 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_init.inc +--enable_result_log +--enable_query_log +--enable_warnings +--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1 +let $MASTER_1_COMMENT_2_1= + COMMENT='table "tbl_a", srv "s_2_1"'; +--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES +let $CHILD2_1_DROP_TABLES= + DROP TABLE IF EXISTS tbl_a; +--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES +let $CHILD2_1_CREATE_TABLES= + CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; +--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES +let $CHILD2_1_SELECT_TABLES= + SELECT pkey FROM tbl_a ORDER BY pkey; +let $CHILD2_1_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; diff --git a/storage/spider/mysql-test/spider/bugfix/r/checksum_table_with_quick_mode_3.result b/storage/spider/mysql-test/spider/bugfix/r/checksum_table_with_quick_mode_3.result index eae4895411e..bd423d934f5 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/checksum_table_with_quick_mode_3.result +++ b/storage/spider/mysql-test/spider/bugfix/r/checksum_table_with_quick_mode_3.result @@ -44,10 +44,10 @@ CHECKSUM TABLE tbl_a EXTENDED; Table Checksum auto_test_local.tbl_a 1061386331 connection child2_1; -SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%checksum %'; argument -select `pkey` from `auto_test_remote`.`tbl_a` -SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' +checksum table `auto_test_remote`.`tbl_a` extended +SELECT argument FROM mysql.general_log WHERE argument LIKE '%checksum %' SELECT pkey FROM tbl_a ORDER BY pkey; pkey 0 diff --git a/storage/spider/mysql-test/spider/bugfix/r/cp932_column.result b/storage/spider/mysql-test/spider/bugfix/r/cp932_column.result new file mode 100644 index 00000000000..30b333c5008 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/cp932_column.result @@ -0,0 +1,84 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 1; + +this test is for MDEV-18992 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +txt_utf8 char(8) NOT NULL, +txt_cp932 char(8) NOT NULL COLLATE cp932_japanese_ci, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE DEFAULT CHARACTER SET utf8 MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey,txt_utf8,txt_cp932) VALUES (0,'',''),(1,'',''),(2,'',''),(3,'',''),(4,'',''),(5,'',''),(6,'',''),(7,'',''),(8,'',''),(9,'',''); +FLUSH TABLES; + +test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection master_1; +SET NAMES cp932; +INSERT INTO tbl_a (pkey,txt_utf8,txt_cp932) VALUES (10,'','’†‘'); +INSERT INTO tbl_a (pkey,txt_utf8,txt_cp932) VALUES (0,'','') ON DUPLICATE KEY UPDATE txt_cp932 = '’†‘'; +UPDATE tbl_a SET txt_cp932 = '’†‘' WHERE pkey = 2; +SET NAMES utf8; +connection child2_1; +SET NAMES cp932; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %' OR argument LIKE '%update %'; +argument +insert into `auto_test_remote`.`tbl_a`(`pkey`,`txt_utf8`,`txt_cp932`)values(10,'',_cp932'\\x92\\x86\\x8D\\x91') +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`txt_utf8`,`txt_cp932`)values(0,'',_cp932'') on duplicate key update `txt_cp932` = _cp932'\x92\x86\x8D\x91' +update `auto_test_remote`.`tbl_a` set `txt_cp932` = _cp932'\x92\x86\x8D\x91' where (`pkey` = 2) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %' OR argument LIKE '%update %' +SELECT pkey, txt_utf8, txt_cp932 FROM tbl_a ORDER BY pkey; +pkey txt_utf8 txt_cp932 +0 ’†‘ +1 +2 ’†‘ +3 +4 +5 +6 +7 +8 +9 +10 ’†‘ +SET NAMES utf8; + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_mariadb.result b/storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_mariadb.result new file mode 100644 index 00000000000..d9fb00a09fc --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_mariadb.result @@ -0,0 +1,85 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +for slave1_1 +connection slave1_1; +connection master_1; +set @old_binlog_format= @@binlog_format; +set session binlog_format= 'ROW'; + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection slave1_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +connection slave1_1; +connection master_1; +SET SESSION sql_log_bin= 0; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +f float DEFAULT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE2 MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +SET SESSION sql_log_bin= 1; +connection slave1_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +f float DEFAULT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +connection master_1; +INSERT INTO tbl_a (pkey, f) VALUES (0,NULL); +INSERT INTO tbl_a (pkey, f) VALUES (1,0.671437); +DELETE FROM tbl_a WHERE pkey = 0; +DELETE FROM tbl_a WHERE pkey = 1; +connection slave1_1; +connection master_1; +SET SESSION sql_log_bin= 0; +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%delete %'; +argument +delete from `auto_test_remote`.`tbl_a` where `pkey` = 0 and `f` is null limit 1 +delete from `auto_test_remote`.`tbl_a` where `pkey` = 1 and `f` = cast(0.671437 as float) limit 1 +SELECT argument FROM mysql.general_log WHERE argument LIKE '%delete %' +SELECT pkey, f FROM tbl_a ORDER BY pkey; +pkey f +connection slave1_1; +SELECT pkey, f FROM tbl_a ORDER BY pkey; +pkey f + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection slave1_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session binlog_format= @old_binlog_format; +connection slave1_1; +for slave1_1 +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_mysql.result b/storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_mysql.result new file mode 100644 index 00000000000..9b11de7cff6 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_mysql.result @@ -0,0 +1,85 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +for slave1_1 +connection slave1_1; +connection master_1; +set @old_binlog_format= @@binlog_format; +set session binlog_format= 'ROW'; + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection slave1_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +connection slave1_1; +connection master_1; +SET SESSION sql_log_bin= 0; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +f float DEFAULT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE2 MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +SET SESSION sql_log_bin= 1; +connection slave1_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +f float DEFAULT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +connection master_1; +INSERT INTO tbl_a (pkey, f) VALUES (0,NULL); +INSERT INTO tbl_a (pkey, f) VALUES (1,0.671437); +DELETE FROM tbl_a WHERE pkey = 0; +DELETE FROM tbl_a WHERE pkey = 1; +connection slave1_1; +connection master_1; +SET SESSION sql_log_bin= 0; +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%delete %'; +argument +delete from `auto_test_remote`.`tbl_a` where `pkey` = 0 and `f` is null limit 1 +delete from `auto_test_remote`.`tbl_a` where `pkey` = 1 and `f` = /* create function to_float(a decimal(20,6)) returns float return a */ to_float(0.671437) limit 1 +SELECT argument FROM mysql.general_log WHERE argument LIKE '%delete %' +SELECT pkey, f FROM tbl_a ORDER BY pkey; +pkey f +connection slave1_1; +SELECT pkey, f FROM tbl_a ORDER BY pkey; +pkey f + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection slave1_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session binlog_format= @old_binlog_format; +connection slave1_1; +for slave1_1 +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/bugfix/r/direct_sql_with_comma_pwd.result b/storage/spider/mysql-test/spider/bugfix/r/direct_sql_with_comma_pwd.result new file mode 100644 index 00000000000..b485d645619 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/direct_sql_with_comma_pwd.result @@ -0,0 +1,37 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection child2_1; +GRANT ALL ON *.* TO tu@'%' IDENTIFIED BY 'pass,1234'; + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +CREATE TEMPORARY TABLE tmp_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE2 +SELECT spider_direct_sql('SELECT 22', 'tmp_a', 'srv "s_2_1", database "test", password "pass,1234", user "tu"'); +spider_direct_sql('SELECT 22', 'tmp_a', 'srv "s_2_1", database "test", password "pass,1234", user "tu"') +1 +SELECT pkey FROM tmp_a; +pkey +22 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP USER tu@'%'; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/bugfix/r/group_by_order_by_limit.result b/storage/spider/mysql-test/spider/bugfix/r/group_by_order_by_limit.result new file mode 100644 index 00000000000..8a2bcb73537 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/group_by_order_by_limit.result @@ -0,0 +1,117 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +this test is for MDEV-16520 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +connection child2_2; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection child2_2; +CHILD2_2_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +skey int NOT NULL, +PRIMARY KEY (pkey), +KEY idx1 (skey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey,skey) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +INSERT INTO tbl_a (pkey,skey) VALUES (10,10),(11,11),(12,12),(13,13),(14,14),(15,15),(16,16),(17,17),(18,18),(19,19); +INSERT INTO tbl_a (pkey,skey) VALUES (20,5),(21,6),(22,7),(23,8),(24,9),(25,10),(26,11),(27,12),(28,13),(29,14); + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection child2_2; +TRUNCATE TABLE mysql.general_log; +connection master_1; +SELECT skey, count(*) cnt FROM tbl_a GROUP BY skey ORDER BY cnt DESC, skey DESC LIMIT 5; +skey cnt +14 2 +13 2 +12 2 +11 2 +10 2 +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; +argument +select count(0),`skey` from `auto_test_remote`.`tbl_a` group by `skey` order by `skey` +SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' +SELECT pkey, skey FROM tbl_a ORDER BY pkey; +pkey skey +1 1 +3 3 +5 5 +7 7 +9 9 +11 11 +13 13 +15 15 +17 17 +19 19 +21 6 +23 8 +25 10 +27 12 +29 14 +connection child2_2; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; +argument +select count(0),`skey` from `auto_test_remote2`.`tbl_a` group by `skey` order by `skey` +SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' +SELECT pkey, skey FROM tbl_a ORDER BY pkey; +pkey skey +0 0 +2 2 +4 4 +6 6 +8 8 +10 10 +12 12 +14 14 +16 16 +18 18 +20 5 +22 7 +24 9 +26 11 +28 13 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +SET GLOBAL log_output = @old_log_output; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_19866.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_19866.result new file mode 100644 index 00000000000..5d483481edd --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_19866.result @@ -0,0 +1,111 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +this test is for MDEV-19866 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +connection child2_2; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection child2_2; +CHILD2_2_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +val char(1) NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey,val) VALUES (1,'1'),(2,'2'),(3,'3'),(4,'4'); + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection child2_2; +TRUNCATE TABLE mysql.general_log; +connection master_1; +SELECT * FROM tbl_a; +pkey val +1 1 +3 3 +2 2 +4 4 +SELECT * FROM tbl_a WHERE pkey = 1; +pkey val +1 1 +SELECT * FROM tbl_a; +pkey val +1 1 +3 3 +2 2 +4 4 +SELECT * FROM tbl_a WHERE pkey = 2; +pkey val +2 2 +SELECT * FROM tbl_a; +pkey val +1 1 +3 3 +2 2 +4 4 +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; +argument +select `pkey`,`val` from `auto_test_remote`.`tbl_a` +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 1 +select `pkey`,`val` from `auto_test_remote`.`tbl_a` +select `pkey`,`val` from `auto_test_remote`.`tbl_a` +SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +1 1 +3 3 +connection child2_2; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; +argument +select `pkey`,`val` from `auto_test_remote2`.`tbl_a` +select `pkey`,`val` from `auto_test_remote2`.`tbl_a` +select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 2 +select `pkey`,`val` from `auto_test_remote2`.`tbl_a` +SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +2 2 +4 4 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +SET GLOBAL log_output = @old_log_output; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_20100.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_20100.result index fc4fb02d72f..9d2297b4daf 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_20100.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_20100.result @@ -78,16 +78,16 @@ a b c connection child2_1; SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; argument -select `a`,`b`,`c` from `auto_test_remote`.`ta_r3` where (`b` = 'c') +select t0.`a` `a`,t0.`b` `b`,t0.`c` `c` from `auto_test_remote`.`ta_r3` t0 where (t0.`b` = 'c') select `a`,`b`,`c` from `auto_test_remote`.`ta_r2` select `a`,`b`,`c` from `auto_test_remote`.`ta_r3` -select `a`,`b`,`c` from `auto_test_remote`.`ta_r4` where (`b` = 'c') +select t0.`a` `a`,t0.`b` `b`,t0.`c` `c` from `auto_test_remote`.`ta_r4` t0 where (t0.`b` = 'c') select `a`,`b`,`c` from `auto_test_remote`.`ta_r2` select `a`,`b`,`c` from `auto_test_remote`.`ta_r3` -select `a`,`b`,`c` from `auto_test_remote`.`ta_r2` where (`b` = 'c') +select t0.`a` `a`,t0.`b` `b`,t0.`c` `c` from `auto_test_remote`.`ta_r2` t0 where (t0.`b` = 'c') select `a`,`b`,`c` from `auto_test_remote`.`ta_r2` select `a`,`b`,`c` from `auto_test_remote`.`ta_r4` -select `a`,`b`,`c` from `auto_test_remote`.`ta_r2` where (`b` = 'c') +select t0.`a` `a`,t0.`b` `b`,t0.`c` `c` from `auto_test_remote`.`ta_r2` t0 where (t0.`b` = 'c') select `a`,`b`,`c` from `auto_test_remote`.`ta_r3` select `a`,`b`,`c` from `auto_test_remote`.`ta_r4` SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_21884.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_21884.result index 921744f7f76..d5ba9b1e64a 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_21884.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_21884.result @@ -72,11 +72,8 @@ connection child2_1; SET NAMES utf8; SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; argument -select `a`,`b` from `auto_test_remote`.`ta_r3` where `a` = 11 order by `b` -select `a`,`b` from `auto_test_remote`.`ta_r3` where `a` = 12 order by `b` -select `a`,`b` from `auto_test_remote`.`ta_r3` where `a` = 13 order by `b` -select `a`,`b` from `auto_test_remote`.`ta_r3` where `a` = 14 order by `b` -select `a`,`b` from `auto_test_remote`.`ta_r3` where `a` = 15 order by `b` +select `a`,`b` from `auto_test_remote`.`ta_r2` order by `a`,`b` +select `a`,`b` from `auto_test_remote`.`ta_r3` order by `a`,`b` SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' SELECT a, b, c FROM ta_r2 ORDER BY a ; SELECT a, b, c FROM ta_r3 ORDER BY a; diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_22246.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_22246.result new file mode 100644 index 00000000000..749c750e018 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_22246.result @@ -0,0 +1,79 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +this test is for MDEV-22246 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +connection child2_2; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection child2_2; +CHILD2_2_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +id bigint NOT NULL, +node text, +PRIMARY KEY (id) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (id,node) VALUES (1,'DB-G0'),(2,'DB-G1'); + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection child2_2; +TRUNCATE TABLE mysql.general_log; +connection master_1; +SELECT * FROM tbl_a; +id node +2 DB-G1 +1 DB-G0 +SELECT * FROM tbl_a WHERE id != 0; +id node +2 DB-G1 +1 DB-G0 +connection child2_1; +SELECT * FROM tbl_a ORDER BY id; +id node +2 DB-G1 +connection child2_2; +SELECT * FROM tbl_a ORDER BY id; +id node +1 DB-G0 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +SET GLOBAL log_output = @old_log_output; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/bugfix/r/return_found_rows_insert.result b/storage/spider/mysql-test/spider/bugfix/r/return_found_rows_insert.result new file mode 100644 index 00000000000..2ddec02ef81 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/return_found_rows_insert.result @@ -0,0 +1,179 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +this test is for MDEV-18973 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +skey int NOT NULL, +dt date NOT NULL, +tm time NOT NULL, +PRIMARY KEY (skey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (skey, dt, tm) VALUES (0, '2012-01-01', '12:00:00'),(1, '2012-02-01', '12:00:00'),(2, '2012-03-01', '12:00:00'),(3, '2012-04-01', '12:00:00'),(4, '2012-05-01', '12:00:00'),(5, '2012-06-01', '12:00:00'),(6, '2012-07-01', '12:00:00'),(7, '2012-08-01', '12:00:00'),(8, '2012-09-01', '12:00:00'),(9, '2012-10-01', '12:00:00'); +FLUSH TABLES; + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +MYSQL -v -v -u root -h localhost -P MASTER_1_MYPORT -S MASTER_1_MYSOCK -e "MASTER_1_SET_COMMAND INSERT IGNORE INTO tbl_a (skey, dt, tm) VALUES (0, '2013-01-01', '13:00:00'),(2, '2013-02-01', '13:00:00'),(4, '2013-03-01', '13:00:00'),(7, '2013-04-01', '13:00:00'),(8, '2013-05-01', '13:00:00'),(10, '2013-06-01', '13:00:00'),(11, '2013-07-01', '13:00:00'),(12, '2013-08-01', '13:00:00'),(13, '2013-09-01', '13:00:00'),(14, '2013-10-01', '13:00:00')" auto_test_local +-------------- +set session spider_direct_dup_insert=1 +-------------- + +Query OK, 0 rows affected + +-------------- +INSERT IGNORE INTO tbl_a (skey, dt, tm) VALUES (0, '2013-01-01', '13:00:00'),(2, '2013-02-01', '13:00:00'),(4, '2013-03-01', '13:00:00'),(7, '2013-04-01', '13:00:00'),(8, '2013-05-01', '13:00:00'),(10, '2013-06-01', '13:00:00'),(11, '2013-07-01', '13:00:00'),(12, '2013-08-01', '13:00:00'),(13, '2013-09-01', '13:00:00'),(14, '2013-10-01', '13:00:00') +-------------- + +Query OK, 5 rows affected +Records: 10 Duplicates: 5 Warnings: 0 + +Bye +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %' OR argument LIKE '%replace %'; +argument +insert ignore into `auto_test_remote`.`tbl_a`(`skey`,`dt`,`tm`)values(0,_latin1'2013-01-01',_latin1'13:00:00'),(2,_latin1'2013-02-01',_latin1'13:00:00'),(4,_latin1'2013-03-01',_latin1'13:00:00'),(7,_latin1'2013-04-01',_latin1'13:00:00'),(8,_latin1'2013-05-01',_latin1'13:00:00'),(10,_latin1'2013-06-01',_latin1'13:00:00'),(11,_latin1'2013-07-01',_latin1'13:00:00'),(12,_latin1'2013-08-01',_latin1'13:00:00'),(13,_latin1'2013-09-01',_latin1'13:00:00'),(14,_latin1'2013-10-01',_latin1'13:00:00') +SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %' OR argument LIKE '%replace %' +SELECT skey, dt, tm FROM tbl_a ORDER BY skey; +skey dt tm +0 2012-01-01 12:00:00 +1 2012-02-01 12:00:00 +2 2012-03-01 12:00:00 +3 2012-04-01 12:00:00 +4 2012-05-01 12:00:00 +5 2012-06-01 12:00:00 +6 2012-07-01 12:00:00 +7 2012-08-01 12:00:00 +8 2012-09-01 12:00:00 +9 2012-10-01 12:00:00 +10 2013-06-01 13:00:00 +11 2013-07-01 13:00:00 +12 2013-08-01 13:00:00 +13 2013-09-01 13:00:00 +14 2013-10-01 13:00:00 +TRUNCATE TABLE mysql.general_log; +MYSQL -v -v -u root -h localhost -P MASTER_1_MYPORT -S MASTER_1_MYSOCK -e "MASTER_1_SET_COMMAND REPLACE INTO tbl_a (skey, dt, tm) VALUES (1, '2012-02-01', '12:00:00'),(3, '2012-12-01', '11:00:00'),(8, '2012-11-30', '11:00:00'),(9, '2012-11-29', '11:00:00'),(10, '2012-11-28', '11:00:00'),(15, '2012-11-27', '11:00:00'),(16, '2012-11-26', '11:00:00'),(17, '2012-11-25', '11:00:00'),(18, '2012-11-24', '11:00:00'),(19, '2012-11-23', '11:00:00')" auto_test_local +-------------- +set session spider_direct_dup_insert=1 +-------------- + +Query OK, 0 rows affected + +-------------- +REPLACE INTO tbl_a (skey, dt, tm) VALUES (1, '2012-02-01', '12:00:00'),(3, '2012-12-01', '11:00:00'),(8, '2012-11-30', '11:00:00'),(9, '2012-11-29', '11:00:00'),(10, '2012-11-28', '11:00:00'),(15, '2012-11-27', '11:00:00'),(16, '2012-11-26', '11:00:00'),(17, '2012-11-25', '11:00:00'),(18, '2012-11-24', '11:00:00'),(19, '2012-11-23', '11:00:00') +-------------- + +Query OK, 14 rows affected +Records: 10 Duplicates: 4 Warnings: 0 + +Bye +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %' OR argument LIKE '%replace %'; +argument +replace into `auto_test_remote`.`tbl_a`(`skey`,`dt`,`tm`)values(1,_latin1'2012-02-01',_latin1'12:00:00'),(3,_latin1'2012-12-01',_latin1'11:00:00'),(8,_latin1'2012-11-30',_latin1'11:00:00'),(9,_latin1'2012-11-29',_latin1'11:00:00'),(10,_latin1'2012-11-28',_latin1'11:00:00'),(15,_latin1'2012-11-27',_latin1'11:00:00'),(16,_latin1'2012-11-26',_latin1'11:00:00'),(17,_latin1'2012-11-25',_latin1'11:00:00'),(18,_latin1'2012-11-24',_latin1'11:00:00'),(19,_latin1'2012-11-23',_latin1'11:00:00') +SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %' OR argument LIKE '%replace %' +SELECT skey, dt, tm FROM tbl_a ORDER BY skey; +skey dt tm +0 2012-01-01 12:00:00 +1 2012-02-01 12:00:00 +2 2012-03-01 12:00:00 +3 2012-12-01 11:00:00 +4 2012-05-01 12:00:00 +5 2012-06-01 12:00:00 +6 2012-07-01 12:00:00 +7 2012-08-01 12:00:00 +8 2012-11-30 11:00:00 +9 2012-11-29 11:00:00 +10 2012-11-28 11:00:00 +11 2013-07-01 13:00:00 +12 2013-08-01 13:00:00 +13 2013-09-01 13:00:00 +14 2013-10-01 13:00:00 +15 2012-11-27 11:00:00 +16 2012-11-26 11:00:00 +17 2012-11-25 11:00:00 +18 2012-11-24 11:00:00 +19 2012-11-23 11:00:00 +TRUNCATE TABLE mysql.general_log; +MYSQL -v -v -u root -h localhost -P MASTER_1_MYPORT -S MASTER_1_MYSOCK -e "MASTER_1_SET_COMMAND INSERT INTO tbl_a (skey, dt, tm) VALUES (1, '2012-11-01', '11:00:00'),(3, '2012-12-01', '11:00:00'),(11, '2012-11-30', '11:00:00'),(15, '2012-11-29', '11:00:00'),(16, '2012-11-28', '11:00:00'),(20, '2012-11-27', '11:00:00'),(21, '2012-11-26', '11:00:00'),(22, '2012-11-25', '11:00:00'),(23, '2012-11-24', '11:00:00'),(24, '2012-11-23', '11:00:00') ON DUPLICATE KEY UPDATE dt=VALUE(dt), tm=VALUE(tm)" auto_test_local +-------------- +set session spider_direct_dup_insert=1 +-------------- + +Query OK, 0 rows affected + +-------------- +INSERT INTO tbl_a (skey, dt, tm) VALUES (1, '2012-11-01', '11:00:00'),(3, '2012-12-01', '11:00:00'),(11, '2012-11-30', '11:00:00'),(15, '2012-11-29', '11:00:00'),(16, '2012-11-28', '11:00:00'),(20, '2012-11-27', '11:00:00'),(21, '2012-11-26', '11:00:00'),(22, '2012-11-25', '11:00:00'),(23, '2012-11-24', '11:00:00'),(24, '2012-11-23', '11:00:00') ON DUPLICATE KEY UPDATE dt=VALUE(dt), tm=VALUE(tm) +-------------- + +Query OK, 13 rows affected +Records: 10 Duplicates: 4 Warnings: 0 + +Bye +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %' OR argument LIKE '%replace %'; +argument +insert high_priority into `auto_test_remote`.`tbl_a`(`skey`,`dt`,`tm`)values(1,_latin1'2012-11-01',_latin1'11:00:00'),(3,_latin1'2012-12-01',_latin1'11:00:00'),(11,_latin1'2012-11-30',_latin1'11:00:00'),(15,_latin1'2012-11-29',_latin1'11:00:00'),(16,_latin1'2012-11-28',_latin1'11:00:00'),(20,_latin1'2012-11-27',_latin1'11:00:00'),(21,_latin1'2012-11-26',_latin1'11:00:00'),(22,_latin1'2012-11-25',_latin1'11:00:00'),(23,_latin1'2012-11-24',_latin1'11:00:00'),(24,_latin1'2012-11-23',_latin1'11:00:00') on duplicate key update `dt` = values(`dt`),`tm` = values(`tm`) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %' OR argument LIKE '%replace %' +SELECT skey, dt, tm FROM tbl_a ORDER BY skey; +skey dt tm +0 2012-01-01 12:00:00 +1 2012-11-01 11:00:00 +2 2012-03-01 12:00:00 +3 2012-12-01 11:00:00 +4 2012-05-01 12:00:00 +5 2012-06-01 12:00:00 +6 2012-07-01 12:00:00 +7 2012-08-01 12:00:00 +8 2012-11-30 11:00:00 +9 2012-11-29 11:00:00 +10 2012-11-28 11:00:00 +11 2012-11-30 11:00:00 +12 2013-08-01 13:00:00 +13 2013-09-01 13:00:00 +14 2013-10-01 13:00:00 +15 2012-11-29 11:00:00 +16 2012-11-28 11:00:00 +17 2012-11-25 11:00:00 +18 2012-11-24 11:00:00 +19 2012-11-23 11:00:00 +20 2012-11-27 11:00:00 +21 2012-11-26 11:00:00 +22 2012-11-25 11:00:00 +23 2012-11-24 11:00:00 +24 2012-11-23 11:00:00 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/bugfix/r/return_found_rows_update.result b/storage/spider/mysql-test/spider/bugfix/r/return_found_rows_update.result new file mode 100644 index 00000000000..cd5423ed272 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/return_found_rows_update.result @@ -0,0 +1,99 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +this test is for MDEV-18973 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +skey int NOT NULL, +dt date NOT NULL, +tm time NOT NULL, +KEY idx1 (skey,dt) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (skey, dt, tm) VALUES (0, '2012-01-01', '12:00:00'),(1, '2012-02-01', '12:00:00'),(2, '2012-03-01', '12:00:00'),(3, '2012-04-01', '12:00:00'),(4, '2012-05-01', '12:00:00'),(5, '2012-06-01', '12:00:00'),(6, '2012-07-01', '12:00:00'),(7, '2012-08-01', '12:00:00'),(8, '2012-09-01', '12:00:00'),(9, '2012-10-01', '12:00:00'); +INSERT INTO tbl_a (skey, dt, tm) VALUES (0, '2013-01-01', '13:00:00'),(1, '2013-02-01', '13:00:00'),(2, '2013-03-01', '13:00:00'),(3, '2013-04-01', '13:00:00'),(4, '2013-05-01', '13:00:00'),(5, '2013-06-01', '13:00:00'),(6, '2013-07-01', '13:00:00'),(7, '2013-08-01', '13:00:00'),(8, '2013-09-01', '13:00:00'),(9, '2013-10-01', '13:00:00'); +INSERT INTO tbl_a (skey, dt, tm) VALUES (0, '2012-11-01', '11:00:00'),(1, '2012-12-01', '11:00:00'),(2, '2012-11-30', '11:00:00'),(3, '2012-11-29', '11:00:00'),(4, '2012-11-28', '11:00:00'),(5, '2012-11-27', '11:00:00'),(6, '2012-11-26', '11:00:00'),(7, '2012-11-25', '11:00:00'),(8, '2012-11-24', '11:00:00'),(9, '2012-11-23', '11:00:00'); +FLUSH TABLES; + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +MYSQL -v -v -u root -h localhost -P MASTER_1_MYPORT -S MASTER_1_MYSOCK -e "UPDATE tbl_a SET tm = '12:00:00' WHERE skey = 0" auto_test_local +-------------- +UPDATE tbl_a SET tm = '12:00:00' WHERE skey = 0 +-------------- + +Query OK, 2 rows affected +Rows matched: 3 Changed: 2 Warnings: 0 + +Bye +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%update %'; +argument +update `auto_test_remote`.`tbl_a` set `tm` = _latin1'12:00:00' where (`skey` = 0) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%update %' +SELECT skey, dt, tm FROM tbl_a ORDER BY skey; +skey dt tm +0 2012-01-01 12:00:00 +0 2013-01-01 12:00:00 +0 2012-11-01 12:00:00 +1 2012-12-01 11:00:00 +1 2013-02-01 13:00:00 +1 2012-02-01 12:00:00 +2 2013-03-01 13:00:00 +2 2012-11-30 11:00:00 +2 2012-03-01 12:00:00 +3 2012-11-29 11:00:00 +3 2013-04-01 13:00:00 +3 2012-04-01 12:00:00 +4 2012-11-28 11:00:00 +4 2012-05-01 12:00:00 +4 2013-05-01 13:00:00 +5 2012-11-27 11:00:00 +5 2012-06-01 12:00:00 +5 2013-06-01 13:00:00 +6 2013-07-01 13:00:00 +6 2012-11-26 11:00:00 +6 2012-07-01 12:00:00 +7 2012-11-25 11:00:00 +7 2012-08-01 12:00:00 +7 2013-08-01 13:00:00 +8 2012-09-01 12:00:00 +8 2013-09-01 13:00:00 +8 2012-11-24 11:00:00 +9 2012-10-01 12:00:00 +9 2013-10-01 13:00:00 +9 2012-11-23 11:00:00 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/bugfix/r/same_server_link.result b/storage/spider/mysql-test/spider/bugfix/r/same_server_link.result new file mode 100644 index 00000000000..1f4177568a7 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/same_server_link.result @@ -0,0 +1,42 @@ +for master_1 +for child2 +for child3 +connection master_1; +set @old_global_spider_same_server_link= @@global.spider_same_server_link; +set @old_session_spider_same_server_link= @@session.spider_same_server_link; +set global spider_same_server_link= 0; +set session spider_same_server_link= 0; + +this test is for MDEV-6268 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; + +create table +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +CREATE TABLE tbl_b ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE2 MASTER_1_CHARSET MASTER_1_COMMENT_2_1 + +select test 1 +connection master_1; +INSERT INTO tbl_a VALUES(1); + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection master_1; +set global spider_same_server_link= @old_global_spider_same_server_link; +set session spider_same_server_link= @old_session_spider_same_server_link; +for master_1 +for child2 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/bugfix/r/select_with_backquote.result b/storage/spider/mysql-test/spider/bugfix/r/select_with_backquote.result new file mode 100644 index 00000000000..52f8c98bf98 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/select_with_backquote.result @@ -0,0 +1,75 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +this test is for MDEV-17204 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +txt_utf8 char(8) NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE DEFAULT CHARACTER SET utf8 MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey,txt_utf8) VALUES (0,'01234567'),(1,'12345678'),(2,'23456789'),(3,'34567890'),(4,'45678901'),(5,'56789012'),(6,'67890123'),(7,'78901234'),(8,'89012345'),(9,'90123456'); +FLUSH TABLES; + +test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection master_1; +SET NAMES utf8; +SELECT `pkey`, LEFT(`txt_utf8`, 4) FROM `auto_test_local`.`tbl_a` ORDER BY LEFT(`txt_utf8`, 4) LIMIT 3; +pkey LEFT(`txt_utf8`, 4) +0 0123 +1 1234 +2 2345 +connection child2_1; +SET NAMES utf8; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; +argument +select t0.`pkey` `pkey`,(left(t0.`txt_utf8` , 4)) `LEFT(``txt_utf8``, 4)` from `auto_test_remote`.`tbl_a` t0 order by `LEFT(``txt_utf8``, 4)` limit 3 +SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' +SELECT pkey, txt_utf8 FROM tbl_a ORDER BY pkey; +pkey txt_utf8 +0 01234567 +1 12345678 +2 23456789 +3 34567890 +4 45678901 +5 56789012 +6 67890123 +7 78901234 +8 89012345 +9 90123456 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/bugfix/r/slave_transaction_retry_errors_5digit.result b/storage/spider/mysql-test/spider/bugfix/r/slave_transaction_retry_errors_5digit.result new file mode 100644 index 00000000000..f2cab6b0a95 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/slave_transaction_retry_errors_5digit.result @@ -0,0 +1,22 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +for slave1_1 + +connection slave1_1; +SHOW VARIABLES LIKE 'slave_transaction_retry_errors'; +Variable_name Value +slave_transaction_retry_errors 1158,1159,1160,1161,1205,1213,1429,2013,12701,10000,20000,30000 +connection slave1_1; +for slave1_1 +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/bugfix/r/slave_trx_isolation.result b/storage/spider/mysql-test/spider/bugfix/r/slave_trx_isolation.result index 06581a604a2..d7a0c1044a7 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/slave_trx_isolation.result +++ b/storage/spider/mysql-test/spider/bugfix/r/slave_trx_isolation.result @@ -50,7 +50,7 @@ SELECT argument FROM mysql.general_log WHERE argument LIKE '%set %'; argument set session time_zone = '+00:00' SET NAMES utf8 -set session transaction isolation level read committed;set session autocommit = 1;start transaction +set session transaction isolation level read committed;set session autocommit = 1;set session wait_timeout = 604800;set session sql_mode = 'strict_trans_tables,error_for_division_by_zero,no_auto_create_user,no_engine_substitution';start transaction SELECT argument FROM mysql.general_log WHERE argument LIKE '%set %' SELECT pkey FROM tbl_a ORDER BY pkey; pkey diff --git a/storage/spider/mysql-test/spider/bugfix/r/spider_table_sts.result b/storage/spider/mysql-test/spider/bugfix/r/spider_table_sts.result new file mode 100644 index 00000000000..f915cc951b1 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/spider_table_sts.result @@ -0,0 +1,38 @@ +for master_1 +for child2 +for child3 +connection master_1; +alter table mysql.spider_table_sts drop column checksum; +insert into mysql.spider_table_sts values ('auto_test_local', 'tbl_a', 0, 0, 0, 0, 0, '2019-01-01 00:00:00', '2019-01-01 00:00:00', '2019-01-01 00:00:00'); + +this test is for MDEV-19842 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; + +create table +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 + +select test 1 +connection master_1; +SELECT pkey FROM tbl_a; +ERROR HY000: System table spider_table_sts is different version + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +ERROR HY000: System table spider_table_sts is different version +connection master_1; +alter table mysql.spider_table_sts add column checksum bigint unsigned default null after update_time; +DROP DATABASE IF EXISTS auto_test_local; +for master_1 +for child2 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/bugfix/r/sql_mode_mariadb.result b/storage/spider/mysql-test/spider/bugfix/r/sql_mode_mariadb.result new file mode 100644 index 00000000000..5048fbb423c --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/sql_mode_mariadb.result @@ -0,0 +1,83 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_sql_mode= @@sql_mode; +set session sql_mode= 'real_as_float,pipes_as_concat,ansi_quotes,ignore_space,ignore_bad_table_options,only_full_group_by,no_unsigned_subtraction,no_dir_in_create,postgresql,oracle,mssql,db2,maxdb,no_key_options,no_table_options,no_field_options,mysql323,mysql40,ansi,no_auto_value_on_zero,no_backslash_escapes,strict_trans_tables,strict_all_tables,no_zero_in_date,no_zero_date,allow_invalid_dates,error_for_division_by_zero,traditional,no_auto_create_user,high_not_precedence,no_engine_substitution,pad_char_to_full_length,empty_string_is_null,simultaneous_assignment,time_round_fractional'; + +this test is for MDEV-16508 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +select test +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection master_1; +SELECT * FROM tbl_a ORDER BY pkey; +pkey +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%sql_mode%'; +argument +set session transaction isolation level repeatable read;set session autocommit = 1;set session sql_log_off = 0;set session wait_timeout = 604800;set session sql_mode = 'real_as_float,ignore_bad_table_options,no_unsigned_subtraction,no_dir_in_create,no_auto_value_on_zero,strict_trans_tables,strict_all_tables,no_zero_in_date,no_zero_date,allow_invalid_dates,error_for_division_by_zero,no_auto_create_user,high_not_precedence,no_engine_substitution,pad_char_to_full_length,empty_string_is_null,simultaneous_assignment,time_round_fractional';set session time_zone = '+00:00';start transaction +SELECT argument FROM mysql.general_log WHERE argument LIKE '%sql_mode%' +SELECT pkey FROM tbl_a ORDER BY pkey; +pkey +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session sql_mode= @old_sql_mode; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/bugfix/r/sql_mode_mysql.result b/storage/spider/mysql-test/spider/bugfix/r/sql_mode_mysql.result new file mode 100644 index 00000000000..08f9a6007aa --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/sql_mode_mysql.result @@ -0,0 +1,83 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_sql_mode= @@sql_mode; +set session sql_mode= 'real_as_float,pipes_as_concat,ansi_quotes,ignore_space,ignore_bad_table_options,only_full_group_by,no_unsigned_subtraction,no_dir_in_create,postgresql,oracle,mssql,db2,maxdb,no_key_options,no_table_options,no_field_options,mysql323,mysql40,ansi,no_auto_value_on_zero,no_backslash_escapes,strict_trans_tables,strict_all_tables,no_zero_in_date,no_zero_date,allow_invalid_dates,error_for_division_by_zero,traditional,no_auto_create_user,high_not_precedence,no_engine_substitution,pad_char_to_full_length,empty_string_is_null,simultaneous_assignment,time_round_fractional'; + +this test is for MDEV-16508 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +select test +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection master_1; +SELECT * FROM tbl_a ORDER BY pkey; +pkey +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%sql_mode%'; +argument +set session transaction isolation level repeatable read;set session autocommit = 1;set session sql_log_off = 0;set session wait_timeout = 604800;set session sql_mode = 'real_as_float,ignore_bad_table_options,no_unsigned_subtraction,no_dir_in_create,no_auto_value_on_zero,strict_trans_tables,strict_all_tables,no_zero_in_date,no_zero_date,allow_invalid_dates,error_for_division_by_zero,no_auto_create_user,high_not_precedence,no_engine_substitution,pad_char_to_full_length';set session time_zone = '+00:00';start transaction +SELECT argument FROM mysql.general_log WHERE argument LIKE '%sql_mode%' +SELECT pkey FROM tbl_a ORDER BY pkey; +pkey +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session sql_mode= @old_sql_mode; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/bugfix/r/wait_timeout.result b/storage/spider/mysql-test/spider/bugfix/r/wait_timeout.result new file mode 100644 index 00000000000..ec9534f7592 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/wait_timeout.result @@ -0,0 +1,130 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection child2_1; +set @old_wait_timeout= @@wait_timeout; +set global wait_timeout= 1; +connection child2_2; +set @old_wait_timeout= @@wait_timeout; +set global wait_timeout= 1; + +this test is for MDEV-16530 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +connection child2_1_2; +USE auto_test_remote; +connection child2_2; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; +connection child2_2_2; +USE auto_test_remote2; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection child2_2; +CHILD2_2_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); +INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29); + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +LOCK TABLE tbl_a READ; +connection child2_2; +TRUNCATE TABLE mysql.general_log; +connection master_1; +INSERT INTO tbl_a SELECT pkey + 30 FROM tbl_a ORDER BY pkey; +connection child2_1_2; +SELECT SLEEP(2); +SLEEP(2) +0 +SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; +argument +insert into `auto_test_remote`.`tbl_a`(`pkey`)values(31),(33),(35),(37),(39),(41),(43),(45),(47),(49),(51),(53),(55),(57),(59) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %' +connection child2_2_2; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; +argument +SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %' +connection child2_1; +UNLOCK TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; +pkey +1 +3 +5 +7 +9 +11 +13 +15 +17 +19 +21 +23 +25 +27 +29 +connection child2_2; +SELECT pkey FROM tbl_a ORDER BY pkey; +pkey +0 +2 +4 +6 +8 +10 +12 +14 +16 +18 +20 +22 +24 +26 +28 +connection master_1; + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +SET GLOBAL log_output = @old_log_output; +connection child2_1; +set global wait_timeout= @old_wait_timeout; +connection child2_2; +set global wait_timeout= @old_wait_timeout; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/bugfix/r/xa_cmd.result b/storage/spider/mysql-test/spider/bugfix/r/xa_cmd.result new file mode 100644 index 00000000000..846dc6c737b --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/xa_cmd.result @@ -0,0 +1,68 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +this test is for MDEV-19794 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection master_1; +XA START 'test'; +INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +XA END 'test'; +XA PREPARE 'test'; +XA COMMIT 'test'; +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; +argument +insert into `auto_test_remote`.`tbl_a`(`pkey`)values(0),(1),(2),(3),(4),(5),(6),(7),(8),(9) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %' +SELECT pkey FROM tbl_a ORDER BY pkey; +pkey +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/bugfix/t/cp932_column.cnf b/storage/spider/mysql-test/spider/bugfix/t/cp932_column.cnf new file mode 100644 index 00000000000..05dfd8a0bce --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/cp932_column.cnf @@ -0,0 +1,3 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf diff --git a/storage/spider/mysql-test/spider/bugfix/t/cp932_column.test b/storage/spider/mysql-test/spider/bugfix/t/cp932_column.test new file mode 100644 index 00000000000..8bd0d40cb60 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/cp932_column.test @@ -0,0 +1,80 @@ +--source ../include/cp932_column_init.inc +--echo +--echo this test is for MDEV-18992 +--echo +--echo drop and create databases + +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; + +--connection child2_1 +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +--enable_warnings + +--echo +--echo create table and insert + +--connection child2_1 +--disable_query_log +echo CHILD2_1_CREATE_TABLES; +eval $CHILD2_1_CREATE_TABLES; +--enable_query_log +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +--disable_query_log +echo CREATE TABLE tbl_a ( + pkey int NOT NULL, + txt_utf8 char(8) NOT NULL, + txt_cp932 char(8) NOT NULL COLLATE cp932_japanese_ci, + PRIMARY KEY (pkey) +) MASTER_1_ENGINE DEFAULT CHARACTER SET utf8 MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + pkey int NOT NULL, + txt_utf8 char(8) NOT NULL, + txt_cp932 char(8) NOT NULL COLLATE cp932_japanese_ci, + PRIMARY KEY (pkey) +) $MASTER_1_ENGINE DEFAULT CHARACTER SET utf8 $MASTER_1_COMMENT_2_1; +--enable_query_log +INSERT INTO tbl_a (pkey,txt_utf8,txt_cp932) VALUES (0,'',''),(1,'',''),(2,'',''),(3,'',''),(4,'',''),(5,'',''),(6,'',''),(7,'',''),(8,'',''),(9,'',''); +FLUSH TABLES; + +--echo +--echo test 1 + +--connection child2_1 +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +SET NAMES cp932; +INSERT INTO tbl_a (pkey,txt_utf8,txt_cp932) VALUES (10,'','’†‘'); +INSERT INTO tbl_a (pkey,txt_utf8,txt_cp932) VALUES (0,'','') ON DUPLICATE KEY UPDATE txt_cp932 = '’†‘'; +UPDATE tbl_a SET txt_cp932 = '’†‘' WHERE pkey = 2; +SET NAMES utf8; + +--connection child2_1 +SET NAMES cp932; +eval $CHILD2_1_SELECT_ARGUMENT1; +eval $CHILD2_1_SELECT_TABLES; +SET NAMES utf8; + +--echo +--echo deinit +--disable_warnings + +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; + +--connection child2_1 +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; + +--enable_warnings +--source ../include/cp932_column_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column.inc b/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column.inc new file mode 100644 index 00000000000..794ebedf355 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column.inc @@ -0,0 +1,98 @@ +--echo +--echo drop and create databases +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; + +--connection slave1_1 +CREATE DATABASE auto_test_local; +USE auto_test_local; + +--connection child2_1 +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +--enable_warnings + +--echo +--echo create table and insert + +--connection child2_1 +--disable_query_log +echo CHILD2_1_CREATE_TABLES; +eval $CHILD2_1_CREATE_TABLES; +--enable_query_log +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +save_master_pos; + +--connection slave1_1 +sync_with_master; + +--connection master_1 +SET SESSION sql_log_bin= 0; +--disable_query_log +echo CREATE TABLE tbl_a ( + pkey int NOT NULL, + f float DEFAULT NULL, + PRIMARY KEY (pkey) +) MASTER_1_ENGINE2 MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + pkey int NOT NULL, + f float DEFAULT NULL, + PRIMARY KEY (pkey) +) $MASTER_1_ENGINE2 $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log +SET SESSION sql_log_bin= 1; + +--connection slave1_1 +--disable_query_log +echo CREATE TABLE tbl_a ( + pkey int NOT NULL, + f float DEFAULT NULL, + PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + pkey int NOT NULL, + f float DEFAULT NULL, + PRIMARY KEY (pkey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log + +--connection master_1 +INSERT INTO tbl_a (pkey, f) VALUES (0,NULL); +INSERT INTO tbl_a (pkey, f) VALUES (1,0.671437); +DELETE FROM tbl_a WHERE pkey = 0; +DELETE FROM tbl_a WHERE pkey = 1; +save_master_pos; + +--connection slave1_1 +sync_with_master; + +--connection master_1 +SET SESSION sql_log_bin= 0; + +--connection child2_1 +eval $CHILD2_1_SELECT_ARGUMENT1; +eval $CHILD2_1_SELECT_TABLES; + +--connection slave1_1 +SELECT pkey, f FROM tbl_a ORDER BY pkey; + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; + +--connection slave1_1 +DROP DATABASE IF EXISTS auto_test_local; + +--connection child2_1 +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; + +--enable_warnings diff --git a/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_mariadb.cnf b/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_mariadb.cnf new file mode 100644 index 00000000000..45019d6c537 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_mariadb.cnf @@ -0,0 +1,4 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf +!include ../my_4_1.cnf diff --git a/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_mariadb.test b/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_mariadb.test new file mode 100644 index 00000000000..ce1a09d6287 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_mariadb.test @@ -0,0 +1,5 @@ +--source ../include/delete_with_float_column_mariadb_init.inc +--source delete_with_float_column.inc +--source ../include/delete_with_float_column_mariadb_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_mysql.cnf b/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_mysql.cnf new file mode 100644 index 00000000000..45019d6c537 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_mysql.cnf @@ -0,0 +1,4 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf +!include ../my_4_1.cnf diff --git a/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_mysql.test b/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_mysql.test new file mode 100644 index 00000000000..c687f947a91 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_mysql.test @@ -0,0 +1,5 @@ +--source ../include/delete_with_float_column_mysql_init.inc +--source delete_with_float_column.inc +--source ../include/delete_with_float_column_mysql_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/bugfix/t/direct_sql_with_comma_pwd.cnf b/storage/spider/mysql-test/spider/bugfix/t/direct_sql_with_comma_pwd.cnf new file mode 100644 index 00000000000..05dfd8a0bce --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/direct_sql_with_comma_pwd.cnf @@ -0,0 +1,3 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf diff --git a/storage/spider/mysql-test/spider/bugfix/t/direct_sql_with_comma_pwd.test b/storage/spider/mysql-test/spider/bugfix/t/direct_sql_with_comma_pwd.test new file mode 100644 index 00000000000..0b7d51190a7 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/direct_sql_with_comma_pwd.test @@ -0,0 +1,35 @@ +--source ../include/direct_sql_with_comma_pwd_init.inc +--echo +--echo drop and create databases + +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; +--enable_warnings + +--disable_query_log +echo CREATE TEMPORARY TABLE tmp_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) MASTER_1_ENGINE2; +eval CREATE TEMPORARY TABLE tmp_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) $MASTER_1_ENGINE2; +--enable_query_log + +eval $DIRECT_SQL_COMMAND; +SELECT pkey FROM tmp_a; + +--echo +--echo deinit +--disable_warnings + +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; + +--enable_warnings +--source ../include/direct_sql_with_comma_pwd_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/bugfix/t/group_by_order_by_limit.cnf b/storage/spider/mysql-test/spider/bugfix/t/group_by_order_by_limit.cnf new file mode 100644 index 00000000000..e0ffb99c38e --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/group_by_order_by_limit.cnf @@ -0,0 +1,4 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf +!include ../my_2_2.cnf diff --git a/storage/spider/mysql-test/spider/bugfix/t/group_by_order_by_limit.test b/storage/spider/mysql-test/spider/bugfix/t/group_by_order_by_limit.test new file mode 100644 index 00000000000..f1de6d5d25f --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/group_by_order_by_limit.test @@ -0,0 +1,97 @@ +--source ../include/group_by_order_by_limit_init.inc +--echo +--echo this test is for MDEV-16520 +--echo +--echo drop and create databases +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; + +--connection child2_1 +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +--connection child2_2 +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; +--enable_warnings + +--echo +--echo create table and insert + +--connection child2_1 +--disable_query_log +echo CHILD2_1_CREATE_TABLES; +eval $CHILD2_1_CREATE_TABLES; +--enable_query_log +TRUNCATE TABLE mysql.general_log; + +--connection child2_2 +--disable_query_log +echo CHILD2_2_CREATE_TABLES; +eval $CHILD2_2_CREATE_TABLES; +--enable_query_log +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +--disable_query_log +echo CREATE TABLE tbl_a ( + pkey int NOT NULL, + skey int NOT NULL, + PRIMARY KEY (pkey), + KEY idx1 (skey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + pkey int NOT NULL, + skey int NOT NULL, + PRIMARY KEY (pkey), + KEY idx1 (skey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log +INSERT INTO tbl_a (pkey,skey) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +INSERT INTO tbl_a (pkey,skey) VALUES (10,10),(11,11),(12,12),(13,13),(14,14),(15,15),(16,16),(17,17),(18,18),(19,19); +INSERT INTO tbl_a (pkey,skey) VALUES (20,5),(21,6),(22,7),(23,8),(24,9),(25,10),(26,11),(27,12),(28,13),(29,14); + +--echo +--echo select test 1 + +--connection child2_1 +TRUNCATE TABLE mysql.general_log; + +--connection child2_2 +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +SELECT skey, count(*) cnt FROM tbl_a GROUP BY skey ORDER BY cnt DESC, skey DESC LIMIT 5; + +--connection child2_1 +eval $CHILD2_1_SELECT_ARGUMENT1; +eval $CHILD2_1_SELECT_TABLES; + +--connection child2_2 +eval $CHILD2_2_SELECT_ARGUMENT1; +eval $CHILD2_2_SELECT_TABLES; + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; + +--connection child2_1 +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; + +--connection child2_2 +DROP DATABASE IF EXISTS auto_test_remote2; +SET GLOBAL log_output = @old_log_output; + +--enable_warnings +--source ../include/group_by_order_by_limit_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_19866.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_19866.cnf new file mode 100644 index 00000000000..e0ffb99c38e --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_19866.cnf @@ -0,0 +1,4 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf +!include ../my_2_2.cnf diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_19866.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_19866.test new file mode 100644 index 00000000000..05b753ae8bb --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_19866.test @@ -0,0 +1,97 @@ +--source ../include/mdev_19866_init.inc +--echo +--echo this test is for MDEV-19866 +--echo +--echo drop and create databases +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; + +--connection child2_1 +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +--connection child2_2 +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; +--enable_warnings + +--echo +--echo create table and insert + +--connection child2_1 +--disable_query_log +echo CHILD2_1_CREATE_TABLES; +eval $CHILD2_1_CREATE_TABLES; +--enable_query_log +TRUNCATE TABLE mysql.general_log; + +--connection child2_2 +--disable_query_log +echo CHILD2_2_CREATE_TABLES; +eval $CHILD2_2_CREATE_TABLES; +--enable_query_log +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +--disable_query_log +echo CREATE TABLE tbl_a ( + pkey int NOT NULL, + val char(1) NOT NULL, + PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + pkey int NOT NULL, + val char(1) NOT NULL, + PRIMARY KEY (pkey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log +INSERT INTO tbl_a (pkey,val) VALUES (1,'1'),(2,'2'),(3,'3'),(4,'4'); + +--echo +--echo select test 1 + +--connection child2_1 +TRUNCATE TABLE mysql.general_log; + +--connection child2_2 +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +SELECT * FROM tbl_a; +SELECT * FROM tbl_a WHERE pkey = 1; +SELECT * FROM tbl_a; +SELECT * FROM tbl_a WHERE pkey = 2; +SELECT * FROM tbl_a; + +--connection child2_1 +eval $CHILD2_1_SELECT_ARGUMENT1; +eval $CHILD2_1_SELECT_TABLES; + +--connection child2_2 +eval $CHILD2_2_SELECT_ARGUMENT1; +eval $CHILD2_2_SELECT_TABLES; + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; + +--connection child2_1 +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; + +--connection child2_2 +DROP DATABASE IF EXISTS auto_test_remote2; +SET GLOBAL log_output = @old_log_output; + +--enable_warnings +--source ../include/mdev_19866_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_22246.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_22246.cnf new file mode 100644 index 00000000000..e0ffb99c38e --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_22246.cnf @@ -0,0 +1,4 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf +!include ../my_2_2.cnf diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_22246.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_22246.test new file mode 100644 index 00000000000..63b04c14e11 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_22246.test @@ -0,0 +1,92 @@ +--source ../include/mdev_22246_init.inc +--echo +--echo this test is for MDEV-22246 +--echo +--echo drop and create databases +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; + +--connection child2_1 +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +--connection child2_2 +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; +--enable_warnings + +--echo +--echo create table and insert + +--connection child2_1 +--disable_query_log +echo CHILD2_1_CREATE_TABLES; +eval $CHILD2_1_CREATE_TABLES; +--enable_query_log +TRUNCATE TABLE mysql.general_log; + +--connection child2_2 +--disable_query_log +echo CHILD2_2_CREATE_TABLES; +eval $CHILD2_2_CREATE_TABLES; +--enable_query_log +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +--disable_query_log +echo CREATE TABLE tbl_a ( + id bigint NOT NULL, + node text, + PRIMARY KEY (id) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + id bigint NOT NULL, + node text, + PRIMARY KEY (id) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log +INSERT INTO tbl_a (id,node) VALUES (1,'DB-G0'),(2,'DB-G1'); + +--echo +--echo select test 1 + +--connection child2_1 +TRUNCATE TABLE mysql.general_log; + +--connection child2_2 +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +SELECT * FROM tbl_a; +SELECT * FROM tbl_a WHERE id != 0; + +--connection child2_1 +eval $CHILD2_1_SELECT_TABLES; + +--connection child2_2 +eval $CHILD2_2_SELECT_TABLES; + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; + +--connection child2_1 +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; + +--connection child2_2 +DROP DATABASE IF EXISTS auto_test_remote2; +SET GLOBAL log_output = @old_log_output; + +--enable_warnings +--source ../include/mdev_22246_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_insert.cnf b/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_insert.cnf new file mode 100644 index 00000000000..05dfd8a0bce --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_insert.cnf @@ -0,0 +1,3 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf diff --git a/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_insert.test b/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_insert.test new file mode 100644 index 00000000000..2beb9d9d7e4 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_insert.test @@ -0,0 +1,98 @@ +--source ../include/return_found_rows_insert_init.inc +--echo +--echo this test is for MDEV-18973 +--echo +--echo drop and create databases + +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; + +--connection child2_1 +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +--enable_warnings + +--echo +--echo create table and insert + +--connection child2_1 +--disable_query_log +echo CHILD2_1_CREATE_TABLES; +eval $CHILD2_1_CREATE_TABLES; +--enable_query_log +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +--disable_query_log +echo CREATE TABLE tbl_a ( + skey int NOT NULL, + dt date NOT NULL, + tm time NOT NULL, + PRIMARY KEY (skey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + skey int NOT NULL, + dt date NOT NULL, + tm time NOT NULL, + PRIMARY KEY (skey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log +INSERT INTO tbl_a (skey, dt, tm) VALUES (0, '2012-01-01', '12:00:00'),(1, '2012-02-01', '12:00:00'),(2, '2012-03-01', '12:00:00'),(3, '2012-04-01', '12:00:00'),(4, '2012-05-01', '12:00:00'),(5, '2012-06-01', '12:00:00'),(6, '2012-07-01', '12:00:00'),(7, '2012-08-01', '12:00:00'),(8, '2012-09-01', '12:00:00'),(9, '2012-10-01', '12:00:00'); +FLUSH TABLES; + +--echo +--echo select test 1 + +--connection child2_1 +TRUNCATE TABLE mysql.general_log; + +--disable_query_log +echo MYSQL -v -v -u root -h localhost -P MASTER_1_MYPORT -S MASTER_1_MYSOCK -e "MASTER_1_SET_COMMAND INSERT IGNORE INTO tbl_a (skey, dt, tm) VALUES (0, '2013-01-01', '13:00:00'),(2, '2013-02-01', '13:00:00'),(4, '2013-03-01', '13:00:00'),(7, '2013-04-01', '13:00:00'),(8, '2013-05-01', '13:00:00'),(10, '2013-06-01', '13:00:00'),(11, '2013-07-01', '13:00:00'),(12, '2013-08-01', '13:00:00'),(13, '2013-09-01', '13:00:00'),(14, '2013-10-01', '13:00:00')" auto_test_local; +exec $MYSQL -v -v -u root -h localhost -P $MASTER_1_MYPORT -S $MASTER_1_MYSOCK -e "$MASTER_1_SET_COMMAND INSERT IGNORE INTO tbl_a (skey, dt, tm) VALUES (0, '2013-01-01', '13:00:00'),(2, '2013-02-01', '13:00:00'),(4, '2013-03-01', '13:00:00'),(7, '2013-04-01', '13:00:00'),(8, '2013-05-01', '13:00:00'),(10, '2013-06-01', '13:00:00'),(11, '2013-07-01', '13:00:00'),(12, '2013-08-01', '13:00:00'),(13, '2013-09-01', '13:00:00'),(14, '2013-10-01', '13:00:00')" auto_test_local; +--enable_query_log + +--connection child2_1 +eval $CHILD2_1_SELECT_ARGUMENT1; +eval $CHILD2_1_SELECT_TABLES; + +TRUNCATE TABLE mysql.general_log; + +--disable_query_log +echo MYSQL -v -v -u root -h localhost -P MASTER_1_MYPORT -S MASTER_1_MYSOCK -e "MASTER_1_SET_COMMAND REPLACE INTO tbl_a (skey, dt, tm) VALUES (1, '2012-02-01', '12:00:00'),(3, '2012-12-01', '11:00:00'),(8, '2012-11-30', '11:00:00'),(9, '2012-11-29', '11:00:00'),(10, '2012-11-28', '11:00:00'),(15, '2012-11-27', '11:00:00'),(16, '2012-11-26', '11:00:00'),(17, '2012-11-25', '11:00:00'),(18, '2012-11-24', '11:00:00'),(19, '2012-11-23', '11:00:00')" auto_test_local; +exec $MYSQL -v -v -u root -h localhost -P $MASTER_1_MYPORT -S $MASTER_1_MYSOCK -e "$MASTER_1_SET_COMMAND REPLACE INTO tbl_a (skey, dt, tm) VALUES (1, '2012-02-01', '12:00:00'),(3, '2012-12-01', '11:00:00'),(8, '2012-11-30', '11:00:00'),(9, '2012-11-29', '11:00:00'),(10, '2012-11-28', '11:00:00'),(15, '2012-11-27', '11:00:00'),(16, '2012-11-26', '11:00:00'),(17, '2012-11-25', '11:00:00'),(18, '2012-11-24', '11:00:00'),(19, '2012-11-23', '11:00:00')" auto_test_local; +--enable_query_log + +--connection child2_1 +eval $CHILD2_1_SELECT_ARGUMENT1; +eval $CHILD2_1_SELECT_TABLES; + +TRUNCATE TABLE mysql.general_log; + +--disable_query_log +echo MYSQL -v -v -u root -h localhost -P MASTER_1_MYPORT -S MASTER_1_MYSOCK -e "MASTER_1_SET_COMMAND INSERT INTO tbl_a (skey, dt, tm) VALUES (1, '2012-11-01', '11:00:00'),(3, '2012-12-01', '11:00:00'),(11, '2012-11-30', '11:00:00'),(15, '2012-11-29', '11:00:00'),(16, '2012-11-28', '11:00:00'),(20, '2012-11-27', '11:00:00'),(21, '2012-11-26', '11:00:00'),(22, '2012-11-25', '11:00:00'),(23, '2012-11-24', '11:00:00'),(24, '2012-11-23', '11:00:00') ON DUPLICATE KEY UPDATE dt=VALUE(dt), tm=VALUE(tm)" auto_test_local; +exec $MYSQL -v -v -u root -h localhost -P $MASTER_1_MYPORT -S $MASTER_1_MYSOCK -e "$MASTER_1_SET_COMMAND INSERT INTO tbl_a (skey, dt, tm) VALUES (1, '2012-11-01', '11:00:00'),(3, '2012-12-01', '11:00:00'),(11, '2012-11-30', '11:00:00'),(15, '2012-11-29', '11:00:00'),(16, '2012-11-28', '11:00:00'),(20, '2012-11-27', '11:00:00'),(21, '2012-11-26', '11:00:00'),(22, '2012-11-25', '11:00:00'),(23, '2012-11-24', '11:00:00'),(24, '2012-11-23', '11:00:00') ON DUPLICATE KEY UPDATE dt=VALUE(dt), tm=VALUE(tm)" auto_test_local; +--enable_query_log + +--connection child2_1 +eval $CHILD2_1_SELECT_ARGUMENT1; +eval $CHILD2_1_SELECT_TABLES; + +--echo +--echo deinit +--disable_warnings + +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; + +--connection child2_1 +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; + +--enable_warnings +--source ../include/return_found_rows_insert_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_update.cnf b/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_update.cnf new file mode 100644 index 00000000000..05dfd8a0bce --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_update.cnf @@ -0,0 +1,3 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf diff --git a/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_update.test b/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_update.test new file mode 100644 index 00000000000..50d9f345dfb --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_update.test @@ -0,0 +1,78 @@ +--source ../include/return_found_rows_update_init.inc +--echo +--echo this test is for MDEV-18973 +--echo +--echo drop and create databases + +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; + +--connection child2_1 +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +--enable_warnings + +--echo +--echo create table and insert + +--connection child2_1 +--disable_query_log +echo CHILD2_1_CREATE_TABLES; +eval $CHILD2_1_CREATE_TABLES; +--enable_query_log +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +--disable_query_log +echo CREATE TABLE tbl_a ( + skey int NOT NULL, + dt date NOT NULL, + tm time NOT NULL, + KEY idx1 (skey,dt) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + skey int NOT NULL, + dt date NOT NULL, + tm time NOT NULL, + KEY idx1 (skey,dt) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log +INSERT INTO tbl_a (skey, dt, tm) VALUES (0, '2012-01-01', '12:00:00'),(1, '2012-02-01', '12:00:00'),(2, '2012-03-01', '12:00:00'),(3, '2012-04-01', '12:00:00'),(4, '2012-05-01', '12:00:00'),(5, '2012-06-01', '12:00:00'),(6, '2012-07-01', '12:00:00'),(7, '2012-08-01', '12:00:00'),(8, '2012-09-01', '12:00:00'),(9, '2012-10-01', '12:00:00'); +INSERT INTO tbl_a (skey, dt, tm) VALUES (0, '2013-01-01', '13:00:00'),(1, '2013-02-01', '13:00:00'),(2, '2013-03-01', '13:00:00'),(3, '2013-04-01', '13:00:00'),(4, '2013-05-01', '13:00:00'),(5, '2013-06-01', '13:00:00'),(6, '2013-07-01', '13:00:00'),(7, '2013-08-01', '13:00:00'),(8, '2013-09-01', '13:00:00'),(9, '2013-10-01', '13:00:00'); +INSERT INTO tbl_a (skey, dt, tm) VALUES (0, '2012-11-01', '11:00:00'),(1, '2012-12-01', '11:00:00'),(2, '2012-11-30', '11:00:00'),(3, '2012-11-29', '11:00:00'),(4, '2012-11-28', '11:00:00'),(5, '2012-11-27', '11:00:00'),(6, '2012-11-26', '11:00:00'),(7, '2012-11-25', '11:00:00'),(8, '2012-11-24', '11:00:00'),(9, '2012-11-23', '11:00:00'); +FLUSH TABLES; + +--echo +--echo select test 1 + +--connection child2_1 +TRUNCATE TABLE mysql.general_log; + +--disable_query_log +echo MYSQL -v -v -u root -h localhost -P MASTER_1_MYPORT -S MASTER_1_MYSOCK -e "UPDATE tbl_a SET tm = '12:00:00' WHERE skey = 0" auto_test_local; +exec $MYSQL -v -v -u root -h localhost --default-character-set=latin1 -P $MASTER_1_MYPORT -S $MASTER_1_MYSOCK -e "UPDATE tbl_a SET tm = '12:00:00' WHERE skey = 0" auto_test_local; +--enable_query_log + +--connection child2_1 +eval $CHILD2_1_SELECT_ARGUMENT1; +eval $CHILD2_1_SELECT_TABLES; + +--echo +--echo deinit +--disable_warnings + +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; + +--connection child2_1 +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; + +--enable_warnings +--source ../include/return_found_rows_update_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/bugfix/t/same_server_link.cnf b/storage/spider/mysql-test/spider/bugfix/t/same_server_link.cnf new file mode 100644 index 00000000000..b0853e32654 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/same_server_link.cnf @@ -0,0 +1,2 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf diff --git a/storage/spider/mysql-test/spider/bugfix/t/same_server_link.test b/storage/spider/mysql-test/spider/bugfix/t/same_server_link.test new file mode 100644 index 00000000000..1468f00cd1c --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/same_server_link.test @@ -0,0 +1,55 @@ +--source ../include/same_server_link_init.inc +--echo +--echo this test is for MDEV-6268 +--echo +--echo drop and create databases + +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; +--enable_warnings + +--echo +--echo create table + +--connection master_1 +--disable_query_log +echo CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +echo CREATE TABLE tbl_b ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) MASTER_1_ENGINE2 MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_b ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) $MASTER_1_ENGINE2 $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log + +--echo +--echo select test 1 + +--connection master_1 +--disable_result_log +--error 12720 +INSERT INTO tbl_a VALUES(1); +--enable_result_log + +--echo +--echo deinit +--disable_warnings + +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; + +--enable_warnings +--source ../include/same_server_link_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/bugfix/t/select_with_backquote.cnf b/storage/spider/mysql-test/spider/bugfix/t/select_with_backquote.cnf new file mode 100644 index 00000000000..05dfd8a0bce --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/select_with_backquote.cnf @@ -0,0 +1,3 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf diff --git a/storage/spider/mysql-test/spider/bugfix/t/select_with_backquote.test b/storage/spider/mysql-test/spider/bugfix/t/select_with_backquote.test new file mode 100644 index 00000000000..4c4d687cf89 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/select_with_backquote.test @@ -0,0 +1,74 @@ +--source ../include/select_with_backquote_init.inc +--echo +--echo this test is for MDEV-17204 +--echo +--echo drop and create databases + +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; + +--connection child2_1 +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +--enable_warnings + +--echo +--echo create table and insert + +--connection child2_1 +--disable_query_log +echo CHILD2_1_CREATE_TABLES; +eval $CHILD2_1_CREATE_TABLES; +--enable_query_log +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +--disable_query_log +echo CREATE TABLE tbl_a ( + pkey int NOT NULL, + txt_utf8 char(8) NOT NULL, + PRIMARY KEY (pkey) +) MASTER_1_ENGINE DEFAULT CHARACTER SET utf8 MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + pkey int NOT NULL, + txt_utf8 char(8) NOT NULL, + PRIMARY KEY (pkey) +) $MASTER_1_ENGINE DEFAULT CHARACTER SET utf8 $MASTER_1_COMMENT_2_1; +--enable_query_log +INSERT INTO tbl_a (pkey,txt_utf8) VALUES (0,'01234567'),(1,'12345678'),(2,'23456789'),(3,'34567890'),(4,'45678901'),(5,'56789012'),(6,'67890123'),(7,'78901234'),(8,'89012345'),(9,'90123456'); +FLUSH TABLES; + +--echo +--echo test 1 + +--connection child2_1 +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +SET NAMES utf8; +SELECT `pkey`, LEFT(`txt_utf8`, 4) FROM `auto_test_local`.`tbl_a` ORDER BY LEFT(`txt_utf8`, 4) LIMIT 3; + +--connection child2_1 +SET NAMES utf8; +eval $CHILD2_1_SELECT_ARGUMENT1; +eval $CHILD2_1_SELECT_TABLES; + +--echo +--echo deinit +--disable_warnings + +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; + +--connection child2_1 +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; + +--enable_warnings +--source ../include/select_with_backquote_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/bugfix/t/slave_transaction_retry_errors_5digit.cnf b/storage/spider/mysql-test/spider/bugfix/t/slave_transaction_retry_errors_5digit.cnf new file mode 100644 index 00000000000..c861d27b01d --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/slave_transaction_retry_errors_5digit.cnf @@ -0,0 +1,6 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf +!include ../my_4_1.cnf +[mysqld.4.1] +slave_transaction_retry_errors="10000,20000,30000" diff --git a/storage/spider/mysql-test/spider/bugfix/t/slave_transaction_retry_errors_5digit.test b/storage/spider/mysql-test/spider/bugfix/t/slave_transaction_retry_errors_5digit.test new file mode 100644 index 00000000000..fc91a43eeb0 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/slave_transaction_retry_errors_5digit.test @@ -0,0 +1,9 @@ +--source ../include/slave_transaction_retry_errors_5digit_init.inc +--echo + +--connection slave1_1 +SHOW VARIABLES LIKE 'slave_transaction_retry_errors'; + +--source ../include/slave_transaction_retry_errors_5digit_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/bugfix/t/spider_table_sts.cnf b/storage/spider/mysql-test/spider/bugfix/t/spider_table_sts.cnf new file mode 100644 index 00000000000..b0853e32654 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/spider_table_sts.cnf @@ -0,0 +1,2 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf diff --git a/storage/spider/mysql-test/spider/bugfix/t/spider_table_sts.test b/storage/spider/mysql-test/spider/bugfix/t/spider_table_sts.test new file mode 100644 index 00000000000..7213017505b --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/spider_table_sts.test @@ -0,0 +1,46 @@ +--source ../include/spider_table_sts_init.inc +--echo +--echo this test is for MDEV-19842 +--echo +--echo drop and create databases + +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; +--enable_warnings + +--echo +--echo create table + +--connection master_1 +--disable_query_log +echo CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log + +--echo +--echo select test 1 + +--connection master_1 +--error 12609 +SELECT pkey FROM tbl_a; + +--echo +--echo deinit +--disable_warnings + +--connection master_1 +--error 12609 +DROP DATABASE IF EXISTS auto_test_local; + +--enable_warnings +--source ../include/spider_table_sts_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/bugfix/t/sql_mode.inc b/storage/spider/mysql-test/spider/bugfix/t/sql_mode.inc new file mode 100644 index 00000000000..ae7c15c5081 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/sql_mode.inc @@ -0,0 +1,65 @@ +--echo +--echo this test is for MDEV-16508 +--echo +--echo drop and create databases + +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; + +--connection child2_1 +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +--enable_warnings + +--echo +--echo create table and insert + +--connection child2_1 +--disable_query_log +echo CHILD2_1_CREATE_TABLES; +eval $CHILD2_1_CREATE_TABLES; +--enable_query_log +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +--disable_query_log +echo CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log +INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +--echo +--echo select test + +--connection child2_1 +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +SELECT * FROM tbl_a ORDER BY pkey; + +--connection child2_1 +eval $CHILD2_1_SELECT_ARGUMENT1; +eval $CHILD2_1_SELECT_TABLES; + +--echo +--echo deinit +--disable_warnings + +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; + +--connection child2_1 +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; + +--enable_warnings diff --git a/storage/spider/mysql-test/spider/bugfix/t/sql_mode_mariadb.cnf b/storage/spider/mysql-test/spider/bugfix/t/sql_mode_mariadb.cnf new file mode 100644 index 00000000000..05dfd8a0bce --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/sql_mode_mariadb.cnf @@ -0,0 +1,3 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf diff --git a/storage/spider/mysql-test/spider/bugfix/t/sql_mode_mariadb.test b/storage/spider/mysql-test/spider/bugfix/t/sql_mode_mariadb.test new file mode 100644 index 00000000000..c63514d22f0 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/sql_mode_mariadb.test @@ -0,0 +1,5 @@ +--source ../include/sql_mode_mariadb_init.inc +--source sql_mode.inc +--source ../include/sql_mode_mariadb_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/bugfix/t/sql_mode_mysql.cnf b/storage/spider/mysql-test/spider/bugfix/t/sql_mode_mysql.cnf new file mode 100644 index 00000000000..05dfd8a0bce --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/sql_mode_mysql.cnf @@ -0,0 +1,3 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf diff --git a/storage/spider/mysql-test/spider/bugfix/t/sql_mode_mysql.test b/storage/spider/mysql-test/spider/bugfix/t/sql_mode_mysql.test new file mode 100644 index 00000000000..3a0f8d20da3 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/sql_mode_mysql.test @@ -0,0 +1,5 @@ +--source ../include/sql_mode_mysql_init.inc +--source sql_mode.inc +--source ../include/sql_mode_mysql_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/bugfix/t/wait_timeout.cnf b/storage/spider/mysql-test/spider/bugfix/t/wait_timeout.cnf new file mode 100644 index 00000000000..e0ffb99c38e --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/wait_timeout.cnf @@ -0,0 +1,4 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf +!include ../my_2_2.cnf diff --git a/storage/spider/mysql-test/spider/bugfix/t/wait_timeout.test b/storage/spider/mysql-test/spider/bugfix/t/wait_timeout.test new file mode 100644 index 00000000000..8da6e8fe314 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/wait_timeout.test @@ -0,0 +1,109 @@ +--source ../include/wait_timeout_init.inc +--echo +--echo this test is for MDEV-16530 +--echo +--echo drop and create databases + +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; + +--connection child2_1 +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +--connection child2_1_2 +USE auto_test_remote; + +--connection child2_2 +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; +--connection child2_2_2 +USE auto_test_remote2; +--enable_warnings + +--echo +--echo create table and insert + +--connection child2_1 +--disable_query_log +echo CHILD2_1_CREATE_TABLES; +eval $CHILD2_1_CREATE_TABLES; +--enable_query_log +TRUNCATE TABLE mysql.general_log; + +--connection child2_2 +--disable_query_log +echo CHILD2_2_CREATE_TABLES; +eval $CHILD2_2_CREATE_TABLES; +--enable_query_log +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +--disable_query_log +echo CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log +INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); +INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29); + +--echo +--echo select test 1 + +--connection child2_1 +TRUNCATE TABLE mysql.general_log; +LOCK TABLE tbl_a READ; + +--connection child2_2 +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +send_eval INSERT INTO tbl_a SELECT pkey + 30 FROM tbl_a ORDER BY pkey; + +--connection child2_1_2 +SELECT SLEEP(2); +eval $CHILD2_1_SELECT_ARGUMENT1; + +--connection child2_2_2 +eval $CHILD2_2_SELECT_ARGUMENT1; + +--connection child2_1 +UNLOCK TABLES; +eval $CHILD2_1_SELECT_TABLES; + +--connection child2_2 +eval $CHILD2_2_SELECT_TABLES; + +--connection master_1 +reap; + +--echo +--echo deinit +--disable_warnings + +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; + +--connection child2_1 +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; + +--connection child2_2 +DROP DATABASE IF EXISTS auto_test_remote2; +SET GLOBAL log_output = @old_log_output; + +--enable_warnings +--source ../include/wait_timeout_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/bugfix/t/xa_cmd.cnf b/storage/spider/mysql-test/spider/bugfix/t/xa_cmd.cnf new file mode 100644 index 00000000000..05dfd8a0bce --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/xa_cmd.cnf @@ -0,0 +1,3 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf diff --git a/storage/spider/mysql-test/spider/bugfix/t/xa_cmd.test b/storage/spider/mysql-test/spider/bugfix/t/xa_cmd.test new file mode 100644 index 00000000000..9ae528071e3 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/xa_cmd.test @@ -0,0 +1,69 @@ +--source ../include/xa_cmd_init.inc +--echo +--echo this test is for MDEV-19794 +--echo +--echo drop and create databases + +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; + +--connection child2_1 +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +--enable_warnings + +--echo +--echo create table and insert + +--connection child2_1 +--disable_query_log +echo CHILD2_1_CREATE_TABLES; +eval $CHILD2_1_CREATE_TABLES; +--enable_query_log +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +--disable_query_log +echo CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log + +--connection child2_1 +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +XA START 'test'; +INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +XA END 'test'; +XA PREPARE 'test'; +XA COMMIT 'test'; + +--connection child2_1 +eval $CHILD2_1_SELECT_ARGUMENT1; +eval $CHILD2_1_SELECT_TABLES; + +--echo +--echo deinit +--disable_warnings + +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; + +--connection child2_1 +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; + +--enable_warnings +--source ../include/xa_cmd_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_deinit.inc b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_deinit.inc new file mode 100644 index 00000000000..52b0625ed9a --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_deinit.inc @@ -0,0 +1,16 @@ +--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP +--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP +--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP +--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP +--let $CHILD2_2_DROP_TABLES= $CHILD2_2_DROP_TABLES_BACKUP +--let $CHILD2_2_CREATE_TABLES= $CHILD2_2_CREATE_TABLES_BACKUP +--let $CHILD2_2_SELECT_TABLES= $CHILD2_2_SELECT_TABLES_BACKUP +--connection master_1 +set session spider_bgs_mode= @old_spider_bgs_mode; +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_extended_deinit.inc b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_extended_deinit.inc new file mode 100644 index 00000000000..799bd983393 --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_extended_deinit.inc @@ -0,0 +1 @@ +--source checksum_table_parallel_deinit.inc diff --git a/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_extended_init.inc b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_extended_init.inc new file mode 100644 index 00000000000..f17a532d53b --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_extended_init.inc @@ -0,0 +1,2 @@ +--source checksum_table_parallel_init.inc +--let $MASTER_1_CHECKSUM_TABLE= CHECKSUM TABLE tbl_a EXTENDED diff --git a/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_init.inc b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_init.inc new file mode 100644 index 00000000000..7aab82515a0 --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_init.inc @@ -0,0 +1,53 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_init.inc +if (!$HAVE_PARTITION) +{ + --source checksum_table_parallel_deinit.inc + --enable_result_log + --enable_query_log + --enable_warnings + skip Test requires partitioning; +} +--enable_result_log +--enable_query_log +--enable_warnings +--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1 +let $MASTER_1_COMMENT_2_1= + COMMENT='table "tbl_a"' + PARTITION BY KEY(pkey) ( + PARTITION pt1 COMMENT='srv "s_2_1"', + PARTITION pt2 COMMENT='srv "s_2_2"' + ); +--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES +let $CHILD2_1_DROP_TABLES= + DROP TABLE IF EXISTS tbl_a; +--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES +let $CHILD2_1_CREATE_TABLES= + CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; +--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES +let $CHILD2_1_SELECT_TABLES= + SELECT pkey FROM tbl_a ORDER BY pkey; +let $CHILD2_1_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE argument LIKE '%checksum %'; +--let $CHILD2_2_DROP_TABLES_BACKUP= $CHILD2_2_DROP_TABLES +let $CHILD2_2_DROP_TABLES= + DROP TABLE IF EXISTS tbl_a; +--let $CHILD2_2_CREATE_TABLES_BACKUP= $CHILD2_2_CREATE_TABLES +let $CHILD2_2_CREATE_TABLES= + CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) + ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; +--let $CHILD2_2_SELECT_TABLES_BACKUP= $CHILD2_2_SELECT_TABLES +let $CHILD2_2_SELECT_TABLES= + SELECT pkey FROM tbl_a ORDER BY pkey; +let $CHILD2_2_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE argument LIKE '%checksum %'; +--connection master_1 +set @old_spider_bgs_mode= @@spider_bgs_mode; +set session spider_bgs_mode= 1; diff --git a/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_no_opt_deinit.inc b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_no_opt_deinit.inc new file mode 100644 index 00000000000..799bd983393 --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_no_opt_deinit.inc @@ -0,0 +1 @@ +--source checksum_table_parallel_deinit.inc diff --git a/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_no_opt_init.inc b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_no_opt_init.inc new file mode 100644 index 00000000000..230b6432a01 --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_no_opt_init.inc @@ -0,0 +1,2 @@ +--source checksum_table_parallel_init.inc +--let $MASTER_1_CHECKSUM_TABLE= CHECKSUM TABLE tbl_a diff --git a/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_quick_deinit.inc b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_quick_deinit.inc new file mode 100644 index 00000000000..799bd983393 --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_quick_deinit.inc @@ -0,0 +1 @@ +--source checksum_table_parallel_deinit.inc diff --git a/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_quick_init.inc b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_quick_init.inc new file mode 100644 index 00000000000..66f6ecbe0ef --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_quick_init.inc @@ -0,0 +1,2 @@ +--source checksum_table_parallel_init.inc +--let $MASTER_1_CHECKSUM_TABLE= CHECKSUM TABLE tbl_a QUICK diff --git a/storage/spider/mysql-test/spider/feature/include/slave_transaction_retry_errors_deinit.inc b/storage/spider/mysql-test/spider/feature/include/slave_transaction_retry_errors_deinit.inc new file mode 100644 index 00000000000..5ac67cdf783 --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/include/slave_transaction_retry_errors_deinit.inc @@ -0,0 +1,10 @@ +--connection slave1_1 +--disable_warnings +--disable_query_log +--disable_result_log +--source ../include/deinit_spider.inc +--source ../t/slave_test_deinit.inc +--source ../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/feature/include/slave_transaction_retry_errors_init.inc b/storage/spider/mysql-test/spider/feature/include/slave_transaction_retry_errors_init.inc new file mode 100644 index 00000000000..052d6ebb2eb --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/include/slave_transaction_retry_errors_init.inc @@ -0,0 +1,10 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_init.inc +--source ../t/slave_test_init.inc +--connection slave1_1 +--source ../include/init_spider.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/feature/my.cnf b/storage/spider/mysql-test/spider/feature/my.cnf new file mode 100644 index 00000000000..b7f76a630cc --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/my.cnf @@ -0,0 +1,2 @@ +!include include/default_mysqld.cnf +!include my_1_1.cnf diff --git a/storage/spider/mysql-test/spider/feature/my_1_1.cnf b/storage/spider/mysql-test/spider/feature/my_1_1.cnf new file mode 100644 index 00000000000..5f17295d895 --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/my_1_1.cnf @@ -0,0 +1,44 @@ +[mysqld.1.1] +log-bin= master-bin +loose_handlersocket_port= 20000 +loose_handlersocket_port_wr= 20001 +loose_handlersocket_threads= 2 +loose_handlersocket_threads_wr= 1 +loose_handlersocket_support_merge_table= 0 +loose_handlersocket_direct_update_mode= 2 +loose_handlersocket_unlimited_boundary= 65536 +loose_handlersocket_bulk_insert= 0 +loose_handlersocket_bulk_insert_timeout= 0 +loose_handlersocket_general_log= 1 +loose_handlersocket_timeout= 30 +loose_handlersocket_close_table_interval=2 +open_files_limit= 4096 +loose_partition= 1 + +[ENV] +USE_GEOMETRY_TEST= 1 +USE_FULLTEXT_TEST= 1 +USE_HA_TEST= 1 +USE_GENERAL_LOG= 1 +USE_REPLICATION= 1 +MASTER_1_MYPORT= @mysqld.1.1.port +MASTER_1_HSRPORT= 20000 +MASTER_1_HSWPORT= 20001 +MASTER_1_MYSOCK= @mysqld.1.1.socket +MASTER_1_ENGINE_TYPE= Spider +#MASTER_1_ENGINE_TYPE= MyISAM +MASTER_1_ENGINE= ENGINE=Spider +MASTER_1_CHARSET= DEFAULT CHARSET=utf8 +MASTER_1_ENGINE2= ENGINE=MyISAM +MASTER_1_CHARSET2= DEFAULT CHARSET=utf8 +MASTER_1_CHARSET3= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci + +STR_SEMICOLON= ; + +#The followings are set in include/init_xxx.inc files +# MASTER_1_COMMENT_2_1 +# MASTER_1_COMMENT2_2_1 +# MASTER_1_COMMENT3_2_1 +# MASTER_1_COMMENT4_2_1 +# MASTER_1_COMMENT5_2_1 +# MASTER_1_COMMENT_P_2_1 diff --git a/storage/spider/mysql-test/spider/feature/my_2_1.cnf b/storage/spider/mysql-test/spider/feature/my_2_1.cnf new file mode 100644 index 00000000000..24161645607 --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/my_2_1.cnf @@ -0,0 +1,56 @@ +[mysqld.2.1] +loose_handlersocket_port= 20002 +loose_handlersocket_port_wr= 20003 +loose_handlersocket_threads= 2 +loose_handlersocket_threads_wr= 1 +loose_handlersocket_support_merge_table= 0 +loose_handlersocket_direct_update_mode= 2 +loose_handlersocket_unlimited_boundary= 65536 +loose_handlersocket_bulk_insert= 0 +loose_handlersocket_bulk_insert_timeout= 0 +loose_handlersocket_general_log= 1 +loose_handlersocket_timeout= 30 +loose_handlersocket_close_table_interval=2 +open_files_limit= 4096 + +[ENV] +USE_CHILD_GROUP2= 1 +OUTPUT_CHILD_GROUP2= 0 +CHILD2_1_MYPORT= @mysqld.2.1.port +CHILD2_1_HSRPORT= 20002 +CHILD2_1_HSWPORT= 20003 +CHILD2_1_MYSOCK= @mysqld.2.1.socket +CHILD2_1_ENGINE_TYPE= InnoDB +CHILD2_1_ENGINE= ENGINE=InnoDB +CHILD2_1_CHARSET= DEFAULT CHARSET=utf8 +CHILD2_1_CHARSET2= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci +CHILD2_1_FT_MYPORT= @mysqld.2.1.port +CHILD2_1_FT_MYSOCK= @mysqld.2.1.socket +CHILD2_1_FT_ENGINE_TYPE= MyISAM +CHILD2_1_FT_ENGINE= ENGINE=MyISAM +CHILD2_1_FT_CHARSET= DEFAULT CHARSET=utf8 +CHILD2_1_GM_MYPORT= @mysqld.2.1.port +CHILD2_1_GM_MYSOCK= @mysqld.2.1.socket +CHILD2_1_GM_ENGINE_TYPE= MyISAM +CHILD2_1_GM_ENGINE= ENGINE=MyISAM +CHILD2_1_GM_CHARSET= DEFAULT CHARSET=utf8 + +#The followings are set in include/init_xxx.inc files +# CHILD2_1_DROP_TABLES +# CHILD2_1_CREATE_TABLES +# CHILD2_1_SELECT_TABLES +# CHILD2_1_DROP_TABLES2 +# CHILD2_1_CREATE_TABLES2 +# CHILD2_1_SELECT_TABLES2 +# CHILD2_1_DROP_TABLES3 +# CHILD2_1_CREATE_TABLES3 +# CHILD2_1_SELECT_TABLES3 +# CHILD2_1_DROP_TABLES4 +# CHILD2_1_CREATE_TABLES4 +# CHILD2_1_SELECT_TABLES4 +# CHILD2_1_DROP_TABLES5 +# CHILD2_1_CREATE_TABLES5 +# CHILD2_1_SELECT_TABLES5 +# CHILD2_1_DROP_TABLES6 +# CHILD2_1_CREATE_TABLES6 +# CHILD2_1_SELECT_TABLES6 diff --git a/storage/spider/mysql-test/spider/feature/my_2_2.cnf b/storage/spider/mysql-test/spider/feature/my_2_2.cnf new file mode 100644 index 00000000000..2d3c2a89a7d --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/my_2_2.cnf @@ -0,0 +1,38 @@ +[mysqld.2.2] +loose_handlersocket_port= 20004 +loose_handlersocket_port_wr= 20005 +loose_handlersocket_threads= 2 +loose_handlersocket_threads_wr= 1 +loose_handlersocket_support_merge_table= 0 +loose_handlersocket_direct_update_mode= 2 +loose_handlersocket_unlimited_boundary= 65536 +loose_handlersocket_bulk_insert= 0 +loose_handlersocket_bulk_insert_timeout= 0 +loose_handlersocket_general_log= 1 +loose_handlersocket_timeout= 30 +loose_handlersocket_close_table_interval=2 +open_files_limit= 4096 + +[ENV] +CHILD2_2_MYPORT= @mysqld.2.2.port +CHILD2_2_HSRPORT= 20004 +CHILD2_2_HSWPORT= 20005 +CHILD2_2_MYSOCK= @mysqld.2.2.socket +CHILD2_2_ENGINE_TYPE= InnoDB +CHILD2_2_ENGINE= ENGINE=InnoDB +CHILD2_2_CHARSET= DEFAULT CHARSET=utf8 +CHILD2_2_FT_MYPORT= @mysqld.2.2.port +CHILD2_2_FT_MYSOCK= @mysqld.2.2.socket +CHILD2_2_FT_ENGINE_TYPE= MyISAM +CHILD2_2_FT_ENGINE= ENGINE=MyISAM +CHILD2_2_FT_CHARSET= DEFAULT CHARSET=utf8 +CHILD2_2_GM_MYPORT= @mysqld.2.2.port +CHILD2_2_GM_MYSOCK= @mysqld.2.2.socket +CHILD2_2_GM_ENGINE_TYPE= MyISAM +CHILD2_2_GM_ENGINE= ENGINE=MyISAM +CHILD2_2_GM_CHARSET= DEFAULT CHARSET=utf8 + +#The followings are set in include/init_xxx.inc files +# CHILD2_2_DROP_TABLES +# CHILD2_2_CREATE_TABLES +# CHILD2_2_SELECT_TABLES diff --git a/storage/spider/mysql-test/spider/feature/my_2_3.cnf b/storage/spider/mysql-test/spider/feature/my_2_3.cnf new file mode 100644 index 00000000000..024da651e0c --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/my_2_3.cnf @@ -0,0 +1,8 @@ +[mysqld.2.3] + +[ENV] +CHILD2_3_MYPORT= @mysqld.2.3.port +CHILD2_3_MYSOCK= @mysqld.2.3.socket +CHILD2_3_ENGINE_TYPE= InnoDB +CHILD2_3_ENGINE= ENGINE=InnoDB +CHILD2_3_CHARSET= DEFAULT CHARSET=utf8 diff --git a/storage/spider/mysql-test/spider/feature/my_3_1.cnf b/storage/spider/mysql-test/spider/feature/my_3_1.cnf new file mode 100644 index 00000000000..fad21607789 --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/my_3_1.cnf @@ -0,0 +1,11 @@ +[mysqld.3.1] +loose_partition= 1 + +[ENV] +USE_CHILD_GROUP3= 1 +OUTPUT_CHILD_GROUP3= 0 +CHILD3_1_MYPORT= @mysqld.3.1.port +CHILD3_1_MYSOCK= @mysqld.3.1.socket +CHILD3_1_ENGINE_TYPE= InnoDB +CHILD3_1_ENGINE= ENGINE=InnoDB +CHILD3_1_CHARSET= DEFAULT CHARSET=utf8 diff --git a/storage/spider/mysql-test/spider/feature/my_3_2.cnf b/storage/spider/mysql-test/spider/feature/my_3_2.cnf new file mode 100644 index 00000000000..6f027b6f525 --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/my_3_2.cnf @@ -0,0 +1,9 @@ +[mysqld.3.2] +loose_partition= 1 + +[ENV] +CHILD3_2_MYPORT= @mysqld.3.2.port +CHILD3_2_MYSOCK= @mysqld.3.2.socket +CHILD3_2_ENGINE_TYPE= InnoDB +CHILD3_2_ENGINE= ENGINE=InnoDB +CHILD3_2_CHARSET= DEFAULT CHARSET=utf8 diff --git a/storage/spider/mysql-test/spider/feature/my_3_3.cnf b/storage/spider/mysql-test/spider/feature/my_3_3.cnf new file mode 100644 index 00000000000..fbb33694738 --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/my_3_3.cnf @@ -0,0 +1,9 @@ +[mysqld.3.3] +loose_partition= 1 + +[ENV] +CHILD3_3_MYPORT= @mysqld.3.3.port +CHILD3_3_MYSOCK= @mysqld.3.3.socket +CHILD3_3_ENGINE_TYPE= InnoDB +CHILD3_3_ENGINE= ENGINE=InnoDB +CHILD3_3_CHARSET= DEFAULT CHARSET=utf8 diff --git a/storage/spider/mysql-test/spider/feature/my_4_1.cnf b/storage/spider/mysql-test/spider/feature/my_4_1.cnf new file mode 100644 index 00000000000..d1812a48b68 --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/my_4_1.cnf @@ -0,0 +1,9 @@ +[mysqld.4.1] +loose_partition= 1 + +[ENV] +SLAVE1_1_MYPORT= @mysqld.4.1.port +SLAVE1_1_MYSOCK= @mysqld.4.1.socket +SLAVE1_1_ENGINE_TYPE= MyISAM +SLAVE1_1_ENGINE= ENGINE=MyISAM +SLAVE1_1_CHARSET= DEFAULT CHARSET=utf8 diff --git a/storage/spider/mysql-test/spider/feature/r/checksum_table_parallel_extended.result b/storage/spider/mysql-test/spider/feature/r/checksum_table_parallel_extended.result new file mode 100644 index 00000000000..34587052181 --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/r/checksum_table_parallel_extended.result @@ -0,0 +1,130 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_spider_bgs_mode= @@spider_bgs_mode; +set session spider_bgs_mode= 1; + +this test is for MDEV-16967 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +connection child2_1_2; +USE auto_test_remote; +connection child2_2; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; +connection child2_2_2; +USE auto_test_remote2; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection child2_2; +CHILD2_2_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); +INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29); + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +LOCK TABLE tbl_a WRITE; +connection child2_2; +TRUNCATE TABLE mysql.general_log; +LOCK TABLE tbl_a WRITE; +connection master_1; +CHECKSUM TABLE tbl_a EXTENDED; +connection child2_1_2; +SELECT SLEEP(1); +SLEEP(1) +0 +SELECT argument FROM mysql.general_log WHERE argument LIKE '%checksum %'; +argument +checksum table `auto_test_remote`.`tbl_a` extended +SELECT argument FROM mysql.general_log WHERE argument LIKE '%checksum %' +connection child2_2_2; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%checksum %'; +argument +checksum table `auto_test_remote2`.`tbl_a` extended +SELECT argument FROM mysql.general_log WHERE argument LIKE '%checksum %' +connection child2_1; +UNLOCK TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; +pkey +1 +3 +5 +7 +9 +11 +13 +15 +17 +19 +21 +23 +25 +27 +29 +connection child2_2; +UNLOCK TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; +pkey +0 +2 +4 +6 +8 +10 +12 +14 +16 +18 +20 +22 +24 +26 +28 +connection master_1; +Table Checksum +auto_test_local.tbl_a 1061386331 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session spider_bgs_mode= @old_spider_bgs_mode; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/feature/r/checksum_table_parallel_no_opt.result b/storage/spider/mysql-test/spider/feature/r/checksum_table_parallel_no_opt.result new file mode 100644 index 00000000000..4e44bd4cc73 --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/r/checksum_table_parallel_no_opt.result @@ -0,0 +1,128 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_spider_bgs_mode= @@spider_bgs_mode; +set session spider_bgs_mode= 1; + +this test is for MDEV-16967 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +connection child2_1_2; +USE auto_test_remote; +connection child2_2; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; +connection child2_2_2; +USE auto_test_remote2; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection child2_2; +CHILD2_2_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); +INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29); + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +LOCK TABLE tbl_a WRITE; +connection child2_2; +TRUNCATE TABLE mysql.general_log; +LOCK TABLE tbl_a WRITE; +connection master_1; +CHECKSUM TABLE tbl_a; +connection child2_1_2; +SELECT SLEEP(1); +SLEEP(1) +0 +SELECT argument FROM mysql.general_log WHERE argument LIKE '%checksum %'; +argument +SELECT argument FROM mysql.general_log WHERE argument LIKE '%checksum %' +connection child2_2_2; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%checksum %'; +argument +SELECT argument FROM mysql.general_log WHERE argument LIKE '%checksum %' +connection child2_1; +UNLOCK TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; +pkey +1 +3 +5 +7 +9 +11 +13 +15 +17 +19 +21 +23 +25 +27 +29 +connection child2_2; +UNLOCK TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; +pkey +0 +2 +4 +6 +8 +10 +12 +14 +16 +18 +20 +22 +24 +26 +28 +connection master_1; +Table Checksum +auto_test_local.tbl_a NULL + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session spider_bgs_mode= @old_spider_bgs_mode; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/feature/r/checksum_table_parallel_quick.result b/storage/spider/mysql-test/spider/feature/r/checksum_table_parallel_quick.result new file mode 100644 index 00000000000..b2c55b34130 --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/r/checksum_table_parallel_quick.result @@ -0,0 +1,128 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_spider_bgs_mode= @@spider_bgs_mode; +set session spider_bgs_mode= 1; + +this test is for MDEV-16967 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +connection child2_1_2; +USE auto_test_remote; +connection child2_2; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; +connection child2_2_2; +USE auto_test_remote2; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection child2_2; +CHILD2_2_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); +INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29); + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +LOCK TABLE tbl_a WRITE; +connection child2_2; +TRUNCATE TABLE mysql.general_log; +LOCK TABLE tbl_a WRITE; +connection master_1; +CHECKSUM TABLE tbl_a QUICK; +connection child2_1_2; +SELECT SLEEP(1); +SLEEP(1) +0 +SELECT argument FROM mysql.general_log WHERE argument LIKE '%checksum %'; +argument +SELECT argument FROM mysql.general_log WHERE argument LIKE '%checksum %' +connection child2_2_2; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%checksum %'; +argument +SELECT argument FROM mysql.general_log WHERE argument LIKE '%checksum %' +connection child2_1; +UNLOCK TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; +pkey +1 +3 +5 +7 +9 +11 +13 +15 +17 +19 +21 +23 +25 +27 +29 +connection child2_2; +UNLOCK TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; +pkey +0 +2 +4 +6 +8 +10 +12 +14 +16 +18 +20 +22 +24 +26 +28 +connection master_1; +Table Checksum +auto_test_local.tbl_a NULL + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session spider_bgs_mode= @old_spider_bgs_mode; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/feature/r/slave_transaction_retry_errors.result b/storage/spider/mysql-test/spider/feature/r/slave_transaction_retry_errors.result new file mode 100644 index 00000000000..0a147c0356a --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/r/slave_transaction_retry_errors.result @@ -0,0 +1,22 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +for slave1_1 + +connection slave1_1; +SHOW VARIABLES LIKE 'slave_transaction_retry_errors'; +Variable_name Value +slave_transaction_retry_errors 1158,1159,1160,1161,1205,1213,1429,2013,12701 +connection slave1_1; +for slave1_1 +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/feature/suite.opt b/storage/spider/mysql-test/spider/feature/suite.opt new file mode 100644 index 00000000000..672a3b37d4f --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/suite.opt @@ -0,0 +1 @@ +--loose-innodb --loose-skip-performance-schema diff --git a/storage/spider/mysql-test/spider/feature/suite.pm b/storage/spider/mysql-test/spider/feature/suite.pm new file mode 100644 index 00000000000..f106147deb6 --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/suite.pm @@ -0,0 +1,12 @@ +package My::Suite::Spider; + +@ISA = qw(My::Suite); + +return "No Spider engine" unless $ENV{HA_SPIDER_SO}; +return "Not run for embedded server" if $::opt_embedded_server; +return "Test needs --big-test" unless $::opt_big_test; + +sub is_default { 1 } + +bless { }; + diff --git a/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel.inc b/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel.inc new file mode 100644 index 00000000000..13e5053d64c --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel.inc @@ -0,0 +1,107 @@ +--echo +--echo this test is for MDEV-16967 +--echo +--echo drop and create databases + +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; + +--connection child2_1 +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +--connection child2_1_2 +USE auto_test_remote; + +--connection child2_2 +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; +--connection child2_2_2 +USE auto_test_remote2; +--enable_warnings + +--echo +--echo create table and insert + +--connection child2_1 +--disable_query_log +echo CHILD2_1_CREATE_TABLES; +eval $CHILD2_1_CREATE_TABLES; +--enable_query_log +TRUNCATE TABLE mysql.general_log; + +--connection child2_2 +--disable_query_log +echo CHILD2_2_CREATE_TABLES; +eval $CHILD2_2_CREATE_TABLES; +--enable_query_log +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +--disable_query_log +echo CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log +INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); +INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29); + +--echo +--echo select test 1 + +--connection child2_1 +TRUNCATE TABLE mysql.general_log; +LOCK TABLE tbl_a WRITE; + +--connection child2_2 +TRUNCATE TABLE mysql.general_log; +LOCK TABLE tbl_a WRITE; + +--connection master_1 +send_eval $MASTER_1_CHECKSUM_TABLE; + +--connection child2_1_2 +SELECT SLEEP(1); +eval $CHILD2_1_SELECT_ARGUMENT1; + +--connection child2_2_2 +eval $CHILD2_2_SELECT_ARGUMENT1; + +--connection child2_1 +UNLOCK TABLES; +eval $CHILD2_1_SELECT_TABLES; + +--connection child2_2 +UNLOCK TABLES; +eval $CHILD2_2_SELECT_TABLES; + +--connection master_1 +reap; + +--echo +--echo deinit +--disable_warnings + +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; + +--connection child2_1 +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; + +--connection child2_2 +DROP DATABASE IF EXISTS auto_test_remote2; +SET GLOBAL log_output = @old_log_output; + +--enable_warnings diff --git a/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_extended.cnf b/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_extended.cnf new file mode 100644 index 00000000000..e0ffb99c38e --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_extended.cnf @@ -0,0 +1,4 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf +!include ../my_2_2.cnf diff --git a/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_extended.test b/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_extended.test new file mode 100644 index 00000000000..871e1e868ad --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_extended.test @@ -0,0 +1,5 @@ +--source ../include/checksum_table_parallel_extended_init.inc +--source checksum_table_parallel.inc +--source ../include/checksum_table_parallel_extended_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_no_opt.cnf b/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_no_opt.cnf new file mode 100644 index 00000000000..e0ffb99c38e --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_no_opt.cnf @@ -0,0 +1,4 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf +!include ../my_2_2.cnf diff --git a/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_no_opt.test b/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_no_opt.test new file mode 100644 index 00000000000..0352d598df6 --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_no_opt.test @@ -0,0 +1,5 @@ +--source ../include/checksum_table_parallel_no_opt_init.inc +--source checksum_table_parallel.inc +--source ../include/checksum_table_parallel_no_opt_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_quick.cnf b/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_quick.cnf new file mode 100644 index 00000000000..e0ffb99c38e --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_quick.cnf @@ -0,0 +1,4 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf +!include ../my_2_2.cnf diff --git a/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_quick.test b/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_quick.test new file mode 100644 index 00000000000..f08f782e7c0 --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_quick.test @@ -0,0 +1,5 @@ +--source ../include/checksum_table_parallel_quick_init.inc +--source checksum_table_parallel.inc +--source ../include/checksum_table_parallel_quick_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/feature/t/slave_transaction_retry_errors.cnf b/storage/spider/mysql-test/spider/feature/t/slave_transaction_retry_errors.cnf new file mode 100644 index 00000000000..45019d6c537 --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/t/slave_transaction_retry_errors.cnf @@ -0,0 +1,4 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf +!include ../my_4_1.cnf diff --git a/storage/spider/mysql-test/spider/feature/t/slave_transaction_retry_errors.test b/storage/spider/mysql-test/spider/feature/t/slave_transaction_retry_errors.test new file mode 100644 index 00000000000..436bc3fb761 --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/t/slave_transaction_retry_errors.test @@ -0,0 +1,9 @@ +--source ../include/slave_transaction_retry_errors_init.inc +--echo + +--connection slave1_1 +SHOW VARIABLES LIKE 'slave_transaction_retry_errors'; + +--source ../include/slave_transaction_retry_errors_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/include/checksum_table_with_quick_mode_3_deinit.inc b/storage/spider/mysql-test/spider/include/checksum_table_with_quick_mode_3_deinit.inc index d551f5a4af3..7db871c700f 100644 --- a/storage/spider/mysql-test/spider/include/checksum_table_with_quick_mode_3_deinit.inc +++ b/storage/spider/mysql-test/spider/include/checksum_table_with_quick_mode_3_deinit.inc @@ -1,5 +1,3 @@ ---let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP ---let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP --let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP --let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP --let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP diff --git a/storage/spider/mysql-test/spider/include/checksum_table_with_quick_mode_3_init.inc b/storage/spider/mysql-test/spider/include/checksum_table_with_quick_mode_3_init.inc index 9ec61a1cb77..0bb12d8f874 100644 --- a/storage/spider/mysql-test/spider/include/checksum_table_with_quick_mode_3_init.inc +++ b/storage/spider/mysql-test/spider/include/checksum_table_with_quick_mode_3_init.inc @@ -21,7 +21,7 @@ let $CHILD2_1_CREATE_TABLES= let $CHILD2_1_SELECT_TABLES= SELECT pkey FROM tbl_a ORDER BY pkey; let $CHILD2_1_SELECT_ARGUMENT1= - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE argument LIKE '%checksum %'; --let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2 --let $OUTPUT_CHILD_GROUP2= 1 --let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG diff --git a/storage/spider/mysql-test/spider/include/deinit_spider.inc b/storage/spider/mysql-test/spider/include/deinit_spider.inc index 3609551e169..51cc075edaa 100644 --- a/storage/spider/mysql-test/spider/include/deinit_spider.inc +++ b/storage/spider/mysql-test/spider/include/deinit_spider.inc @@ -1,8 +1,39 @@ -DROP FUNCTION spider_direct_sql; -DROP FUNCTION spider_bg_direct_sql; -DROP FUNCTION spider_ping_table; -DROP FUNCTION spider_copy_tables; +let $SERVER_NAME= + `SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(version(), '-', 2), '-', -1)`; +let $SERVER_MAJOR_VERSION= + `SELECT SUBSTRING_INDEX(version(), '.', 1)`; +let $SERVER_MINOR_VERSION= + `SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(version(), '.', 2), '.', -1)`; +let $PLUGIN_VERSION= + `SELECT SUBSTRING_INDEX(plugin_version, '.', 1) + FROM information_schema.plugins + WHERE plugin_name = 'SPIDER'`; +if (`SELECT IF($PLUGIN_VERSION = 3, 1, 0)`) +{ + let $HAS_REWRITE= + `SELECT IF (STRCMP('$SERVER_NAME', 'MariaDB') = 0, + IF ($SERVER_MAJOR_VERSION = 10, + IF ($SERVER_MINOR_VERSION < 4, 0, 1), + IF ($SERVER_MAJOR_VERSION < 10, 0, 1)), + 0)`; + let $HAS_REWRITE= 0; + if ($HAS_REWRITE) + { + DROP FUNCTION spider_flush_rewrite_cache; + UNINSTALL PLUGIN spider_rewrite; + DROP TABLE IF EXISTS mysql.spider_rewrite_tables; + DROP TABLE IF EXISTS mysql.spider_rewrite_table_tables; + DROP TABLE IF EXISTS mysql.spider_rewrite_table_partitions; + DROP TABLE IF EXISTS mysql.spider_rewrite_table_subpartitions; + DROP TABLE IF EXISTS mysql.spider_rewritten_tables; + } +} DROP FUNCTION spider_flush_table_mon_cache; +DROP FUNCTION spider_copy_tables; +DROP FUNCTION spider_ping_table; +DROP FUNCTION spider_bg_direct_sql; +DROP FUNCTION spider_direct_sql; +UNINSTALL PLUGIN spider_alloc_mem; UNINSTALL PLUGIN spider; DROP TABLE IF EXISTS mysql.spider_xa; DROP TABLE IF EXISTS mysql.spider_xa_member; @@ -13,9 +44,57 @@ DROP TABLE IF EXISTS mysql.spider_link_failed_log; DROP TABLE IF EXISTS mysql.spider_table_position_for_recovery; DROP TABLE IF EXISTS mysql.spider_table_sts; DROP TABLE IF EXISTS mysql.spider_table_crd; -DROP SERVER s_2_1; -DROP SERVER s_2_2; -DROP SERVER s_2_3; -DROP SERVER s_3_1; -DROP SERVER s_3_2; -DROP SERVER s_3_3; +if ($VERSION_COMPILE_OS_WIN) +{ + if ($CHILD2_1_MYPORT) + { + DROP SERVER s_2_1; + } + if ($CHILD2_2_MYPORT) + { + DROP SERVER s_2_2; + } + if ($CHILD2_3_MYPORT) + { + DROP SERVER s_2_3; + } + if ($CHILD3_1_MYPORT) + { + DROP SERVER s_3_1; + } + if ($CHILD3_2_MYPORT) + { + DROP SERVER s_3_2; + } + if ($CHILD2_3_MYPORT) + { + DROP SERVER s_3_3; + } +} +if (!$VERSION_COMPILE_OS_WIN) +{ + if ($CHILD2_1_MYSOCK) + { + DROP SERVER s_2_1; + } + if ($CHILD2_2_MYSOCK) + { + DROP SERVER s_2_2; + } + if ($CHILD2_3_MYSOCK) + { + DROP SERVER s_2_3; + } + if ($CHILD3_1_MYSOCK) + { + DROP SERVER s_3_1; + } + if ($CHILD3_2_MYSOCK) + { + DROP SERVER s_3_2; + } + if ($CHILD3_3_MYSOCK) + { + DROP SERVER s_3_3; + } +} diff --git a/storage/spider/mysql-test/spider/include/init_spider.inc b/storage/spider/mysql-test/spider/include/init_spider.inc index 1da1ec970b5..69d1fae425e 100644 --- a/storage/spider/mysql-test/spider/include/init_spider.inc +++ b/storage/spider/mysql-test/spider/include/init_spider.inc @@ -3,104 +3,130 @@ let $VERSION_COMPILE_OS_WIN= if ($VERSION_COMPILE_OS_WIN) { INSTALL PLUGIN spider SONAME 'ha_spider.dll'; - CREATE FUNCTION spider_direct_sql RETURNS INT SONAME 'ha_spider.dll'; - CREATE AGGREGATE FUNCTION spider_bg_direct_sql RETURNS INT SONAME 'ha_spider.dll'; - CREATE FUNCTION spider_ping_table RETURNS INT SONAME 'ha_spider.dll'; - CREATE FUNCTION spider_copy_tables RETURNS INT SONAME 'ha_spider.dll'; - CREATE FUNCTION spider_flush_table_mon_cache RETURNS INT SONAME 'ha_spider.dll'; - eval CREATE SERVER s_2_1 FOREIGN DATA WRAPPER mysql OPTIONS ( - HOST 'localhost', - DATABASE 'auto_test_remote', - USER 'root', - PASSWORD '', - PORT $CHILD2_1_MYPORT - ); - eval CREATE SERVER s_2_2 FOREIGN DATA WRAPPER mysql OPTIONS ( - HOST 'localhost', - DATABASE 'auto_test_remote2', - USER 'root', - PASSWORD '', - PORT $CHILD2_2_MYPORT - ); - eval CREATE SERVER s_2_3 FOREIGN DATA WRAPPER mysql OPTIONS ( - HOST 'localhost', - DATABASE 'auto_test_remote3', - USER 'root', - PASSWORD '', - PORT $CHILD2_3_MYPORT - ); - eval CREATE SERVER s_3_1 FOREIGN DATA WRAPPER mysql OPTIONS ( - HOST 'localhost', - DATABASE 'auto_test_local', - USER 'root', - PASSWORD '', - PORT $CHILD3_1_MYPORT - ); - eval CREATE SERVER s_3_2 FOREIGN DATA WRAPPER mysql OPTIONS ( - HOST 'localhost', - DATABASE 'auto_test_local', - USER 'root', - PASSWORD '', - PORT $CHILD3_2_MYPORT - ); - eval CREATE SERVER s_3_3 FOREIGN DATA WRAPPER mysql OPTIONS ( - HOST 'localhost', - DATABASE 'auto_test_local', - USER 'root', - PASSWORD '', - PORT $CHILD2_3_MYPORT - ); + if ($CHILD2_1_MYPORT) + { + eval CREATE SERVER s_2_1 FOREIGN DATA WRAPPER mysql OPTIONS ( + HOST 'localhost', + DATABASE 'auto_test_remote', + USER 'root', + PASSWORD '', + PORT $CHILD2_1_MYPORT + ); + } + if ($CHILD2_2_MYPORT) + { + eval CREATE SERVER s_2_2 FOREIGN DATA WRAPPER mysql OPTIONS ( + HOST 'localhost', + DATABASE 'auto_test_remote2', + USER 'root', + PASSWORD '', + PORT $CHILD2_2_MYPORT + ); + } + if ($CHILD2_3_MYPORT) + { + eval CREATE SERVER s_2_3 FOREIGN DATA WRAPPER mysql OPTIONS ( + HOST 'localhost', + DATABASE 'auto_test_remote3', + USER 'root', + PASSWORD '', + PORT $CHILD2_3_MYPORT + ); + } + if ($CHILD3_1_MYPORT) + { + eval CREATE SERVER s_3_1 FOREIGN DATA WRAPPER mysql OPTIONS ( + HOST 'localhost', + DATABASE 'auto_test_local', + USER 'root', + PASSWORD '', + PORT $CHILD3_1_MYPORT + ); + } + if ($CHILD3_2_MYPORT) + { + eval CREATE SERVER s_3_2 FOREIGN DATA WRAPPER mysql OPTIONS ( + HOST 'localhost', + DATABASE 'auto_test_local', + USER 'root', + PASSWORD '', + PORT $CHILD3_2_MYPORT + ); + } + if ($CHILD2_3_MYPORT) + { + eval CREATE SERVER s_3_3 FOREIGN DATA WRAPPER mysql OPTIONS ( + HOST 'localhost', + DATABASE 'auto_test_local', + USER 'root', + PASSWORD '', + PORT $CHILD2_3_MYPORT + ); + } } if (!$VERSION_COMPILE_OS_WIN) { INSTALL PLUGIN spider SONAME 'ha_spider.so'; - CREATE FUNCTION spider_direct_sql RETURNS INT SONAME 'ha_spider.so'; - CREATE AGGREGATE FUNCTION spider_bg_direct_sql RETURNS INT SONAME 'ha_spider.so'; - CREATE FUNCTION spider_ping_table RETURNS INT SONAME 'ha_spider.so'; - CREATE FUNCTION spider_copy_tables RETURNS INT SONAME 'ha_spider.so'; - CREATE FUNCTION spider_flush_table_mon_cache RETURNS INT SONAME 'ha_spider.so'; - eval CREATE SERVER s_2_1 FOREIGN DATA WRAPPER mysql OPTIONS ( - HOST 'localhost', - DATABASE 'auto_test_remote', - USER 'root', - PASSWORD '', - SOCKET '$CHILD2_1_MYSOCK' - ); - eval CREATE SERVER s_2_2 FOREIGN DATA WRAPPER mysql OPTIONS ( - HOST 'localhost', - DATABASE 'auto_test_remote2', - USER 'root', - PASSWORD '', - SOCKET '$CHILD2_2_MYSOCK' - ); - eval CREATE SERVER s_2_3 FOREIGN DATA WRAPPER mysql OPTIONS ( - HOST 'localhost', - DATABASE 'auto_test_remote3', - USER 'root', - PASSWORD '', - SOCKET '$CHILD2_3_MYSOCK' - ); - eval CREATE SERVER s_3_1 FOREIGN DATA WRAPPER mysql OPTIONS ( - HOST 'localhost', - DATABASE 'auto_test_local', - USER 'root', - PASSWORD '', - SOCKET '$CHILD3_1_MYSOCK' - ); - eval CREATE SERVER s_3_2 FOREIGN DATA WRAPPER mysql OPTIONS ( - HOST 'localhost', - DATABASE 'auto_test_local', - USER 'root', - PASSWORD '', - SOCKET '$CHILD3_2_MYSOCK' - ); - eval CREATE SERVER s_3_3 FOREIGN DATA WRAPPER mysql OPTIONS ( - HOST 'localhost', - DATABASE 'auto_test_local', - USER 'root', - PASSWORD '', - SOCKET '$CHILD3_3_MYSOCK' - ); + if ($CHILD2_1_MYSOCK) + { + eval CREATE SERVER s_2_1 FOREIGN DATA WRAPPER mysql OPTIONS ( + HOST 'localhost', + DATABASE 'auto_test_remote', + USER 'root', + PASSWORD '', + SOCKET '$CHILD2_1_MYSOCK' + ); + } + if ($CHILD2_2_MYSOCK) + { + eval CREATE SERVER s_2_2 FOREIGN DATA WRAPPER mysql OPTIONS ( + HOST 'localhost', + DATABASE 'auto_test_remote2', + USER 'root', + PASSWORD '', + SOCKET '$CHILD2_2_MYSOCK' + ); + } + if ($CHILD2_3_MYSOCK) + { + eval CREATE SERVER s_2_3 FOREIGN DATA WRAPPER mysql OPTIONS ( + HOST 'localhost', + DATABASE 'auto_test_remote3', + USER 'root', + PASSWORD '', + SOCKET '$CHILD2_3_MYSOCK' + ); + } + if ($CHILD3_1_MYSOCK) + { + eval CREATE SERVER s_3_1 FOREIGN DATA WRAPPER mysql OPTIONS ( + HOST 'localhost', + DATABASE 'auto_test_local', + USER 'root', + PASSWORD '', + SOCKET '$CHILD3_1_MYSOCK' + ); + } + if ($CHILD3_2_MYSOCK) + { + eval CREATE SERVER s_3_2 FOREIGN DATA WRAPPER mysql OPTIONS ( + HOST 'localhost', + DATABASE 'auto_test_local', + USER 'root', + PASSWORD '', + SOCKET '$CHILD3_2_MYSOCK' + ); + } + if ($CHILD3_3_MYSOCK) + { + eval CREATE SERVER s_3_3 FOREIGN DATA WRAPPER mysql OPTIONS ( + HOST 'localhost', + DATABASE 'auto_test_local', + USER 'root', + PASSWORD '', + SOCKET '$CHILD3_3_MYSOCK' + ); + } } let $SERVER_NAME= @@ -113,313 +139,34 @@ let $PLUGIN_VERSION= `SELECT SUBSTRING_INDEX(plugin_version, '.', 1) FROM information_schema.plugins WHERE plugin_name = 'SPIDER'`; - -if (`SELECT IF($PLUGIN_VERSION = 1, 1, 0)`) -{ - DROP TABLE IF EXISTS mysql.spider_xa; - CREATE TABLE mysql.spider_xa( - format_id int not null default 0, - gtrid_length int not null default 0, - bqual_length int not null default 0, - data char(128) charset binary not null default '', - status char(8) not null default '', - PRIMARY KEY (data, format_id, gtrid_length), - KEY idx1 (status) - ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - DROP TABLE IF EXISTS mysql.spider_xa_member; - CREATE TABLE mysql.spider_xa_member( - format_id int not null default 0, - gtrid_length int not null default 0, - bqual_length int not null default 0, - data char(128) charset binary not null default '', - scheme char(64) not null default '', - host char(64) not null default '', - port char(5) not null default '', - socket char(64) not null default '', - username char(64) not null default '', - password char(64) not null default '', - PRIMARY KEY (data, format_id, gtrid_length, host, port, socket) - ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - DROP TABLE IF EXISTS mysql.spider_tables; - CREATE TABLE mysql.spider_tables( - db_name char(64) not null default '', - table_name char(64) not null default '', - priority bigint not null default 0, - server char(64) default null, - scheme char(64) default null, - host char(64) default null, - port char(5) default null, - socket char(64) default null, - username char(64) default null, - password char(64) default null, - tgt_db_name char(64) default null, - tgt_table_name char(64) default null, - PRIMARY KEY (db_name, table_name), - KEY idx1 (priority) - ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -} -if (`SELECT IF($PLUGIN_VERSION = 2, 1, 0)`) -{ - DROP TABLE IF EXISTS mysql.spider_xa; - CREATE TABLE mysql.spider_xa( - format_id int not null default 0, - gtrid_length int not null default 0, - bqual_length int not null default 0, - data char(128) charset binary not null default '', - status char(8) not null default '', - PRIMARY KEY (data, format_id, gtrid_length), - KEY idx1 (status) - ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - DROP TABLE IF EXISTS mysql.spider_xa_member; - CREATE TABLE mysql.spider_xa_member( - format_id int not null default 0, - gtrid_length int not null default 0, - bqual_length int not null default 0, - data char(128) charset binary not null default '', - scheme char(64) not null default '', - host char(64) not null default '', - port char(5) not null default '', - socket char(64) not null default '', - username char(64) not null default '', - password char(64) not null default '', - ssl_ca char(64) default null, - ssl_capath char(64) default null, - ssl_cert char(64) default null, - ssl_cipher char(64) default null, - ssl_key char(64) default null, - ssl_verify_server_cert tinyint not null default 0, - default_file char(64) default null, - default_group char(64) default null, - PRIMARY KEY (data, format_id, gtrid_length, host, port, socket) - ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - DROP TABLE IF EXISTS mysql.spider_tables; - CREATE TABLE mysql.spider_tables( - db_name char(64) not null default '', - table_name char(64) not null default '', - link_id int not null default 0, - priority bigint not null default 0, - server char(64) default null, - scheme char(64) default null, - host char(64) default null, - port char(5) default null, - socket char(64) default null, - username char(64) default null, - password char(64) default null, - ssl_ca char(64) default null, - ssl_capath char(64) default null, - ssl_cert char(64) default null, - ssl_cipher char(64) default null, - ssl_key char(64) default null, - ssl_verify_server_cert tinyint not null default 0, - default_file char(64) default null, - default_group char(64) default null, - tgt_db_name char(64) default null, - tgt_table_name char(64) default null, - link_status tinyint not null default 1, - PRIMARY KEY (db_name, table_name, link_id), - KEY idx1 (priority) - ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - DROP TABLE IF EXISTS mysql.spider_link_mon_servers; - CREATE TABLE mysql.spider_link_mon_servers( - db_name char(64) not null default '', - table_name char(64) not null default '', - link_id char(5) not null default '', - sid int not null default 0, - server char(64) default null, - scheme char(64) default null, - host char(64) default null, - port char(5) default null, - socket char(64) default null, - username char(64) default null, - password char(64) default null, - ssl_ca char(64) default null, - ssl_capath char(64) default null, - ssl_cert char(64) default null, - ssl_cipher char(64) default null, - ssl_key char(64) default null, - ssl_verify_server_cert tinyint not null default 0, - default_file char(64) default null, - default_group char(64) default null, - PRIMARY KEY (db_name, table_name, link_id, sid) - ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - DROP TABLE IF EXISTS mysql.spider_link_failed_log; - CREATE TABLE mysql.spider_link_failed_log( - db_name char(64) not null default '', - table_name char(64) not null default '', - link_id int not null default 0, - failed_time timestamp not null default current_timestamp - ) ENGINE=MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -} if (`SELECT IF($PLUGIN_VERSION = 3, 1, 0)`) { - let $ENGINE_NAME= + let $HAS_REWRITE= `SELECT IF (STRCMP('$SERVER_NAME', 'MariaDB') = 0, IF ($SERVER_MAJOR_VERSION = 10, - IF ($SERVER_MINOR_VERSION < 4, 'MyISAM', - 'Aria transactional=1'), - IF ($SERVER_MAJOR_VERSION < 10, 'MyISAM', - 'Aria transactional=1')), - 'MyISAM')`; - DROP TABLE IF EXISTS mysql.spider_xa; - eval - CREATE TABLE mysql.spider_xa( - format_id int not null default 0, - gtrid_length int not null default 0, - bqual_length int not null default 0, - data binary(128) not null default '', - status char(8) not null default '', - PRIMARY KEY (data, format_id, gtrid_length), - KEY idx1 (status) - ) ENGINE=$ENGINE_NAME DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - DROP TABLE IF EXISTS mysql.spider_xa_member; - eval - CREATE TABLE mysql.spider_xa_member( - format_id int not null default 0, - gtrid_length int not null default 0, - bqual_length int not null default 0, - data binary(128) not null default '', - scheme char(64) not null default '', - host char(64) not null default '', - port char(5) not null default '', - socket text not null default '', - username char(64) not null default '', - password char(64) not null default '', - ssl_ca text default null, - ssl_capath text default null, - ssl_cert text default null, - ssl_cipher char(64) default null, - ssl_key text default null, - ssl_verify_server_cert tinyint not null default 0, - default_file text default null, - default_group char(64) default null, - KEY idx1 (data, format_id, gtrid_length, host) - ) ENGINE=$ENGINE_NAME DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - DROP TABLE IF EXISTS mysql.spider_xa_failed_log; - eval - CREATE TABLE mysql.spider_xa_failed_log( - format_id int not null default 0, - gtrid_length int not null default 0, - bqual_length int not null default 0, - data binary(128) not null default '', - scheme char(64) not null default '', - host char(64) not null default '', - port char(5) not null default '', - socket text not null, - username char(64) not null default '', - password char(64) not null default '', - ssl_ca text, - ssl_capath text, - ssl_cert text, - ssl_cipher char(64) default null, - ssl_key text, - ssl_verify_server_cert tinyint not null default 0, - default_file text, - default_group char(64) default null, - thread_id int default null, - status char(8) not null default '', - failed_time timestamp not null default current_timestamp, - key idx1 (data, format_id, gtrid_length, host) - ) ENGINE=$ENGINE_NAME DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - DROP TABLE IF EXISTS mysql.spider_tables; - eval - CREATE TABLE mysql.spider_tables( - db_name char(64) not null default '', - table_name char(199) not null default '', - link_id int not null default 0, - priority bigint not null default 0, - server char(64) default null, - scheme char(64) default null, - host char(64) default null, - port char(5) default null, - socket text default null, - username char(64) default null, - password char(64) default null, - ssl_ca text default null, - ssl_capath text default null, - ssl_cert text default null, - ssl_cipher char(64) default null, - ssl_key text default null, - ssl_verify_server_cert tinyint not null default 0, - monitoring_binlog_pos_at_failing tinyint not null default 0, - default_file text default null, - default_group char(64) default null, - tgt_db_name char(64) default null, - tgt_table_name char(64) default null, - link_status tinyint not null default 1, - block_status tinyint not null default 0, - static_link_id char(64) default null, - PRIMARY KEY (db_name, table_name, link_id), - KEY idx1 (priority), - UNIQUE KEY uidx1 (db_name, table_name, static_link_id) - ) ENGINE=$ENGINE_NAME DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - DROP TABLE IF EXISTS mysql.spider_link_mon_servers; - eval - CREATE TABLE mysql.spider_link_mon_servers( - db_name char(64) not null default '', - table_name char(199) not null default '', - link_id char(64) not null default '', - sid int unsigned not null default 0, - server char(64) default null, - scheme char(64) default null, - host char(64) default null, - port char(5) default null, - socket text default null, - username char(64) default null, - password char(64) default null, - ssl_ca text default null, - ssl_capath text default null, - ssl_cert text default null, - ssl_cipher char(64) default null, - ssl_key text default null, - ssl_verify_server_cert tinyint not null default 0, - default_file text default null, - default_group char(64) default null, - PRIMARY KEY (db_name, table_name, link_id, sid) - ) ENGINE=$ENGINE_NAME DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - DROP TABLE IF EXISTS mysql.spider_link_failed_log; - eval - CREATE TABLE mysql.spider_link_failed_log( - db_name char(64) not null default '', - table_name char(199) not null default '', - link_id char(64) not null default '', - failed_time timestamp not null default current_timestamp - ) ENGINE=$ENGINE_NAME DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - DROP TABLE IF EXISTS mysql.spider_table_position_for_recovery; - eval - CREATE TABLE mysql.spider_table_position_for_recovery( - db_name char(64) not null default '', - table_name char(199) not null default '', - failed_link_id int not null default 0, - source_link_id int not null default 0, - file text, - position text, - gtid text, - primary key (db_name, table_name, failed_link_id, source_link_id) - ) ENGINE=$ENGINE_NAME DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - DROP TABLE IF EXISTS mysql.spider_table_sts; - eval - CREATE TABLE mysql.spider_table_sts( - db_name char(64) not null default '', - table_name char(199) not null default '', - data_file_length bigint unsigned not null default 0, - max_data_file_length bigint unsigned not null default 0, - index_file_length bigint unsigned not null default 0, - records bigint unsigned not null default 0, - mean_rec_length bigint unsigned not null default 0, - check_time datetime not null default '0000-00-00 00:00:00', - create_time datetime not null default '0000-00-00 00:00:00', - update_time datetime not null default '0000-00-00 00:00:00', - primary key (db_name, table_name) - ) ENGINE=$ENGINE_NAME DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - DROP TABLE IF EXISTS mysql.spider_table_crd; - eval - CREATE TABLE mysql.spider_table_crd( - db_name char(64) not null default '', - table_name char(199) not null default '', - key_seq int unsigned not null default 0, - cardinality bigint not null default 0, - primary key (db_name, table_name, key_seq) - ) ENGINE=$ENGINE_NAME DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + IF ($SERVER_MINOR_VERSION < 4, 0, 1), + IF ($SERVER_MAJOR_VERSION < 10, 0, 1)), + 0)`; + let $HAS_REWRITE= 0; + if ($HAS_REWRITE) + { + let $PLUGIN_NAME= spider_flush_rewrite_cache; + let $PLUGIN_EXIST= + `SELECT COUNT(*) FROM mysql.func WHERE name = '$PLUGIN_NAME'`; + while (!$PLUGIN_EXIST) + { + let $PLUGIN_EXIST= + `SELECT COUNT(*) FROM mysql.func WHERE name = '$PLUGIN_NAME'`; + } + } +} +let $PLUGIN_NAME= spider_flush_table_mon_cache; +let $PLUGIN_EXIST= + `SELECT COUNT(*) FROM mysql.func WHERE name = '$PLUGIN_NAME'`; +while (!$PLUGIN_EXIST) +{ + let $PLUGIN_EXIST= + `SELECT COUNT(*) FROM mysql.func WHERE name = '$PLUGIN_NAME'`; } SET spider_internal_sql_log_off= 0; diff --git a/storage/spider/mysql-test/spider/r/checksum_table_with_quick_mode_3.result b/storage/spider/mysql-test/spider/r/checksum_table_with_quick_mode_3.result index ee8e1f056f3..2fe86099bc2 100644 --- a/storage/spider/mysql-test/spider/r/checksum_table_with_quick_mode_3.result +++ b/storage/spider/mysql-test/spider/r/checksum_table_with_quick_mode_3.result @@ -45,10 +45,10 @@ CHECKSUM TABLE tbl_a EXTENDED; Table Checksum auto_test_local.tbl_a 1061386331 connection child2_1; -SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%checksum %'; argument -select `pkey` from `auto_test_remote`.`tbl_a` -SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' +checksum table `auto_test_remote`.`tbl_a` extended +SELECT argument FROM mysql.general_log WHERE argument LIKE '%checksum %' SELECT pkey FROM tbl_a ORDER BY pkey; pkey 0 diff --git a/storage/spider/mysql-test/spider/r/direct_join.result b/storage/spider/mysql-test/spider/r/direct_join.result index 0a76c3246f9..a1018c35fbf 100644 --- a/storage/spider/mysql-test/spider/r/direct_join.result +++ b/storage/spider/mysql-test/spider/r/direct_join.result @@ -167,7 +167,7 @@ connection child2_1; SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; argument select `id`,`hr_status`,`region_code`,`region` from `auto_test_remote`.`tbl_person` where `id` = '24FC3F0A5119432BAE13DD65AABAA39C' and `region` = 510411 -select `person_id`,`diseaseKind_id` from `auto_test_remote`.`tbl_ncd_cm_person` where ((`diseaseKind_id` = '52A0328740914BCE86ED10A4D2521816')) +select count(0) `count(0)` from `auto_test_remote`.`tbl_ncd_cm_person` t0 where ((t0.`person_id` = '24FC3F0A5119432BAE13DD65AABAA39C') and (t0.`diseaseKind_id` = '52A0328740914BCE86ED10A4D2521816')) SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' SELECT * FROM tbl_person; id hr_status region_code region diff --git a/storage/spider/mysql-test/spider/r/partition_fulltext.result b/storage/spider/mysql-test/spider/r/partition_fulltext.result index 3289473b905..6c001d25444 100644 --- a/storage/spider/mysql-test/spider/r/partition_fulltext.result +++ b/storage/spider/mysql-test/spider/r/partition_fulltext.result @@ -71,7 +71,7 @@ pkey words connection child2_1; SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; argument -select match(`words`)against('+ghi' in boolean mode),`pkey`,`words` from `auto_test_remote`.`tbl_a` where match(`words`)against('+ghi' in boolean mode) and (match(`words`)against('+ghi' in boolean mode)) +select match(`words`)against('+ghi' in boolean mode),`pkey`,`words` from `auto_test_remote`.`tbl_a` where match(`words`)against('+ghi' in boolean mode) and (match(`words`)against(_latin1'+ghi' in boolean mode)) SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' SELECT pkey FROM tbl_a ORDER BY pkey; pkey @@ -80,7 +80,7 @@ pkey connection child2_2; SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; argument -select match(`words`)against('+ghi' in boolean mode),`pkey`,`words` from `auto_test_remote2`.`tbl_a` where match(`words`)against('+ghi' in boolean mode) and (match(`words`)against('+ghi' in boolean mode)) +select match(`words`)against('+ghi' in boolean mode),`pkey`,`words` from `auto_test_remote2`.`tbl_a` where match(`words`)against('+ghi' in boolean mode) and (match(`words`)against(_latin1'+ghi' in boolean mode)) SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' SELECT pkey FROM tbl_a ORDER BY pkey; pkey @@ -91,7 +91,7 @@ pkey connection child2_3; SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; argument -select match(`words`)against('+ghi' in boolean mode),`pkey`,`words` from `auto_test_remote3`.`tbl_a` where match(`words`)against('+ghi' in boolean mode) and (match(`words`)against('+ghi' in boolean mode)) +select match(`words`)against('+ghi' in boolean mode),`pkey`,`words` from `auto_test_remote3`.`tbl_a` where match(`words`)against('+ghi' in boolean mode) and (match(`words`)against(_latin1'+ghi' in boolean mode)) SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' SELECT pkey FROM tbl_a ORDER BY pkey; pkey diff --git a/storage/spider/mysql-test/spider/r/show_system_tables.result b/storage/spider/mysql-test/spider/r/show_system_tables.result index 831d4578efe..67411862e00 100644 --- a/storage/spider/mysql-test/spider/r/show_system_tables.result +++ b/storage/spider/mysql-test/spider/r/show_system_tables.result @@ -13,15 +13,15 @@ connection master_1; SELECT table_name, engine FROM information_schema.tables WHERE table_schema = 'mysql' AND table_name like '%spider_%'; table_name engine -spider_link_failed_log MyISAM -spider_link_mon_servers MyISAM -spider_table_crd MyISAM -spider_table_position_for_recovery MyISAM -spider_table_sts MyISAM -spider_tables MyISAM -spider_xa MyISAM -spider_xa_failed_log MyISAM -spider_xa_member MyISAM +spider_link_failed_log Aria +spider_link_mon_servers Aria +spider_table_crd Aria +spider_table_position_for_recovery Aria +spider_table_sts Aria +spider_tables Aria +spider_xa Aria +spider_xa_failed_log Aria +spider_xa_member Aria deinit for master_1 diff --git a/storage/spider/mysql-test/spider/r/slave_trx_isolation.result b/storage/spider/mysql-test/spider/r/slave_trx_isolation.result index 7d9ba40cab3..e68b4a2c82d 100644 --- a/storage/spider/mysql-test/spider/r/slave_trx_isolation.result +++ b/storage/spider/mysql-test/spider/r/slave_trx_isolation.result @@ -53,7 +53,7 @@ SELECT argument FROM mysql.general_log WHERE argument LIKE '%set %'; argument set session time_zone = '+00:00' SET NAMES utf8 -set session transaction isolation level read committed;set session autocommit = 1;start transaction +set session transaction isolation level read committed;set session autocommit = 1;set session wait_timeout = 604800;set session sql_mode = 'strict_trans_tables,error_for_division_by_zero,no_auto_create_user,no_engine_substitution';start transaction SELECT argument FROM mysql.general_log WHERE argument LIKE '%set %' SELECT pkey FROM tbl_a ORDER BY pkey; pkey diff --git a/storage/spider/mysql-test/spider/r/timestamp.result b/storage/spider/mysql-test/spider/r/timestamp.result index 4e4badccc41..2993c08c5db 100644 --- a/storage/spider/mysql-test/spider/r/timestamp.result +++ b/storage/spider/mysql-test/spider/r/timestamp.result @@ -252,11 +252,11 @@ col_a col_dt col_ts unix_timestamp(col_ts) connection child2_1; SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; argument -select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` > '2017-12-31 23:00:00') -select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` < '2018-10-28 01:30:00') -select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where ('2018-10-28 01:30:00' > t0.`col_ts`) -select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` between '2018-10-28 00:30:00' and '2018-10-28 01:30:00') -select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where ((t0.`col_ts` >= '2018-10-28 00:30:00') and (t0.`col_ts` <= '2018-10-28 01:30:00')) +select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` > _latin1'2017-12-31 23:00:00') +select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` < _latin1'2018-10-28 01:30:00') +select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (_latin1'2018-10-28 01:30:00' > t0.`col_ts`) +select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` between _latin1'2018-10-28 00:30:00' and _latin1'2018-10-28 01:30:00') +select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where ((t0.`col_ts` >= _latin1'2018-10-28 00:30:00') and (t0.`col_ts` <= _latin1'2018-10-28 01:30:00')) select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` > '2018-03-25 01:00:00') select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` > '1970-01-01 00:00:01') SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' @@ -339,11 +339,11 @@ col_a col_dt col_ts unix_timestamp(col_ts) connection child2_1; SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; argument -select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` > '2017-12-31 23:00:00') -select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` < '2018-10-28 01:30:00') -select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where ('2018-10-28 01:30:00' > t0.`col_ts`) -select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` between '2018-10-28 00:30:00' and '2018-10-28 01:30:00') -select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where ((t0.`col_ts` >= '2018-10-28 00:30:00') and (t0.`col_ts` <= '2018-10-28 01:30:00')) +select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` > _latin1'2017-12-31 23:00:00') +select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` < _latin1'2018-10-28 01:30:00') +select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (_latin1'2018-10-28 01:30:00' > t0.`col_ts`) +select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` between _latin1'2018-10-28 00:30:00' and _latin1'2018-10-28 01:30:00') +select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where ((t0.`col_ts` >= _latin1'2018-10-28 00:30:00') and (t0.`col_ts` <= _latin1'2018-10-28 01:30:00')) select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` > '2018-03-25 01:00:00') select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` > '1970-01-01 00:00:01') SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' diff --git a/storage/spider/mysql-test/spider/regression/e1121/include/direct_join_by_pkey_key_deinit.inc b/storage/spider/mysql-test/spider/regression/e1121/include/direct_join_by_pkey_key_deinit.inc new file mode 100644 index 00000000000..ad30aac5d6e --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/include/direct_join_by_pkey_key_deinit.inc @@ -0,0 +1,12 @@ +--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP +--let $MASTER_1_COMMENT_2_1_2= $MASTER_1_COMMENT_2_1_2_BACKUP +--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP +--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP +--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP +--disable_warnings +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/regression/e1121/include/direct_join_by_pkey_key_init.inc b/storage/spider/mysql-test/spider/regression/e1121/include/direct_join_by_pkey_key_init.inc new file mode 100644 index 00000000000..695d46101ae --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/include/direct_join_by_pkey_key_init.inc @@ -0,0 +1,36 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log +--enable_warnings +--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1 +let $MASTER_1_COMMENT_2_1= + COMMENT='table "tbl_a", srv "s_2_1"'; +--let $MASTER_1_COMMENT_2_1_2_BACKUP= $MASTER_1_COMMENT_2_1_2 +let $MASTER_1_COMMENT_2_1_2= + COMMENT='table "tbl_b", srv "s_2_1"'; +--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES +let $CHILD2_1_DROP_TABLES= + DROP TABLE IF EXISTS tbl_a $STR_SEMICOLON + DROP TABLE IF EXISTS tbl_b; +--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES +let $CHILD2_1_CREATE_TABLES= + CREATE TABLE tbl_a ( + akey int NOT NULL, + val int NOT NULL, + KEY idx1 (akey) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET $STR_SEMICOLON + CREATE TABLE tbl_b ( + bkey int NOT NULL, + akey int NOT NULL, + PRIMARY KEY (bkey) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; +--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES +let $CHILD2_1_SELECT_TABLES= + SELECT akey, val FROM tbl_a ORDER BY akey $STR_SEMICOLON + SELECT bkey, akey FROM tbl_b ORDER BY bkey; +let $CHILD2_1_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' $STR_SEMICOLON + SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_b`%'; diff --git a/storage/spider/mysql-test/spider/regression/e1121/include/direct_join_by_pkey_pkey_deinit.inc b/storage/spider/mysql-test/spider/regression/e1121/include/direct_join_by_pkey_pkey_deinit.inc new file mode 100644 index 00000000000..ad30aac5d6e --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/include/direct_join_by_pkey_pkey_deinit.inc @@ -0,0 +1,12 @@ +--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP +--let $MASTER_1_COMMENT_2_1_2= $MASTER_1_COMMENT_2_1_2_BACKUP +--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP +--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP +--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP +--disable_warnings +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/regression/e1121/include/direct_join_by_pkey_pkey_init.inc b/storage/spider/mysql-test/spider/regression/e1121/include/direct_join_by_pkey_pkey_init.inc new file mode 100644 index 00000000000..e364489c05f --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/include/direct_join_by_pkey_pkey_init.inc @@ -0,0 +1,36 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log +--enable_warnings +--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1 +let $MASTER_1_COMMENT_2_1= + COMMENT='table "tbl_a", srv "s_2_1"'; +--let $MASTER_1_COMMENT_2_1_2_BACKUP= $MASTER_1_COMMENT_2_1_2 +let $MASTER_1_COMMENT_2_1_2= + COMMENT='table "tbl_b", srv "s_2_1"'; +--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES +let $CHILD2_1_DROP_TABLES= + DROP TABLE IF EXISTS tbl_a $STR_SEMICOLON + DROP TABLE IF EXISTS tbl_b; +--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES +let $CHILD2_1_CREATE_TABLES= + CREATE TABLE tbl_a ( + akey int NOT NULL, + val int NOT NULL, + PRIMARY KEY (akey) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET $STR_SEMICOLON + CREATE TABLE tbl_b ( + bkey int NOT NULL, + akey int NOT NULL, + PRIMARY KEY (bkey) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; +--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES +let $CHILD2_1_SELECT_TABLES= + SELECT akey, val FROM tbl_a ORDER BY akey $STR_SEMICOLON + SELECT bkey, akey FROM tbl_b ORDER BY bkey; +let $CHILD2_1_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' $STR_SEMICOLON + SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_b`%'; diff --git a/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi0_deinit.inc b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi0_deinit.inc new file mode 100644 index 00000000000..f1899d1576a --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi0_deinit.inc @@ -0,0 +1,3 @@ +--connection master_1 +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +--source load_data_deinit.inc diff --git a/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi0_init.inc b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi0_init.inc new file mode 100644 index 00000000000..24f0dc9820e --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi0_init.inc @@ -0,0 +1,4 @@ +--source load_data_init.inc +--connection master_1 +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 0; diff --git a/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi1_deinit.inc b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi1_deinit.inc new file mode 100644 index 00000000000..f1899d1576a --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi1_deinit.inc @@ -0,0 +1,3 @@ +--connection master_1 +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +--source load_data_deinit.inc diff --git a/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi1_init.inc b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi1_init.inc new file mode 100644 index 00000000000..50ef8d47696 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi1_init.inc @@ -0,0 +1,4 @@ +--source load_data_init.inc +--connection master_1 +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 1; diff --git a/storage/spider/mysql-test/spider/regression/e1121/include/load_data_deinit.inc b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_deinit.inc new file mode 100644 index 00000000000..f8405973768 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_deinit.inc @@ -0,0 +1,11 @@ +--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP +--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP +--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP +--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP +--disable_warnings +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/regression/e1121/include/load_data_init.inc b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_init.inc new file mode 100644 index 00000000000..5f4104382dc --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_init.inc @@ -0,0 +1,25 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log +--enable_warnings +--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1 +let $MASTER_1_COMMENT_2_1= + COMMENT='table "tbl_a", srv "s_2_1"'; +--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES +let $CHILD2_1_DROP_TABLES= + DROP TABLE IF EXISTS tbl_a; +--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES +let $CHILD2_1_CREATE_TABLES= + CREATE TABLE tbl_a ( + pkey int NOT NULL, + val int NOT NULL, + PRIMARY KEY (pkey) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; +--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES +let $CHILD2_1_SELECT_TABLES= + SELECT pkey, val FROM tbl_a ORDER BY pkey; +let $CHILD2_1_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; diff --git a/storage/spider/mysql-test/spider/regression/e1121/my.cnf b/storage/spider/mysql-test/spider/regression/e1121/my.cnf new file mode 100644 index 00000000000..47558d85fc6 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/my.cnf @@ -0,0 +1,3 @@ +!include include/default_mysqld.cnf +!include my_1_1.cnf +!include my_2_1.cnf diff --git a/storage/spider/mysql-test/spider/regression/e1121/my_1_1.cnf b/storage/spider/mysql-test/spider/regression/e1121/my_1_1.cnf new file mode 100644 index 00000000000..5f17295d895 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/my_1_1.cnf @@ -0,0 +1,44 @@ +[mysqld.1.1] +log-bin= master-bin +loose_handlersocket_port= 20000 +loose_handlersocket_port_wr= 20001 +loose_handlersocket_threads= 2 +loose_handlersocket_threads_wr= 1 +loose_handlersocket_support_merge_table= 0 +loose_handlersocket_direct_update_mode= 2 +loose_handlersocket_unlimited_boundary= 65536 +loose_handlersocket_bulk_insert= 0 +loose_handlersocket_bulk_insert_timeout= 0 +loose_handlersocket_general_log= 1 +loose_handlersocket_timeout= 30 +loose_handlersocket_close_table_interval=2 +open_files_limit= 4096 +loose_partition= 1 + +[ENV] +USE_GEOMETRY_TEST= 1 +USE_FULLTEXT_TEST= 1 +USE_HA_TEST= 1 +USE_GENERAL_LOG= 1 +USE_REPLICATION= 1 +MASTER_1_MYPORT= @mysqld.1.1.port +MASTER_1_HSRPORT= 20000 +MASTER_1_HSWPORT= 20001 +MASTER_1_MYSOCK= @mysqld.1.1.socket +MASTER_1_ENGINE_TYPE= Spider +#MASTER_1_ENGINE_TYPE= MyISAM +MASTER_1_ENGINE= ENGINE=Spider +MASTER_1_CHARSET= DEFAULT CHARSET=utf8 +MASTER_1_ENGINE2= ENGINE=MyISAM +MASTER_1_CHARSET2= DEFAULT CHARSET=utf8 +MASTER_1_CHARSET3= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci + +STR_SEMICOLON= ; + +#The followings are set in include/init_xxx.inc files +# MASTER_1_COMMENT_2_1 +# MASTER_1_COMMENT2_2_1 +# MASTER_1_COMMENT3_2_1 +# MASTER_1_COMMENT4_2_1 +# MASTER_1_COMMENT5_2_1 +# MASTER_1_COMMENT_P_2_1 diff --git a/storage/spider/mysql-test/spider/regression/e1121/my_2_1.cnf b/storage/spider/mysql-test/spider/regression/e1121/my_2_1.cnf new file mode 100644 index 00000000000..24161645607 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/my_2_1.cnf @@ -0,0 +1,56 @@ +[mysqld.2.1] +loose_handlersocket_port= 20002 +loose_handlersocket_port_wr= 20003 +loose_handlersocket_threads= 2 +loose_handlersocket_threads_wr= 1 +loose_handlersocket_support_merge_table= 0 +loose_handlersocket_direct_update_mode= 2 +loose_handlersocket_unlimited_boundary= 65536 +loose_handlersocket_bulk_insert= 0 +loose_handlersocket_bulk_insert_timeout= 0 +loose_handlersocket_general_log= 1 +loose_handlersocket_timeout= 30 +loose_handlersocket_close_table_interval=2 +open_files_limit= 4096 + +[ENV] +USE_CHILD_GROUP2= 1 +OUTPUT_CHILD_GROUP2= 0 +CHILD2_1_MYPORT= @mysqld.2.1.port +CHILD2_1_HSRPORT= 20002 +CHILD2_1_HSWPORT= 20003 +CHILD2_1_MYSOCK= @mysqld.2.1.socket +CHILD2_1_ENGINE_TYPE= InnoDB +CHILD2_1_ENGINE= ENGINE=InnoDB +CHILD2_1_CHARSET= DEFAULT CHARSET=utf8 +CHILD2_1_CHARSET2= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci +CHILD2_1_FT_MYPORT= @mysqld.2.1.port +CHILD2_1_FT_MYSOCK= @mysqld.2.1.socket +CHILD2_1_FT_ENGINE_TYPE= MyISAM +CHILD2_1_FT_ENGINE= ENGINE=MyISAM +CHILD2_1_FT_CHARSET= DEFAULT CHARSET=utf8 +CHILD2_1_GM_MYPORT= @mysqld.2.1.port +CHILD2_1_GM_MYSOCK= @mysqld.2.1.socket +CHILD2_1_GM_ENGINE_TYPE= MyISAM +CHILD2_1_GM_ENGINE= ENGINE=MyISAM +CHILD2_1_GM_CHARSET= DEFAULT CHARSET=utf8 + +#The followings are set in include/init_xxx.inc files +# CHILD2_1_DROP_TABLES +# CHILD2_1_CREATE_TABLES +# CHILD2_1_SELECT_TABLES +# CHILD2_1_DROP_TABLES2 +# CHILD2_1_CREATE_TABLES2 +# CHILD2_1_SELECT_TABLES2 +# CHILD2_1_DROP_TABLES3 +# CHILD2_1_CREATE_TABLES3 +# CHILD2_1_SELECT_TABLES3 +# CHILD2_1_DROP_TABLES4 +# CHILD2_1_CREATE_TABLES4 +# CHILD2_1_SELECT_TABLES4 +# CHILD2_1_DROP_TABLES5 +# CHILD2_1_CREATE_TABLES5 +# CHILD2_1_SELECT_TABLES5 +# CHILD2_1_DROP_TABLES6 +# CHILD2_1_CREATE_TABLES6 +# CHILD2_1_SELECT_TABLES6 diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/direct_join_by_pkey_key.result b/storage/spider/mysql-test/spider/regression/e1121/r/direct_join_by_pkey_key.result new file mode 100644 index 00000000000..4b04b71aee2 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/r/direct_join_by_pkey_key.result @@ -0,0 +1,94 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +this test is for MDEV-18995 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +akey int NOT NULL, +val int NOT NULL, +KEY idx1 (akey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +CREATE TABLE tbl_b ( +bkey int NOT NULL, +akey int NOT NULL, +PRIMARY KEY (bkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1_2 +INSERT INTO tbl_a (akey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +INSERT INTO tbl_b (bkey,akey) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,4),(6,3),(7,2),(8,1),(9,0); + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection master_1; +SELECT a.val, a.akey FROM tbl_a a, tbl_b b WHERE a.akey = b.akey AND b.bkey = 5; +val akey +4 4 +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' ; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_b`%'; +argument +select t0.`val` `val`,t0.`akey` `akey` from `auto_test_remote`.`tbl_a` t0 where (t0.`akey` = '4') +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' ; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_b`%' +argument +select `bkey`,`akey` from `auto_test_remote`.`tbl_b` where `bkey` = 5 +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' ; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_b`%' +SELECT akey, val FROM tbl_a ORDER BY akey ; +SELECT bkey, akey FROM tbl_b ORDER BY bkey; +akey val +0 0 +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +bkey akey +0 0 +1 1 +2 2 +3 3 +4 4 +5 4 +6 3 +7 2 +8 1 +9 0 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/direct_join_by_pkey_pkey.result b/storage/spider/mysql-test/spider/regression/e1121/r/direct_join_by_pkey_pkey.result new file mode 100644 index 00000000000..9a75cc691fe --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/r/direct_join_by_pkey_pkey.result @@ -0,0 +1,94 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +this test is for MDEV-18995 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +akey int NOT NULL, +val int NOT NULL, +PRIMARY KEY (akey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +CREATE TABLE tbl_b ( +bkey int NOT NULL, +akey int NOT NULL, +PRIMARY KEY (bkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1_2 +INSERT INTO tbl_a (akey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +INSERT INTO tbl_b (bkey,akey) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,4),(6,3),(7,2),(8,1),(9,0); + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection master_1; +SELECT a.val, a.akey FROM tbl_a a, tbl_b b WHERE a.akey = b.akey AND b.bkey = 5; +val akey +4 4 +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' ; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_b`%'; +argument +select `akey`,`val` from `auto_test_remote`.`tbl_a` where `akey` = 4 +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' ; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_b`%' +argument +select `bkey`,`akey` from `auto_test_remote`.`tbl_b` where `bkey` = 5 +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' ; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_b`%' +SELECT akey, val FROM tbl_a ORDER BY akey ; +SELECT bkey, akey FROM tbl_b ORDER BY bkey; +akey val +0 0 +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +bkey akey +0 0 +1 1 +2 2 +3 3 +4 4 +5 4 +6 3 +7 2 +8 1 +9 0 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ddi0.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ddi0.result new file mode 100644 index 00000000000..2244b176b31 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ddi0.result @@ -0,0 +1,75 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 0; + +this test is for MDEV-18987 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +val int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +TRUNCATE tbl_a; + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection master_1; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' INTO TABLE tbl_a; +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +0 0 +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ddi1.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ddi1.result new file mode 100644 index 00000000000..6d0d29cd4bd --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ddi1.result @@ -0,0 +1,75 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 1; + +this test is for MDEV-18987 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +val int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +TRUNCATE tbl_a; + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection master_1; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' INTO TABLE tbl_a; +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +0 0 +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ignore_ddi0.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ignore_ddi0.result new file mode 100644 index 00000000000..1bdd1470faa --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ignore_ddi0.result @@ -0,0 +1,95 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 0; + +this test is for MDEV-18987 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +val int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +UPDATE tbl_a SET val = val + 1; + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection master_1; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' IGNORE INTO TABLE tbl_a; +Warnings: +Warning 1062 Duplicate entry '0' for key 'PRIMARY' +Warning 1062 Duplicate entry '1' for key 'PRIMARY' +Warning 1062 Duplicate entry '2' for key 'PRIMARY' +Warning 1062 Duplicate entry '3' for key 'PRIMARY' +Warning 1062 Duplicate entry '4' for key 'PRIMARY' +Warning 1062 Duplicate entry '5' for key 'PRIMARY' +Warning 1062 Duplicate entry '6' for key 'PRIMARY' +Warning 1062 Duplicate entry '7' for key 'PRIMARY' +Warning 1062 Duplicate entry '8' for key 'PRIMARY' +Warning 1062 Duplicate entry '9' for key 'PRIMARY' +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(2,2) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(4,4) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(6,6) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(8,8) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +0 1 +1 2 +2 3 +3 4 +4 5 +5 6 +6 7 +7 8 +8 9 +9 10 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ignore_ddi1.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ignore_ddi1.result new file mode 100644 index 00000000000..4d64840e85d --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ignore_ddi1.result @@ -0,0 +1,75 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 1; + +this test is for MDEV-18987 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +val int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +UPDATE tbl_a SET val = val + 1; + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection master_1; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' IGNORE INTO TABLE tbl_a; +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert high_priority ignore into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +0 1 +1 2 +2 3 +3 4 +4 5 +5 6 +6 7 +7 8 +8 9 +9 10 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ddi0.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ddi0.result new file mode 100644 index 00000000000..9156c838e09 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ddi0.result @@ -0,0 +1,84 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 0; + +this test is for MDEV-18987 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +val int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +TRUNCATE tbl_a; + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection master_1; +LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' INTO TABLE tbl_a; +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(2,2) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(4,4) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(6,6) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(8,8) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +0 0 +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ddi1.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ddi1.result new file mode 100644 index 00000000000..761ce71dc02 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ddi1.result @@ -0,0 +1,75 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 1; + +this test is for MDEV-18987 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +val int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +TRUNCATE tbl_a; + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection master_1; +LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' INTO TABLE tbl_a; +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert high_priority ignore into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +0 0 +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ignore_ddi0.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ignore_ddi0.result new file mode 100644 index 00000000000..81d0fdbf785 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ignore_ddi0.result @@ -0,0 +1,95 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 0; + +this test is for MDEV-18987 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +val int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +UPDATE tbl_a SET val = val + 1; + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection master_1; +LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' IGNORE INTO TABLE tbl_a; +Warnings: +Warning 1062 Duplicate entry '0' for key 'PRIMARY' +Warning 1062 Duplicate entry '1' for key 'PRIMARY' +Warning 1062 Duplicate entry '2' for key 'PRIMARY' +Warning 1062 Duplicate entry '3' for key 'PRIMARY' +Warning 1062 Duplicate entry '4' for key 'PRIMARY' +Warning 1062 Duplicate entry '5' for key 'PRIMARY' +Warning 1062 Duplicate entry '6' for key 'PRIMARY' +Warning 1062 Duplicate entry '7' for key 'PRIMARY' +Warning 1062 Duplicate entry '8' for key 'PRIMARY' +Warning 1062 Duplicate entry '9' for key 'PRIMARY' +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(2,2) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(4,4) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(6,6) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(8,8) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +0 1 +1 2 +2 3 +3 4 +4 5 +5 6 +6 7 +7 8 +8 9 +9 10 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ignore_ddi1.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ignore_ddi1.result new file mode 100644 index 00000000000..737cccc42cb --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ignore_ddi1.result @@ -0,0 +1,75 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 1; + +this test is for MDEV-18987 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +val int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +UPDATE tbl_a SET val = val + 1; + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection master_1; +LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' IGNORE INTO TABLE tbl_a; +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert high_priority ignore into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +0 1 +1 2 +2 3 +3 4 +4 5 +5 6 +6 7 +7 8 +8 9 +9 10 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_replace_ddi0.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_replace_ddi0.result new file mode 100644 index 00000000000..7d8fb034544 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_replace_ddi0.result @@ -0,0 +1,104 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 0; + +this test is for MDEV-18987 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +val int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +UPDATE tbl_a SET val = val + 1; + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection master_1; +LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' REPLACE INTO TABLE tbl_a; +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 0 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 0,`val` = 0 where `pkey` = 0 and `val` = 1 limit 1 +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 1 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 1,`val` = 1 where `pkey` = 1 and `val` = 2 limit 1 +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(2,2) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 2 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 2,`val` = 2 where `pkey` = 2 and `val` = 3 limit 1 +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 3 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 3,`val` = 3 where `pkey` = 3 and `val` = 4 limit 1 +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(4,4) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 4 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 4,`val` = 4 where `pkey` = 4 and `val` = 5 limit 1 +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 5 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 5,`val` = 5 where `pkey` = 5 and `val` = 6 limit 1 +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(6,6) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 6 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 6,`val` = 6 where `pkey` = 6 and `val` = 7 limit 1 +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 7 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 7,`val` = 7 where `pkey` = 7 and `val` = 8 limit 1 +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(8,8) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 8 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 8,`val` = 8 where `pkey` = 8 and `val` = 9 limit 1 +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 9 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 9,`val` = 9 where `pkey` = 9 and `val` = 10 limit 1 +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +0 0 +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_replace_ddi1.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_replace_ddi1.result new file mode 100644 index 00000000000..f3e272c1cd1 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_replace_ddi1.result @@ -0,0 +1,75 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 1; + +this test is for MDEV-18987 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +val int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +UPDATE tbl_a SET val = val + 1; + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection master_1; +LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' REPLACE INTO TABLE tbl_a; +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +replace into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +0 0 +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/load_data_replace_ddi0.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_replace_ddi0.result new file mode 100644 index 00000000000..3ce058a9fc8 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_replace_ddi0.result @@ -0,0 +1,104 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 0; + +this test is for MDEV-18987 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +val int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +UPDATE tbl_a SET val = val + 1; + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection master_1; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' REPLACE INTO TABLE tbl_a; +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 0 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 0,`val` = 0 where `pkey` = 0 and `val` = 1 limit 1 +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 1 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 1,`val` = 1 where `pkey` = 1 and `val` = 2 limit 1 +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(2,2) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 2 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 2,`val` = 2 where `pkey` = 2 and `val` = 3 limit 1 +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 3 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 3,`val` = 3 where `pkey` = 3 and `val` = 4 limit 1 +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(4,4) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 4 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 4,`val` = 4 where `pkey` = 4 and `val` = 5 limit 1 +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 5 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 5,`val` = 5 where `pkey` = 5 and `val` = 6 limit 1 +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(6,6) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 6 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 6,`val` = 6 where `pkey` = 6 and `val` = 7 limit 1 +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 7 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 7,`val` = 7 where `pkey` = 7 and `val` = 8 limit 1 +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(8,8) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 8 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 8,`val` = 8 where `pkey` = 8 and `val` = 9 limit 1 +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 9 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 9,`val` = 9 where `pkey` = 9 and `val` = 10 limit 1 +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +0 0 +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/load_data_replace_ddi1.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_replace_ddi1.result new file mode 100644 index 00000000000..86124b9c5c6 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_replace_ddi1.result @@ -0,0 +1,75 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 1; + +this test is for MDEV-18987 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +val int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +UPDATE tbl_a SET val = val + 1; + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection master_1; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' REPLACE INTO TABLE tbl_a; +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +replace into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +0 0 +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/regression/e1121/suite.opt b/storage/spider/mysql-test/spider/regression/e1121/suite.opt new file mode 100644 index 00000000000..672a3b37d4f --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/suite.opt @@ -0,0 +1 @@ +--loose-innodb --loose-skip-performance-schema diff --git a/storage/spider/mysql-test/spider/regression/e1121/suite.pm b/storage/spider/mysql-test/spider/regression/e1121/suite.pm new file mode 100644 index 00000000000..f106147deb6 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/suite.pm @@ -0,0 +1,12 @@ +package My::Suite::Spider; + +@ISA = qw(My::Suite); + +return "No Spider engine" unless $ENV{HA_SPIDER_SO}; +return "Not run for embedded server" if $::opt_embedded_server; +return "Test needs --big-test" unless $::opt_big_test; + +sub is_default { 1 } + +bless { }; + diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/direct_join_by_pkey_key.test b/storage/spider/mysql-test/spider/regression/e1121/t/direct_join_by_pkey_key.test new file mode 100644 index 00000000000..e915a21fd4a --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/t/direct_join_by_pkey_key.test @@ -0,0 +1,82 @@ +--source ../include/direct_join_by_pkey_key_init.inc +--echo +--echo this test is for MDEV-18995 +--echo +--echo drop and create databases + +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; + +--connection child2_1 +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +--enable_warnings + +--echo +--echo create table and insert + +--connection child2_1 +--disable_query_log +echo CHILD2_1_CREATE_TABLES; +eval $CHILD2_1_CREATE_TABLES; +--enable_query_log +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +--disable_query_log +echo CREATE TABLE tbl_a ( + akey int NOT NULL, + val int NOT NULL, + KEY idx1 (akey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + akey int NOT NULL, + val int NOT NULL, + KEY idx1 (akey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +echo CREATE TABLE tbl_b ( + bkey int NOT NULL, + akey int NOT NULL, + PRIMARY KEY (bkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1_2; +eval CREATE TABLE tbl_b ( + bkey int NOT NULL, + akey int NOT NULL, + PRIMARY KEY (bkey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1_2; +--enable_query_log +INSERT INTO tbl_a (akey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +INSERT INTO tbl_b (bkey,akey) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,4),(6,3),(7,2),(8,1),(9,0); + +--echo +--echo select test 1 + +--connection child2_1 +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +SELECT a.val, a.akey FROM tbl_a a, tbl_b b WHERE a.akey = b.akey AND b.bkey = 5; + +--connection child2_1 +eval $CHILD2_1_SELECT_ARGUMENT1; +eval $CHILD2_1_SELECT_TABLES; + +--echo +--echo deinit +--disable_warnings + +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; + +--connection child2_1 +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; + +--enable_warnings +--source ../include/direct_join_by_pkey_key_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/direct_join_by_pkey_pkey.test b/storage/spider/mysql-test/spider/regression/e1121/t/direct_join_by_pkey_pkey.test new file mode 100644 index 00000000000..dcd6e3a4535 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/t/direct_join_by_pkey_pkey.test @@ -0,0 +1,82 @@ +--source ../include/direct_join_by_pkey_pkey_init.inc +--echo +--echo this test is for MDEV-18995 +--echo +--echo drop and create databases + +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; + +--connection child2_1 +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +--enable_warnings + +--echo +--echo create table and insert + +--connection child2_1 +--disable_query_log +echo CHILD2_1_CREATE_TABLES; +eval $CHILD2_1_CREATE_TABLES; +--enable_query_log +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +--disable_query_log +echo CREATE TABLE tbl_a ( + akey int NOT NULL, + val int NOT NULL, + PRIMARY KEY (akey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + akey int NOT NULL, + val int NOT NULL, + PRIMARY KEY (akey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +echo CREATE TABLE tbl_b ( + bkey int NOT NULL, + akey int NOT NULL, + PRIMARY KEY (bkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1_2; +eval CREATE TABLE tbl_b ( + bkey int NOT NULL, + akey int NOT NULL, + PRIMARY KEY (bkey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1_2; +--enable_query_log +INSERT INTO tbl_a (akey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +INSERT INTO tbl_b (bkey,akey) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,4),(6,3),(7,2),(8,1),(9,0); + +--echo +--echo select test 1 + +--connection child2_1 +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +SELECT a.val, a.akey FROM tbl_a a, tbl_b b WHERE a.akey = b.akey AND b.bkey = 5; + +--connection child2_1 +eval $CHILD2_1_SELECT_ARGUMENT1; +eval $CHILD2_1_SELECT_TABLES; + +--echo +--echo deinit +--disable_warnings + +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; + +--connection child2_1 +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; + +--enable_warnings +--source ../include/direct_join_by_pkey_pkey_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data.inc b/storage/spider/mysql-test/spider/regression/e1121/t/load_data.inc new file mode 100644 index 00000000000..8c1aa4e651f --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data.inc @@ -0,0 +1,76 @@ +--echo +--echo this test is for MDEV-18987 +--echo +--echo drop and create databases + +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; + +--connection child2_1 +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +--enable_warnings + +--echo +--echo create table and insert + +--connection child2_1 +--disable_query_log +echo CHILD2_1_CREATE_TABLES; +eval $CHILD2_1_CREATE_TABLES; +--enable_query_log +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +--disable_query_log +echo CREATE TABLE tbl_a ( + pkey int NOT NULL, + val int NOT NULL, + PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + pkey int NOT NULL, + val int NOT NULL, + PRIMARY KEY (pkey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log +INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +--disable_query_log +--echo SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +eval SELECT pkey,val INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +--enable_query_log +eval $COMMAND_BEFORE_LOAD_DATA; + +--echo +--echo select test 1 + +--connection child2_1 +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +--disable_query_log +--echo LOAD DATA $OPTION_LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' $OPTION_WORD INTO TABLE tbl_a; +eval LOAD DATA $OPTION_LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' $OPTION_WORD INTO TABLE tbl_a; +--enable_query_log +--remove_file $MYSQLTEST_VARDIR/tmp/spider_outfile.tsv + +--connection child2_1 +eval $CHILD2_1_SELECT_ARGUMENT1; +eval $CHILD2_1_SELECT_TABLES; + +--echo +--echo deinit +--disable_warnings + +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; + +--connection child2_1 +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; + +--enable_warnings diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ddi0.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ddi0.test new file mode 100644 index 00000000000..d43a944d5e1 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ddi0.test @@ -0,0 +1,8 @@ +--source ../include/load_data_ddi0_init.inc +--let COMMAND_BEFORE_LOAD_DATA= TRUNCATE tbl_a +--let OPTION_LOCAL= +--let OPTION_WORD= +--source load_data.inc +--source ../include/load_data_ddi0_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ddi1.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ddi1.test new file mode 100644 index 00000000000..a73d1ef03b2 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ddi1.test @@ -0,0 +1,8 @@ +--source ../include/load_data_ddi1_init.inc +--let COMMAND_BEFORE_LOAD_DATA= TRUNCATE tbl_a +--let OPTION_LOCAL= +--let OPTION_WORD= +--source load_data.inc +--source ../include/load_data_ddi1_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ignore_ddi0.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ignore_ddi0.test new file mode 100644 index 00000000000..6fee83e7b43 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ignore_ddi0.test @@ -0,0 +1,8 @@ +--source ../include/load_data_ddi0_init.inc +--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1 +--let OPTION_LOCAL= +--let OPTION_WORD= IGNORE +--source load_data.inc +--source ../include/load_data_ddi0_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ignore_ddi1.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ignore_ddi1.test new file mode 100644 index 00000000000..1c8827911b2 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ignore_ddi1.test @@ -0,0 +1,8 @@ +--source ../include/load_data_ddi1_init.inc +--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1 +--let OPTION_LOCAL= +--let OPTION_WORD= IGNORE +--source load_data.inc +--source ../include/load_data_ddi1_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ddi0.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ddi0.test new file mode 100644 index 00000000000..dadd02245ba --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ddi0.test @@ -0,0 +1,8 @@ +--source ../include/load_data_ddi0_init.inc +--let COMMAND_BEFORE_LOAD_DATA= TRUNCATE tbl_a +--let OPTION_LOCAL= LOCAL +--let OPTION_WORD= +--source load_data.inc +--source ../include/load_data_ddi0_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ddi1.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ddi1.test new file mode 100644 index 00000000000..95b065050b5 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ddi1.test @@ -0,0 +1,8 @@ +--source ../include/load_data_ddi1_init.inc +--let COMMAND_BEFORE_LOAD_DATA= TRUNCATE tbl_a +--let OPTION_LOCAL= LOCAL +--let OPTION_WORD= +--source load_data.inc +--source ../include/load_data_ddi1_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ignore_ddi0.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ignore_ddi0.test new file mode 100644 index 00000000000..2243f8924a8 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ignore_ddi0.test @@ -0,0 +1,8 @@ +--source ../include/load_data_ddi0_init.inc +--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1 +--let OPTION_LOCAL= LOCAL +--let OPTION_WORD= IGNORE +--source load_data.inc +--source ../include/load_data_ddi0_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ignore_ddi1.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ignore_ddi1.test new file mode 100644 index 00000000000..2ab7307e3af --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ignore_ddi1.test @@ -0,0 +1,8 @@ +--source ../include/load_data_ddi1_init.inc +--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1 +--let OPTION_LOCAL= LOCAL +--let OPTION_WORD= IGNORE +--source load_data.inc +--source ../include/load_data_ddi1_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_replace_ddi0.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_replace_ddi0.test new file mode 100644 index 00000000000..1821a9ef730 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_replace_ddi0.test @@ -0,0 +1,8 @@ +--source ../include/load_data_ddi0_init.inc +--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1 +--let OPTION_LOCAL= LOCAL +--let OPTION_WORD= REPLACE +--source load_data.inc +--source ../include/load_data_ddi0_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_replace_ddi1.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_replace_ddi1.test new file mode 100644 index 00000000000..3d53feca372 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_replace_ddi1.test @@ -0,0 +1,8 @@ +--source ../include/load_data_ddi1_init.inc +--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1 +--let OPTION_LOCAL= LOCAL +--let OPTION_WORD= REPLACE +--source load_data.inc +--source ../include/load_data_ddi1_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_replace_ddi0.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_replace_ddi0.test new file mode 100644 index 00000000000..4bc402a40f1 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_replace_ddi0.test @@ -0,0 +1,8 @@ +--source ../include/load_data_ddi0_init.inc +--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1 +--let OPTION_LOCAL= +--let OPTION_WORD= REPLACE +--source load_data.inc +--source ../include/load_data_ddi0_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_replace_ddi1.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_replace_ddi1.test new file mode 100644 index 00000000000..9dafd24a15e --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_replace_ddi1.test @@ -0,0 +1,8 @@ +--source ../include/load_data_ddi1_init.inc +--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1 +--let OPTION_LOCAL= +--let OPTION_WORD= REPLACE +--source load_data.inc +--source ../include/load_data_ddi1_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/regression/e112122/include/group_by_order_by_limit_ok_deinit.inc b/storage/spider/mysql-test/spider/regression/e112122/include/group_by_order_by_limit_ok_deinit.inc new file mode 100644 index 00000000000..2248eef3650 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/include/group_by_order_by_limit_ok_deinit.inc @@ -0,0 +1,14 @@ +--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP +--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP +--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP +--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP +--let $CHILD2_2_DROP_TABLES= $CHILD2_2_DROP_TABLES_BACKUP +--let $CHILD2_2_CREATE_TABLES= $CHILD2_2_CREATE_TABLES_BACKUP +--let $CHILD2_2_SELECT_TABLES= $CHILD2_2_SELECT_TABLES_BACKUP +--disable_warnings +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/regression/e112122/include/group_by_order_by_limit_ok_init.inc b/storage/spider/mysql-test/spider/regression/e112122/include/group_by_order_by_limit_ok_init.inc new file mode 100644 index 00000000000..a6945218fab --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/include/group_by_order_by_limit_ok_init.inc @@ -0,0 +1,54 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +if (!$HAVE_PARTITION) +{ + --source group_by_order_by_limit_ok_deinit.inc + --enable_result_log + --enable_query_log + --enable_warnings + skip Test requires partitioning; +} +--enable_result_log +--enable_query_log +--enable_warnings +--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1 +let $MASTER_1_COMMENT_2_1= + COMMENT='table "tbl_a"' + PARTITION BY KEY(skey) ( + PARTITION pt1 COMMENT='srv "s_2_1"', + PARTITION pt2 COMMENT='srv "s_2_2"' + ); +--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES +let $CHILD2_1_DROP_TABLES= + DROP TABLE IF EXISTS tbl_a; +--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES +let $CHILD2_1_CREATE_TABLES= + CREATE TABLE tbl_a ( + pkey int NOT NULL, + skey int NOT NULL, + KEY idx1 (pkey), + KEY idx2 (skey) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; +--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES +let $CHILD2_1_SELECT_TABLES= + SELECT pkey, skey FROM tbl_a ORDER BY pkey; +let $CHILD2_1_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; +--let $CHILD2_2_DROP_TABLES_BACKUP= $CHILD2_2_DROP_TABLES +let $CHILD2_2_DROP_TABLES= + DROP TABLE IF EXISTS tbl_a; +--let $CHILD2_2_CREATE_TABLES_BACKUP= $CHILD2_2_CREATE_TABLES +let $CHILD2_2_CREATE_TABLES= + CREATE TABLE tbl_a ( + pkey int NOT NULL, + skey int NOT NULL, + KEY idx1 (pkey), + KEY idx2 (skey) + ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; +--let $CHILD2_2_SELECT_TABLES_BACKUP= $CHILD2_2_SELECT_TABLES +let $CHILD2_2_SELECT_TABLES= + SELECT pkey, skey FROM tbl_a ORDER BY pkey; +let $CHILD2_2_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; diff --git a/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi0_deinit.inc b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi0_deinit.inc new file mode 100644 index 00000000000..c41917340b0 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi0_deinit.inc @@ -0,0 +1,3 @@ +--connection master_1 +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +--source load_data_part_deinit.inc diff --git a/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi0_init.inc b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi0_init.inc new file mode 100644 index 00000000000..8e69f52cc58 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi0_init.inc @@ -0,0 +1,4 @@ +--source load_data_part_init.inc +--connection master_1 +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 0; diff --git a/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi1_deinit.inc b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi1_deinit.inc new file mode 100644 index 00000000000..c41917340b0 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi1_deinit.inc @@ -0,0 +1,3 @@ +--connection master_1 +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +--source load_data_part_deinit.inc diff --git a/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi1_init.inc b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi1_init.inc new file mode 100644 index 00000000000..b9194ccd51c --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi1_init.inc @@ -0,0 +1,4 @@ +--source load_data_part_init.inc +--connection master_1 +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 1; diff --git a/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_deinit.inc b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_deinit.inc new file mode 100644 index 00000000000..2248eef3650 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_deinit.inc @@ -0,0 +1,14 @@ +--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP +--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP +--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP +--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP +--let $CHILD2_2_DROP_TABLES= $CHILD2_2_DROP_TABLES_BACKUP +--let $CHILD2_2_CREATE_TABLES= $CHILD2_2_CREATE_TABLES_BACKUP +--let $CHILD2_2_SELECT_TABLES= $CHILD2_2_SELECT_TABLES_BACKUP +--disable_warnings +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_init.inc b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_init.inc new file mode 100644 index 00000000000..42a0ea72539 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_init.inc @@ -0,0 +1,52 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +if (!$HAVE_PARTITION) +{ + --source load_data_part_deinit.inc + --enable_result_log + --enable_query_log + --enable_warnings + skip Test requires partitioning; +} +--enable_result_log +--enable_query_log +--enable_warnings +--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1 +let $MASTER_1_COMMENT_2_1= + COMMENT='table "tbl_a"' + PARTITION BY KEY(pkey) ( + PARTITION pt1 COMMENT='srv "s_2_1"', + PARTITION pt2 COMMENT='srv "s_2_2"' + ); +--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES +let $CHILD2_1_DROP_TABLES= + DROP TABLE IF EXISTS tbl_a; +--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES +let $CHILD2_1_CREATE_TABLES= + CREATE TABLE tbl_a ( + pkey int NOT NULL, + val int NOT NULL, + PRIMARY KEY (pkey) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; +--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES +let $CHILD2_1_SELECT_TABLES= + SELECT pkey, val FROM tbl_a ORDER BY pkey; +let $CHILD2_1_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +--let $CHILD2_2_DROP_TABLES_BACKUP= $CHILD2_2_DROP_TABLES +let $CHILD2_2_DROP_TABLES= + DROP TABLE IF EXISTS tbl_a; +--let $CHILD2_2_CREATE_TABLES_BACKUP= $CHILD2_2_CREATE_TABLES +let $CHILD2_2_CREATE_TABLES= + CREATE TABLE tbl_a ( + pkey int NOT NULL, + val int NOT NULL, + PRIMARY KEY (pkey) + ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; +--let $CHILD2_2_SELECT_TABLES_BACKUP= $CHILD2_2_SELECT_TABLES +let $CHILD2_2_SELECT_TABLES= + SELECT pkey, val FROM tbl_a ORDER BY pkey; +let $CHILD2_2_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; diff --git a/storage/spider/mysql-test/spider/regression/e112122/my.cnf b/storage/spider/mysql-test/spider/regression/e112122/my.cnf new file mode 100644 index 00000000000..6610e4cfd98 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/my.cnf @@ -0,0 +1,4 @@ +!include include/default_mysqld.cnf +!include my_1_1.cnf +!include my_2_1.cnf +!include my_2_2.cnf diff --git a/storage/spider/mysql-test/spider/regression/e112122/my_1_1.cnf b/storage/spider/mysql-test/spider/regression/e112122/my_1_1.cnf new file mode 100644 index 00000000000..5f17295d895 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/my_1_1.cnf @@ -0,0 +1,44 @@ +[mysqld.1.1] +log-bin= master-bin +loose_handlersocket_port= 20000 +loose_handlersocket_port_wr= 20001 +loose_handlersocket_threads= 2 +loose_handlersocket_threads_wr= 1 +loose_handlersocket_support_merge_table= 0 +loose_handlersocket_direct_update_mode= 2 +loose_handlersocket_unlimited_boundary= 65536 +loose_handlersocket_bulk_insert= 0 +loose_handlersocket_bulk_insert_timeout= 0 +loose_handlersocket_general_log= 1 +loose_handlersocket_timeout= 30 +loose_handlersocket_close_table_interval=2 +open_files_limit= 4096 +loose_partition= 1 + +[ENV] +USE_GEOMETRY_TEST= 1 +USE_FULLTEXT_TEST= 1 +USE_HA_TEST= 1 +USE_GENERAL_LOG= 1 +USE_REPLICATION= 1 +MASTER_1_MYPORT= @mysqld.1.1.port +MASTER_1_HSRPORT= 20000 +MASTER_1_HSWPORT= 20001 +MASTER_1_MYSOCK= @mysqld.1.1.socket +MASTER_1_ENGINE_TYPE= Spider +#MASTER_1_ENGINE_TYPE= MyISAM +MASTER_1_ENGINE= ENGINE=Spider +MASTER_1_CHARSET= DEFAULT CHARSET=utf8 +MASTER_1_ENGINE2= ENGINE=MyISAM +MASTER_1_CHARSET2= DEFAULT CHARSET=utf8 +MASTER_1_CHARSET3= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci + +STR_SEMICOLON= ; + +#The followings are set in include/init_xxx.inc files +# MASTER_1_COMMENT_2_1 +# MASTER_1_COMMENT2_2_1 +# MASTER_1_COMMENT3_2_1 +# MASTER_1_COMMENT4_2_1 +# MASTER_1_COMMENT5_2_1 +# MASTER_1_COMMENT_P_2_1 diff --git a/storage/spider/mysql-test/spider/regression/e112122/my_2_1.cnf b/storage/spider/mysql-test/spider/regression/e112122/my_2_1.cnf new file mode 100644 index 00000000000..24161645607 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/my_2_1.cnf @@ -0,0 +1,56 @@ +[mysqld.2.1] +loose_handlersocket_port= 20002 +loose_handlersocket_port_wr= 20003 +loose_handlersocket_threads= 2 +loose_handlersocket_threads_wr= 1 +loose_handlersocket_support_merge_table= 0 +loose_handlersocket_direct_update_mode= 2 +loose_handlersocket_unlimited_boundary= 65536 +loose_handlersocket_bulk_insert= 0 +loose_handlersocket_bulk_insert_timeout= 0 +loose_handlersocket_general_log= 1 +loose_handlersocket_timeout= 30 +loose_handlersocket_close_table_interval=2 +open_files_limit= 4096 + +[ENV] +USE_CHILD_GROUP2= 1 +OUTPUT_CHILD_GROUP2= 0 +CHILD2_1_MYPORT= @mysqld.2.1.port +CHILD2_1_HSRPORT= 20002 +CHILD2_1_HSWPORT= 20003 +CHILD2_1_MYSOCK= @mysqld.2.1.socket +CHILD2_1_ENGINE_TYPE= InnoDB +CHILD2_1_ENGINE= ENGINE=InnoDB +CHILD2_1_CHARSET= DEFAULT CHARSET=utf8 +CHILD2_1_CHARSET2= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci +CHILD2_1_FT_MYPORT= @mysqld.2.1.port +CHILD2_1_FT_MYSOCK= @mysqld.2.1.socket +CHILD2_1_FT_ENGINE_TYPE= MyISAM +CHILD2_1_FT_ENGINE= ENGINE=MyISAM +CHILD2_1_FT_CHARSET= DEFAULT CHARSET=utf8 +CHILD2_1_GM_MYPORT= @mysqld.2.1.port +CHILD2_1_GM_MYSOCK= @mysqld.2.1.socket +CHILD2_1_GM_ENGINE_TYPE= MyISAM +CHILD2_1_GM_ENGINE= ENGINE=MyISAM +CHILD2_1_GM_CHARSET= DEFAULT CHARSET=utf8 + +#The followings are set in include/init_xxx.inc files +# CHILD2_1_DROP_TABLES +# CHILD2_1_CREATE_TABLES +# CHILD2_1_SELECT_TABLES +# CHILD2_1_DROP_TABLES2 +# CHILD2_1_CREATE_TABLES2 +# CHILD2_1_SELECT_TABLES2 +# CHILD2_1_DROP_TABLES3 +# CHILD2_1_CREATE_TABLES3 +# CHILD2_1_SELECT_TABLES3 +# CHILD2_1_DROP_TABLES4 +# CHILD2_1_CREATE_TABLES4 +# CHILD2_1_SELECT_TABLES4 +# CHILD2_1_DROP_TABLES5 +# CHILD2_1_CREATE_TABLES5 +# CHILD2_1_SELECT_TABLES5 +# CHILD2_1_DROP_TABLES6 +# CHILD2_1_CREATE_TABLES6 +# CHILD2_1_SELECT_TABLES6 diff --git a/storage/spider/mysql-test/spider/regression/e112122/my_2_2.cnf b/storage/spider/mysql-test/spider/regression/e112122/my_2_2.cnf new file mode 100644 index 00000000000..2d3c2a89a7d --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/my_2_2.cnf @@ -0,0 +1,38 @@ +[mysqld.2.2] +loose_handlersocket_port= 20004 +loose_handlersocket_port_wr= 20005 +loose_handlersocket_threads= 2 +loose_handlersocket_threads_wr= 1 +loose_handlersocket_support_merge_table= 0 +loose_handlersocket_direct_update_mode= 2 +loose_handlersocket_unlimited_boundary= 65536 +loose_handlersocket_bulk_insert= 0 +loose_handlersocket_bulk_insert_timeout= 0 +loose_handlersocket_general_log= 1 +loose_handlersocket_timeout= 30 +loose_handlersocket_close_table_interval=2 +open_files_limit= 4096 + +[ENV] +CHILD2_2_MYPORT= @mysqld.2.2.port +CHILD2_2_HSRPORT= 20004 +CHILD2_2_HSWPORT= 20005 +CHILD2_2_MYSOCK= @mysqld.2.2.socket +CHILD2_2_ENGINE_TYPE= InnoDB +CHILD2_2_ENGINE= ENGINE=InnoDB +CHILD2_2_CHARSET= DEFAULT CHARSET=utf8 +CHILD2_2_FT_MYPORT= @mysqld.2.2.port +CHILD2_2_FT_MYSOCK= @mysqld.2.2.socket +CHILD2_2_FT_ENGINE_TYPE= MyISAM +CHILD2_2_FT_ENGINE= ENGINE=MyISAM +CHILD2_2_FT_CHARSET= DEFAULT CHARSET=utf8 +CHILD2_2_GM_MYPORT= @mysqld.2.2.port +CHILD2_2_GM_MYSOCK= @mysqld.2.2.socket +CHILD2_2_GM_ENGINE_TYPE= MyISAM +CHILD2_2_GM_ENGINE= ENGINE=MyISAM +CHILD2_2_GM_CHARSET= DEFAULT CHARSET=utf8 + +#The followings are set in include/init_xxx.inc files +# CHILD2_2_DROP_TABLES +# CHILD2_2_CREATE_TABLES +# CHILD2_2_SELECT_TABLES diff --git a/storage/spider/mysql-test/spider/regression/e112122/r/group_by_order_by_limit_ok.result b/storage/spider/mysql-test/spider/regression/e112122/r/group_by_order_by_limit_ok.result new file mode 100644 index 00000000000..96746e09b8d --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/r/group_by_order_by_limit_ok.result @@ -0,0 +1,117 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +this test is for MDEV-18988 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +connection child2_2; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection child2_2; +CHILD2_2_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +skey int NOT NULL, +KEY idx1 (pkey), +KEY idx2 (skey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey,skey) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +INSERT INTO tbl_a (pkey,skey) VALUES (10,10),(11,11),(12,12),(13,13),(14,14),(15,15),(16,16),(17,17),(18,18),(19,19); +INSERT INTO tbl_a (pkey,skey) VALUES (20,5),(21,6),(22,7),(23,8),(24,9),(25,10),(26,11),(27,12),(28,13),(29,14); + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection child2_2; +TRUNCATE TABLE mysql.general_log; +connection master_1; +SELECT skey, count(*) cnt FROM tbl_a GROUP BY skey ORDER BY cnt DESC, skey DESC LIMIT 5; +skey cnt +14 2 +13 2 +12 2 +11 2 +10 2 +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; +argument +select count(0),`skey` from `auto_test_remote`.`tbl_a` group by `skey` order by count(0) desc,`skey` desc limit 5 +SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' +SELECT pkey, skey FROM tbl_a ORDER BY pkey; +pkey skey +1 1 +3 3 +5 5 +7 7 +9 9 +11 11 +13 13 +15 15 +17 17 +19 19 +20 5 +22 7 +24 9 +26 11 +28 13 +connection child2_2; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; +argument +select count(0),`skey` from `auto_test_remote2`.`tbl_a` group by `skey` order by count(0) desc,`skey` desc limit 5 +SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' +SELECT pkey, skey FROM tbl_a ORDER BY pkey; +pkey skey +0 0 +2 2 +4 4 +6 6 +8 8 +10 10 +12 12 +14 14 +16 16 +18 18 +21 6 +23 8 +25 10 +27 12 +29 14 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +SET GLOBAL log_output = @old_log_output; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ddi0.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ddi0.result new file mode 100644 index 00000000000..23753239054 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ddi0.result @@ -0,0 +1,95 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 0; + +this test is for MDEV-18987 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +connection child2_2; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection child2_2; +CHILD2_2_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +val int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +TRUNCATE tbl_a; + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection child2_2; +TRUNCATE TABLE mysql.general_log; +connection master_1; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' INTO TABLE tbl_a; +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1),(3,3),(5,5),(7,7),(9,9) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +1 1 +3 3 +5 5 +7 7 +9 9 +connection child2_2; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0),(2,2),(4,4),(6,6),(8,8) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +0 0 +2 2 +4 4 +6 6 +8 8 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ddi1.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ddi1.result new file mode 100644 index 00000000000..c30a5c037a7 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ddi1.result @@ -0,0 +1,95 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 1; + +this test is for MDEV-18987 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +connection child2_2; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection child2_2; +CHILD2_2_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +val int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +TRUNCATE tbl_a; + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection child2_2; +TRUNCATE TABLE mysql.general_log; +connection master_1; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' INTO TABLE tbl_a; +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1),(3,3),(5,5),(7,7),(9,9) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +1 1 +3 3 +5 5 +7 7 +9 9 +connection child2_2; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0),(2,2),(4,4),(6,6),(8,8) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +0 0 +2 2 +4 4 +6 6 +8 8 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ignore_ddi0.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ignore_ddi0.result new file mode 100644 index 00000000000..0071042cd58 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ignore_ddi0.result @@ -0,0 +1,114 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 0; + +this test is for MDEV-18987 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +connection child2_2; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection child2_2; +CHILD2_2_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +val int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +UPDATE tbl_a SET val = val + 1; + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection child2_2; +TRUNCATE TABLE mysql.general_log; +connection master_1; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' IGNORE INTO TABLE tbl_a; +Warnings: +Warning 1062 Duplicate entry '0' for key 'PRIMARY' +Warning 1062 Duplicate entry '1' for key 'PRIMARY' +Warning 1062 Duplicate entry '2' for key 'PRIMARY' +Warning 1062 Duplicate entry '3' for key 'PRIMARY' +Warning 1062 Duplicate entry '4' for key 'PRIMARY' +Warning 1062 Duplicate entry '5' for key 'PRIMARY' +Warning 1062 Duplicate entry '6' for key 'PRIMARY' +Warning 1062 Duplicate entry '7' for key 'PRIMARY' +Warning 1062 Duplicate entry '8' for key 'PRIMARY' +Warning 1062 Duplicate entry '9' for key 'PRIMARY' +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +1 2 +3 4 +5 6 +7 8 +9 10 +connection child2_2; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0) +insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(2,2) +insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(4,4) +insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(6,6) +insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(8,8) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +0 1 +2 3 +4 5 +6 7 +8 9 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ignore_ddi1.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ignore_ddi1.result new file mode 100644 index 00000000000..9f2e8dec535 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ignore_ddi1.result @@ -0,0 +1,95 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 1; + +this test is for MDEV-18987 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +connection child2_2; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection child2_2; +CHILD2_2_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +val int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +UPDATE tbl_a SET val = val + 1; + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection child2_2; +TRUNCATE TABLE mysql.general_log; +connection master_1; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' IGNORE INTO TABLE tbl_a; +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert high_priority ignore into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1),(3,3),(5,5),(7,7),(9,9) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +1 2 +3 4 +5 6 +7 8 +9 10 +connection child2_2; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert high_priority ignore into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0),(2,2),(4,4),(6,6),(8,8) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +0 1 +2 3 +4 5 +6 7 +8 9 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ddi0.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ddi0.result new file mode 100644 index 00000000000..7ec2b5b0b9e --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ddi0.result @@ -0,0 +1,103 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 0; + +this test is for MDEV-18987 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +connection child2_2; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection child2_2; +CHILD2_2_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +val int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +TRUNCATE tbl_a; + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection child2_2; +TRUNCATE TABLE mysql.general_log; +connection master_1; +LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' INTO TABLE tbl_a; +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +1 1 +3 3 +5 5 +7 7 +9 9 +connection child2_2; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0) +insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(2,2) +insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(4,4) +insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(6,6) +insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(8,8) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +0 0 +2 2 +4 4 +6 6 +8 8 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ddi1.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ddi1.result new file mode 100644 index 00000000000..f908ce1c1d5 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ddi1.result @@ -0,0 +1,95 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 1; + +this test is for MDEV-18987 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +connection child2_2; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection child2_2; +CHILD2_2_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +val int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +TRUNCATE tbl_a; + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection child2_2; +TRUNCATE TABLE mysql.general_log; +connection master_1; +LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' INTO TABLE tbl_a; +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert high_priority ignore into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1),(3,3),(5,5),(7,7),(9,9) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +1 1 +3 3 +5 5 +7 7 +9 9 +connection child2_2; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert high_priority ignore into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0),(2,2),(4,4),(6,6),(8,8) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +0 0 +2 2 +4 4 +6 6 +8 8 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ignore_ddi0.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ignore_ddi0.result new file mode 100644 index 00000000000..c0a8f653fee --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ignore_ddi0.result @@ -0,0 +1,114 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 0; + +this test is for MDEV-18987 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +connection child2_2; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection child2_2; +CHILD2_2_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +val int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +UPDATE tbl_a SET val = val + 1; + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection child2_2; +TRUNCATE TABLE mysql.general_log; +connection master_1; +LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' IGNORE INTO TABLE tbl_a; +Warnings: +Warning 1062 Duplicate entry '0' for key 'PRIMARY' +Warning 1062 Duplicate entry '1' for key 'PRIMARY' +Warning 1062 Duplicate entry '2' for key 'PRIMARY' +Warning 1062 Duplicate entry '3' for key 'PRIMARY' +Warning 1062 Duplicate entry '4' for key 'PRIMARY' +Warning 1062 Duplicate entry '5' for key 'PRIMARY' +Warning 1062 Duplicate entry '6' for key 'PRIMARY' +Warning 1062 Duplicate entry '7' for key 'PRIMARY' +Warning 1062 Duplicate entry '8' for key 'PRIMARY' +Warning 1062 Duplicate entry '9' for key 'PRIMARY' +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +1 2 +3 4 +5 6 +7 8 +9 10 +connection child2_2; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0) +insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(2,2) +insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(4,4) +insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(6,6) +insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(8,8) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +0 1 +2 3 +4 5 +6 7 +8 9 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ignore_ddi1.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ignore_ddi1.result new file mode 100644 index 00000000000..619dd789d9a --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ignore_ddi1.result @@ -0,0 +1,95 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 1; + +this test is for MDEV-18987 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +connection child2_2; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection child2_2; +CHILD2_2_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +val int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +UPDATE tbl_a SET val = val + 1; + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection child2_2; +TRUNCATE TABLE mysql.general_log; +connection master_1; +LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' IGNORE INTO TABLE tbl_a; +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert high_priority ignore into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1),(3,3),(5,5),(7,7),(9,9) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +1 2 +3 4 +5 6 +7 8 +9 10 +connection child2_2; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert high_priority ignore into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0),(2,2),(4,4),(6,6),(8,8) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +0 1 +2 3 +4 5 +6 7 +8 9 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_replace_ddi0.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_replace_ddi0.result new file mode 100644 index 00000000000..e12e380bb93 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_replace_ddi0.result @@ -0,0 +1,123 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 0; + +this test is for MDEV-18987 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +connection child2_2; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection child2_2; +CHILD2_2_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +val int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +UPDATE tbl_a SET val = val + 1; + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection child2_2; +TRUNCATE TABLE mysql.general_log; +connection master_1; +LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' REPLACE INTO TABLE tbl_a; +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 1 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 1,`val` = 1 where `pkey` = 1 and `val` = 2 limit 1 +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 3 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 3,`val` = 3 where `pkey` = 3 and `val` = 4 limit 1 +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 5 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 5,`val` = 5 where `pkey` = 5 and `val` = 6 limit 1 +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 7 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 7,`val` = 7 where `pkey` = 7 and `val` = 8 limit 1 +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 9 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 9,`val` = 9 where `pkey` = 9 and `val` = 10 limit 1 +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +1 1 +3 3 +5 5 +7 7 +9 9 +connection child2_2; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0) +select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 0 for update +update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 0,`val` = 0 where `pkey` = 0 and `val` = 1 limit 1 +insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(2,2) +select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 2 for update +update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 2,`val` = 2 where `pkey` = 2 and `val` = 3 limit 1 +insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(4,4) +select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 4 for update +update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 4,`val` = 4 where `pkey` = 4 and `val` = 5 limit 1 +insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(6,6) +select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 6 for update +update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 6,`val` = 6 where `pkey` = 6 and `val` = 7 limit 1 +insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(8,8) +select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 8 for update +update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 8,`val` = 8 where `pkey` = 8 and `val` = 9 limit 1 +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +0 0 +2 2 +4 4 +6 6 +8 8 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_replace_ddi1.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_replace_ddi1.result new file mode 100644 index 00000000000..d367cbfd0ad --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_replace_ddi1.result @@ -0,0 +1,95 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 1; + +this test is for MDEV-18987 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +connection child2_2; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection child2_2; +CHILD2_2_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +val int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +UPDATE tbl_a SET val = val + 1; + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection child2_2; +TRUNCATE TABLE mysql.general_log; +connection master_1; +LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' REPLACE INTO TABLE tbl_a; +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +replace into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1),(3,3),(5,5),(7,7),(9,9) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +1 1 +3 3 +5 5 +7 7 +9 9 +connection child2_2; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +replace into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0),(2,2),(4,4),(6,6),(8,8) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +0 0 +2 2 +4 4 +6 6 +8 8 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_replace_ddi0.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_replace_ddi0.result new file mode 100644 index 00000000000..039a8dd4fad --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_replace_ddi0.result @@ -0,0 +1,123 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 0; + +this test is for MDEV-18987 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +connection child2_2; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection child2_2; +CHILD2_2_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +val int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +UPDATE tbl_a SET val = val + 1; + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection child2_2; +TRUNCATE TABLE mysql.general_log; +connection master_1; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' REPLACE INTO TABLE tbl_a; +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 1 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 1,`val` = 1 where `pkey` = 1 and `val` = 2 limit 1 +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 3 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 3,`val` = 3 where `pkey` = 3 and `val` = 4 limit 1 +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 5 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 5,`val` = 5 where `pkey` = 5 and `val` = 6 limit 1 +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 7 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 7,`val` = 7 where `pkey` = 7 and `val` = 8 limit 1 +insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9) +select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 9 for update +update ignore `auto_test_remote`.`tbl_a` set `pkey` = 9,`val` = 9 where `pkey` = 9 and `val` = 10 limit 1 +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +1 1 +3 3 +5 5 +7 7 +9 9 +connection child2_2; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0) +select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 0 for update +update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 0,`val` = 0 where `pkey` = 0 and `val` = 1 limit 1 +insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(2,2) +select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 2 for update +update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 2,`val` = 2 where `pkey` = 2 and `val` = 3 limit 1 +insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(4,4) +select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 4 for update +update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 4,`val` = 4 where `pkey` = 4 and `val` = 5 limit 1 +insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(6,6) +select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 6 for update +update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 6,`val` = 6 where `pkey` = 6 and `val` = 7 limit 1 +insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(8,8) +select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 8 for update +update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 8,`val` = 8 where `pkey` = 8 and `val` = 9 limit 1 +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +0 0 +2 2 +4 4 +6 6 +8 8 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_replace_ddi1.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_replace_ddi1.result new file mode 100644 index 00000000000..c8155be9910 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_replace_ddi1.result @@ -0,0 +1,95 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection master_1; +set @old_spider_direct_dup_insert= @@spider_direct_dup_insert; +set session spider_direct_dup_insert= 1; + +this test is for MDEV-18987 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +connection child2_2; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection child2_2; +CHILD2_2_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +val int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +UPDATE tbl_a SET val = val + 1; + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection child2_2; +TRUNCATE TABLE mysql.general_log; +connection master_1; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' REPLACE INTO TABLE tbl_a; +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +replace into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1),(3,3),(5,5),(7,7),(9,9) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +1 1 +3 3 +5 5 +7 7 +9 9 +connection child2_2; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'; +argument +replace into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0),(2,2),(4,4),(6,6),(8,8) +SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%' +SELECT pkey, val FROM tbl_a ORDER BY pkey; +pkey val +0 0 +2 2 +4 4 +6 6 +8 8 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +SET GLOBAL log_output = @old_log_output; +connection master_1; +set session spider_direct_dup_insert= @old_spider_direct_dup_insert; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/regression/e112122/suite.opt b/storage/spider/mysql-test/spider/regression/e112122/suite.opt new file mode 100644 index 00000000000..672a3b37d4f --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/suite.opt @@ -0,0 +1 @@ +--loose-innodb --loose-skip-performance-schema diff --git a/storage/spider/mysql-test/spider/regression/e112122/suite.pm b/storage/spider/mysql-test/spider/regression/e112122/suite.pm new file mode 100644 index 00000000000..f106147deb6 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/suite.pm @@ -0,0 +1,12 @@ +package My::Suite::Spider; + +@ISA = qw(My::Suite); + +return "No Spider engine" unless $ENV{HA_SPIDER_SO}; +return "Not run for embedded server" if $::opt_embedded_server; +return "Test needs --big-test" unless $::opt_big_test; + +sub is_default { 1 } + +bless { }; + diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/group_by_order_by_limit_ok.test b/storage/spider/mysql-test/spider/regression/e112122/t/group_by_order_by_limit_ok.test new file mode 100644 index 00000000000..2a70098ed1b --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/t/group_by_order_by_limit_ok.test @@ -0,0 +1,97 @@ +--source ../include/group_by_order_by_limit_ok_init.inc +--echo +--echo this test is for MDEV-18988 +--echo +--echo drop and create databases +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; + +--connection child2_1 +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +--connection child2_2 +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; +--enable_warnings + +--echo +--echo create table and insert + +--connection child2_1 +--disable_query_log +echo CHILD2_1_CREATE_TABLES; +eval $CHILD2_1_CREATE_TABLES; +--enable_query_log +TRUNCATE TABLE mysql.general_log; + +--connection child2_2 +--disable_query_log +echo CHILD2_2_CREATE_TABLES; +eval $CHILD2_2_CREATE_TABLES; +--enable_query_log +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +--disable_query_log +echo CREATE TABLE tbl_a ( + pkey int NOT NULL, + skey int NOT NULL, + KEY idx1 (pkey), + KEY idx2 (skey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + pkey int NOT NULL, + skey int NOT NULL, + KEY idx1 (pkey), + KEY idx2 (skey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log +INSERT INTO tbl_a (pkey,skey) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +INSERT INTO tbl_a (pkey,skey) VALUES (10,10),(11,11),(12,12),(13,13),(14,14),(15,15),(16,16),(17,17),(18,18),(19,19); +INSERT INTO tbl_a (pkey,skey) VALUES (20,5),(21,6),(22,7),(23,8),(24,9),(25,10),(26,11),(27,12),(28,13),(29,14); + +--echo +--echo select test 1 + +--connection child2_1 +TRUNCATE TABLE mysql.general_log; + +--connection child2_2 +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +SELECT skey, count(*) cnt FROM tbl_a GROUP BY skey ORDER BY cnt DESC, skey DESC LIMIT 5; + +--connection child2_1 +eval $CHILD2_1_SELECT_ARGUMENT1; +eval $CHILD2_1_SELECT_TABLES; + +--connection child2_2 +eval $CHILD2_2_SELECT_ARGUMENT1; +eval $CHILD2_2_SELECT_TABLES; + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; + +--connection child2_1 +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; + +--connection child2_2 +DROP DATABASE IF EXISTS auto_test_remote2; +SET GLOBAL log_output = @old_log_output; + +--enable_warnings +--source ../include/group_by_order_by_limit_ok_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part.inc b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part.inc new file mode 100644 index 00000000000..e66550f9a90 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part.inc @@ -0,0 +1,100 @@ +--echo +--echo this test is for MDEV-18987 +--echo +--echo drop and create databases + +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; + +--connection child2_1 +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +--connection child2_2 +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; +--enable_warnings + +--echo +--echo create table and insert + +--connection child2_1 +--disable_query_log +echo CHILD2_1_CREATE_TABLES; +eval $CHILD2_1_CREATE_TABLES; +--enable_query_log +TRUNCATE TABLE mysql.general_log; + +--connection child2_2 +--disable_query_log +echo CHILD2_2_CREATE_TABLES; +eval $CHILD2_2_CREATE_TABLES; +--enable_query_log +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +--disable_query_log +echo CREATE TABLE tbl_a ( + pkey int NOT NULL, + val int NOT NULL, + PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + pkey int NOT NULL, + val int NOT NULL, + PRIMARY KEY (pkey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log +INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +--disable_query_log +--echo SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +eval SELECT pkey,val INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +--enable_query_log +eval $COMMAND_BEFORE_LOAD_DATA; + +--echo +--echo select test 1 + +--connection child2_1 +TRUNCATE TABLE mysql.general_log; + +--connection child2_2 +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +--disable_query_log +--echo LOAD DATA $OPTION_LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' $OPTION_WORD INTO TABLE tbl_a; +eval LOAD DATA $OPTION_LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' $OPTION_WORD INTO TABLE tbl_a; +--enable_query_log +--remove_file $MYSQLTEST_VARDIR/tmp/spider_outfile.tsv + +--connection child2_1 +eval $CHILD2_1_SELECT_ARGUMENT1; +eval $CHILD2_1_SELECT_TABLES; + +--connection child2_2 +eval $CHILD2_2_SELECT_ARGUMENT1; +eval $CHILD2_2_SELECT_TABLES; + +--echo +--echo deinit +--disable_warnings + +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; + +--connection child2_1 +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; + +--connection child2_2 +DROP DATABASE IF EXISTS auto_test_remote2; +SET GLOBAL log_output = @old_log_output; + +--enable_warnings diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ddi0.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ddi0.test new file mode 100644 index 00000000000..b78529095a4 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ddi0.test @@ -0,0 +1,8 @@ +--source ../include/load_data_part_ddi0_init.inc +--let COMMAND_BEFORE_LOAD_DATA= TRUNCATE tbl_a +--let OPTION_LOCAL= +--let OPTION_WORD= +--source load_data_part.inc +--source ../include/load_data_part_ddi0_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ddi1.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ddi1.test new file mode 100644 index 00000000000..a2540077639 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ddi1.test @@ -0,0 +1,8 @@ +--source ../include/load_data_part_ddi1_init.inc +--let COMMAND_BEFORE_LOAD_DATA= TRUNCATE tbl_a +--let OPTION_LOCAL= +--let OPTION_WORD= +--source load_data_part.inc +--source ../include/load_data_part_ddi1_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ignore_ddi0.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ignore_ddi0.test new file mode 100644 index 00000000000..a6fb58d69d1 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ignore_ddi0.test @@ -0,0 +1,8 @@ +--source ../include/load_data_part_ddi0_init.inc +--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1 +--let OPTION_LOCAL= +--let OPTION_WORD= IGNORE +--source load_data_part.inc +--source ../include/load_data_part_ddi0_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ignore_ddi1.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ignore_ddi1.test new file mode 100644 index 00000000000..b9f75894c60 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ignore_ddi1.test @@ -0,0 +1,8 @@ +--source ../include/load_data_part_ddi1_init.inc +--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1 +--let OPTION_LOCAL= +--let OPTION_WORD= IGNORE +--source load_data_part.inc +--source ../include/load_data_part_ddi1_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ddi0.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ddi0.test new file mode 100644 index 00000000000..f44f7ae936d --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ddi0.test @@ -0,0 +1,8 @@ +--source ../include/load_data_part_ddi0_init.inc +--let COMMAND_BEFORE_LOAD_DATA= TRUNCATE tbl_a +--let OPTION_LOCAL= LOCAL +--let OPTION_WORD= +--source load_data_part.inc +--source ../include/load_data_part_ddi0_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ddi1.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ddi1.test new file mode 100644 index 00000000000..4c806096ad1 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ddi1.test @@ -0,0 +1,8 @@ +--source ../include/load_data_part_ddi1_init.inc +--let COMMAND_BEFORE_LOAD_DATA= TRUNCATE tbl_a +--let OPTION_LOCAL= LOCAL +--let OPTION_WORD= +--source load_data_part.inc +--source ../include/load_data_part_ddi1_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ignore_ddi0.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ignore_ddi0.test new file mode 100644 index 00000000000..179bab5b4aa --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ignore_ddi0.test @@ -0,0 +1,8 @@ +--source ../include/load_data_part_ddi0_init.inc +--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1 +--let OPTION_LOCAL= LOCAL +--let OPTION_WORD= IGNORE +--source load_data_part.inc +--source ../include/load_data_part_ddi0_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ignore_ddi1.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ignore_ddi1.test new file mode 100644 index 00000000000..cd7d8215b7a --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ignore_ddi1.test @@ -0,0 +1,8 @@ +--source ../include/load_data_part_ddi1_init.inc +--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1 +--let OPTION_LOCAL= LOCAL +--let OPTION_WORD= IGNORE +--source load_data_part.inc +--source ../include/load_data_part_ddi1_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_replace_ddi0.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_replace_ddi0.test new file mode 100644 index 00000000000..5df3f420e09 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_replace_ddi0.test @@ -0,0 +1,8 @@ +--source ../include/load_data_part_ddi0_init.inc +--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1 +--let OPTION_LOCAL= LOCAL +--let OPTION_WORD= REPLACE +--source load_data_part.inc +--source ../include/load_data_part_ddi0_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_replace_ddi1.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_replace_ddi1.test new file mode 100644 index 00000000000..bf3c7c93be8 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_replace_ddi1.test @@ -0,0 +1,8 @@ +--source ../include/load_data_part_ddi1_init.inc +--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1 +--let OPTION_LOCAL= LOCAL +--let OPTION_WORD= REPLACE +--source load_data_part.inc +--source ../include/load_data_part_ddi1_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_replace_ddi0.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_replace_ddi0.test new file mode 100644 index 00000000000..910b7e813da --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_replace_ddi0.test @@ -0,0 +1,8 @@ +--source ../include/load_data_part_ddi0_init.inc +--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1 +--let OPTION_LOCAL= +--let OPTION_WORD= REPLACE +--source load_data_part.inc +--source ../include/load_data_part_ddi0_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_replace_ddi1.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_replace_ddi1.test new file mode 100644 index 00000000000..fc84bf14487 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_replace_ddi1.test @@ -0,0 +1,8 @@ +--source ../include/load_data_part_ddi1_init.inc +--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1 +--let OPTION_LOCAL= +--let OPTION_WORD= REPLACE +--source load_data_part.inc +--source ../include/load_data_part_ddi1_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/connect_child2_1.inc b/storage/spider/mysql-test/spider/t/connect_child2_1.inc index cd9b0c9ca9b..15e26031527 100644 --- a/storage/spider/mysql-test/spider/t/connect_child2_1.inc +++ b/storage/spider/mysql-test/spider/t/connect_child2_1.inc @@ -1 +1,2 @@ --connect (child2_1, localhost, root, , , $CHILD2_1_MYPORT, $CHILD2_1_MYSOCK) +--connect (child2_1_2, localhost, root, , , $CHILD2_1_MYPORT, $CHILD2_1_MYSOCK) diff --git a/storage/spider/mysql-test/spider/t/connect_child2_2.inc b/storage/spider/mysql-test/spider/t/connect_child2_2.inc index e145f66b630..75a50821ea7 100644 --- a/storage/spider/mysql-test/spider/t/connect_child2_2.inc +++ b/storage/spider/mysql-test/spider/t/connect_child2_2.inc @@ -1 +1,2 @@ --connect (child2_2, localhost, root, , , $CHILD2_2_MYPORT, $CHILD2_2_MYSOCK) +--connect (child2_2_2, localhost, root, , , $CHILD2_2_MYPORT, $CHILD2_2_MYSOCK) diff --git a/storage/spider/mysql-test/spider/t/test_deinit.inc b/storage/spider/mysql-test/spider/t/test_deinit.inc index 989bde26d3c..5a82b43ce0f 100644 --- a/storage/spider/mysql-test/spider/t/test_deinit.inc +++ b/storage/spider/mysql-test/spider/t/test_deinit.inc @@ -10,10 +10,12 @@ if ($USE_CHILD_GROUP2) --connection child2_1 --source ../include/deinit_child2_1.inc --disconnect child2_1 + --disconnect child2_1_2 --echo child2_2 --connection child2_2 --source ../include/deinit_child2_2.inc --disconnect child2_2 + --disconnect child2_2_2 --echo child2_3 --connection child2_3 --source ../include/deinit_child2_3.inc diff --git a/storage/spider/scripts/install_spider.sql b/storage/spider/scripts/install_spider.sql index f52c78e496d..403bd99fd68 100644 --- a/storage/spider/scripts/install_spider.sql +++ b/storage/spider/scripts/install_spider.sql @@ -1,4 +1,4 @@ -# Copyright (C) 2010-2018 Kentoku Shiba +# Copyright (C) 2010-2019 Kentoku Shiba # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,482 +13,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA -# This SQL script creates system tables for SPIDER -# or fixes incompatibilities if ones already exist. - --- Create system tables if not exist -create table if not exists mysql.spider_xa( - format_id int not null default 0, - gtrid_length int not null default 0, - bqual_length int not null default 0, - data char(128) charset binary not null default '', - status char(8) not null default '', - primary key (data, format_id, gtrid_length), - key idx1 (status) -) engine=MyISAM default charset=utf8 collate=utf8_bin; -create table if not exists mysql.spider_xa_member( - format_id int not null default 0, - gtrid_length int not null default 0, - bqual_length int not null default 0, - data char(128) charset binary not null default '', - scheme char(64) not null default '', - host char(64) not null default '', - port char(5) not null default '', - socket text not null, - username char(64) not null default '', - password char(64) not null default '', - ssl_ca text, - ssl_capath text, - ssl_cert text, - ssl_cipher char(64) default null, - ssl_key text, - ssl_verify_server_cert tinyint not null default 0, - default_file text, - default_group char(64) default null, - key idx1 (data, format_id, gtrid_length, host) -) engine=MyISAM default charset=utf8 collate=utf8_bin; -create table if not exists mysql.spider_xa_failed_log( - format_id int not null default 0, - gtrid_length int not null default 0, - bqual_length int not null default 0, - data char(128) charset binary not null default '', - scheme char(64) not null default '', - host char(64) not null default '', - port char(5) not null default '', - socket text not null, - username char(64) not null default '', - password char(64) not null default '', - ssl_ca text, - ssl_capath text, - ssl_cert text, - ssl_cipher char(64) default null, - ssl_key text, - ssl_verify_server_cert tinyint not null default 0, - default_file text, - default_group char(64) default null, - thread_id int default null, - status char(8) not null default '', - failed_time timestamp not null default current_timestamp, - key idx1 (data, format_id, gtrid_length, host) -) engine=MyISAM default charset=utf8 collate=utf8_bin; -create table if not exists mysql.spider_tables( - db_name char(64) not null default '', - table_name char(199) not null default '', - link_id int not null default 0, - priority bigint not null default 0, - server char(64) default null, - scheme char(64) default null, - host char(64) default null, - port char(5) default null, - socket text, - username char(64) default null, - password char(64) default null, - ssl_ca text, - ssl_capath text, - ssl_cert text, - ssl_cipher char(64) default null, - ssl_key text, - ssl_verify_server_cert tinyint not null default 0, - monitoring_binlog_pos_at_failing tinyint not null default 0, - default_file text, - default_group char(64) default null, - tgt_db_name char(64) default null, - tgt_table_name char(64) default null, - link_status tinyint not null default 1, - block_status tinyint not null default 0, - static_link_id char(64) default null, - primary key (db_name, table_name, link_id), - key idx1 (priority), - unique key uidx1 (db_name, table_name, static_link_id) -) engine=MyISAM default charset=utf8 collate=utf8_bin; -create table if not exists mysql.spider_link_mon_servers( - db_name char(64) not null default '', - table_name char(199) not null default '', - link_id char(64) not null default '', - sid int unsigned not null default 0, - server char(64) default null, - scheme char(64) default null, - host char(64) default null, - port char(5) default null, - socket text, - username char(64) default null, - password char(64) default null, - ssl_ca text, - ssl_capath text, - ssl_cert text, - ssl_cipher char(64) default null, - ssl_key text, - ssl_verify_server_cert tinyint not null default 0, - default_file text, - default_group char(64) default null, - primary key (db_name, table_name, link_id, sid) -) engine=MyISAM default charset=utf8 collate=utf8_bin; -create table if not exists mysql.spider_link_failed_log( - db_name char(64) not null default '', - table_name char(199) not null default '', - link_id char(64) not null default '', - failed_time timestamp not null default current_timestamp -) engine=MyISAM default charset=utf8 collate=utf8_bin; -create table if not exists mysql.spider_table_position_for_recovery( - db_name char(64) not null default '', - table_name char(199) not null default '', - failed_link_id int not null default 0, - source_link_id int not null default 0, - file text, - position text, - gtid text, - primary key (db_name, table_name, failed_link_id, source_link_id) -) engine=MyISAM default charset=utf8 collate=utf8_bin; -create table if not exists mysql.spider_table_sts( - db_name char(64) not null default '', - table_name char(199) not null default '', - data_file_length bigint unsigned not null default 0, - max_data_file_length bigint unsigned not null default 0, - index_file_length bigint unsigned not null default 0, - records bigint unsigned not null default 0, - mean_rec_length bigint unsigned not null default 0, - check_time datetime not null default '0000-00-00 00:00:00', - create_time datetime not null default '0000-00-00 00:00:00', - update_time datetime not null default '0000-00-00 00:00:00', - primary key (db_name, table_name) -) engine=MyISAM default charset=utf8 collate=utf8_bin; -create table if not exists mysql.spider_table_crd( - db_name char(64) not null default '', - table_name char(199) not null default '', - key_seq int unsigned not null default 0, - cardinality bigint not null default 0, - primary key (db_name, table_name, key_seq) -) engine=MyISAM default charset=utf8 collate=utf8_bin; - --- If tables already exist and their definition differ from the latest ones, --- we fix them here. -drop procedure if exists mysql.spider_fix_one_table; -drop procedure if exists mysql.spider_fix_system_tables; -delimiter // -create procedure mysql.spider_fix_one_table - (tab_name char(255) charset utf8 collate utf8_bin, - test_col_name char(255) charset utf8 collate utf8_bin, - _sql text charset utf8 collate utf8_bin) -begin - set @col_exists := 0; - select 1 into @col_exists from INFORMATION_SCHEMA.COLUMNS - where TABLE_SCHEMA = 'mysql' - AND TABLE_NAME = tab_name - AND COLUMN_NAME = test_col_name; - if @col_exists = 0 then - select @stmt := _sql; - prepare sp_stmt1 from @stmt; - execute sp_stmt1; - end if; -end;// - -create procedure mysql.spider_fix_system_tables() -begin - select substring_index(substring_index(version(), '-', 2), '-', -1) - into @server_name; - select substring_index(version(), '.', 1) - into @server_major_version; - select substring_index(substring_index(version(), '.', 2), '.', -1) - into @server_minor_version; - - -- Fix for 0.5 - call mysql.spider_fix_one_table('spider_tables', 'server', - 'alter table mysql.spider_tables - add server char(64) default null, - add scheme char(64) default null, - add host char(64) default null, - add port char(5) default null, - add socket char(64) default null, - add username char(64) default null, - add password char(64) default null, - add tgt_db_name char(64) default null, - add tgt_table_name char(64) default null'); - - -- Fix for version 0.17 - select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS - where TABLE_SCHEMA = 'mysql' - AND TABLE_NAME = 'spider_xa' - AND COLUMN_NAME = 'data'; - if @col_type != 'binary(128)' then - alter table mysql.spider_xa modify data binary(128) not null default ''; - end if; - select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS - where TABLE_SCHEMA = 'mysql' - AND TABLE_NAME = 'spider_xa_member' - AND COLUMN_NAME = 'data'; - if @col_type != 'binary(128)' then - alter table mysql.spider_xa_member modify data binary(128) not null default ''; - end if; - - -- Fix for version 2.7 - call mysql.spider_fix_one_table('spider_tables', 'link_id', - 'alter table mysql.spider_tables - add column link_id int not null default 0 after table_name, - drop primary key, - add primary key (db_name, table_name, link_id)'); - - -- Fix for version 2.8 - call mysql.spider_fix_one_table('spider_tables', 'link_status', - 'alter table mysql.spider_tables - add column link_status tinyint not null default 1'); - - -- Fix for version 2.10 - call mysql.spider_fix_one_table('spider_xa_member', 'ssl_ca', - 'alter table mysql.spider_xa_member - add column ssl_ca char(64) default null after password, - add column ssl_capath char(64) default null after ssl_ca, - add column ssl_cert char(64) default null after ssl_capath, - add column ssl_cipher char(64) default null after ssl_cert, - add column ssl_key char(64) default null after ssl_cipher, - add column ssl_verify_server_cert tinyint not null default 0 after ssl_key, - add column default_file char(64) default null after ssl_verify_server_cert, - add column default_group char(64) default null after default_file'); - call mysql.spider_fix_one_table('spider_tables', 'ssl_ca', - 'alter table mysql.spider_tables - add column ssl_ca char(64) default null after password, - add column ssl_capath char(64) default null after ssl_ca, - add column ssl_cert char(64) default null after ssl_capath, - add column ssl_cipher char(64) default null after ssl_cert, - add column ssl_key char(64) default null after ssl_cipher, - add column ssl_verify_server_cert tinyint not null default 0 after ssl_key, - add column default_file char(64) default null after ssl_verify_server_cert, - add column default_group char(64) default null after default_file'); - call mysql.spider_fix_one_table('spider_link_mon_servers', 'ssl_ca', - 'alter table mysql.spider_link_mon_servers - add column ssl_ca char(64) default null after password, - add column ssl_capath char(64) default null after ssl_ca, - add column ssl_cert char(64) default null after ssl_capath, - add column ssl_cipher char(64) default null after ssl_cert, - add column ssl_key char(64) default null after ssl_cipher, - add column ssl_verify_server_cert tinyint not null default 0 after ssl_key, - add column default_file char(64) default null after ssl_verify_server_cert, - add column default_group char(64) default null after default_file'); - - -- Fix for version 2.25 - -- select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS - -- where TABLE_SCHEMA = 'mysql' - -- AND TABLE_NAME = 'spider_link_mon_servers' - -- AND COLUMN_NAME = 'link_id'; - -- if @col_type != 'char(5)' then - -- alter table mysql.spider_link_mon_servers - -- modify link_id char(5) not null default ''; - -- end if; - - -- Fix for version 2.28 - select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS - where TABLE_SCHEMA = 'mysql' - AND TABLE_NAME = 'spider_link_mon_servers' - AND COLUMN_NAME = 'sid'; - if @col_type != 'int(10) unsigned' then - alter table mysql.spider_link_mon_servers - modify sid int unsigned not null default 0; - end if; - - -- Fix for version 3.1 - select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS - where TABLE_SCHEMA = 'mysql' - AND TABLE_NAME = 'spider_xa_member' - AND COLUMN_NAME = 'socket'; - if @col_type = 'char(64)' then - alter table mysql.spider_xa_member - drop primary key, - add index idx1 (data, format_id, gtrid_length, host), - modify socket text not null, - modify ssl_ca text, - modify ssl_capath text, - modify ssl_cert text, - modify ssl_key text, - modify default_file text; - end if; - select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS - where TABLE_SCHEMA = 'mysql' - AND TABLE_NAME = 'spider_tables' - AND COLUMN_NAME = 'socket'; - if @col_type = 'char(64)' then - alter table mysql.spider_tables - modify socket text, - modify ssl_ca text, - modify ssl_capath text, - modify ssl_cert text, - modify ssl_key text, - modify default_file text; - end if; - select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS - where TABLE_SCHEMA = 'mysql' - AND TABLE_NAME = 'spider_link_mon_servers' - AND COLUMN_NAME = 'socket'; - if @col_type = 'char(64)' then - alter table mysql.spider_link_mon_servers - modify socket text, - modify ssl_ca text, - modify ssl_capath text, - modify ssl_cert text, - modify ssl_key text, - modify default_file text; - end if; - - -- Fix for version 3.3.0 - call mysql.spider_fix_one_table('spider_tables', - 'monitoring_binlog_pos_at_failing', - 'alter table mysql.spider_tables - add monitoring_binlog_pos_at_failing tinyint not null default 0 after ssl_verify_server_cert'); - - -- Fix for version 3.3.6 - call mysql.spider_fix_one_table('spider_tables', 'block_status', - 'alter table mysql.spider_tables - add column block_status tinyint not null default 0 after link_status'); - call mysql.spider_fix_one_table('spider_tables', 'static_link_id', - 'alter table mysql.spider_tables - add column static_link_id char(64) default null after block_status, - add unique index uidx1 (db_name, table_name, static_link_id)'); - select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS - where TABLE_SCHEMA = 'mysql' - AND TABLE_NAME = 'spider_link_mon_servers' - AND COLUMN_NAME = 'link_id'; - if @col_type != 'char(64)' then - alter table mysql.spider_link_mon_servers - modify link_id char(64) not null default ''; - end if; - select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS - where TABLE_SCHEMA = 'mysql' - AND TABLE_NAME = 'spider_link_failed_log' - AND COLUMN_NAME = 'link_id'; - if @col_type != 'char(64)' then - alter table mysql.spider_link_failed_log - modify link_id char(64) not null default ''; - end if; - - -- Fix for version 3.3.10 - select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS - where TABLE_SCHEMA = 'mysql' - AND TABLE_NAME = 'spider_tables' - AND COLUMN_NAME = 'table_name'; - if @col_type != 'char(199)' then - alter table mysql.spider_tables - modify table_name char(199) not null default ''; - end if; - select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS - where TABLE_SCHEMA = 'mysql' - AND TABLE_NAME = 'spider_link_mon_servers' - AND COLUMN_NAME = 'table_name'; - if @col_type != 'char(199)' then - alter table mysql.spider_link_mon_servers - modify table_name char(199) not null default ''; - end if; - select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS - where TABLE_SCHEMA = 'mysql' - AND TABLE_NAME = 'spider_link_failed_log' - AND COLUMN_NAME = 'table_name'; - if @col_type != 'char(199)' then - alter table mysql.spider_link_failed_log - modify table_name char(199) not null default ''; - end if; - select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS - where TABLE_SCHEMA = 'mysql' - AND TABLE_NAME = 'spider_table_position_for_recovery' - AND COLUMN_NAME = 'table_name'; - if @col_type != 'char(199)' then - alter table mysql.spider_table_position_for_recovery - modify table_name char(199) not null default ''; - end if; - select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS - where TABLE_SCHEMA = 'mysql' - AND TABLE_NAME = 'spider_table_sts' - AND COLUMN_NAME = 'table_name'; - if @col_type != 'char(199)' then - alter table mysql.spider_table_sts - modify table_name char(199) not null default ''; - end if; - select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS - where TABLE_SCHEMA = 'mysql' - AND TABLE_NAME = 'spider_table_crd' - AND COLUMN_NAME = 'table_name'; - if @col_type != 'char(199)' then - alter table mysql.spider_table_crd - modify table_name char(199) not null default ''; - end if; - - -- Fix for MariaDB 10.4: Crash-Safe system tables - if @server_name = 'MariaDB' and - ( - @server_major_version > 10 or - ( - @server_major_version = 10 and - @server_minor_version >= 4 - ) - ) - then - select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES - where TABLE_SCHEMA = 'mysql' - AND TABLE_NAME = 'spider_link_failed_log'; - if @engine_name != 'Aria' then - alter table mysql.spider_link_failed_log - engine=Aria transactional=1; - end if; - select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES - where TABLE_SCHEMA = 'mysql' - AND TABLE_NAME = 'spider_link_mon_servers'; - if @engine_name != 'Aria' then - alter table mysql.spider_link_mon_servers - engine=Aria transactional=1; - end if; - select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES - where TABLE_SCHEMA = 'mysql' - AND TABLE_NAME = 'spider_table_crd'; - if @engine_name != 'Aria' then - alter table mysql.spider_table_crd - engine=Aria transactional=1; - end if; - select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES - where TABLE_SCHEMA = 'mysql' - AND TABLE_NAME = 'spider_table_position_for_recovery'; - if @engine_name != 'Aria' then - alter table mysql.spider_table_position_for_recovery - engine=Aria transactional=1; - end if; - select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES - where TABLE_SCHEMA = 'mysql' - AND TABLE_NAME = 'spider_table_sts'; - if @engine_name != 'Aria' then - alter table mysql.spider_table_sts - engine=Aria transactional=1; - end if; - select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES - where TABLE_SCHEMA = 'mysql' - AND TABLE_NAME = 'spider_tables'; - if @engine_name != 'Aria' then - alter table mysql.spider_tables - engine=Aria transactional=1; - end if; - select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES - where TABLE_SCHEMA = 'mysql' - AND TABLE_NAME = 'spider_xa'; - if @engine_name != 'Aria' then - alter table mysql.spider_xa - engine=Aria transactional=1; - end if; - select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES - where TABLE_SCHEMA = 'mysql' - AND TABLE_NAME = 'spider_xa_failed_log'; - if @engine_name != 'Aria' then - alter table mysql.spider_xa_failed_log - engine=Aria transactional=1; - end if; - select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES - where TABLE_SCHEMA = 'mysql' - AND TABLE_NAME = 'spider_xa_member'; - if @engine_name != 'Aria' then - alter table mysql.spider_xa_member - engine=Aria transactional=1; - end if; - end if; -end;// -delimiter ; -call mysql.spider_fix_system_tables; -drop procedure mysql.spider_fix_one_table; -drop procedure mysql.spider_fix_system_tables; - --- Install a plugin and UDFs drop procedure if exists mysql.spider_plugin_installer; delimiter // create procedure mysql.spider_plugin_installer() @@ -512,71 +36,6 @@ begin install plugin spider soname 'ha_spider.dll'; end if; end if; - set @have_spider_i_s_alloc_mem_plugin := 0; - select @have_spider_i_s_alloc_mem_plugin := 1 from INFORMATION_SCHEMA.plugins where PLUGIN_NAME = 'SPIDER_ALLOC_MEM'; - set @have_spider_alloc_mem_plugin := 0; - select @have_spider_alloc_mem_plugin := 1 from mysql.plugin where name = 'spider_alloc_mem'; - if @have_spider_i_s_alloc_mem_plugin = 0 then - if @have_spider_alloc_mem_plugin = 1 then - -- spider_alloc_mem plugin is present in mysql.plugin but not in - -- information_schema.plugins. Remove spider_alloc_mem plugin entry - -- in mysql.plugin first. - delete from mysql.plugin where name = 'spider_alloc_mem'; - end if; - -- Install spider_alloc_mem plugin - if @win_plugin = 0 then - install plugin spider_alloc_mem soname 'ha_spider.so'; - else - install plugin spider_alloc_mem soname 'ha_spider.dll'; - end if; - end if; - set @have_spider_direct_sql_udf := 0; - select @have_spider_direct_sql_udf := 1 from mysql.func where name = 'spider_direct_sql'; - if @have_spider_direct_sql_udf = 0 then - if @win_plugin = 0 then - create function spider_direct_sql returns int soname 'ha_spider.so'; - else - create function spider_direct_sql returns int soname 'ha_spider.dll'; - end if; - end if; - set @have_spider_bg_direct_sql_udf := 0; - select @have_spider_bg_direct_sql_udf := 1 from mysql.func where name = 'spider_bg_direct_sql'; - if @have_spider_bg_direct_sql_udf = 0 then - if @win_plugin = 0 then - create aggregate function spider_bg_direct_sql returns int soname 'ha_spider.so'; - else - create aggregate function spider_bg_direct_sql returns int soname 'ha_spider.dll'; - end if; - end if; - set @have_spider_ping_table_udf := 0; - select @have_spider_ping_table_udf := 1 from mysql.func where name = 'spider_ping_table'; - if @have_spider_ping_table_udf = 0 then - if @win_plugin = 0 then - create function spider_ping_table returns int soname 'ha_spider.so'; - else - create function spider_ping_table returns int soname 'ha_spider.dll'; - end if; - end if; - set @have_spider_copy_tables_udf := 0; - select @have_spider_copy_tables_udf := 1 from mysql.func where name = 'spider_copy_tables'; - if @have_spider_copy_tables_udf = 0 then - if @win_plugin = 0 then - create function spider_copy_tables returns int soname 'ha_spider.so'; - else - create function spider_copy_tables returns int soname 'ha_spider.dll'; - end if; - end if; - - set @have_spider_flush_table_mon_cache_udf := 0; - select @have_spider_flush_table_mon_cache_udf := 1 from mysql.func where name = 'spider_flush_table_mon_cache'; - if @have_spider_flush_table_mon_cache_udf = 0 then - if @win_plugin = 0 then - create function spider_flush_table_mon_cache returns int soname 'ha_spider.so'; - else - create function spider_flush_table_mon_cache returns int soname 'ha_spider.dll'; - end if; - end if; - end;// delimiter ; call mysql.spider_plugin_installer; diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc index e7e48b40add..1e973493ba8 100644 --- a/storage/spider/spd_conn.cc +++ b/storage/spider/spd_conn.cc @@ -1,4 +1,5 @@ -/* Copyright (C) 2008-2018 Kentoku Shiba +/* Copyright (C) 2008-2019 Kentoku Shiba + Copyright (C) 2019, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -91,6 +92,9 @@ extern PSI_thread_key spd_key_thd_bg_mon; /* UTC time zone for timestamp columns */ extern Time_zone *UTC; +extern sql_mode_t full_sql_mode; +extern sql_mode_t pushdown_sql_mode; + HASH spider_open_connections; uint spider_open_connections_id; HASH spider_ipport_conns; @@ -148,6 +152,8 @@ int spider_reset_conn_setted_parameter( DBUG_ENTER("spider_reset_conn_setted_parameter"); conn->autocommit = spider_param_remote_autocommit(); conn->sql_log_off = spider_param_remote_sql_log_off(); + conn->wait_timeout = spider_param_remote_wait_timeout(thd); + conn->sql_mode = full_sql_mode + 1; if (thd && spider_param_remote_time_zone()) { int tz_length = strlen(spider_param_remote_time_zone()); @@ -1428,6 +1434,32 @@ void spider_conn_queue_sql_log_off( DBUG_VOID_RETURN; } +void spider_conn_queue_wait_timeout( + SPIDER_CONN *conn, + int wait_timeout +) { + DBUG_ENTER("spider_conn_queue_wait_timeout"); + DBUG_PRINT("info", ("spider conn=%p", conn)); + if (wait_timeout > 0) + { + conn->queued_wait_timeout = TRUE; + conn->queued_wait_timeout_val = wait_timeout; + } + DBUG_VOID_RETURN; +} + +void spider_conn_queue_sql_mode( + SPIDER_CONN *conn, + sql_mode_t sql_mode +) { + DBUG_ENTER("spider_conn_queue_sql_mode"); + DBUG_PRINT("info", ("spider conn=%p", conn)); + DBUG_ASSERT(!(sql_mode & ~full_sql_mode)); + conn->queued_sql_mode = TRUE; + conn->queued_sql_mode_val = (sql_mode & pushdown_sql_mode); + DBUG_VOID_RETURN; +} + void spider_conn_queue_time_zone( SPIDER_CONN *conn, Time_zone *time_zone @@ -1483,6 +1515,8 @@ void spider_conn_clear_queue( conn->queued_semi_trx_isolation = FALSE; conn->queued_autocommit = FALSE; conn->queued_sql_log_off = FALSE; + conn->queued_wait_timeout = FALSE; + conn->queued_sql_mode = FALSE; conn->queued_time_zone = FALSE; conn->queued_trx_start = FALSE; conn->queued_xa_start = FALSE; @@ -2824,23 +2858,20 @@ void *spider_bg_conn_action( { switch (conn->bg_simple_action) { - case SPIDER_BG_SIMPLE_CONNECT: + case SPIDER_SIMPLE_CONNECT: conn->db_conn->bg_connect(); break; - case SPIDER_BG_SIMPLE_DISCONNECT: + case SPIDER_SIMPLE_DISCONNECT: conn->db_conn->bg_disconnect(); break; - case SPIDER_BG_SIMPLE_RECORDS: - DBUG_PRINT("info",("spider bg simple records")); + default: spider = (ha_spider*) conn->bg_target; *conn->bg_error_num = - spider->dbton_handler[conn->dbton_id]-> - show_records(conn->link_idx); - break; - default: + spider_db_simple_action(conn->bg_simple_action, + spider->dbton_handler[conn->dbton_id], conn->link_idx); break; } - conn->bg_simple_action = SPIDER_BG_SIMPLE_NO_ACTION; + conn->bg_simple_action = SPIDER_SIMPLE_NO_ACTION; if (conn->bg_caller_wait) { pthread_mutex_lock(&conn->bg_conn_sync_mutex); @@ -4556,17 +4587,18 @@ SPIDER_IP_PORT_CONN* spider_create_ipport_conn(SPIDER_CONN *conn) goto err_malloc_key; } - ret->key = (char *) my_malloc(ret->key_len, MY_ZEROFILL | MY_WME); + ret->key = (char *) my_malloc(ret->key_len + conn->tgt_host_length + 1, + MY_ZEROFILL | MY_WME); if (!ret->key) { pthread_cond_destroy(&ret->cond); pthread_mutex_destroy(&ret->mutex); goto err_malloc_key; } + ret->remote_ip_str = ret->key + ret->key_len; memcpy(ret->key, conn->conn_key, ret->key_len); - strncpy(ret->remote_ip_str, conn->tgt_host, sizeof(ret->remote_ip_str)); - ret->remote_ip_str[sizeof ret->remote_ip_str - 1] = '\0'; + memcpy(ret->remote_ip_str, conn->tgt_host, conn->tgt_host_length); ret->remote_port = conn->tgt_port; ret->conn_id = conn->conn_id; ret->ip_port_count = 1; // init diff --git a/storage/spider/spd_conn.h b/storage/spider/spd_conn.h index a066da6a5ea..1612593a1cb 100644 --- a/storage/spider/spd_conn.h +++ b/storage/spider/spd_conn.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2008-2018 Kentoku Shiba +/* Copyright (C) 2008-2019 Kentoku Shiba + Copyright (C) 2019 MariaDB corp This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,10 +18,13 @@ #define SPIDER_LOCK_MODE_SHARED 1 #define SPIDER_LOCK_MODE_EXCLUSIVE 2 -#define SPIDER_BG_SIMPLE_NO_ACTION 0 -#define SPIDER_BG_SIMPLE_CONNECT 1 -#define SPIDER_BG_SIMPLE_DISCONNECT 2 -#define SPIDER_BG_SIMPLE_RECORDS 3 +#define SPIDER_SIMPLE_NO_ACTION 0 +#define SPIDER_SIMPLE_CONNECT 1 +#define SPIDER_SIMPLE_DISCONNECT 2 +#define SPIDER_SIMPLE_RECORDS 3 +#ifdef HA_HAS_CHECKSUM_EXTENDED +#define SPIDER_SIMPLE_CHECKSUM_TABLE 4 +#endif uchar *spider_conn_get_key( SPIDER_CONN *conn, @@ -132,6 +136,16 @@ void spider_conn_queue_sql_log_off( bool sql_log_off ); +void spider_conn_queue_wait_timeout( + SPIDER_CONN *conn, + int wait_timeout +); + +void spider_conn_queue_sql_mode( + SPIDER_CONN *conn, + sql_mode_t sql_mode +); + void spider_conn_queue_time_zone( SPIDER_CONN *conn, Time_zone *time_zone diff --git a/storage/spider/spd_copy_tables.cc b/storage/spider/spd_copy_tables.cc index 13c53220b16..319b02462b1 100644 --- a/storage/spider/spd_copy_tables.cc +++ b/storage/spider/spd_copy_tables.cc @@ -216,7 +216,7 @@ int spider_udf_parse_copy_tables_param( ) { int error_num = 0; char *param_string = NULL; - char *sprit_ptr[2]; + char *sprit_ptr; char *tmp_ptr, *tmp_ptr2, *start_ptr; int title_length; SPIDER_PARAM_STRING_PARSE param_string_parse; @@ -243,23 +243,17 @@ int spider_udf_parse_copy_tables_param( } DBUG_PRINT("info",("spider param_string=%s", param_string)); - sprit_ptr[0] = param_string; + sprit_ptr = param_string; param_string_parse.init(param_string, ER_SPIDER_INVALID_UDF_PARAM_NUM); - while (sprit_ptr[0]) + while (sprit_ptr) { - if ((sprit_ptr[1] = strchr(sprit_ptr[0], ','))) - { - *sprit_ptr[1] = '\0'; - sprit_ptr[1]++; - } - tmp_ptr = sprit_ptr[0]; - sprit_ptr[0] = sprit_ptr[1]; + tmp_ptr = sprit_ptr; while (*tmp_ptr == ' ' || *tmp_ptr == '\r' || *tmp_ptr == '\n' || *tmp_ptr == '\t') tmp_ptr++; if (*tmp_ptr == '\0') - continue; + break; title_length = 0; start_ptr = tmp_ptr; @@ -272,6 +266,11 @@ int spider_udf_parse_copy_tables_param( start_ptr++; } param_string_parse.set_param_title(tmp_ptr, tmp_ptr + title_length); + if ((error_num = param_string_parse.get_next_parameter_head( + start_ptr, &sprit_ptr))) + { + goto error; + } switch (title_length) { diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc index 424f22d46ee..264f85d74cb 100644 --- a/storage/spider/spd_db_conn.cc +++ b/storage/spider/spd_db_conn.cc @@ -1,4 +1,5 @@ -/* Copyright (C) 2008-2018 Kentoku Shiba +/* Copyright (C) 2008-2019 Kentoku Shiba + Copyright (C) 2019, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -361,6 +362,20 @@ int spider_db_conn_queue_action( append_sql_log_off(&sql_str, conn->queued_sql_log_off_val)) ) || ( + conn->queued_wait_timeout && + conn->queued_wait_timeout_val != conn->wait_timeout && + conn->db_conn->set_wait_timeout_in_bulk_sql() && + (error_num = spider_dbton[conn->dbton_id].db_util-> + append_wait_timeout(&sql_str, conn->queued_wait_timeout_val)) + ) || + ( + conn->queued_sql_mode && + conn->queued_sql_mode_val != conn->sql_mode && + conn->db_conn->set_sql_mode_in_bulk_sql() && + (error_num = spider_dbton[conn->dbton_id].db_util-> + append_sql_mode(&sql_str, conn->queued_sql_mode_val)) + ) || + ( conn->queued_time_zone && conn->queued_time_zone_val != conn->time_zone && conn->db_conn->set_time_zone_in_bulk_sql() && @@ -433,6 +448,24 @@ int spider_db_conn_queue_action( DBUG_RETURN(error_num); } if ( + conn->queued_wait_timeout && + conn->queued_wait_timeout_val != conn->wait_timeout && + !conn->db_conn->set_wait_timeout_in_bulk_sql() && + (error_num = spider_dbton[conn->dbton_id].db_util-> + append_wait_timeout(&sql_str, conn->queued_wait_timeout_val)) + ) { + DBUG_RETURN(error_num); + } + if ( + conn->queued_sql_mode && + conn->queued_sql_mode_val != conn->sql_mode && + !conn->db_conn->set_sql_mode_in_bulk_sql() && + (error_num = spider_dbton[conn->dbton_id].db_util-> + append_sql_mode(&sql_str, conn->queued_sql_mode_val)) + ) { + DBUG_RETURN(error_num); + } + if ( conn->queued_time_zone && conn->queued_time_zone_val != conn->time_zone && !conn->db_conn->set_time_zone_in_bulk_sql() && @@ -499,6 +532,20 @@ int spider_db_conn_queue_action( conn->trx_isolation)); } + if ( + conn->queued_wait_timeout && + conn->queued_wait_timeout_val != conn->wait_timeout + ) { + conn->wait_timeout = conn->queued_wait_timeout_val; + } + + if ( + conn->queued_sql_mode && + conn->queued_sql_mode_val != conn->sql_mode + ) { + conn->sql_mode = conn->queued_sql_mode_val; + } + if (conn->queued_autocommit) { if (conn->queued_autocommit_val && conn->autocommit != 1) @@ -1353,7 +1400,7 @@ int spider_db_append_name_with_quote_str( ) { DBUG_ENTER("spider_db_append_name_with_quote_str"); DBUG_RETURN(spider_db_append_name_with_quote_str_internal( - str, name, strlen(name), dbton_id)); + str, name, strlen(name), system_charset_info, dbton_id)); } int spider_db_append_name_with_quote_str( @@ -1363,7 +1410,7 @@ int spider_db_append_name_with_quote_str( ) { DBUG_ENTER("spider_db_append_name_with_quote_str"); DBUG_RETURN(spider_db_append_name_with_quote_str_internal( - str, name.str, name.length, dbton_id)); + str, name.str, name.length, system_charset_info, dbton_id)); } int spider_db_append_name_with_quote_str_internal( @@ -1372,6 +1419,18 @@ int spider_db_append_name_with_quote_str_internal( int length, uint dbton_id ) { + DBUG_ENTER("spider_db_append_name_with_quote_str_internal"); + DBUG_RETURN(spider_db_append_name_with_quote_str_internal( + str, name, length, system_charset_info, dbton_id)); +} + +int spider_db_append_name_with_quote_str_internal( + spider_string *str, + const char *name, + int length, + CHARSET_INFO *cs, + uint dbton_id +) { int error_num; const char *name_end; char head_code; @@ -1380,9 +1439,9 @@ int spider_db_append_name_with_quote_str_internal( { head_code = *name; #ifdef SPIDER_HAS_MY_CHARLEN - if ((length = my_charlen(system_charset_info, name, name_end)) < 1) + if ((length = my_charlen(cs, name, name_end)) < 1) #else - if (!(length = my_mbcharlen(system_charset_info, (uchar) head_code))) + if (!(length = my_mbcharlen(cs, (uchar) head_code))) #endif { my_message(ER_SPIDER_WRONG_CHARACTER_IN_NAME_NUM, @@ -1399,7 +1458,7 @@ int spider_db_append_name_with_quote_str_internal( DBUG_RETURN(error_num); } } else { - if (str->append(name, length, system_charset_info)) + if (str->append(name, length, cs)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); } } @@ -1619,6 +1678,7 @@ int spider_db_append_key_where_internal( int key_count; uint length; uint store_length; + uint current_pos = str->length(); const uchar *ptr, *another_ptr; const key_range *use_key, *another_key; KEY_PART_INFO *key_part; @@ -1762,6 +1822,7 @@ int spider_db_append_key_where_internal( key_part++, key_count++ ) { + DBUG_PRINT("info", ("spider tgt_key_part_map=%lu", tgt_key_part_map)); store_length = key_part->store_length; field = key_part->field; key_name_length = dbton_share->get_column_name_length(field->field_index); @@ -1787,7 +1848,6 @@ int spider_db_append_key_where_internal( #endif } } else { - DBUG_PRINT("info", ("spider tgt_key_part_map=%lu", tgt_key_part_map)); if (tgt_key_part_map > 1) key_eq = TRUE; else @@ -1797,7 +1857,8 @@ int spider_db_append_key_where_internal( (key_eq && use_key == start_key) || (!key_eq && start_key_part_map) ) { - bool tgt_final = (use_key == start_key && tgt_key_part_map == 1); + bool tgt_final = (use_key == start_key && + (tgt_key_part_map == 1 || !end_key_part_map)); ptr = start_key->key + length; if ( (error_num = dbton_hdl->append_is_null_part(sql_type, key_part, @@ -1843,10 +1904,23 @@ int spider_db_append_key_where_internal( if (use_key == start_key) { +#ifdef SPIDER_HANDLER_SUPPORT_MULTIPLE_KEY_PARTS if (spider_dbton[dbton_id].db_util-> append_column_value(spider, str_part, field, ptr, share->access_charset)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); +#else + if (str_part->length() == SPIDER_SQL_OPEN_PAREN_LEN) + { + if (str->reserve(SPIDER_SQL_EQUAL_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN); + if (spider_dbton[dbton_id].db_util-> + append_column_value(spider, str_part, field, ptr, + share->access_charset)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } +#endif } } #if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET) @@ -1894,7 +1968,8 @@ int spider_db_append_key_where_internal( if (use_key == start_key) { - if (tgt_key_part_map == 1) +#ifdef SPIDER_HANDLER_SUPPORT_MULTIPLE_KEY_PARTS + if (tgt_key_part_map == 1 || !end_key_part_map) { if (str->reserve(SPIDER_SQL_EQUAL_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -1904,6 +1979,18 @@ int spider_db_append_key_where_internal( append_column_value(spider, str_part, field, ptr, share->access_charset)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); +#else + if (str_part->length() == SPIDER_SQL_OPEN_PAREN_LEN) + { + if (str->reserve(SPIDER_SQL_EQUAL_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN); + if (spider_dbton[dbton_id].db_util-> + append_column_value(spider, str_part, field, ptr, + share->access_charset)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } +#endif } } #if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET) @@ -1953,7 +2040,8 @@ int spider_db_append_key_where_internal( if (use_key == start_key) { - if (tgt_key_part_map == 1) +#ifdef SPIDER_HANDLER_SUPPORT_MULTIPLE_KEY_PARTS + if (tgt_key_part_map == 1 || !end_key_part_map) { if (str->reserve(SPIDER_SQL_GT_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -1963,6 +2051,18 @@ int spider_db_append_key_where_internal( append_column_value(spider, str_part, field, ptr, share->access_charset)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); +#else + if (str_part->length() == SPIDER_SQL_OPEN_PAREN_LEN) + { + if (str->reserve(SPIDER_SQL_GT_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + str->q_append(SPIDER_SQL_GT_STR, SPIDER_SQL_GT_LEN); + if (spider_dbton[dbton_id].db_util-> + append_column_value(spider, str_part, field, ptr, + share->access_charset)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } +#endif } } #if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET) @@ -2013,7 +2113,8 @@ int spider_db_append_key_where_internal( if (use_key == start_key) { - if (tgt_key_part_map == 1) +#ifdef SPIDER_HANDLER_SUPPORT_MULTIPLE_KEY_PARTS + if (tgt_key_part_map == 1 || !end_key_part_map) { if (str->reserve(SPIDER_SQL_LT_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -2023,6 +2124,18 @@ int spider_db_append_key_where_internal( append_column_value(spider, str_part, field, ptr, share->access_charset)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); +#else + if (str_part->length() == SPIDER_SQL_OPEN_PAREN_LEN) + { + if (str->reserve(SPIDER_SQL_LT_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + str->q_append(SPIDER_SQL_LT_STR, SPIDER_SQL_LT_LEN); + if (spider_dbton[dbton_id].db_util-> + append_column_value(spider, str_part, field, ptr, + share->access_charset)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } +#endif } } #if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET) @@ -2079,7 +2192,8 @@ int spider_db_append_key_where_internal( if (use_key == start_key) { - if (tgt_key_part_map == 1) +#ifdef SPIDER_HANDLER_SUPPORT_MULTIPLE_KEY_PARTS + if (tgt_key_part_map == 1 || !end_key_part_map) { if (str->reserve(SPIDER_SQL_LTEQUAL_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -2090,6 +2204,19 @@ int spider_db_append_key_where_internal( append_column_value(spider, str_part, field, ptr, share->access_charset)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); +#else + if (str_part->length() == SPIDER_SQL_OPEN_PAREN_LEN) + { + if (str->reserve(SPIDER_SQL_LTEQUAL_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + str->q_append(SPIDER_SQL_LTEQUAL_STR, + SPIDER_SQL_LTEQUAL_LEN); + if (spider_dbton[dbton_id].db_util-> + append_column_value(spider, str_part, field, ptr, + share->access_charset)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } +#endif } } #if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET) @@ -2228,7 +2355,8 @@ int spider_db_append_key_where_internal( if (use_key == start_key) { - if (tgt_key_part_map == 1) +#ifdef SPIDER_HANDLER_SUPPORT_MULTIPLE_KEY_PARTS + if (tgt_key_part_map == 1 || !end_key_part_map) { if (str->reserve(SPIDER_SQL_GTEQUAL_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -2239,6 +2367,19 @@ int spider_db_append_key_where_internal( append_column_value(spider, str_part, field, ptr, share->access_charset)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); +#else + if (str_part->length() == SPIDER_SQL_OPEN_PAREN_LEN) + { + if (str->reserve(SPIDER_SQL_GTEQUAL_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + str->q_append(SPIDER_SQL_GTEQUAL_STR, + SPIDER_SQL_GTEQUAL_LEN); + if (spider_dbton[dbton_id].db_util-> + append_column_value(spider, str_part, field, ptr, + share->access_charset)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } +#endif } } #if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET) @@ -2269,12 +2410,14 @@ int spider_db_append_key_where_internal( str_part2->q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN); +#ifdef SPIDER_HANDLER_SUPPORT_MULTIPLE_KEY_PARTS if (use_key == start_key) { if (str_part->reserve(SPIDER_SQL_COMMA_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str_part->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); } +#endif } } @@ -2330,18 +2473,23 @@ int spider_db_append_key_where_internal( if (use_key == end_key) { -/* - if (tgt_key_part_map == 1) +#ifdef SPIDER_HANDLER_SUPPORT_MULTIPLE_KEY_PARTS + if (spider_dbton[dbton_id].db_util-> + append_column_value(spider, str_part, field, ptr, + share->access_charset)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); +#else + if (str_part->length() == SPIDER_SQL_OPEN_PAREN_LEN) { if (str->reserve(SPIDER_SQL_EQUAL_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN); + if (spider_dbton[dbton_id].db_util-> + append_column_value(spider, str_part, field, ptr, + share->access_charset)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); } -*/ - if (spider_dbton[dbton_id].db_util-> - append_column_value(spider, str_part, field, ptr, - share->access_charset)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); +#endif } } } else { @@ -2382,7 +2530,8 @@ int spider_db_append_key_where_internal( if (use_key == end_key) { - if (tgt_key_part_map == 1) +#ifdef SPIDER_HANDLER_SUPPORT_MULTIPLE_KEY_PARTS + if (tgt_key_part_map == 1 || !start_key_part_map) { if (str->reserve(SPIDER_SQL_LT_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -2392,6 +2541,18 @@ int spider_db_append_key_where_internal( append_column_value(spider, str_part, field, ptr, share->access_charset)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); +#else + if (str_part->length() == SPIDER_SQL_OPEN_PAREN_LEN) + { + if (str->reserve(SPIDER_SQL_LT_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + str->q_append(SPIDER_SQL_LT_STR, SPIDER_SQL_LT_LEN); + if (spider_dbton[dbton_id].db_util-> + append_column_value(spider, str_part, field, ptr, + share->access_charset)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } +#endif } } break; @@ -2428,7 +2589,8 @@ int spider_db_append_key_where_internal( if (use_key == end_key) { - if (tgt_key_part_map == 1) +#ifdef SPIDER_HANDLER_SUPPORT_MULTIPLE_KEY_PARTS + if (tgt_key_part_map == 1 || !start_key_part_map) { if (str->reserve(SPIDER_SQL_LTEQUAL_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -2439,6 +2601,19 @@ int spider_db_append_key_where_internal( append_column_value(spider, str_part, field, ptr, share->access_charset)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); +#else + if (str_part->length() == SPIDER_SQL_OPEN_PAREN_LEN) + { + if (str->reserve(SPIDER_SQL_LTEQUAL_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + str->q_append(SPIDER_SQL_LTEQUAL_STR, + SPIDER_SQL_LTEQUAL_LEN); + if (spider_dbton[dbton_id].db_util-> + append_column_value(spider, str_part, field, ptr, + share->access_charset)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } +#endif } } break; @@ -2456,12 +2631,14 @@ int spider_db_append_key_where_internal( str_part2->q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN); +#ifdef SPIDER_HANDLER_SUPPORT_MULTIPLE_KEY_PARTS if (use_key == end_key) { if (str_part->reserve(SPIDER_SQL_COMMA_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str_part->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); } +#endif } } if (use_both && (!start_key_part_map || !end_key_part_map)) @@ -2475,6 +2652,11 @@ int spider_db_append_key_where_internal( DBUG_RETURN(error_num); end: + if (spider->multi_range_num && current_pos == str->length()) + { + DBUG_PRINT("info", ("spider no key where condition")); + dbton_hdl->no_where_cond = TRUE; + } /* use condition */ if (dbton_hdl->append_condition_part(NULL, 0, sql_type, FALSE)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -2519,6 +2701,22 @@ int spider_db_append_key_where( DBUG_RETURN(0); } +int spider_db_append_charset_name_before_string( + spider_string *str, + CHARSET_INFO *cs +) { + const char *csname = cs->csname; + uint csname_length = strlen(csname); + DBUG_ENTER("spider_db_append_charset_name_before_string"); + if (str->reserve(SPIDER_SQL_UNDERSCORE_LEN + csname_length)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_SQL_UNDERSCORE_STR, SPIDER_SQL_UNDERSCORE_LEN); + str->q_append(csname, csname_length); + DBUG_RETURN(0); +} + #ifdef HANDLER_HAS_DIRECT_AGGREGATE int spider_db_refetch_for_item_sum_funcs( ha_spider *spider @@ -5694,7 +5892,39 @@ int spider_db_show_table_status( DBUG_RETURN(error_num); } -int spider_db_show_records( +int spider_db_simple_action( + uint simple_action, + spider_db_handler *db_handler, + int link_idx +) { + int error_num; + DBUG_ENTER("spider_db_simple_action"); + switch (simple_action) + { + case SPIDER_SIMPLE_RECORDS: + DBUG_PRINT("info",("spider simple records")); + error_num = db_handler->show_records( + link_idx + ); + break; +#ifdef HA_HAS_CHECKSUM_EXTENDED + case SPIDER_SIMPLE_CHECKSUM_TABLE: + DBUG_PRINT("info",("spider simple checksum_table")); + error_num = db_handler->checksum_table( + link_idx + ); + break; +#endif + default: + DBUG_ASSERT(0); + error_num = HA_ERR_CRASHED; + break; + } + DBUG_RETURN(error_num); +} + +int spider_db_simple_action( + uint simple_action, ha_spider *spider, int link_idx, bool pre_call @@ -5702,7 +5932,7 @@ int spider_db_show_records( int error_num; THD *thd = spider->trx->thd; SPIDER_CONN *conn; - DBUG_ENTER("spider_db_show_records"); + DBUG_ENTER("spider_db_simple_action"); if (pre_call) { if (spider_param_bgs_mode(thd, spider->share->bgs_mode)) @@ -5715,18 +5945,20 @@ int spider_db_show_records( conn = spider->conns[link_idx]; if (!(error_num = spider_create_conn_thread(conn))) { - spider_bg_conn_simple_action(conn, SPIDER_BG_SIMPLE_RECORDS, FALSE, + spider_bg_conn_simple_action(conn, simple_action, FALSE, spider, link_idx, (int *) &spider->result_list.bgs_error); } } else { conn = spider->conns[link_idx]; - error_num = spider->dbton_handler[conn->dbton_id]->show_records( + error_num = spider_db_simple_action( + simple_action, + spider->dbton_handler[conn->dbton_id], link_idx ); } } else { conn = spider->conns[link_idx]; - if (spider->use_pre_records) + if (spider->use_pre_action) { if (spider_param_bgs_mode(thd, spider->share->bgs_mode)) { @@ -5740,7 +5972,9 @@ int spider_db_show_records( error_num = 0; } } else { - error_num = spider->dbton_handler[conn->dbton_id]->show_records( + error_num = spider_db_simple_action( + simple_action, + spider->dbton_handler[conn->dbton_id], link_idx ); } @@ -5768,7 +6002,7 @@ void spider_db_set_cardinarity( { key_part = &key_info->key_part[roop_count2]; field = key_part->field; - rec_per_key = (ha_rows) share->records / + rec_per_key = (ha_rows) share->stat.records / share->cardinality[field->field_index]; if (rec_per_key > ~(ulong) 0) key_info->rec_per_key[roop_count2] = ~(ulong) 0; @@ -5913,6 +6147,7 @@ int spider_db_bulk_insert_init( int spider_db_bulk_insert( ha_spider *spider, TABLE *table, + ha_copy_info *copy_info, bool bulk_end ) { int error_num, first_insert_link_idx = -1; @@ -5957,6 +6192,7 @@ int spider_db_bulk_insert( if (!spider->is_bulk_access_clone) { #endif + bool insert_info = FALSE; for ( roop_count2 = spider_conn_link_idx_next(share->link_statuses, spider->conn_link_idx, -1, share->link_count, @@ -6093,6 +6329,11 @@ int spider_db_bulk_insert( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; + if (!insert_info && copy_info) + { + insert_info = + conn->db_conn->inserted_info(dbton_handler, copy_info); + } #if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET) if (conn->conn_kind != SPIDER_CONN_KIND_MYSQL) { @@ -6890,7 +7131,8 @@ int spider_db_direct_update( TABLE *table, KEY_MULTI_RANGE *ranges, uint range_count, - ha_rows *update_rows + ha_rows *update_rows, + ha_rows *found_rows ) { int error_num, roop_count; SPIDER_SHARE *share = spider->share; @@ -7175,6 +7417,8 @@ int spider_db_direct_update( { *update_rows = spider->conns[roop_count]->db_conn->affected_rows(); DBUG_PRINT("info", ("spider update_rows = %llu", *update_rows)); + *found_rows = spider->conns[roop_count]->db_conn->matched_rows(); + DBUG_PRINT("info", ("spider found_rows = %llu", *found_rows)); counted = TRUE; } #if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET) @@ -7196,6 +7440,8 @@ int spider_db_direct_update( { *update_rows = conn->db_conn->affected_rows(); DBUG_PRINT("info", ("spider update_rows = %llu", *update_rows)); + *found_rows = conn->db_conn->matched_rows(); + DBUG_PRINT("info", ("spider found_rows = %llu", *found_rows)); counted = TRUE; } result->free_result(); @@ -7237,7 +7483,8 @@ int spider_db_direct_update( int spider_db_direct_update( ha_spider *spider, TABLE *table, - ha_rows *update_rows + ha_rows *update_rows, + ha_rows *found_rows ) { int error_num, roop_count; SPIDER_SHARE *share = spider->share; @@ -7442,6 +7689,8 @@ int spider_db_direct_update( { *update_rows = spider->conns[roop_count]->db_conn->affected_rows(); DBUG_PRINT("info", ("spider update_rows = %llu", *update_rows)); + *found_rows = spider->conns[roop_count]->db_conn->matched_rows(); + DBUG_PRINT("info", ("spider found_rows = %llu", *found_rows)); counted = TRUE; } DBUG_ASSERT(conn->mta_conn_mutex_lock_already); @@ -7463,7 +7712,8 @@ int spider_db_direct_update( #ifdef HA_CAN_BULK_ACCESS int spider_db_bulk_direct_update( ha_spider *spider, - ha_rows *update_rows + ha_rows *update_rows, + ha_rows *found_rows ) { int error_num = 0, roop_count, tmp_error_num; SPIDER_SHARE *share = spider->share; @@ -7511,6 +7761,8 @@ int spider_db_bulk_direct_update( { *update_rows = spider->conns[roop_count]->db_conn->affected_rows(); DBUG_PRINT("info", ("spider update_rows = %llu", *update_rows)); + *found_rows = spider->conns[roop_count]->db_conn->matched_rows(); + DBUG_PRINT("info", ("spider found_rows = %llu", *found_rows)); counted = TRUE; } #if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET) @@ -7532,6 +7784,8 @@ int spider_db_bulk_direct_update( { *update_rows = conn->db_conn->affected_rows(); DBUG_PRINT("info", ("spider update_rows = %llu", *update_rows)); + *found_rows = conn->db_conn->matched_rows(); + DBUG_PRINT("info", ("spider found_rows = %llu", *found_rows)); counted = TRUE; } result->free_result(); @@ -9073,34 +9327,58 @@ int spider_db_open_item_ident( Field *field = item_ident->cached_table->table->field[ item_ident->cached_field_index]; DBUG_PRINT("info",("spider use cached_field_index")); - if (!use_fields) + DBUG_PRINT("info",("spider const_table=%s", + field->table->const_table ? "TRUE" : "FALSE")); + if (field->table->const_table) { - if (!(field = spider->field_exchange(field))) - DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM); if (str) { - if ((error_num = share->dbton_share[dbton_id]-> - append_column_name_with_alias(str, field->field_index, - alias, alias_length))) - DBUG_RETURN(error_num); + String str_value; + String *tmp_str; + tmp_str = field->val_str(&str_value); + if (!tmp_str) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + if (str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN * 2 + + tmp_str->length() * 2)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); + str->append_escape_string(tmp_str->ptr(), tmp_str->length()); + str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); } } else { - if (str) + if (!use_fields) { - SPIDER_FIELD_CHAIN *field_chain = fields->get_next_field_chain(); - SPIDER_FIELD_HOLDER *field_holder = field_chain->field_holder; - spider = field_holder->spider; - share = spider->share; - field = spider->field_exchange(field); - DBUG_ASSERT(field); - if ((error_num = share->dbton_share[dbton_id]-> - append_column_name_with_alias(str, field->field_index, - field_holder->alias->ptr(), field_holder->alias->length()))) - DBUG_RETURN(error_num); + if (!(field = spider->field_exchange(field))) + DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM); + if (str) + { + if ((error_num = share->dbton_share[dbton_id]-> + append_column_name_with_alias(str, field->field_index, + alias, alias_length))) + DBUG_RETURN(error_num); + } } else { - if ((error_num = fields->add_field(field))) + if (str) { - DBUG_RETURN(error_num); + SPIDER_FIELD_CHAIN *field_chain = fields->get_next_field_chain(); + SPIDER_FIELD_HOLDER *field_holder = field_chain->field_holder; + spider = field_holder->spider; + share = spider->share; + field = spider->field_exchange(field); + DBUG_ASSERT(field); + if ((error_num = share->dbton_share[dbton_id]-> + append_column_name_with_alias(str, field->field_index, + field_holder->alias->ptr(), field_holder->alias->length()))) + DBUG_RETURN(error_num); + } else { + if ((error_num = fields->add_field(field))) + { + DBUG_RETURN(error_num); + } } } } @@ -9127,10 +9405,11 @@ int spider_db_open_item_ident( str->q_append(alias, alias_length); #ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name if ((error_num = spider_dbton[dbton_id].db_util-> - append_name(str, item_ident->field_name.str, field_name_length))) + append_escaped_name(str, item_ident->field_name.str, + field_name_length))) #else if ((error_num = spider_dbton[dbton_id].db_util-> - append_name(str, item_ident->field_name, field_name_length))) + append_escaped_name(str, item_ident->field_name, field_name_length))) #endif { DBUG_RETURN(error_num); @@ -9141,11 +9420,11 @@ int spider_db_open_item_ident( str->q_append(alias, alias_length); #ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name if ((error_num = spider_dbton[dbton_id].db_util-> - append_name_with_charset(str, item_ident->field_name.str, + append_escaped_name_with_charset(str, item_ident->field_name.str, field_name_length, system_charset_info))) #else if ((error_num = spider_dbton[dbton_id].db_util-> - append_name_with_charset(str, item_ident->field_name, + append_escaped_name_with_charset(str, item_ident->field_name, field_name_length, system_charset_info))) #endif { @@ -9170,46 +9449,72 @@ int spider_db_open_item_field( Field *field = item_field->field; SPIDER_SHARE *share = spider->share; DBUG_ENTER("spider_db_open_item_field"); - if (field && !field->table->const_table) + if (field) { DBUG_PRINT("info",("spider field=%p", field)); DBUG_PRINT("info",("spider db=%s", field->table->s->db.str)); - DBUG_PRINT("info",("spider table_name=%s", field->table->s->table_name.str)); - DBUG_PRINT("info",("spider tmp_table=%u", field->table->s->tmp_table)); - if (field->table->s->tmp_table != INTERNAL_TMP_TABLE) + DBUG_PRINT("info",("spider table_name=%s", + field->table->s->table_name.str)); + DBUG_PRINT("info",("spider const_table=%s", + field->table->const_table ? "TRUE" : "FALSE")); + if (field->table->const_table) { - if (!use_fields) + if (str) { - if (!(field = spider->field_exchange(field))) - DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM); - if (str) + String str_value; + String *tmp_str; + tmp_str = field->val_str(&str_value); + if (!tmp_str) { - if ((error_num = share->dbton_share[dbton_id]-> - append_column_name_with_alias(str, field->field_index, - alias, alias_length))) - DBUG_RETURN(error_num); + DBUG_RETURN(HA_ERR_OUT_OF_MEM); } - DBUG_RETURN(0); - } else { - if (str) + if (str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN * 2 + + tmp_str->length() * 2)) { - SPIDER_FIELD_CHAIN *field_chain = fields->get_next_field_chain(); - SPIDER_FIELD_HOLDER *field_holder = field_chain->field_holder; - spider = field_holder->spider; - share = spider->share; - field = spider->field_exchange(field); - DBUG_ASSERT(field); - if ((error_num = share->dbton_share[dbton_id]-> - append_column_name_with_alias(str, field->field_index, - field_holder->alias->ptr(), field_holder->alias->length()))) - DBUG_RETURN(error_num); + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); + str->append_escape_string(tmp_str->ptr(), tmp_str->length()); + str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); + } + DBUG_RETURN(0); + } else { + DBUG_PRINT("info",("spider tmp_table=%u", field->table->s->tmp_table)); + if (field->table->s->tmp_table != INTERNAL_TMP_TABLE) + { + if (!use_fields) + { + if (!(field = spider->field_exchange(field))) + DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM); + if (str) + { + if ((error_num = share->dbton_share[dbton_id]-> + append_column_name_with_alias(str, field->field_index, + alias, alias_length))) + DBUG_RETURN(error_num); + } + DBUG_RETURN(0); } else { - if ((error_num = fields->add_field(field))) + if (str) { - DBUG_RETURN(error_num); + SPIDER_FIELD_CHAIN *field_chain = fields->get_next_field_chain(); + SPIDER_FIELD_HOLDER *field_holder = field_chain->field_holder; + spider = field_holder->spider; + share = spider->share; + field = spider->field_exchange(field); + DBUG_ASSERT(field); + if ((error_num = share->dbton_share[dbton_id]-> + append_column_name_with_alias(str, field->field_index, + field_holder->alias->ptr(), field_holder->alias->length()))) + DBUG_RETURN(error_num); + } else { + if ((error_num = fields->add_field(field))) + { + DBUG_RETURN(error_num); + } } + DBUG_RETURN(0); } - DBUG_RETURN(0); } } } @@ -9406,6 +9711,14 @@ int spider_db_open_item_string( goto end; } } + if (str->charset() != tmp_str2->charset()) + { + if ((error_num = spider_db_append_charset_name_before_string(str, + tmp_str2->charset()))) + { + goto end; + } + } if (str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN * 2 + tmp_str2->length() * 2)) { @@ -9415,7 +9728,8 @@ int spider_db_open_item_string( if (!thd) tmp_str.mem_calc(); str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); - str->append_escape_string(tmp_str2->ptr(), tmp_str2->length()); + str->append_escape_string(tmp_str2->ptr(), tmp_str2->length(), + tmp_str2->charset()); if (str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN)) { error_num = HA_ERR_OUT_OF_MEM; diff --git a/storage/spider/spd_db_conn.h b/storage/spider/spd_db_conn.h index e3f95f7b28d..6fdb4b694ae 100644 --- a/storage/spider/spd_db_conn.h +++ b/storage/spider/spd_db_conn.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2008-2018 Kentoku Shiba +/* Copyright (C) 2008-2019 Kentoku Shiba + Copyright (C) 2019 MariaDB corp This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -429,6 +430,14 @@ int spider_db_append_name_with_quote_str_internal( uint dbton_id ); +int spider_db_append_name_with_quote_str_internal( + spider_string *str, + const char *name, + int length, + CHARSET_INFO *cs, + uint dbton_id +); + int spider_db_append_select( ha_spider *spider ); @@ -472,6 +481,11 @@ int spider_db_append_key_where( ha_spider *spider ); +int spider_db_append_charset_name_before_string( + spider_string *str, + CHARSET_INFO *cs +); + #ifdef HANDLER_HAS_DIRECT_AGGREGATE int spider_db_refetch_for_item_sum_funcs( ha_spider *spider @@ -692,7 +706,14 @@ int spider_db_show_table_status( uint flag ); -int spider_db_show_records( +int spider_db_simple_action( + uint simple_action, + spider_db_handler *db_handler, + int link_idx +); + +int spider_db_simple_action( + uint simple_action, ha_spider *spider, int link_idx, bool pre_call @@ -725,6 +746,7 @@ int spider_db_bulk_insert_init( int spider_db_bulk_insert( ha_spider *spider, TABLE *table, + ha_copy_info *copy_info, bool bulk_end ); @@ -768,13 +790,15 @@ int spider_db_direct_update( TABLE *table, KEY_MULTI_RANGE *ranges, uint range_count, - ha_rows *update_rows + ha_rows *update_rows, + ha_rows *found_rows ); #else int spider_db_direct_update( ha_spider *spider, TABLE *table, - ha_rows *update_rows + ha_rows *update_rows, + ha_rows *found_rows ); #endif #endif diff --git a/storage/spider/spd_db_handlersocket.cc b/storage/spider/spd_db_handlersocket.cc index 1e42838f40a..b8e4c0e705a 100644 --- a/storage/spider/spd_db_handlersocket.cc +++ b/storage/spider/spd_db_handlersocket.cc @@ -740,15 +740,7 @@ SPIDER_DB_ROW *spider_db_handlersocket_result::fetch_row_from_tmp_table( int spider_db_handlersocket_result::fetch_table_status( int mode, - ha_rows &records, - ulong &mean_rec_length, - ulonglong &data_file_length, - ulonglong &max_data_file_length, - ulonglong &index_file_length, - ulonglong &auto_increment_value, - time_t &create_time, - time_t &update_time, - time_t &check_time + ha_statistics &stat ) { DBUG_ENTER("spider_db_handlersocket_result::fetch_table_status"); DBUG_PRINT("info",("spider this=%p", this)); @@ -1663,6 +1655,22 @@ uint spider_db_handlersocket::affected_rows() DBUG_RETURN((uint) my_strtoll10(hs_row->begin(), (char**) NULL, &error_num)); } +uint spider_db_handlersocket::matched_rows() +{ + DBUG_ENTER("spider_db_handlersocket::matched_rows"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_RETURN(0); +} + +bool spider_db_handlersocket::inserted_info( + spider_db_handler *handler, + ha_copy_info *copy_info +) { + DBUG_ENTER("spider_db_handlersocket::inserted_info"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_RETURN(FALSE); +} + ulonglong spider_db_handlersocket::last_insert_id() { DBUG_ENTER("spider_db_handlersocket::last_insert_id"); @@ -1839,6 +1847,40 @@ int spider_db_handlersocket::set_sql_log_off( DBUG_RETURN(0); } +bool spider_db_handlersocket::set_wait_timeout_in_bulk_sql() +{ + DBUG_ENTER("spider_db_handlersocket::set_wait_timeout_in_bulk_sql"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_RETURN(FALSE); +} + +int spider_db_handlersocket::set_wait_timeout( + int wait_timeout, + int *need_mon +) { + DBUG_ENTER("spider_db_handlersocket::set_wait_timeout"); + DBUG_PRINT("info",("spider this=%p", this)); + /* nothing to do */ + DBUG_RETURN(0); +} + +bool spider_db_handlersocket::set_sql_mode_in_bulk_sql() +{ + DBUG_ENTER("spider_db_handlersocket::set_sql_mode_in_bulk_sql"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_RETURN(FALSE); +} + +int spider_db_handlersocket::set_sql_mode( + sql_mode_t sql_mode, + int *need_mon +) { + DBUG_ENTER("spider_db_handlersocket::set_sql_mode"); + DBUG_PRINT("info",("spider this=%p", this)); + /* nothing to do */ + DBUG_RETURN(0); +} + bool spider_db_handlersocket::set_time_zone_in_bulk_sql() { DBUG_ENTER("spider_db_handlersocket::set_time_zone_in_bulk_sql"); @@ -2478,6 +2520,57 @@ int spider_db_handlersocket_util::append_name_with_charset( DBUG_RETURN(0); } +int spider_db_handlersocket_util::append_escaped_name( + spider_string *str, + const char *name, + uint name_length +) { + int error_num; + DBUG_ENTER("spider_db_handlersocket_util::append_name"); + if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN * 2 + name_length * 2)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); + if ((error_num = spider_db_append_name_with_quote_str_internal( + str, name, name_length, dbton_id))) + { + DBUG_RETURN(error_num); + } + if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); + DBUG_RETURN(0); +} + +int spider_db_handlersocket_util::append_escaped_name_with_charset( + spider_string *str, + const char *name, + uint name_length, + CHARSET_INFO *name_charset +) { + int error_num; + DBUG_ENTER("spider_db_handlersocket_util::append_name_with_charset"); + if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN * 2 + name_length * 2)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); + if ((error_num = spider_db_append_name_with_quote_str_internal( + str, name, name_length, name_charset, dbton_id))) + { + DBUG_RETURN(error_num); + } + if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); + DBUG_RETURN(0); +} + bool spider_db_handlersocket_util::is_name_quote( const char head_code ) { @@ -2675,6 +2768,26 @@ int spider_db_handlersocket_util::append_sql_log_off( DBUG_RETURN(0); } +int spider_db_handlersocket_util::append_wait_timeout( + spider_string *str, + int wait_timeout +) { + DBUG_ENTER("spider_db_handlersocket_util::append_wait_timeout"); + DBUG_PRINT("info",("spider this=%p", this)); + /* nothing to do */ + DBUG_RETURN(0); +} + +int spider_db_handlersocket_util::append_sql_mode( + spider_string *str, + sql_mode_t sql_mode +) { + DBUG_ENTER("spider_db_handlersocket_util::append_sql_mode"); + DBUG_PRINT("info",("spider this=%p", this)); + /* nothing to do */ + DBUG_RETURN(0); +} + int spider_db_handlersocket_util::append_time_zone( spider_string *str, Time_zone *time_zone @@ -5145,7 +5258,7 @@ int spider_handlersocket_handler::append_open_handler( share->tgt_dbs[spider->conn_link_idx[link_idx]], share->tgt_table_names[spider->conn_link_idx[link_idx]], spider->active_index < MAX_KEY ? - table->s->key_info[spider->active_index].name : + table->key_info[spider->active_index].name : "0", str->c_ptr_safe(), &request_key @@ -5786,15 +5899,7 @@ int spider_handlersocket_handler::show_table_status( DBUG_ENTER("spider_handlersocket_show_table_status"); res.fetch_table_status( sts_mode, - share->records, - share->mean_rec_length, - share->data_file_length, - share->max_data_file_length, - share->index_file_length, - auto_increment_value, - share->create_time, - share->update_time, - share->check_time + share->stat ); if (auto_increment_value > share->lgtm_tblhnd_share->auto_increment_value) { diff --git a/storage/spider/spd_db_handlersocket.h b/storage/spider/spd_db_handlersocket.h index d1b59386cbe..19a4a391ed6 100644 --- a/storage/spider/spd_db_handlersocket.h +++ b/storage/spider/spd_db_handlersocket.h @@ -34,6 +34,17 @@ public: uint name_length, CHARSET_INFO *name_charset ); + int append_escaped_name( + spider_string *str, + const char *name, + uint name_length + ); + int append_escaped_name_with_charset( + spider_string *str, + const char *name, + uint name_length, + CHARSET_INFO *name_charset + ); bool is_name_quote( const char head_code ); @@ -59,6 +70,14 @@ public: spider_string *str, bool sql_log_off ); + int append_wait_timeout( + spider_string *str, + int wait_timeout + ); + int append_sql_mode( + spider_string *str, + sql_mode_t sql_mode + ); int append_time_zone( spider_string *str, Time_zone *time_zone @@ -211,15 +230,7 @@ public: ); int fetch_table_status( int mode, - ha_rows &records, - ulong &mean_rec_length, - ulonglong &data_file_length, - ulonglong &max_data_file_length, - ulonglong &index_file_length, - ulonglong &auto_increment_value, - time_t &create_time, - time_t &update_time, - time_t &check_time + ha_statistics &stat ); int fetch_table_records( int mode, @@ -324,6 +335,11 @@ public: ); int next_result(); uint affected_rows(); + uint matched_rows(); + bool inserted_info( + spider_db_handler *handler, + spider_copy_info *copy_info + ); ulonglong last_insert_id(); int set_character_set( const char *csname @@ -380,6 +396,16 @@ public: bool sql_log_off, int *need_mon ); + bool set_wait_timeout_in_bulk_sql(); + int set_wait_timeout( + int wait_timeout, + int *need_mon + ); + bool set_sql_mode_in_bulk_sql(); + int set_sql_mode( + sql_mode_t sql_mode, + int *need_mon + ); bool set_time_zone_in_bulk_sql(); int set_time_zone( Time_zone *time_zone, diff --git a/storage/spider/spd_db_include.cc b/storage/spider/spd_db_include.cc index 2910aa97690..7f600142187 100644 --- a/storage/spider/spd_db_include.cc +++ b/storage/spider/spd_db_include.cc @@ -41,6 +41,16 @@ spider_db_result::spider_db_result( DBUG_VOID_RETURN; } +#ifdef HA_HAS_CHECKSUM_EXTENDED +int spider_db_result::fetch_table_checksum( + ha_spider *spider +) { + DBUG_ENTER("spider_db_result::fetch_table_checksum"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_RETURN(0); +} +#endif + spider_db_conn::spider_db_conn( SPIDER_CONN *in_conn ) : conn(in_conn), dbton_id(in_conn->dbton_id) @@ -49,3 +59,20 @@ spider_db_conn::spider_db_conn( DBUG_PRINT("info",("spider this=%p", this)); DBUG_VOID_RETURN; } + +#ifdef HA_HAS_CHECKSUM_EXTENDED +bool spider_db_share::checksum_support() +{ + DBUG_ENTER("spider_db_share::checksum_support"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_RETURN(FALSE); +} + +int spider_db_handler::checksum_table( + int link_idx +) { + DBUG_ENTER("spider_db_handler::checksum_table"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_RETURN(0); +} +#endif diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h index d51770c1a77..9b005ba7ccd 100644 --- a/storage/spider/spd_db_include.h +++ b/storage/spider/spd_db_include.h @@ -157,6 +157,8 @@ typedef st_spider_result SPIDER_RESULT; #define SPIDER_SQL_MBR_DISJOINT_LEN (sizeof(SPIDER_SQL_MBR_DISJOINT_STR) - 1) #define SPIDER_SQL_NOT_BETWEEN_STR "not between" #define SPIDER_SQL_NOT_BETWEEN_LEN (sizeof(SPIDER_SQL_NOT_BETWEEN_STR) - 1) +#define SPIDER_SQL_TO_FLOAT_STR "/* create function to_float(a decimal(20,6)) returns float return a */ to_float(" +#define SPIDER_SQL_TO_FLOAT_LEN (sizeof(SPIDER_SQL_TO_FLOAT_STR) - 1) #define SPIDER_SQL_IN_STR "in(" #define SPIDER_SQL_IN_LEN (sizeof(SPIDER_SQL_IN_STR) - 1) #define SPIDER_SQL_NOT_IN_STR "not in(" @@ -181,6 +183,8 @@ typedef st_spider_result SPIDER_RESULT; #define SPIDER_SQL_AS_TIME_LEN (sizeof(SPIDER_SQL_AS_TIME_STR) - 1) #define SPIDER_SQL_AS_BINARY_STR " as binary" #define SPIDER_SQL_AS_BINARY_LEN (sizeof(SPIDER_SQL_AS_BINARY_STR) - 1) +#define SPIDER_SQL_AS_FLOAT_STR " as float" +#define SPIDER_SQL_AS_FLOAT_LEN (sizeof(SPIDER_SQL_AS_FLOAT_STR) - 1) #define SPIDER_SQL_IS_TRUE_STR " is true" #define SPIDER_SQL_IS_TRUE_LEN (sizeof(SPIDER_SQL_IS_TRUE_STR) - 1) #define SPIDER_SQL_IS_NOT_TRUE_STR " is not true" @@ -251,6 +255,7 @@ typedef struct st_spider_transaction SPIDER_TRX; typedef struct st_spider_share SPIDER_SHARE; class ha_spider; class spider_db_copy_table; +class spider_db_handler; class spider_string { @@ -533,6 +538,11 @@ public: const char *st, uint len ); + void append_escape_string( + const char *st, + uint len, + CHARSET_INFO *cs + ); bool append_for_single_quote( const char *st, uint len @@ -812,6 +822,17 @@ public: uint name_length, CHARSET_INFO *name_charset ) = 0; + virtual int append_escaped_name( + spider_string *str, + const char *name, + uint name_length + ) = 0; + virtual int append_escaped_name_with_charset( + spider_string *str, + const char *name, + uint name_length, + CHARSET_INFO *name_charset + ) = 0; virtual bool is_name_quote( const char head_code ) = 0; @@ -837,6 +858,14 @@ public: spider_string *str, bool sql_log_off ) = 0; + virtual int append_wait_timeout( + spider_string *str, + int wait_timeout + ) = 0; + virtual int append_sql_mode( + spider_string *str, + sql_mode_t sql_mode + ) = 0; virtual int append_time_zone( spider_string *str, Time_zone *time_zone @@ -979,20 +1008,17 @@ public: ) = 0; virtual int fetch_table_status( int mode, - ha_rows &records, - ulong &mean_rec_length, - ulonglong &data_file_length, - ulonglong &max_data_file_length, - ulonglong &index_file_length, - ulonglong &auto_increment_value, - time_t &create_time, - time_t &update_time, - time_t &check_time + ha_statistics &stat ) = 0; virtual int fetch_table_records( int mode, ha_rows &records ) = 0; +#ifdef HA_HAS_CHECKSUM_EXTENDED + virtual int fetch_table_checksum( + ha_spider *spider + ); +#endif virtual int fetch_table_cardinality( int mode, TABLE *table, @@ -1080,6 +1106,11 @@ public: ) = 0; virtual int next_result() = 0; virtual uint affected_rows() = 0; + virtual uint matched_rows() = 0; + virtual bool inserted_info( + spider_db_handler *handler, + ha_copy_info *copy_info + ) = 0; virtual ulonglong last_insert_id() = 0; virtual int set_character_set( const char *csname @@ -1136,6 +1167,16 @@ public: bool sql_log_off, int *need_mon ) = 0; + virtual bool set_wait_timeout_in_bulk_sql() = 0; + virtual int set_wait_timeout( + int wait_timeout, + int *need_mon + ) = 0; + virtual bool set_sql_mode_in_bulk_sql() = 0; + virtual int set_sql_mode( + sql_mode_t sql_mode, + int *need_mon + ) = 0; virtual bool set_time_zone_in_bulk_sql() = 0; virtual int set_time_zone( Time_zone *time_zone, @@ -1262,6 +1303,9 @@ public: spider_string *str ) = 0; #endif +#ifdef HA_HAS_CHECKSUM_EXTENDED + virtual bool checksum_support(); +#endif }; class spider_db_handler @@ -1279,6 +1323,7 @@ public: #ifdef SPIDER_HAS_GROUP_BY_HANDLER SPIDER_LINK_IDX_CHAIN *link_idx_chain; #endif + bool no_where_cond; spider_db_handler(ha_spider *spider, spider_db_share *db_share) : dbton_id(db_share->dbton_id), spider(spider), db_share(db_share), first_link_idx(-1) {} @@ -1630,6 +1675,11 @@ public: virtual int show_records( int link_idx ) = 0; +#ifdef HA_HAS_CHECKSUM_EXTENDED + virtual int checksum_table( + int link_idx + ); +#endif virtual int show_last_insert_id( int link_idx, ulonglong &last_insert_id diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index ce6aef63fd8..86ce0c530b1 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -56,6 +56,8 @@ extern HASH spider_open_connections; extern HASH spider_ipport_conns; extern SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE]; extern const char spider_dig_upper[]; +extern const char **spd_mysqld_unix_port; +extern uint *spd_mysqld_port; spider_db_mysql_util spider_db_mysql_utility; spider_db_mariadb_util spider_db_mariadb_utility; @@ -88,6 +90,12 @@ static const char *name_quote_str = SPIDER_SQL_NAME_QUOTE_STR; #define SPIDER_SQL_SQL_LOG_ON_STR "set session sql_log_off = 1" #define SPIDER_SQL_SQL_LOG_ON_LEN sizeof(SPIDER_SQL_SQL_LOG_ON_STR) - 1 +#define SPIDER_SQL_WAIT_TIMEOUT_STR "set session wait_timeout = " +#define SPIDER_SQL_WAIT_TIMEOUT_LEN sizeof(SPIDER_SQL_WAIT_TIMEOUT_STR) - 1 + +#define SPIDER_SQL_SQL_MODE_STR "set session sql_mode = '" +#define SPIDER_SQL_SQL_MODE_LEN sizeof(SPIDER_SQL_SQL_MODE_STR) - 1 + #define SPIDER_SQL_TIME_ZONE_STR "set session time_zone = '" #define SPIDER_SQL_TIME_ZONE_LEN sizeof(SPIDER_SQL_TIME_ZONE_STR) - 1 @@ -123,7 +131,7 @@ static const char *name_quote_str = SPIDER_SQL_NAME_QUOTE_STR; #define SPIDER_SQL_SHOW_TABLE_STATUS_STR "show table status from " #define SPIDER_SQL_SHOW_TABLE_STATUS_LEN sizeof(SPIDER_SQL_SHOW_TABLE_STATUS_STR) - 1 -#define SPIDER_SQL_SELECT_TABLES_STATUS_STR "select `table_rows`,`avg_row_length`,`data_length`,`max_data_length`,`index_length`,`auto_increment`,`create_time`,`update_time`,`check_time` from `information_schema`.`tables` where `table_schema` = " +#define SPIDER_SQL_SELECT_TABLES_STATUS_STR "select `table_rows`,`avg_row_length`,`data_length`,`max_data_length`,`index_length`,`auto_increment`,`create_time`,`update_time`,`check_time`,`checksum` from `information_schema`.`tables` where `table_schema` = " #define SPIDER_SQL_SELECT_TABLES_STATUS_LEN sizeof(SPIDER_SQL_SELECT_TABLES_STATUS_STR) - 1 #define SPIDER_SQL_SHOW_WARNINGS_STR "show warnings" #define SPIDER_SQL_SHOW_WARNINGS_LEN sizeof(SPIDER_SQL_SHOW_WARNINGS_STR) - 1 @@ -151,6 +159,15 @@ static const char *name_quote_str = SPIDER_SQL_NAME_QUOTE_STR; #define SPIDER_SQL_USING_HASH_LEN sizeof(SPIDER_SQL_USING_HASH_STR) - 1 #endif +#define SPIDER_SQL_SHOW_RECORDS_RECORDS_POS 0 +#define SPIDER_SQL_EXPLAIN_SELECT_RECORDS_POS 8 + +#ifdef HA_HAS_CHECKSUM_EXTENDED +#define SPIDER_SQL_CHECKSUM_CHECKSUM_POS 1 +#define SPIDER_SQL_CHECKSUM_TABLE_STR "checksum table " +#define SPIDER_SQL_CHECKSUM_TABLE_LEN (sizeof(SPIDER_SQL_CHECKSUM_TABLE_STR) - 1) +#endif + #define SPIDER_SQL_LIKE_STR " like " #define SPIDER_SQL_LIKE_LEN (sizeof(SPIDER_SQL_LIKE_STR) - 1) #define SPIDER_SQL_LIMIT1_STR " limit 1" @@ -167,6 +184,11 @@ static uchar SPIDER_SQL_LINESTRING_HEAD_STR[] = {0x00,0x00,0x00,0x00,0x01,0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00}; #define SPIDER_SQL_LINESTRING_HEAD_LEN sizeof(SPIDER_SQL_LINESTRING_HEAD_STR) +#define SPIDER_SQL_DIRECT_INSERT_KIND_INSERT 0 +#define SPIDER_SQL_DIRECT_INSERT_KIND_REPLACE 1 +#define SPIDER_SQL_DIRECT_INSERT_KIND_IGNORE 2 +#define SPIDER_SQL_DIRECT_INSERT_KIND_DUP_UPDATE 3 + static const char *spider_db_table_lock_str[] = { " read local,", @@ -784,15 +806,7 @@ SPIDER_DB_ROW *spider_db_mbase_result::fetch_row_from_tmp_table( int spider_db_mbase_result::fetch_table_status( int mode, - ha_rows &records, - ulong &mean_rec_length, - ulonglong &data_file_length, - ulonglong &max_data_file_length, - ulonglong &index_file_length, - ulonglong &auto_increment_value, - time_t &create_time, - time_t &update_time, - time_t &check_time + ha_statistics &stat ) { int error_num; MYSQL_ROW mysql_row; @@ -831,47 +845,47 @@ int spider_db_mbase_result::fetch_table_status( } if (mysql_row[4]) - records = + stat.records = (ha_rows) my_strtoll10(mysql_row[4], (char**) NULL, &error_num); else - records = (ha_rows) 0; + stat.records = (ha_rows) 0; DBUG_PRINT("info", - ("spider records=%lld", records)); + ("spider records=%lld", stat.records)); if (mysql_row[5]) - mean_rec_length = + stat.mean_rec_length = (ulong) my_strtoll10(mysql_row[5], (char**) NULL, &error_num); else - mean_rec_length = 0; + stat.mean_rec_length = 0; DBUG_PRINT("info", - ("spider mean_rec_length=%lu", mean_rec_length)); + ("spider mean_rec_length=%lu", stat.mean_rec_length)); if (mysql_row[6]) - data_file_length = + stat.data_file_length = (ulonglong) my_strtoll10(mysql_row[6], (char**) NULL, &error_num); else - data_file_length = 0; + stat.data_file_length = 0; DBUG_PRINT("info", - ("spider data_file_length=%lld", data_file_length)); + ("spider data_file_length=%lld", stat.data_file_length)); if (mysql_row[7]) - max_data_file_length = + stat.max_data_file_length = (ulonglong) my_strtoll10(mysql_row[7], (char**) NULL, &error_num); else - max_data_file_length = 0; + stat.max_data_file_length = 0; DBUG_PRINT("info", - ("spider max_data_file_length=%lld", max_data_file_length)); + ("spider max_data_file_length=%lld", stat.max_data_file_length)); if (mysql_row[8]) - index_file_length = + stat.index_file_length = (ulonglong) my_strtoll10(mysql_row[8], (char**) NULL, &error_num); else - index_file_length = 0; + stat.index_file_length = 0; DBUG_PRINT("info", - ("spider index_file_length=%lld", index_file_length)); + ("spider index_file_length=%lld", stat.index_file_length)); if (mysql_row[10]) - auto_increment_value = + stat.auto_increment_value = (ulonglong) my_strtoll10(mysql_row[10], (char**) NULL, &error_num); else - auto_increment_value = 1; + stat.auto_increment_value = 1; DBUG_PRINT("info", - ("spider auto_increment_value=%lld", auto_increment_value)); + ("spider auto_increment_value=%lld", stat.auto_increment_value)); if (mysql_row[11]) { #ifdef SPIDER_HAS_TIME_STATUS @@ -880,19 +894,19 @@ int spider_db_mbase_result::fetch_table_status( SPIDER_str_to_datetime(mysql_row[11], strlen(mysql_row[11]), &mysql_time, 0, &time_status); #ifdef MARIADB_BASE_VERSION - create_time = (time_t) my_system_gmt_sec(&mysql_time, + stat.create_time = (time_t) my_system_gmt_sec(&mysql_time, ¬_used_long, ¬_used_uint); #else - create_time = (time_t) my_system_gmt_sec(&mysql_time, + stat.create_time = (time_t) my_system_gmt_sec(&mysql_time, ¬_used_long, ¬_used_my_bool); #endif } else - create_time = (time_t) 0; + stat.create_time = (time_t) 0; #ifndef DBUG_OFF { struct tm *ts, tmp_ts; char buf[80]; - ts = localtime_r(&create_time, &tmp_ts); + ts = localtime_r(&stat.create_time, &tmp_ts); strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", ts); DBUG_PRINT("info",("spider create_time=%s", buf)); } @@ -905,19 +919,19 @@ int spider_db_mbase_result::fetch_table_status( SPIDER_str_to_datetime(mysql_row[12], strlen(mysql_row[12]), &mysql_time, 0, &time_status); #ifdef MARIADB_BASE_VERSION - update_time = (time_t) my_system_gmt_sec(&mysql_time, + stat.update_time = (time_t) my_system_gmt_sec(&mysql_time, ¬_used_long, ¬_used_uint); #else - update_time = (time_t) my_system_gmt_sec(&mysql_time, + stat.update_time = (time_t) my_system_gmt_sec(&mysql_time, ¬_used_long, ¬_used_my_bool); #endif } else - update_time = (time_t) 0; + stat.update_time = (time_t) 0; #ifndef DBUG_OFF { struct tm *ts, tmp_ts; char buf[80]; - ts = localtime_r(&update_time, &tmp_ts); + ts = localtime_r(&stat.update_time, &tmp_ts); strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", ts); DBUG_PRINT("info",("spider update_time=%s", buf)); } @@ -930,66 +944,77 @@ int spider_db_mbase_result::fetch_table_status( SPIDER_str_to_datetime(mysql_row[13], strlen(mysql_row[13]), &mysql_time, 0, &time_status); #ifdef MARIADB_BASE_VERSION - check_time = (time_t) my_system_gmt_sec(&mysql_time, + stat.check_time = (time_t) my_system_gmt_sec(&mysql_time, ¬_used_long, ¬_used_uint); #else - check_time = (time_t) my_system_gmt_sec(&mysql_time, + stat.check_time = (time_t) my_system_gmt_sec(&mysql_time, ¬_used_long, ¬_used_my_bool); #endif } else - check_time = (time_t) 0; + stat.check_time = (time_t) 0; #ifndef DBUG_OFF { struct tm *ts, tmp_ts; char buf[80]; - ts = localtime_r(&check_time, &tmp_ts); + ts = localtime_r(&stat.check_time, &tmp_ts); strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", ts); DBUG_PRINT("info",("spider check_time=%s", buf)); } #endif + if (mysql_row[15]) + { + stat.checksum_null = FALSE; + stat.checksum = + (ha_checksum) my_strtoll10(mysql_row[15], (char**) NULL, &error_num); + DBUG_PRINT("info", ("spider checksum=%lu", (ulong) stat.checksum)); + } else { + stat.checksum_null = TRUE; + stat.checksum = (ha_checksum) 0; + DBUG_PRINT("info", ("spider checksum is null")); + } } else { if (mysql_row[0]) - records = + stat.records = (ha_rows) my_strtoll10(mysql_row[0], (char**) NULL, &error_num); else - records = (ha_rows) 0; + stat.records = (ha_rows) 0; DBUG_PRINT("info", - ("spider records=%lld", records)); + ("spider records=%lld", stat.records)); if (mysql_row[1]) - mean_rec_length = + stat.mean_rec_length = (ulong) my_strtoll10(mysql_row[1], (char**) NULL, &error_num); else - mean_rec_length = 0; + stat.mean_rec_length = 0; DBUG_PRINT("info", - ("spider mean_rec_length=%lu", mean_rec_length)); + ("spider mean_rec_length=%lu", stat.mean_rec_length)); if (mysql_row[2]) - data_file_length = + stat.data_file_length = (ulonglong) my_strtoll10(mysql_row[2], (char**) NULL, &error_num); else - data_file_length = 0; + stat.data_file_length = 0; DBUG_PRINT("info", - ("spider data_file_length=%lld", data_file_length)); + ("spider data_file_length=%lld", stat.data_file_length)); if (mysql_row[3]) - max_data_file_length = + stat.max_data_file_length = (ulonglong) my_strtoll10(mysql_row[3], (char**) NULL, &error_num); else - max_data_file_length = 0; + stat.max_data_file_length = 0; DBUG_PRINT("info", - ("spider max_data_file_length=%lld", max_data_file_length)); + ("spider max_data_file_length=%lld", stat.max_data_file_length)); if (mysql_row[4]) - index_file_length = + stat.index_file_length = (ulonglong) my_strtoll10(mysql_row[4], (char**) NULL, &error_num); else - index_file_length = 0; + stat.index_file_length = 0; DBUG_PRINT("info", - ("spider index_file_length=%lld", index_file_length)); + ("spider index_file_length=%lld", stat.index_file_length)); if (mysql_row[5]) - auto_increment_value = + stat.auto_increment_value = (ulonglong) my_strtoll10(mysql_row[5], (char**) NULL, &error_num); else - auto_increment_value = 1; + stat.auto_increment_value = 1; DBUG_PRINT("info", - ("spider auto_increment_value=%lld", auto_increment_value)); + ("spider auto_increment_value=%lld", stat.auto_increment_value)); if (mysql_row[6]) { #ifdef SPIDER_HAS_TIME_STATUS @@ -998,19 +1023,19 @@ int spider_db_mbase_result::fetch_table_status( SPIDER_str_to_datetime(mysql_row[6], strlen(mysql_row[6]), &mysql_time, 0, &time_status); #ifdef MARIADB_BASE_VERSION - create_time = (time_t) my_system_gmt_sec(&mysql_time, + stat.create_time = (time_t) my_system_gmt_sec(&mysql_time, ¬_used_long, ¬_used_uint); #else - create_time = (time_t) my_system_gmt_sec(&mysql_time, + stat.create_time = (time_t) my_system_gmt_sec(&mysql_time, ¬_used_long, ¬_used_my_bool); #endif } else - create_time = (time_t) 0; + stat.create_time = (time_t) 0; #ifndef DBUG_OFF { struct tm *ts, tmp_ts; char buf[80]; - ts = localtime_r(&create_time, &tmp_ts); + ts = localtime_r(&stat.create_time, &tmp_ts); strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", ts); DBUG_PRINT("info",("spider create_time=%s", buf)); } @@ -1023,19 +1048,19 @@ int spider_db_mbase_result::fetch_table_status( SPIDER_str_to_datetime(mysql_row[7], strlen(mysql_row[7]), &mysql_time, 0, &time_status); #ifdef MARIADB_BASE_VERSION - update_time = (time_t) my_system_gmt_sec(&mysql_time, + stat.update_time = (time_t) my_system_gmt_sec(&mysql_time, ¬_used_long, ¬_used_uint); #else - update_time = (time_t) my_system_gmt_sec(&mysql_time, + stat.update_time = (time_t) my_system_gmt_sec(&mysql_time, ¬_used_long, ¬_used_my_bool); #endif } else - update_time = (time_t) 0; + stat.update_time = (time_t) 0; #ifndef DBUG_OFF { struct tm *ts, tmp_ts; char buf[80]; - ts = localtime_r(&update_time, &tmp_ts); + ts = localtime_r(&stat.update_time, &tmp_ts); strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", ts); DBUG_PRINT("info",("spider update_time=%s", buf)); } @@ -1048,34 +1073,46 @@ int spider_db_mbase_result::fetch_table_status( SPIDER_str_to_datetime(mysql_row[8], strlen(mysql_row[8]), &mysql_time, 0, &time_status); #ifdef MARIADB_BASE_VERSION - check_time = (time_t) my_system_gmt_sec(&mysql_time, + stat.check_time = (time_t) my_system_gmt_sec(&mysql_time, ¬_used_long, ¬_used_uint); #else - check_time = (time_t) my_system_gmt_sec(&mysql_time, + stat.check_time = (time_t) my_system_gmt_sec(&mysql_time, ¬_used_long, ¬_used_my_bool); #endif } else - check_time = (time_t) 0; + stat.check_time = (time_t) 0; #ifndef DBUG_OFF { struct tm *ts, tmp_ts; char buf[80]; - ts = localtime_r(&check_time, &tmp_ts); + ts = localtime_r(&stat.check_time, &tmp_ts); strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", ts); DBUG_PRINT("info",("spider check_time=%s", buf)); } #endif + if (mysql_row[9]) + { + stat.checksum_null = FALSE; + stat.checksum = + (ha_checksum) my_strtoll10(mysql_row[9], (char**) NULL, &error_num); + DBUG_PRINT("info", ("spider checksum=%lu", (ulong) stat.checksum)); + } else { + stat.checksum_null = TRUE; + stat.checksum = (ha_checksum) 0; + DBUG_PRINT("info", ("spider checksum is null")); + } } DBUG_RETURN(0); } -int spider_db_mbase_result::fetch_table_records( - int mode, - ha_rows &records +int spider_db_mbase_result::fetch_simple_action( + uint simple_action, + uint position, + void *param ) { int error_num; MYSQL_ROW mysql_row; - DBUG_ENTER("spider_db_mbase_result::fetch_table_records"); + DBUG_ENTER("spider_db_mbase_result::fetch_simple_action"); DBUG_PRINT("info",("spider this=%p", this)); if (!(mysql_row = mysql_fetch_row(db_result))) { @@ -1088,32 +1125,78 @@ int spider_db_mbase_result::fetch_table_records( } DBUG_RETURN(ER_QUERY_ON_FOREIGN_DATA_SOURCE); } - if (mode == 1) + if (num_fields() <= position) { - if (mysql_row[0]) - { - records = - (ha_rows) my_strtoll10(mysql_row[0], (char**) NULL, &error_num); - } else - records = (ha_rows) 0; - DBUG_PRINT("info", - ("spider records=%lld", records)); - } else { - if (num_fields() != 10) + DBUG_RETURN(ER_QUERY_ON_FOREIGN_DATA_SOURCE); + } + switch (simple_action) + { + case SPIDER_SIMPLE_RECORDS: { - DBUG_RETURN(ER_QUERY_ON_FOREIGN_DATA_SOURCE); + ha_rows *records = (ha_rows *) param; + if (mysql_row[position]) + { + *records = + (ha_rows) my_strtoll10(mysql_row[position], (char**) NULL, + &error_num); + } else { + *records = (ha_rows) 0; + } + DBUG_PRINT("info", ("spider records=%lld", *records)); + break; } - - if (mysql_row[8]) +#ifdef HA_HAS_CHECKSUM_EXTENDED + case SPIDER_SIMPLE_CHECKSUM_TABLE: { - records = - (ha_rows) my_strtoll10(mysql_row[8], (char**) NULL, &error_num); - } else - records = 0; + ha_spider *spider = (ha_spider *) param; + if (mysql_row[position]) + { + spider->checksum_val = + (ha_checksum) my_strtoll10(mysql_row[position], (char**) NULL, + &error_num); + DBUG_PRINT("info", ("spider checksum=%llu", (ulonglong)spider->checksum_val)); + spider->checksum_null = FALSE; + } else { + spider->checksum_null = TRUE; + DBUG_PRINT("info", ("spider checksum is null")); + } + break; + } +#endif + default: + DBUG_ASSERT(0); + break; } DBUG_RETURN(0); } +int spider_db_mbase_result::fetch_table_records( + int mode, + ha_rows &records +) { + DBUG_ENTER("spider_db_mbase_result::fetch_table_records"); + DBUG_PRINT("info",("spider this=%p", this)); + if (mode == 1) + { + DBUG_RETURN(fetch_simple_action(SPIDER_SIMPLE_RECORDS, + SPIDER_SQL_SHOW_RECORDS_RECORDS_POS, &records)); + } else { + DBUG_RETURN(fetch_simple_action(SPIDER_SIMPLE_RECORDS, + SPIDER_SQL_EXPLAIN_SELECT_RECORDS_POS, &records)); + } +} + +#ifdef HA_HAS_CHECKSUM_EXTENDED +int spider_db_mbase_result::fetch_table_checksum( + ha_spider *spider +) { + DBUG_ENTER("spider_db_mbase_result::fetch_table_checksum"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_RETURN(fetch_simple_action(SPIDER_SIMPLE_CHECKSUM_TABLE, + SPIDER_SQL_CHECKSUM_CHECKSUM_POS, spider)); +} +#endif + int spider_db_mbase_result::fetch_table_cardinality( int mode, TABLE *table, @@ -1897,6 +1980,30 @@ int spider_db_mbase::connect( conn->tgt_default_group); } + if (!spider_param_same_server_link(thd)) + { + if (!strcmp(tgt_host, my_localhost)) + { + if (!strcmp(tgt_socket, *spd_mysqld_unix_port)) + { + my_printf_error(ER_SPIDER_SAME_SERVER_LINK_NUM, + ER_SPIDER_SAME_SERVER_LINK_STR1, MYF(0), + tgt_host, tgt_socket); + DBUG_RETURN(ER_SPIDER_SAME_SERVER_LINK_NUM); + } + } else if (!strcmp(tgt_host, "127.0.0.1") || + !strcmp(tgt_host, glob_hostname)) + { + if (tgt_port == (long) *spd_mysqld_port) + { + my_printf_error(ER_SPIDER_SAME_SERVER_LINK_NUM, + ER_SPIDER_SAME_SERVER_LINK_STR2, MYF(0), + tgt_host, tgt_port); + DBUG_RETURN(ER_SPIDER_SAME_SERVER_LINK_NUM); + } + } + } + if (connect_mutex) pthread_mutex_lock(&spider_open_conn_mutex); /* tgt_db not use */ @@ -2325,6 +2432,81 @@ uint spider_db_mbase::affected_rows() DBUG_RETURN((uint) last_used_con->affected_rows); } +uint spider_db_mbase::matched_rows() +{ + MYSQL *last_used_con; + DBUG_ENTER("spider_db_mysql::matched_rows"); + DBUG_PRINT("info", ("spider this=%p", this)); +#if MYSQL_VERSION_ID < 50500 + last_used_con = db_conn->last_used_con; +#else + last_used_con = db_conn; +#endif + /* Rows matched: 65 Changed: 65 Warnings: 0 */ + const char *info = last_used_con->info; + if (!info) + DBUG_RETURN(0); + DBUG_PRINT("info", ("spider info=%s", info)); + const char *begin = strstr(info, "Rows matched: "); + if (!begin) + DBUG_RETURN(0); + DBUG_RETURN(atoi(begin + strlen("Rows matched: "))); +} + +bool spider_db_mbase::inserted_info( + spider_db_handler *handler, + ha_copy_info *copy_info +) { + MYSQL *last_used_con; + uchar direct_insert_kind = + ((spider_mbase_handler *) handler)->direct_insert_kind; + DBUG_ENTER("spider_db_mysql::inserted_info"); + DBUG_PRINT("info", ("spider this=%p", this)); + if (direct_insert_kind == SPIDER_SQL_DIRECT_INSERT_KIND_INSERT) + { + DBUG_RETURN(TRUE); + } +#if MYSQL_VERSION_ID < 50500 + last_used_con = db_conn->last_used_con; +#else + last_used_con = db_conn; +#endif + /* Records: 10 Duplicates: 4 Warnings: 0 */ + const char *info = last_used_con->info; + if (!info) + DBUG_RETURN(FALSE); + DBUG_PRINT("info", ("spider info=%s", info)); + const char *begin = strstr(info, "Records: "); + if (!begin) + DBUG_RETURN(FALSE); + begin += strlen("Records: "); + uint records = atoi(begin); + begin = strstr(begin, "Duplicates: "); + if (!begin) + DBUG_RETURN(FALSE); + uint duplicates = atoi(begin + strlen("Duplicates: ")); + copy_info->records+= records; + switch (direct_insert_kind) + { + case SPIDER_SQL_DIRECT_INSERT_KIND_IGNORE: + copy_info->copied+= duplicates; + break; + case SPIDER_SQL_DIRECT_INSERT_KIND_REPLACE: + copy_info->copied+= records; + copy_info->deleted+= duplicates; + break; + case SPIDER_SQL_DIRECT_INSERT_KIND_DUP_UPDATE: + copy_info->touched+= (last_used_con->affected_rows - (duplicates * 2)); + copy_info->copied+= (last_used_con->affected_rows - duplicates); + copy_info->updated+= duplicates; + break; + default: + DBUG_ASSERT(0); + DBUG_RETURN(FALSE); + } + DBUG_RETURN(TRUE); +} + ulonglong spider_db_mbase::last_insert_id() { MYSQL *last_used_con; @@ -2977,6 +3159,126 @@ int spider_db_mbase::set_sql_log_off( DBUG_RETURN(0); } +bool spider_db_mbase::set_wait_timeout_in_bulk_sql() +{ + DBUG_ENTER("spider_db_mbase::set_wait_timeout_in_bulk_sql"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_RETURN(TRUE); +} + +int spider_db_mbase::set_wait_timeout( + int wait_timeout, + int *need_mon +) { + char sql_buf[MAX_FIELD_WIDTH]; + char timeout_str[SPIDER_SQL_INT_LEN]; + int timeout_str_length; + spider_string sql_str(sql_buf, sizeof(sql_buf), &my_charset_bin); + DBUG_ENTER("spider_db_mbase::set_wait_timeout"); + DBUG_PRINT("info",("spider this=%p", this)); + sql_str.init_calc_mem(264); + sql_str.length(0); + timeout_str_length = + my_sprintf(timeout_str, (timeout_str, "%d", wait_timeout)); + if (sql_str.reserve(SPIDER_SQL_WAIT_TIMEOUT_LEN + timeout_str_length)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + sql_str.q_append(SPIDER_SQL_WAIT_TIMEOUT_STR, SPIDER_SQL_WAIT_TIMEOUT_LEN); + sql_str.q_append(timeout_str, timeout_str_length); + pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); + 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; + if (spider_db_query( + conn, + sql_str.ptr(), + sql_str.length(), + -1, + need_mon) + ) { + 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; + DBUG_RETURN(spider_db_errorno(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; + SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); + pthread_mutex_unlock(&conn->mta_conn_mutex); + DBUG_RETURN(0); +} + +bool spider_db_mbase::set_sql_mode_in_bulk_sql() +{ + DBUG_ENTER("spider_db_mbase::set_sql_mode_in_bulk_sql"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_RETURN(TRUE); +} + +int spider_db_mbase::set_sql_mode( + sql_mode_t sql_mode, + int *need_mon +) { + int error_num; + char sql_buf[MAX_FIELD_WIDTH]; + spider_string sql_str(sql_buf, sizeof(sql_buf), &my_charset_bin); + DBUG_ENTER("spider_db_mbase::set_sql_mode"); + DBUG_PRINT("info",("spider this=%p", this)); + sql_str.init_calc_mem(265); + sql_str.length(0); + if (sql_str.reserve(SPIDER_SQL_SQL_MODE_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + sql_str.q_append(SPIDER_SQL_SQL_MODE_STR, SPIDER_SQL_SQL_MODE_LEN); + if ((error_num = spider_db_mbase_utility->append_sql_mode_internal(&sql_str, sql_mode))) + { + DBUG_RETURN(error_num); + } + if (sql_str.length() > SPIDER_SQL_SQL_MODE_LEN) + { + sql_str.length(sql_str.length() - SPIDER_SQL_COMMA_LEN); + } else { + if (sql_str.reserve(SPIDER_SQL_VALUE_QUOTE_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + } + sql_str.q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); + pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); + 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; + if (spider_db_query( + conn, + sql_str.ptr(), + sql_str.length(), + -1, + need_mon) + ) { + 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; + DBUG_RETURN(spider_db_errorno(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; + SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); + pthread_mutex_unlock(&conn->mta_conn_mutex); + DBUG_RETURN(0); +} + bool spider_db_mbase::set_time_zone_in_bulk_sql() { DBUG_ENTER("spider_db_mbase::set_time_zone_in_bulk_sql"); @@ -3568,10 +3870,10 @@ void spider_db_mbase::set_dup_key_idx( key_name_length = spider->share->tgt_pk_names_lengths[all_link_idx]; } else { #ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name - key_name = table->s->key_info[roop_count].name.str; - key_name_length = table->s->key_info[roop_count].name.length; + key_name = table->key_info[roop_count].name.str; + key_name_length = table->key_info[roop_count].name.length; #else - key_name = table->s->key_info[roop_count].name; + key_name = table->key_info[roop_count].name; key_name_length = strlen(key_name); #endif } @@ -3674,6 +3976,57 @@ int spider_db_mbase_util::append_name_with_charset( DBUG_RETURN(0); } +int spider_db_mbase_util::append_escaped_name( + spider_string *str, + const char *name, + uint name_length +) { + int error_num; + DBUG_ENTER("spider_db_mbase_util::append_name"); + if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN * 2 + name_length * 2)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); + if ((error_num = spider_db_append_name_with_quote_str_internal( + str, name, name_length, dbton_id))) + { + DBUG_RETURN(error_num); + } + if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); + DBUG_RETURN(0); +} + +int spider_db_mbase_util::append_escaped_name_with_charset( + spider_string *str, + const char *name, + uint name_length, + CHARSET_INFO *name_charset +) { + int error_num; + DBUG_ENTER("spider_db_mbase_util::append_name_with_charset"); + if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN * 2 + name_length * 2)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); + if ((error_num = spider_db_append_name_with_quote_str_internal( + str, name, name_length, name_charset, dbton_id))) + { + DBUG_RETURN(error_num); + } + if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); + DBUG_RETURN(0); +} + bool spider_db_mbase_util::is_name_quote( const char head_code ) { @@ -3692,20 +4045,22 @@ int spider_db_mbase_util::append_escaped_name_quote( DBUG_RETURN(0); } -int spider_db_mbase_util::append_column_value( +int spider_db_mariadb_util::append_column_value( ha_spider *spider, spider_string *str, Field *field, const uchar *new_ptr, CHARSET_INFO *access_charset ) { + bool float_value = FALSE; + int error_num; char buf[MAX_FIELD_WIDTH]; - spider_string tmp_str(buf, MAX_FIELD_WIDTH, &my_charset_bin); + spider_string tmp_str(buf, MAX_FIELD_WIDTH, field->charset()); String *ptr; uint length; THD *thd = field->table->in_use; Time_zone *saved_time_zone = thd->variables.time_zone; - DBUG_ENTER("spider_db_mbase_util::append_column_value"); + DBUG_ENTER("spider_db_mariadb_util::append_column_value"); tmp_str.init_calc_mem(113); thd->variables.time_zone = UTC; @@ -3718,7 +4073,7 @@ int spider_db_mbase_util::append_column_value( ) { length = uint2korr(new_ptr); tmp_str.set_quick((char *) new_ptr + HA_KEY_BLOB_LENGTH, length, - &my_charset_bin); + field->charset()); ptr = tmp_str.get_str(); } else if (field->type() == MYSQL_TYPE_GEOMETRY) { @@ -3804,6 +4159,10 @@ int spider_db_mbase_util::append_column_value( } else { ptr = field->val_str(tmp_str.get_str()); tmp_str.mem_calc(); + if (field->type() == MYSQL_TYPE_FLOAT) + { + float_value = TRUE; + } } thd->variables.time_zone = saved_time_zone; @@ -3834,6 +4193,14 @@ int spider_db_mbase_util::append_column_value( if (field->result_type() == STRING_RESULT) { DBUG_PRINT("info", ("spider STRING_RESULT")); + if (str->charset() != field->charset()) + { + if ((error_num = spider_db_append_charset_name_before_string(str, + field->charset()))) + { + DBUG_RETURN(error_num); + } + } if (str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); @@ -3844,7 +4211,7 @@ int spider_db_mbase_util::append_column_value( ) { DBUG_PRINT("info", ("spider append_escaped")); char buf2[MAX_FIELD_WIDTH]; - spider_string tmp_str2(buf2, MAX_FIELD_WIDTH, access_charset); + spider_string tmp_str2(buf2, MAX_FIELD_WIDTH, field->charset()); tmp_str2.init_calc_mem(114); tmp_str2.length(0); if ( @@ -3860,13 +4227,258 @@ int spider_db_mbase_util::append_column_value( str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); } else if (field->str_needs_quotes()) { + if (str->charset() != field->charset()) + { + if ((error_num = spider_db_append_charset_name_before_string(str, + field->charset()))) + { + DBUG_RETURN(error_num); + } + } if (str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN * 2 + ptr->length() * 2 + 2)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); append_escaped_util(str, ptr); str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); + } else if (float_value) + { + if (str->reserve(SPIDER_SQL_CAST_LEN + ptr->length() + + SPIDER_SQL_AS_FLOAT_LEN, SPIDER_SQL_CLOSE_PAREN_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_SQL_CAST_STR, SPIDER_SQL_CAST_LEN); + str->q_append(ptr->ptr(), ptr->length()); + str->q_append(SPIDER_SQL_AS_FLOAT_STR, SPIDER_SQL_AS_FLOAT_LEN); + str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN); } else if (str->append(*ptr)) + { DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + DBUG_RETURN(0); +} + +int spider_db_mysql_util::append_column_value( + ha_spider *spider, + spider_string *str, + Field *field, + const uchar *new_ptr, + CHARSET_INFO *access_charset +) { + bool float_value = FALSE; + int error_num; + char buf[MAX_FIELD_WIDTH]; + spider_string tmp_str(buf, MAX_FIELD_WIDTH, field->charset()); + String *ptr; + uint length; + THD *thd = field->table->in_use; + Time_zone *saved_time_zone = thd->variables.time_zone; + DBUG_ENTER("spider_db_mysql_util::append_column_value"); + tmp_str.init_calc_mem(266); + + thd->variables.time_zone = UTC; + + if (new_ptr) + { + if ( + field->type() == MYSQL_TYPE_BLOB || + field->real_type() == MYSQL_TYPE_VARCHAR + ) { + length = uint2korr(new_ptr); + tmp_str.set_quick((char *) new_ptr + HA_KEY_BLOB_LENGTH, length, + field->charset()); + ptr = tmp_str.get_str(); + } else if (field->type() == MYSQL_TYPE_GEOMETRY) + { +/* + uint mlength = SIZEOF_STORED_DOUBLE, lcnt; + uchar *dest = (uchar *) buf; + const uchar *source; + for (lcnt = 0; lcnt < 4; lcnt++) + { + mlength = SIZEOF_STORED_DOUBLE; + source = new_ptr + mlength + SIZEOF_STORED_DOUBLE * lcnt; + while (mlength--) + *dest++ = *--source; + } + tmp_str.length(SIZEOF_STORED_DOUBLE * lcnt); +*/ +#ifndef DBUG_OFF + double xmin, xmax, ymin, ymax; +/* + float8store(buf,xmin); + float8store(buf+8,xmax); + float8store(buf+16,ymin); + float8store(buf+24,ymax); + memcpy(&xmin,new_ptr,sizeof(xmin)); + memcpy(&xmax,new_ptr + 8,sizeof(xmax)); + memcpy(&ymin,new_ptr + 16,sizeof(ymin)); + memcpy(&ymax,new_ptr + 24,sizeof(ymax)); + float8get(xmin, buf); + float8get(xmax, buf + 8); + float8get(ymin, buf + 16); + float8get(ymax, buf + 24); + DBUG_PRINT("info", ("spider geo is %f %f %f %f", + xmin, xmax, ymin, ymax)); + DBUG_PRINT("info", ("spider geo is %.14g %.14g %.14g %.14g", + xmin, xmax, ymin, ymax)); +*/ + float8get(xmin, new_ptr); + float8get(xmax, new_ptr + 8); + float8get(ymin, new_ptr + 16); + float8get(ymax, new_ptr + 24); + DBUG_PRINT("info", ("spider geo is %f %f %f %f", + xmin, xmax, ymin, ymax)); +/* + float8get(xmin, new_ptr + SIZEOF_STORED_DOUBLE * 4); + float8get(xmax, new_ptr + SIZEOF_STORED_DOUBLE * 5); + float8get(ymin, new_ptr + SIZEOF_STORED_DOUBLE * 6); + float8get(ymax, new_ptr + SIZEOF_STORED_DOUBLE * 7); + DBUG_PRINT("info", ("spider geo is %f %f %f %f", + xmin, xmax, ymin, ymax)); + float8get(xmin, new_ptr + SIZEOF_STORED_DOUBLE * 8); + float8get(xmax, new_ptr + SIZEOF_STORED_DOUBLE * 9); + float8get(ymin, new_ptr + SIZEOF_STORED_DOUBLE * 10); + float8get(ymax, new_ptr + SIZEOF_STORED_DOUBLE * 11); + DBUG_PRINT("info", ("spider geo is %f %f %f %f", + xmin, xmax, ymin, ymax)); + float8get(xmin, new_ptr + SIZEOF_STORED_DOUBLE * 12); + float8get(xmax, new_ptr + SIZEOF_STORED_DOUBLE * 13); + float8get(ymin, new_ptr + SIZEOF_STORED_DOUBLE * 14); + float8get(ymax, new_ptr + SIZEOF_STORED_DOUBLE * 15); + DBUG_PRINT("info", ("spider geo is %f %f %f %f", + xmin, xmax, ymin, ymax)); +*/ +#endif +/* + tmp_str.set_quick((char *) new_ptr, SIZEOF_STORED_DOUBLE * 4, + &my_charset_bin); +*/ + tmp_str.length(0); + tmp_str.q_append((char *) SPIDER_SQL_LINESTRING_HEAD_STR, + SPIDER_SQL_LINESTRING_HEAD_LEN); + tmp_str.q_append((char *) new_ptr, SIZEOF_STORED_DOUBLE); + tmp_str.q_append((char *) new_ptr + SIZEOF_STORED_DOUBLE * 2, + SIZEOF_STORED_DOUBLE); + tmp_str.q_append((char *) new_ptr + SIZEOF_STORED_DOUBLE, + SIZEOF_STORED_DOUBLE); + tmp_str.q_append((char *) new_ptr + SIZEOF_STORED_DOUBLE * 3, + SIZEOF_STORED_DOUBLE); + ptr = tmp_str.get_str(); + } else { + ptr = field->val_str(tmp_str.get_str(), new_ptr); + tmp_str.mem_calc(); + } + } else { + ptr = field->val_str(tmp_str.get_str()); + tmp_str.mem_calc(); + if (field->type() == MYSQL_TYPE_FLOAT) + { + float_value = TRUE; + } + } + + thd->variables.time_zone = saved_time_zone; + + DBUG_PRINT("info", ("spider field->type() is %d", field->type())); + DBUG_PRINT("info", ("spider ptr->length() is %d", ptr->length())); +/* + if ( + field->type() == MYSQL_TYPE_BIT || + (field->type() >= MYSQL_TYPE_TINY_BLOB && + field->type() <= MYSQL_TYPE_BLOB) + ) { + uchar *hex_ptr = (uchar *) ptr->ptr(), *end_ptr; + char *str_ptr; + DBUG_PRINT("info", ("spider HEX")); + if (str->reserve(SPIDER_SQL_HEX_LEN + ptr->length() * 2)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + str->q_append(SPIDER_SQL_HEX_STR, SPIDER_SQL_HEX_LEN); + str_ptr = (char *) str->ptr() + str->length(); + for (end_ptr = hex_ptr + ptr->length(); hex_ptr < end_ptr; hex_ptr++) + { + *str_ptr++ = spider_dig_upper[(*hex_ptr) >> 4]; + *str_ptr++ = spider_dig_upper[(*hex_ptr) & 0x0F]; + } + str->length(str->length() + ptr->length() * 2); + } else +*/ + if (field->result_type() == STRING_RESULT) + { + DBUG_PRINT("info", ("spider STRING_RESULT")); + if (str->charset() != field->charset()) + { + if ((error_num = spider_db_append_charset_name_before_string(str, + field->charset()))) + { + DBUG_RETURN(error_num); + } + } + if (str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); + if ( + field->type() == MYSQL_TYPE_VARCHAR || + (field->type() >= MYSQL_TYPE_ENUM && + field->type() <= MYSQL_TYPE_GEOMETRY) + ) { + DBUG_PRINT("info", ("spider append_escaped")); + char buf2[MAX_FIELD_WIDTH]; + spider_string tmp_str2(buf2, MAX_FIELD_WIDTH, field->charset()); + tmp_str2.init_calc_mem(267); + tmp_str2.length(0); + if ( + tmp_str2.append(ptr->ptr(), ptr->length(), field->charset()) || + str->reserve(tmp_str2.length() * 2) || + append_escaped_util(str, tmp_str2.get_str()) + ) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } else if (str->append(*ptr)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + if (str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); + } else if (field->str_needs_quotes()) + { + if (str->charset() != field->charset()) + { + if ((error_num = spider_db_append_charset_name_before_string(str, + field->charset()))) + { + DBUG_RETURN(error_num); + } + } + if (str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN * 2 + ptr->length() * 2 + 2)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); + append_escaped_util(str, ptr); + str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); + } else if (float_value) + { + if (str->reserve(SPIDER_SQL_TO_FLOAT_LEN + ptr->length() + + SPIDER_SQL_CLOSE_PAREN_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_SQL_TO_FLOAT_STR, SPIDER_SQL_TO_FLOAT_LEN); + str->q_append(ptr->ptr(), ptr->length()); + str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN); + } else if (str->append(*ptr)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + DBUG_RETURN(0); +} + +int spider_db_mbase_util::append_column_value( + ha_spider *spider, + spider_string *str, + Field *field, + const uchar *new_ptr, + CHARSET_INFO *access_charset +) { + DBUG_ENTER("spider_db_mbase_util::append_column_value"); + DBUG_ASSERT(0); DBUG_RETURN(0); } @@ -3985,6 +4597,885 @@ int spider_db_mbase_util::append_sql_log_off( DBUG_RETURN(0); } +int spider_db_mbase_util::append_wait_timeout( + spider_string *str, + int wait_timeout +) { + char timeout_str[SPIDER_SQL_INT_LEN]; + int timeout_str_length; + DBUG_ENTER("spider_db_mbase_util::append_wait_timeout"); + DBUG_PRINT("info",("spider this=%p", this)); + timeout_str_length = + my_sprintf(timeout_str, (timeout_str, "%d", wait_timeout)); + if (str->reserve(SPIDER_SQL_SEMICOLON_LEN + SPIDER_SQL_WAIT_TIMEOUT_LEN + + timeout_str_length)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + if (str->length()) + { + str->q_append(SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN); + } + str->q_append(SPIDER_SQL_WAIT_TIMEOUT_STR, SPIDER_SQL_WAIT_TIMEOUT_LEN); + str->q_append(timeout_str, timeout_str_length); + DBUG_RETURN(0); +} + +#define SPIDER_REAL_AS_FLOAT_STR "real_as_float" +#define SPIDER_REAL_AS_FLOAT_LEN (sizeof(SPIDER_REAL_AS_FLOAT_STR) - 1) +#define SPIDER_PIPES_AS_CONCAT_STR "pipes_as_concat" +#define SPIDER_PIPES_AS_CONCAT_LEN (sizeof(SPIDER_PIPES_AS_CONCAT_STR) - 1) +#define SPIDER_ANSI_QUOTES_STR "ansi_quotes" +#define SPIDER_ANSI_QUOTES_LEN (sizeof(SPIDER_ANSI_QUOTES_STR) - 1) +#define SPIDER_IGNORE_SPACE_STR "ignore_space" +#define SPIDER_IGNORE_SPACE_LEN (sizeof(SPIDER_IGNORE_SPACE_STR) - 1) +#define SPIDER_IGNORE_BAD_TABLE_OPTIONS_STR "ignore_bad_table_options" +#define SPIDER_IGNORE_BAD_TABLE_OPTIONS_LEN (sizeof(SPIDER_IGNORE_BAD_TABLE_OPTIONS_STR) - 1) +#define SPIDER_ONLY_FULL_GROUP_BY_STR "only_full_group_by" +#define SPIDER_ONLY_FULL_GROUP_BY_LEN (sizeof(SPIDER_ONLY_FULL_GROUP_BY_STR) - 1) +#define SPIDER_NO_UNSIGNED_SUBTRACTION_STR "no_unsigned_subtraction" +#define SPIDER_NO_UNSIGNED_SUBTRACTION_LEN (sizeof(SPIDER_NO_UNSIGNED_SUBTRACTION_STR) - 1) +#define SPIDER_NO_DIR_IN_CREATE_STR "no_dir_in_create" +#define SPIDER_NO_DIR_IN_CREATE_LEN (sizeof(SPIDER_NO_DIR_IN_CREATE_STR) - 1) +#define SPIDER_POSTGRESQL_STR "postgresql" +#define SPIDER_POSTGRESQL_LEN (sizeof(SPIDER_POSTGRESQL_STR) - 1) +#define SPIDER_ORACLE_STR "oracle" +#define SPIDER_ORACLE_LEN (sizeof(SPIDER_ORACLE_STR) - 1) +#define SPIDER_MSSQL_STR "mssql" +#define SPIDER_MSSQL_LEN (sizeof(SPIDER_MSSQL_STR) - 1) +#define SPIDER_DB2_STR "db2" +#define SPIDER_DB2_LEN (sizeof(SPIDER_DB2_STR) - 1) +#define SPIDER_MAXDB_STR "maxdb" +#define SPIDER_MAXDB_LEN (sizeof(SPIDER_MAXDB_STR) - 1) +#define SPIDER_NO_KEY_OPTIONS_STR "no_key_options" +#define SPIDER_NO_KEY_OPTIONS_LEN (sizeof(SPIDER_NO_KEY_OPTIONS_STR) - 1) +#define SPIDER_NO_TABLE_OPTIONS_STR "no_table_options" +#define SPIDER_NO_TABLE_OPTIONS_LEN (sizeof(SPIDER_NO_TABLE_OPTIONS_STR) - 1) +#define SPIDER_NO_FIELD_OPTIONS_STR "no_field_options" +#define SPIDER_NO_FIELD_OPTIONS_LEN (sizeof(SPIDER_NO_FIELD_OPTIONS_STR) - 1) +#define SPIDER_MYSQL323_STR "mysql323" +#define SPIDER_MYSQL323_LEN (sizeof(SPIDER_MYSQL323_STR) - 1) +#define SPIDER_MYSQL40_STR "mysql40" +#define SPIDER_MYSQL40_LEN (sizeof(SPIDER_MYSQL40_STR) - 1) +#define SPIDER_ANSI_STR "ansi" +#define SPIDER_ANSI_LEN (sizeof(SPIDER_ANSI_STR) - 1) +#define SPIDER_NO_AUTO_VALUE_ON_ZERO_STR "no_auto_value_on_zero" +#define SPIDER_NO_AUTO_VALUE_ON_ZERO_LEN (sizeof(SPIDER_NO_AUTO_VALUE_ON_ZERO_STR) - 1) +#define SPIDER_NO_BACKSLASH_ESCAPES_STR "no_backslash_escapes" +#define SPIDER_NO_BACKSLASH_ESCAPES_LEN (sizeof(SPIDER_NO_BACKSLASH_ESCAPES_STR) - 1) +#define SPIDER_STRICT_TRANS_TABLES_STR "strict_trans_tables" +#define SPIDER_STRICT_TRANS_TABLES_LEN (sizeof(SPIDER_STRICT_TRANS_TABLES_STR) - 1) +#define SPIDER_STRICT_ALL_TABLES_STR "strict_all_tables" +#define SPIDER_STRICT_ALL_TABLES_LEN (sizeof(SPIDER_STRICT_ALL_TABLES_STR) - 1) +#define SPIDER_NO_ZERO_IN_DATE_STR "no_zero_in_date" +#define SPIDER_NO_ZERO_IN_DATE_LEN (sizeof(SPIDER_NO_ZERO_IN_DATE_STR) - 1) +#define SPIDER_NO_ZERO_DATE_STR "no_zero_date" +#define SPIDER_NO_ZERO_DATE_LEN (sizeof(SPIDER_NO_ZERO_DATE_STR) - 1) +#define SPIDER_INVALID_DATES_STR "allow_invalid_dates" +#define SPIDER_INVALID_DATES_LEN (sizeof(SPIDER_INVALID_DATES_STR) - 1) +#define SPIDER_ERROR_FOR_DIVISION_BY_ZERO_STR "error_for_division_by_zero" +#define SPIDER_ERROR_FOR_DIVISION_BY_ZERO_LEN (sizeof(SPIDER_ERROR_FOR_DIVISION_BY_ZERO_STR) - 1) +#define SPIDER_TRADITIONAL_STR "traditional" +#define SPIDER_TRADITIONAL_LEN (sizeof(SPIDER_TRADITIONAL_STR) - 1) +#define SPIDER_NO_AUTO_CREATE_USER_STR "no_auto_create_user" +#define SPIDER_NO_AUTO_CREATE_USER_LEN (sizeof(SPIDER_NO_AUTO_CREATE_USER_STR) - 1) +#define SPIDER_HIGH_NOT_PRECEDENCE_STR "high_not_precedence" +#define SPIDER_HIGH_NOT_PRECEDENCE_LEN (sizeof(SPIDER_HIGH_NOT_PRECEDENCE_STR) - 1) +#define SPIDER_NO_ENGINE_SUBSTITUTION_STR "no_engine_substitution" +#define SPIDER_NO_ENGINE_SUBSTITUTION_LEN (sizeof(SPIDER_NO_ENGINE_SUBSTITUTION_STR) - 1) +#define SPIDER_PAD_CHAR_TO_FULL_LENGTH_STR "pad_char_to_full_length" +#define SPIDER_PAD_CHAR_TO_FULL_LENGTH_LEN (sizeof(SPIDER_PAD_CHAR_TO_FULL_LENGTH_STR) - 1) +#define SPIDER_EMPTY_STRING_IS_NULL_STR "empty_string_is_null" +#define SPIDER_EMPTY_STRING_IS_NULL_LEN (sizeof(SPIDER_EMPTY_STRING_IS_NULL_STR) - 1) +#define SPIDER_SIMULTANEOUS_ASSIGNMENT_STR "simultaneous_assignment" +#define SPIDER_SIMULTANEOUS_ASSIGNMENT_LEN (sizeof(SPIDER_SIMULTANEOUS_ASSIGNMENT_STR) - 1) +#define SPIDER_TIME_ROUND_FRACTIONAL_STR "time_round_fractional" +#define SPIDER_TIME_ROUND_FRACTIONAL_LEN (sizeof(SPIDER_TIME_ROUND_FRACTIONAL_STR) - 1) + +sql_mode_t full_sql_mode = +#ifdef MODE_REAL_AS_FLOAT + MODE_REAL_AS_FLOAT | +#endif +#ifdef MODE_PIPES_AS_CONCAT + MODE_PIPES_AS_CONCAT | +#endif +#ifdef MODE_ANSI_QUOTES + MODE_ANSI_QUOTES | +#endif +#ifdef MODE_IGNORE_SPACE + MODE_IGNORE_SPACE | +#endif +#ifdef MODE_IGNORE_BAD_TABLE_OPTIONS + MODE_IGNORE_BAD_TABLE_OPTIONS | +#endif +#ifdef MODE_ONLY_FULL_GROUP_BY + MODE_ONLY_FULL_GROUP_BY | +#endif +#ifdef MODE_NO_UNSIGNED_SUBTRACTION + MODE_NO_UNSIGNED_SUBTRACTION | +#endif +#ifdef MODE_NO_DIR_IN_CREATE + MODE_NO_DIR_IN_CREATE | +#endif +#ifdef MODE_POSTGRESQL + MODE_POSTGRESQL | +#endif +#ifdef MODE_ORACLE + MODE_ORACLE | +#endif +#ifdef MODE_MSSQL + MODE_MSSQL | +#endif +#ifdef MODE_DB2 + MODE_DB2 | +#endif +#ifdef MODE_MAXDB + MODE_MAXDB | +#endif +#ifdef MODE_NO_KEY_OPTIONS + MODE_NO_KEY_OPTIONS | +#endif +#ifdef MODE_NO_TABLE_OPTIONS + MODE_NO_TABLE_OPTIONS | +#endif +#ifdef MODE_NO_FIELD_OPTIONS + MODE_NO_FIELD_OPTIONS | +#endif +#ifdef MODE_MYSQL323 + MODE_MYSQL323 | +#endif +#ifdef MODE_MYSQL40 + MODE_MYSQL40 | +#endif +#ifdef MODE_ANSI + MODE_ANSI | +#endif +#ifdef MODE_NO_AUTO_VALUE_ON_ZERO + MODE_NO_AUTO_VALUE_ON_ZERO | +#endif +#ifdef MODE_NO_BACKSLASH_ESCAPES + MODE_NO_BACKSLASH_ESCAPES | +#endif +#ifdef MODE_STRICT_TRANS_TABLES + MODE_STRICT_TRANS_TABLES | +#endif +#ifdef MODE_STRICT_ALL_TABLES + MODE_STRICT_ALL_TABLES | +#endif +#ifdef MODE_NO_ZERO_IN_DATE + MODE_NO_ZERO_IN_DATE | +#endif +#ifdef MODE_NO_ZERO_DATE + MODE_NO_ZERO_DATE | +#endif +#ifdef MODE_INVALID_DATES + MODE_INVALID_DATES | +#endif +#ifdef MODE_ERROR_FOR_DIVISION_BY_ZERO + MODE_ERROR_FOR_DIVISION_BY_ZERO | +#endif +#ifdef MODE_TRADITIONAL + MODE_TRADITIONAL | +#endif +#ifdef MODE_NO_AUTO_CREATE_USER + MODE_NO_AUTO_CREATE_USER | +#endif +#ifdef MODE_HIGH_NOT_PRECEDENCE + MODE_HIGH_NOT_PRECEDENCE | +#endif +#ifdef MODE_NO_ENGINE_SUBSTITUTION + MODE_NO_ENGINE_SUBSTITUTION | +#endif +#ifdef MODE_PAD_CHAR_TO_FULL_LENGTH + MODE_PAD_CHAR_TO_FULL_LENGTH | +#endif +#ifdef MODE_EMPTY_STRING_IS_NULL + MODE_EMPTY_STRING_IS_NULL | +#endif +#ifdef MODE_SIMULTANEOUS_ASSIGNMENT + MODE_SIMULTANEOUS_ASSIGNMENT | +#endif +#ifdef MODE_TIME_ROUND_FRACTIONAL + MODE_TIME_ROUND_FRACTIONAL | +#endif + 0; + +#ifdef MODE_REAL_AS_FLOAT +/* pushdown */ +#define SPIDER_SQL_MODE_REAL_AS_FLOAT +#endif +#ifdef MODE_PIPES_AS_CONCAT +/* no pushdown */ +#endif +#ifdef MODE_ANSI_QUOTES +/* no pushdown */ +#endif +#ifdef MODE_IGNORE_SPACE +/* no pushdown */ +#endif +#ifdef MODE_IGNORE_BAD_TABLE_OPTIONS +/* pushdown */ +#define SPIDER_SQL_MODE_IGNORE_BAD_TABLE_OPTIONS +#endif +#ifdef MODE_ONLY_FULL_GROUP_BY +/* no pushdown */ +#endif +#ifdef MODE_NO_UNSIGNED_SUBTRACTION +/* pushdown */ +#define SPIDER_SQL_MODE_NO_UNSIGNED_SUBTRACTION +#endif +#ifdef MODE_NO_DIR_IN_CREATE +/* pushdown */ +#define SPIDER_SQL_MODE_NO_DIR_IN_CREATE +#endif +#ifdef MODE_POSTGRESQL +/* no pushdown */ +#endif +#ifdef MODE_ORACLE +/* no pushdown */ +#endif +#ifdef MODE_MSSQL +/* no pushdown */ +#endif +#ifdef MODE_DB2 +/* no pushdown */ +#endif +#ifdef MODE_MAXDB +/* no pushdown */ +#endif +#ifdef MODE_NO_KEY_OPTIONS +/* no pushdown */ +#endif +#ifdef MODE_NO_TABLE_OPTIONS +/* no pushdown */ +#endif +#ifdef MODE_NO_FIELD_OPTIONS +/* no pushdown */ +#endif +#ifdef MODE_MYSQL323 +/* no pushdown */ +#endif +#ifdef MODE_MYSQL40 +/* no pushdown */ +#endif +#ifdef MODE_ANSI +/* no pushdown */ +#endif +#ifdef MODE_NO_AUTO_VALUE_ON_ZERO +/* pushdown */ +#define SPIDER_SQL_MODE_NO_AUTO_VALUE_ON_ZERO +#endif +#ifdef MODE_NO_BACKSLASH_ESCAPES +/* no pushdown */ +#endif +#ifdef MODE_STRICT_TRANS_TABLES +/* pushdown */ +#define SPIDER_SQL_MODE_STRICT_TRANS_TABLES +#endif +#ifdef MODE_STRICT_ALL_TABLES +/* pushdown */ +#define SPIDER_SQL_MODE_STRICT_ALL_TABLES +#endif +#ifdef MODE_NO_ZERO_IN_DATE +/* pushdown */ +#define SPIDER_SQL_MODE_NO_ZERO_IN_DATE +#endif +#ifdef MODE_NO_ZERO_DATE +/* pushdown */ +#define SPIDER_SQL_MODE_NO_ZERO_DATE +#endif +#ifdef MODE_INVALID_DATES +/* pushdown */ +#define SPIDER_SQL_MODE_INVALID_DATES +#endif +#ifdef MODE_ERROR_FOR_DIVISION_BY_ZERO +/* pushdown */ +#define SPIDER_SQL_MODE_ERROR_FOR_DIVISION_BY_ZERO +#endif +#ifdef MODE_TRADITIONAL +/* no pushdown */ +#endif +#ifdef MODE_NO_AUTO_CREATE_USER +/* pushdown */ +#define SPIDER_SQL_MODE_NO_AUTO_CREATE_USER +#endif +#ifdef MODE_HIGH_NOT_PRECEDENCE +/* pushdown */ +#define SPIDER_SQL_MODE_HIGH_NOT_PRECEDENCE +#endif +#ifdef MODE_NO_ENGINE_SUBSTITUTION +/* pushdown */ +#define SPIDER_SQL_MODE_NO_ENGINE_SUBSTITUTION +#endif +#ifdef MODE_PAD_CHAR_TO_FULL_LENGTH +/* pushdown */ +#define SPIDER_SQL_MODE_PAD_CHAR_TO_FULL_LENGTH +#endif +#ifdef MODE_EMPTY_STRING_IS_NULL +/* pushdown */ +#define SPIDER_SQL_MODE_EMPTY_STRING_IS_NULL +#endif +#ifdef MODE_SIMULTANEOUS_ASSIGNMENT +/* pushdown */ +#define SPIDER_SQL_MODE_SIMULTANEOUS_ASSIGNMENT +#endif +#ifdef MODE_TIME_ROUND_FRACTIONAL +/* pushdown */ +#define SPIDER_SQL_MODE_TIME_ROUND_FRACTIONAL +#endif + +sql_mode_t pushdown_sql_mode = +#ifdef SPIDER_SQL_MODE_REAL_AS_FLOAT + MODE_REAL_AS_FLOAT | +#endif +#ifdef SPIDER_SQL_MODE_PIPES_AS_CONCAT + MODE_PIPES_AS_CONCAT | +#endif +#ifdef SPIDER_SQL_MODE_ANSI_QUOTES + MODE_ANSI_QUOTES | +#endif +#ifdef SPIDER_SQL_MODE_IGNORE_SPACE + MODE_IGNORE_SPACE | +#endif +#ifdef SPIDER_SQL_MODE_IGNORE_BAD_TABLE_OPTIONS + MODE_IGNORE_BAD_TABLE_OPTIONS | +#endif +#ifdef SPIDER_SQL_MODE_ONLY_FULL_GROUP_BY + MODE_ONLY_FULL_GROUP_BY | +#endif +#ifdef SPIDER_SQL_MODE_NO_UNSIGNED_SUBTRACTION + MODE_NO_UNSIGNED_SUBTRACTION | +#endif +#ifdef SPIDER_SQL_MODE_NO_DIR_IN_CREATE + MODE_NO_DIR_IN_CREATE | +#endif +#ifdef SPIDER_SQL_MODE_POSTGRESQL + MODE_POSTGRESQL | +#endif +#ifdef SPIDER_SQL_MODE_ORACLE + MODE_ORACLE | +#endif +#ifdef SPIDER_SQL_MODE_MSSQL + MODE_MSSQL | +#endif +#ifdef SPIDER_SQL_MODE_DB2 + MODE_DB2 | +#endif +#ifdef SPIDER_SQL_MODE_MAXDB + MODE_MAXDB | +#endif +#ifdef SPIDER_SQL_MODE_NO_KEY_OPTIONS + MODE_NO_KEY_OPTIONS | +#endif +#ifdef SPIDER_SQL_MODE_NO_TABLE_OPTIONS + MODE_NO_TABLE_OPTIONS | +#endif +#ifdef SPIDER_SQL_MODE_NO_FIELD_OPTIONS + MODE_NO_FIELD_OPTIONS | +#endif +#ifdef SPIDER_SQL_MODE_MYSQL323 + MODE_MYSQL323 | +#endif +#ifdef SPIDER_SQL_MODE_MYSQL40 + MODE_MYSQL40 | +#endif +#ifdef SPIDER_SQL_MODE_ANSI + MODE_ANSI | +#endif +#ifdef SPIDER_SQL_MODE_NO_AUTO_VALUE_ON_ZERO + MODE_NO_AUTO_VALUE_ON_ZERO | +#endif +#ifdef SPIDER_SQL_MODE_NO_BACKSLASH_ESCAPES + MODE_NO_BACKSLASH_ESCAPES | +#endif +#ifdef SPIDER_SQL_MODE_STRICT_TRANS_TABLES + MODE_STRICT_TRANS_TABLES | +#endif +#ifdef SPIDER_SQL_MODE_STRICT_ALL_TABLES + MODE_STRICT_ALL_TABLES | +#endif +#ifdef SPIDER_SQL_MODE_NO_ZERO_IN_DATE + MODE_NO_ZERO_IN_DATE | +#endif +#ifdef SPIDER_SQL_MODE_NO_ZERO_DATE + MODE_NO_ZERO_DATE | +#endif +#ifdef SPIDER_SQL_MODE_INVALID_DATES + MODE_INVALID_DATES | +#endif +#ifdef SPIDER_SQL_MODE_ERROR_FOR_DIVISION_BY_ZERO + MODE_ERROR_FOR_DIVISION_BY_ZERO | +#endif +#ifdef SPIDER_SQL_MODE_TRADITIONAL + MODE_TRADITIONAL | +#endif +#ifdef SPIDER_SQL_MODE_NO_AUTO_CREATE_USER + MODE_NO_AUTO_CREATE_USER | +#endif +#ifdef SPIDER_SQL_MODE_HIGH_NOT_PRECEDENCE + MODE_HIGH_NOT_PRECEDENCE | +#endif +#ifdef SPIDER_SQL_MODE_NO_ENGINE_SUBSTITUTION + MODE_NO_ENGINE_SUBSTITUTION | +#endif +#ifdef SPIDER_SQL_MODE_PAD_CHAR_TO_FULL_LENGTH + MODE_PAD_CHAR_TO_FULL_LENGTH | +#endif +#ifdef SPIDER_SQL_MODE_EMPTY_STRING_IS_NULL + MODE_EMPTY_STRING_IS_NULL | +#endif +#ifdef SPIDER_SQL_MODE_SIMULTANEOUS_ASSIGNMENT + MODE_SIMULTANEOUS_ASSIGNMENT | +#endif +#ifdef SPIDER_SQL_MODE_TIME_ROUND_FRACTIONAL + MODE_TIME_ROUND_FRACTIONAL | +#endif + 0; + +int spider_db_mbase_util::append_sql_mode_internal( + spider_string *str, + sql_mode_t sql_mode +) { + DBUG_ENTER("spider_db_mbase_util::append_sql_mode_internal"); + DBUG_PRINT("info",("spider this=%p", this)); +#ifdef SPIDER_SQL_MODE_REAL_AS_FLOAT + if (sql_mode & MODE_REAL_AS_FLOAT) + { + if (str->reserve(SPIDER_REAL_AS_FLOAT_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_REAL_AS_FLOAT_STR, SPIDER_REAL_AS_FLOAT_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_PIPES_AS_CONCAT + if (sql_mode & MODE_PIPES_AS_CONCAT) + { + if (str->reserve(SPIDER_PIPES_AS_CONCAT_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_PIPES_AS_CONCAT_STR, SPIDER_PIPES_AS_CONCAT_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_ANSI_QUOTES + if (sql_mode & MODE_ANSI_QUOTES) + { + if (str->reserve(SPIDER_ANSI_QUOTES_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_ANSI_QUOTES_STR, SPIDER_ANSI_QUOTES_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_IGNORE_SPACE + if (sql_mode & MODE_IGNORE_SPACE) + { + if (str->reserve(SPIDER_IGNORE_SPACE_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_IGNORE_SPACE_STR, SPIDER_IGNORE_SPACE_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_IGNORE_BAD_TABLE_OPTIONS + if (sql_mode & MODE_IGNORE_BAD_TABLE_OPTIONS) + { + if (str->reserve(SPIDER_IGNORE_BAD_TABLE_OPTIONS_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_IGNORE_BAD_TABLE_OPTIONS_STR, SPIDER_IGNORE_BAD_TABLE_OPTIONS_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_ONLY_FULL_GROUP_BY + if (sql_mode & MODE_ONLY_FULL_GROUP_BY) + { + if (str->reserve(SPIDER_ONLY_FULL_GROUP_BY_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_ONLY_FULL_GROUP_BY_STR, SPIDER_ONLY_FULL_GROUP_BY_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_NO_UNSIGNED_SUBTRACTION + if (sql_mode & MODE_NO_UNSIGNED_SUBTRACTION) + { + if (str->reserve(SPIDER_NO_UNSIGNED_SUBTRACTION_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_NO_UNSIGNED_SUBTRACTION_STR, SPIDER_NO_UNSIGNED_SUBTRACTION_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_NO_DIR_IN_CREATE + if (sql_mode & MODE_NO_DIR_IN_CREATE) + { + if (str->reserve(SPIDER_NO_DIR_IN_CREATE_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_NO_DIR_IN_CREATE_STR, SPIDER_NO_DIR_IN_CREATE_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_POSTGRESQL + if (sql_mode & MODE_POSTGRESQL) + { + if (str->reserve(SPIDER_POSTGRESQL_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_POSTGRESQL_STR, SPIDER_POSTGRESQL_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_ORACLE + if (sql_mode & MODE_ORACLE) + { + if (str->reserve(SPIDER_ORACLE_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_ORACLE_STR, SPIDER_ORACLE_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_MSSQL + if (sql_mode & MODE_MSSQL) + { + if (str->reserve(SPIDER_MSSQL_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_MSSQL_STR, SPIDER_MSSQL_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_DB2 + if (sql_mode & MODE_DB2) + { + if (str->reserve(SPIDER_DB2_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_DB2_STR, SPIDER_DB2_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_MAXDB + if (sql_mode & MODE_MAXDB) + { + if (str->reserve(SPIDER_MAXDB_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_MAXDB_STR, SPIDER_MAXDB_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_NO_KEY_OPTIONS + if (sql_mode & MODE_NO_KEY_OPTIONS) + { + if (str->reserve(SPIDER_NO_KEY_OPTIONS_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_NO_KEY_OPTIONS_STR, SPIDER_NO_KEY_OPTIONS_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_NO_TABLE_OPTIONS + if (sql_mode & MODE_NO_TABLE_OPTIONS) + { + if (str->reserve(SPIDER_NO_TABLE_OPTIONS_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_NO_TABLE_OPTIONS_STR, SPIDER_NO_TABLE_OPTIONS_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_NO_FIELD_OPTIONS + if (sql_mode & MODE_NO_FIELD_OPTIONS) + { + if (str->reserve(SPIDER_NO_FIELD_OPTIONS_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_NO_FIELD_OPTIONS_STR, SPIDER_NO_FIELD_OPTIONS_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_MYSQL323 + if (sql_mode & MODE_MYSQL323) + { + if (str->reserve(SPIDER_MYSQL323_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_MYSQL323_STR, SPIDER_MYSQL323_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_MYSQL40 + if (sql_mode & MODE_MYSQL40) + { + if (str->reserve(SPIDER_MYSQL40_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_MYSQL40_STR, SPIDER_MYSQL40_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_ANSI + if (sql_mode & MODE_ANSI) + { + if (str->reserve(SPIDER_ANSI_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_ANSI_STR, SPIDER_ANSI_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_NO_AUTO_VALUE_ON_ZERO + if (sql_mode & MODE_NO_AUTO_VALUE_ON_ZERO) + { + if (str->reserve(SPIDER_NO_AUTO_VALUE_ON_ZERO_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_NO_AUTO_VALUE_ON_ZERO_STR, SPIDER_NO_AUTO_VALUE_ON_ZERO_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_NO_BACKSLASH_ESCAPES + if (sql_mode & MODE_NO_BACKSLASH_ESCAPES) + { + if (str->reserve(SPIDER_NO_BACKSLASH_ESCAPES_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_NO_BACKSLASH_ESCAPES_STR, SPIDER_NO_BACKSLASH_ESCAPES_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_STRICT_TRANS_TABLES + if (sql_mode & MODE_STRICT_TRANS_TABLES) + { + if (str->reserve(SPIDER_STRICT_TRANS_TABLES_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_STRICT_TRANS_TABLES_STR, SPIDER_STRICT_TRANS_TABLES_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_STRICT_ALL_TABLES + if (sql_mode & MODE_STRICT_ALL_TABLES) + { + if (str->reserve(SPIDER_STRICT_ALL_TABLES_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_STRICT_ALL_TABLES_STR, SPIDER_STRICT_ALL_TABLES_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_NO_ZERO_IN_DATE + if (sql_mode & MODE_NO_ZERO_IN_DATE) + { + if (str->reserve(SPIDER_NO_ZERO_IN_DATE_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_NO_ZERO_IN_DATE_STR, SPIDER_NO_ZERO_IN_DATE_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_NO_ZERO_DATE + if (sql_mode & MODE_NO_ZERO_DATE) + { + if (str->reserve(SPIDER_NO_ZERO_DATE_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_NO_ZERO_DATE_STR, SPIDER_NO_ZERO_DATE_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_INVALID_DATES + if (sql_mode & MODE_INVALID_DATES) + { + if (str->reserve(SPIDER_INVALID_DATES_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_INVALID_DATES_STR, SPIDER_INVALID_DATES_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_ERROR_FOR_DIVISION_BY_ZERO + if (sql_mode & MODE_ERROR_FOR_DIVISION_BY_ZERO) + { + if (str->reserve(SPIDER_ERROR_FOR_DIVISION_BY_ZERO_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_ERROR_FOR_DIVISION_BY_ZERO_STR, SPIDER_ERROR_FOR_DIVISION_BY_ZERO_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_TRADITIONAL + if (sql_mode & MODE_TRADITIONAL) + { + if (str->reserve(SPIDER_TRADITIONAL_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_TRADITIONAL_STR, SPIDER_TRADITIONAL_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_NO_AUTO_CREATE_USER + if (sql_mode & MODE_NO_AUTO_CREATE_USER) + { + if (str->reserve(SPIDER_NO_AUTO_CREATE_USER_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_NO_AUTO_CREATE_USER_STR, SPIDER_NO_AUTO_CREATE_USER_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_HIGH_NOT_PRECEDENCE + if (sql_mode & MODE_HIGH_NOT_PRECEDENCE) + { + if (str->reserve(SPIDER_HIGH_NOT_PRECEDENCE_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_HIGH_NOT_PRECEDENCE_STR, SPIDER_HIGH_NOT_PRECEDENCE_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_NO_ENGINE_SUBSTITUTION + if (sql_mode & MODE_NO_ENGINE_SUBSTITUTION) + { + if (str->reserve(SPIDER_NO_ENGINE_SUBSTITUTION_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_NO_ENGINE_SUBSTITUTION_STR, SPIDER_NO_ENGINE_SUBSTITUTION_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_PAD_CHAR_TO_FULL_LENGTH + if (sql_mode & MODE_PAD_CHAR_TO_FULL_LENGTH) + { + if (str->reserve(SPIDER_PAD_CHAR_TO_FULL_LENGTH_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_PAD_CHAR_TO_FULL_LENGTH_STR, SPIDER_PAD_CHAR_TO_FULL_LENGTH_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif + DBUG_RETURN(0); +} + +int spider_db_mariadb_util::append_sql_mode_internal( + spider_string *str, + sql_mode_t sql_mode +) { + int error_num; + DBUG_ENTER("spider_db_mbase_util::append_sql_mode_internal"); + DBUG_PRINT("info",("spider this=%p", this)); + if ((error_num = spider_db_mbase_util::append_sql_mode_internal( + str, sql_mode))) + { + DBUG_RETURN(error_num); + } +#ifdef SPIDER_SQL_MODE_EMPTY_STRING_IS_NULL + if (sql_mode & MODE_EMPTY_STRING_IS_NULL) + { + if (str->reserve(SPIDER_EMPTY_STRING_IS_NULL_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_EMPTY_STRING_IS_NULL_STR, SPIDER_EMPTY_STRING_IS_NULL_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_SIMULTANEOUS_ASSIGNMENT + if (sql_mode & MODE_SIMULTANEOUS_ASSIGNMENT) + { + if (str->reserve(SPIDER_SIMULTANEOUS_ASSIGNMENT_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_SIMULTANEOUS_ASSIGNMENT_STR, SPIDER_SIMULTANEOUS_ASSIGNMENT_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif +#ifdef SPIDER_SQL_MODE_TIME_ROUND_FRACTIONAL + if (sql_mode & MODE_TIME_ROUND_FRACTIONAL) + { + if (str->reserve(SPIDER_TIME_ROUND_FRACTIONAL_LEN + SPIDER_SQL_COMMA_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_TIME_ROUND_FRACTIONAL_STR, SPIDER_TIME_ROUND_FRACTIONAL_LEN); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } +#endif + DBUG_RETURN(0); +} + +int spider_db_mbase_util::append_sql_mode( + spider_string *str, + sql_mode_t sql_mode +) { + int error_num; + uint length; + DBUG_ENTER("spider_db_mbase_util::append_sql_mode"); + DBUG_PRINT("info",("spider this=%p", this)); + if (str->reserve(SPIDER_SQL_SEMICOLON_LEN + SPIDER_SQL_SQL_MODE_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + if (str->length()) + { + str->q_append(SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN); + } + str->q_append(SPIDER_SQL_SQL_MODE_STR, SPIDER_SQL_SQL_MODE_LEN); + length = str->length(); + if ((error_num = append_sql_mode_internal(str, sql_mode))) + { + DBUG_RETURN(error_num); + } + if (str->length() > length) + { + str->length(str->length() - SPIDER_SQL_COMMA_LEN); + } else { + if (str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + } + str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); + DBUG_RETURN(0); +} + int spider_db_mbase_util::append_time_zone( spider_string *str, Time_zone *time_zone @@ -5074,9 +6565,10 @@ int spider_db_mbase_util::open_item_func( } break; case Item_func::LIKE_FUNC: +#ifdef SPIDER_LIKE_FUNC_HAS_GET_NEGATED if (str) { - if (((Item_func_like *)item_func)->negated) + if (((Item_func_like *)item_func)->get_negated()) { func_name = SPIDER_SQL_NOT_LIKE_STR; func_name_length = SPIDER_SQL_NOT_LIKE_LEN; @@ -5088,6 +6580,9 @@ int spider_db_mbase_util::open_item_func( } } break; +#else + DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM); +#endif default: THD *thd = spider->trx->thd; SPIDER_SHARE *share = spider->share; @@ -7002,6 +8497,15 @@ int spider_mbase_share::discover_table_structure( } #endif +#ifdef HA_HAS_CHECKSUM_EXTENDED +bool spider_mbase_share::checksum_support() +{ + DBUG_ENTER("spider_mbase_share::checksum_support"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_RETURN(TRUE); +} +#endif + spider_mbase_handler::spider_mbase_handler( ha_spider *spider, spider_mbase_share *db_share, @@ -7127,10 +8631,12 @@ int spider_mbase_handler::init() } sql.set_charset(share->access_charset); sql_part.set_charset(share->access_charset); + sql_part2.set_charset(share->access_charset); ha_sql.set_charset(share->access_charset); insert_sql.set_charset(share->access_charset); update_sql.set_charset(share->access_charset); tmp_sql.set_charset(share->access_charset); + dup_update_sql.set_charset(share->access_charset); upd_tmp_tbl_prm.init(); upd_tmp_tbl_prm.field_count = 1; if (!(link_for_hash = (SPIDER_LINK_FOR_HASH *) @@ -7935,6 +9441,7 @@ int spider_mbase_handler::append_insert( ) { SPIDER_SHARE *share = spider->share; DBUG_ENTER("spider_mbase_handler::append_insert"); + direct_insert_kind = SPIDER_SQL_DIRECT_INSERT_KIND_INSERT; if ( ( spider->write_can_replace || @@ -7944,6 +9451,7 @@ int spider_mbase_handler::append_insert( ) && spider->direct_dup_insert ) { + direct_insert_kind = SPIDER_SQL_DIRECT_INSERT_KIND_REPLACE; if (str->reserve(SPIDER_SQL_REPLACE_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(SPIDER_SQL_REPLACE_STR, SPIDER_SQL_REPLACE_LEN); @@ -7991,6 +9499,7 @@ int spider_mbase_handler::append_insert( spider->sql_command != SQLCOM_REPLACE && spider->sql_command != SQLCOM_REPLACE_SELECT ) { + direct_insert_kind = SPIDER_SQL_DIRECT_INSERT_KIND_IGNORE; if (str->reserve(SPIDER_SQL_SQL_IGNORE_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(SPIDER_SQL_SQL_IGNORE_STR, SPIDER_SQL_SQL_IGNORE_LEN); @@ -9207,6 +10716,7 @@ int spider_mbase_handler::append_is_null( key->flag == HA_READ_KEY_EXACT || key->flag == HA_READ_KEY_OR_NEXT ) { +#ifdef SPIDER_HANDLER_SUPPORT_MULTIPLE_KEY_PARTS if (tgt_final) { if (str->reserve(SPIDER_SQL_EQUAL_LEN)) @@ -9217,11 +10727,23 @@ int spider_mbase_handler::append_is_null( if (str->reserve(SPIDER_SQL_NULL_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(SPIDER_SQL_NULL_STR, SPIDER_SQL_NULL_LEN); +#else + if (str_part->length() == SPIDER_SQL_OPEN_PAREN_LEN) + { + if (str->reserve(SPIDER_SQL_EQUAL_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN); + str = str_part; + if (str->reserve(SPIDER_SQL_NULL_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + str->q_append(SPIDER_SQL_NULL_STR, SPIDER_SQL_NULL_LEN); + } +#endif } else { +#ifdef SPIDER_HANDLER_SUPPORT_MULTIPLE_KEY_PARTS if (str_part->length() == SPIDER_SQL_OPEN_PAREN_LEN) { str = str_part; - /* first index column */ str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN); ha_next_pos = str->length(); if (str->reserve(SPIDER_SQL_FIRST_LEN)) @@ -9238,6 +10760,19 @@ int spider_mbase_handler::append_is_null( DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(SPIDER_SQL_NULL_STR, SPIDER_SQL_NULL_LEN); } +#else + if (str_part->length() == SPIDER_SQL_OPEN_PAREN_LEN) + { + str = str_part; + /* first index column */ + str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN); + ha_next_pos = str->length(); + if (str->reserve(SPIDER_SQL_FIRST_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + str->q_append(SPIDER_SQL_FIRST_STR, SPIDER_SQL_FIRST_LEN); + spider->result_list.ha_read_kind = 1; + } +#endif } str = str_part2; } @@ -9319,7 +10854,9 @@ int spider_mbase_handler::append_where_terminator( } else { str_part2->length(str_part2->length() - SPIDER_SQL_AND_LEN); +#ifdef SPIDER_HANDLER_SUPPORT_MULTIPLE_KEY_PARTS str_part->length(str_part->length() - SPIDER_SQL_COMMA_LEN); +#endif if (!result_list->ha_read_kind) str_part->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN); @@ -10828,6 +12365,7 @@ int spider_mbase_handler::append_insert_terminator( dup_update_sql.length() ) { DBUG_PRINT("info",("spider add duplicate key update")); + direct_insert_kind = SPIDER_SQL_DIRECT_INSERT_KIND_DUP_UPDATE; str->length(str->length() - SPIDER_SQL_COMMA_LEN); if (str->reserve(SPIDER_SQL_DUPLICATE_KEY_UPDATE_LEN + dup_update_sql.length())) @@ -12512,16 +14050,9 @@ int spider_mbase_handler::show_table_status( pthread_mutex_unlock(&conn->mta_conn_mutex); error_num = res->fetch_table_status( sts_mode, - share->records, - share->mean_rec_length, - share->data_file_length, - share->max_data_file_length, - share->index_file_length, - auto_increment_value, - share->create_time, - share->update_time, - share->check_time + share->stat ); + auto_increment_value = share->stat.auto_increment_value; res->free_result(); delete res; if (error_num) @@ -12663,16 +14194,9 @@ int spider_mbase_handler::show_table_status( pthread_mutex_unlock(&conn->mta_conn_mutex); error_num = res->fetch_table_status( sts_mode, - share->records, - share->mean_rec_length, - share->data_file_length, - share->max_data_file_length, - share->index_file_length, - auto_increment_value, - share->create_time, - share->update_time, - share->check_time + share->stat ); + auto_increment_value = share->stat.auto_increment_value; res->free_result(); delete res; if (error_num) @@ -12701,11 +14225,11 @@ int spider_mbase_handler::show_table_status( } if (share->static_records_for_status != -1) { - share->records = (ha_rows) share->static_records_for_status; + share->stat.records = (ha_rows) share->static_records_for_status; } if (share->static_mean_rec_length != -1) { - share->mean_rec_length = (ulong) share->static_mean_rec_length; + share->stat.mean_rec_length = (ulong) share->static_mean_rec_length; } if (auto_increment_value > share->lgtm_tblhnd_share->auto_increment_value) { @@ -13039,7 +14563,8 @@ int spider_mbase_handler::show_index( DBUG_RETURN(0); } -int spider_mbase_handler::show_records( +int spider_mbase_handler::simple_action( + uint simple_action, int link_idx ) { int error_num; @@ -13047,7 +14572,49 @@ int spider_mbase_handler::show_records( SPIDER_DB_RESULT *res; SPIDER_SHARE *share = spider->share; uint pos = spider->conn_link_idx[link_idx]; - DBUG_ENTER("spider_mbase_handler::show_records"); + spider_string *str = NULL; + DBUG_ENTER("spider_mbase_handler::simple_action"); + switch (simple_action) + { + case SPIDER_SIMPLE_RECORDS: + DBUG_PRINT("info",("spider simple records")); + str = &mysql_share->show_records[pos]; + break; +#ifdef HA_HAS_CHECKSUM_EXTENDED + case SPIDER_SIMPLE_CHECKSUM_TABLE: + DBUG_PRINT("info",("spider simple checksum_table")); + str = &spider->result_list.sqls[link_idx]; + str->length(0); + if (str->reserve( + SPIDER_SQL_CHECKSUM_TABLE_LEN + + mysql_share->db_nm_max_length + + SPIDER_SQL_DOT_LEN + + mysql_share->table_nm_max_length + + /* SPIDER_SQL_NAME_QUOTE_LEN */ 4 + + ((spider->action_flags & T_QUICK) ? SPIDER_SQL_SQL_QUICK_LEN : 0) + + ((spider->action_flags & T_EXTEND) ? SPIDER_SQL_SQL_EXTENDED_LEN : 0) + )) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_SQL_CHECKSUM_TABLE_STR, + SPIDER_SQL_CHECKSUM_TABLE_LEN); + mysql_share->append_table_name(str, pos); + if (spider->action_flags & T_QUICK) + { + str->q_append(SPIDER_SQL_SQL_QUICK_STR, SPIDER_SQL_SQL_QUICK_LEN); + } + if (spider->action_flags & T_EXTEND) + { + str->q_append(SPIDER_SQL_SQL_EXTENDED_STR, + SPIDER_SQL_SQL_EXTENDED_LEN); + } + break; +#endif + default: + DBUG_ASSERT(0); + DBUG_RETURN(0); + } pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); @@ -13063,8 +14630,8 @@ int spider_mbase_handler::show_records( ( spider_db_query( conn, - mysql_share->show_records[pos].ptr(), - mysql_share->show_records[pos].length(), + str->ptr(), + str->length(), -1, &spider->need_mons[link_idx]) && (error_num = spider_db_errorno(conn)) @@ -13101,8 +14668,8 @@ int spider_mbase_handler::show_records( share); if (spider_db_query( conn, - mysql_share->show_records[pos].ptr(), - mysql_share->show_records[pos].length(), + str->ptr(), + str->length(), -1, &spider->need_mons[link_idx]) ) { @@ -13159,10 +14726,22 @@ int spider_mbase_handler::show_records( conn->mta_conn_mutex_unlock_later = FALSE; SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); - error_num = res->fetch_table_records( - 1, - spider->table_rows - ); + switch (simple_action) + { + case SPIDER_SIMPLE_RECORDS: + DBUG_PRINT("info",("spider simple records")); + error_num = res->fetch_table_records(1, spider->table_rows); + break; +#ifdef HA_HAS_CHECKSUM_EXTENDED + case SPIDER_SIMPLE_CHECKSUM_TABLE: + DBUG_PRINT("info",("spider simple checksum_table")); + error_num = res->fetch_table_checksum(spider); + break; +#endif + default: + DBUG_ASSERT(0); + break; + } res->free_result(); delete res; if (error_num) @@ -13170,10 +14749,34 @@ int spider_mbase_handler::show_records( DBUG_PRINT("info", ("spider error_num=%d 7", error_num)); DBUG_RETURN(error_num); } + DBUG_RETURN(0); +} + +int spider_mbase_handler::show_records( + int link_idx +) { + int error_num; + DBUG_ENTER("spider_mbase_handler::show_records"); + error_num = simple_action(SPIDER_SIMPLE_RECORDS, link_idx); + if (error_num) + { + DBUG_PRINT("info", ("spider error_num=%d", error_num)); + DBUG_RETURN(error_num); + } spider->trx->direct_aggregate_count++; DBUG_RETURN(0); } +#ifdef HA_HAS_CHECKSUM_EXTENDED +int spider_mbase_handler::checksum_table( + int link_idx +) { + DBUG_ENTER("spider_mbase_handler::checksum_table"); + DBUG_RETURN(simple_action(SPIDER_SIMPLE_CHECKSUM_TABLE, link_idx)); + DBUG_RETURN(0); +} +#endif + int spider_mbase_handler::show_last_insert_id( int link_idx, ulonglong &last_insert_id @@ -14311,7 +15914,7 @@ int spider_mbase_handler::append_list_item_select( )) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN); - if ((error_num = spider_db_mbase_utility->append_name(str, + if ((error_num = spider_db_mbase_utility->append_escaped_name(str, item_name, length))) { DBUG_RETURN(error_num); diff --git a/storage/spider/spd_db_mysql.h b/storage/spider/spd_db_mysql.h index d50bb0d1f9d..626bb4d5624 100644 --- a/storage/spider/spd_db_mysql.h +++ b/storage/spider/spd_db_mysql.h @@ -29,6 +29,17 @@ public: uint name_length, CHARSET_INFO *name_charset ); + int append_escaped_name( + spider_string *str, + const char *name, + uint name_length + ); + int append_escaped_name_with_charset( + spider_string *str, + const char *name, + uint name_length, + CHARSET_INFO *name_charset + ); bool is_name_quote( const char head_code ); @@ -64,6 +75,18 @@ public: spider_string *str, bool sql_log_off ); + int append_wait_timeout( + spider_string *str, + int wait_timeout + ); + virtual int append_sql_mode_internal( + spider_string *str, + sql_mode_t sql_mode + ); + int append_sql_mode( + spider_string *str, + sql_mode_t sql_mode + ); int append_time_zone( spider_string *str, Time_zone *time_zone @@ -179,6 +202,13 @@ class spider_db_mysql_util: public spider_db_mbase_util public: spider_db_mysql_util(); ~spider_db_mysql_util(); + int append_column_value( + ha_spider *spider, + spider_string *str, + Field *field, + const uchar *new_ptr, + CHARSET_INFO *access_charset + ); }; class spider_db_mariadb_util: public spider_db_mbase_util @@ -186,6 +216,17 @@ class spider_db_mariadb_util: public spider_db_mbase_util public: spider_db_mariadb_util(); ~spider_db_mariadb_util(); + int append_sql_mode_internal( + spider_string *str, + sql_mode_t sql_mode + ); + int append_column_value( + ha_spider *spider, + spider_string *str, + Field *field, + const uchar *new_ptr, + CHARSET_INFO *access_charset + ); }; class spider_db_mbase_row: public spider_db_row @@ -267,20 +308,22 @@ public: ); int fetch_table_status( int mode, - ha_rows &records, - ulong &mean_rec_length, - ulonglong &data_file_length, - ulonglong &max_data_file_length, - ulonglong &index_file_length, - ulonglong &auto_increment_value, - time_t &create_time, - time_t &update_time, - time_t &check_time + ha_statistics &stat + ); + int fetch_simple_action( + uint simple_action, + uint position, + void *param ); int fetch_table_records( int mode, ha_rows &records ); +#ifdef HA_HAS_CHECKSUM_EXTENDED + int fetch_table_checksum( + ha_spider *spider + ); +#endif int fetch_table_cardinality( int mode, TABLE *table, @@ -410,6 +453,11 @@ public: ); int next_result(); uint affected_rows(); + uint matched_rows(); + bool inserted_info( + spider_db_handler *handler, + ha_copy_info *copy_info + ); ulonglong last_insert_id(); int set_character_set( const char *csname @@ -466,6 +514,16 @@ public: bool sql_log_off, int *need_mon ); + bool set_wait_timeout_in_bulk_sql(); + int set_wait_timeout( + int wait_timeout, + int *need_mon + ); + bool set_sql_mode_in_bulk_sql(); + int set_sql_mode( + sql_mode_t sql_mode, + int *need_mon + ); bool set_time_zone_in_bulk_sql(); int set_time_zone( Time_zone *time_zone, @@ -660,6 +718,9 @@ public: spider_string *str ); #endif +#ifdef HA_HAS_CHECKSUM_EXTENDED + bool checksum_support(); +#endif protected: int create_table_names_str(); void free_table_names_str(); @@ -745,6 +806,7 @@ public: spider_mbase_share *mysql_share; SPIDER_LINK_FOR_HASH *link_for_hash; uchar *minimum_select_bitmap; + uchar direct_insert_kind; spider_mbase_handler( ha_spider *spider, spider_mbase_share *share, @@ -1439,9 +1501,18 @@ public: int link_idx, int crd_mode ); + int simple_action( + uint simple_action, + int link_idx + ); int show_records( int link_idx ); +#ifdef HA_HAS_CHECKSUM_EXTENDED + int checksum_table( + int link_idx + ); +#endif int show_last_insert_id( int link_idx, ulonglong &last_insert_id diff --git a/storage/spider/spd_db_oracle.cc b/storage/spider/spd_db_oracle.cc index b7e8100e480..b7561ccb96e 100644 --- a/storage/spider/spd_db_oracle.cc +++ b/storage/spider/spd_db_oracle.cc @@ -927,30 +927,22 @@ SPIDER_DB_ROW *spider_db_oracle_result::fetch_row_from_tmp_table( int spider_db_oracle_result::fetch_table_status( int mode, - ha_rows &records, - ulong &mean_rec_length, - ulonglong &data_file_length, - ulonglong &max_data_file_length, - ulonglong &index_file_length, - ulonglong &auto_increment_value, - time_t &create_time, - time_t &update_time, - time_t &check_time + ha_statistics &stat ) { DBUG_ENTER("spider_db_oracle_result::fetch_table_status"); DBUG_PRINT("info",("spider this=%p", this)); /* TODO: develop later */ - records = 2; - mean_rec_length = 65535; - data_file_length = 65535; - max_data_file_length = 65535; - index_file_length = 65535; + stat.records = 2; + stat.mean_rec_length = 65535; + stat.data_file_length = 65535; + stat.max_data_file_length = 65535; + stat.index_file_length = 65535; /* auto_increment_value = 0; */ - create_time = (time_t) 0; - update_time = (time_t) 0; - check_time = (time_t) 0; + stat.create_time = (time_t) 0; + stat.update_time = (time_t) 0; + stat.check_time = (time_t) 0; DBUG_RETURN(0); } @@ -1349,7 +1341,7 @@ int spider_db_oracle::connect( this->connect_retry_interval = connect_retry_interval; if ((error_num = spider_create_conn_thread(conn))) DBUG_RETURN(error_num); - spider_bg_conn_simple_action(conn, SPIDER_BG_SIMPLE_CONNECT, TRUE, NULL, + spider_bg_conn_simple_action(conn, SPIDER_SIMPLE_CONNECT, TRUE, NULL, 0, NULL); if (stored_error_num) @@ -1440,7 +1432,7 @@ void spider_db_oracle::disconnect() DBUG_PRINT("info",("spider this=%p", this)); if (!conn->bg_init) DBUG_VOID_RETURN; - spider_bg_conn_simple_action(conn, SPIDER_BG_SIMPLE_DISCONNECT, TRUE, NULL, + spider_bg_conn_simple_action(conn, SPIDER_SIMPLE_DISCONNECT, TRUE, NULL, 0, NULL); DBUG_VOID_RETURN; } @@ -1739,6 +1731,22 @@ uint spider_db_oracle::affected_rows() DBUG_RETURN(update_rows); } +uint spider_db_oracle::matched_rows() +{ + DBUG_ENTER("spider_db_oracle::matched_rows"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_RETURN(0); +} + +bool spider_db_oracle::inserted_info( + spider_db_handler *handler, + ha_copy_info *copy_info +) { + DBUG_ENTER("spider_db_oracle::inserted_info"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_RETURN(FALSE); +} + ulonglong spider_db_oracle::last_insert_id() { DBUG_ENTER("spider_db_oracle::last_insert_id"); @@ -2174,6 +2182,40 @@ int spider_db_oracle::set_sql_log_off( DBUG_RETURN(0); } +bool spider_db_oracle::set_wait_timeout_in_bulk_sql() +{ + DBUG_ENTER("spider_db_oracle::set_wait_timeout_in_bulk_sql"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_RETURN(FALSE); +} + +int spider_db_oracle::set_wait_timeout( + int wait_timeout, + int *need_mon +) { + DBUG_ENTER("spider_db_oracle::set_wait_timeout"); + DBUG_PRINT("info",("spider this=%p", this)); + /* nothing to do */ + DBUG_RETURN(0); +} + +bool spider_db_oracle::set_sql_mode_in_bulk_sql() +{ + DBUG_ENTER("spider_db_oracle::set_sql_mode_in_bulk_sql"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_RETURN(FALSE); +} + +int spider_db_oracle::set_sql_mode( + sql_mode_t sql_mode, + int *need_mon +) { + DBUG_ENTER("spider_db_oracle::set_sql_mode"); + DBUG_PRINT("info",("spider this=%p", this)); + /* nothing to do */ + DBUG_RETURN(0); +} + bool spider_db_oracle::set_time_zone_in_bulk_sql() { DBUG_ENTER("spider_db_oracle::set_time_zone_in_bulk_sql"); @@ -2589,6 +2631,57 @@ int spider_db_oracle_util::append_name_with_charset( DBUG_RETURN(0); } +int spider_db_oracle_util::append_escaped_name( + spider_string *str, + const char *name, + uint name_length +) { + int error_num; + DBUG_ENTER("spider_db_oracle_util::append_name"); + if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN * 2 + name_length * 2)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); + if ((error_num = spider_db_append_name_with_quote_str_internal( + str, name, name_length, dbton_id))) + { + DBUG_RETURN(error_num); + } + if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); + DBUG_RETURN(0); +} + +int spider_db_oracle_util::append_escaped_name_with_charset( + spider_string *str, + const char *name, + uint name_length, + CHARSET_INFO *name_charset +) { + int error_num; + DBUG_ENTER("spider_db_oracle_util::append_name_with_charset"); + if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN * 2 + name_length * 2)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); + if ((error_num = spider_db_append_name_with_quote_str_internal( + str, name, name_length, name_charset, dbton_id))) + { + DBUG_RETURN(error_num); + } + if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); + DBUG_RETURN(0); +} + bool spider_db_oracle_util::is_name_quote( const char head_code ) { @@ -2880,6 +2973,26 @@ int spider_db_oracle_util::append_sql_log_off( DBUG_RETURN(0); } +int spider_db_oracle_util::append_wait_timeout( + spider_string *str, + int wait_timeout +) { + DBUG_ENTER("spider_db_oracle_util::append_wait_timeout"); + DBUG_PRINT("info",("spider this=%p", this)); + /* nothing to do */ + DBUG_RETURN(0); +} + +int spider_db_oracle_util::append_sql_mode( + spider_string *str, + sql_mode_t sql_mode +) { + DBUG_ENTER("spider_db_oracle_util::append_sql_mode"); + DBUG_PRINT("info",("spider this=%p", this)); + /* nothing to do */ + DBUG_RETURN(0); +} + int spider_db_oracle_util::append_time_zone( spider_string *str, Time_zone *time_zone @@ -4086,13 +4199,31 @@ int spider_db_oracle_util::open_item_func( case Item_func::LE_FUNC: case Item_func::GE_FUNC: case Item_func::GT_FUNC: - case Item_func::LIKE_FUNC: if (str) { func_name = (char*) item_func->func_name(); func_name_length = strlen(func_name); } break; + case Item_func::LIKE_FUNC: +#ifdef SPIDER_LIKE_FUNC_HAS_GET_NEGATED + if (str) + { + if (((Item_func_like *)item_func)->get_negated()) + { + func_name = SPIDER_SQL_NOT_LIKE_STR; + func_name_length = SPIDER_SQL_NOT_LIKE_LEN; + } + else + { + func_name = (char*)item_func->func_name(); + func_name_length = strlen(func_name); + } + } + break; +#else + DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM); +#endif default: THD *thd = spider->trx->thd; SPIDER_SHARE *share = spider->share; @@ -5450,10 +5581,12 @@ int spider_oracle_handler::init() } sql.set_charset(share->access_charset); sql_part.set_charset(share->access_charset); + sql_part2.set_charset(share->access_charset); ha_sql.set_charset(share->access_charset); insert_sql.set_charset(share->access_charset); update_sql.set_charset(share->access_charset); tmp_sql.set_charset(share->access_charset); + dup_update_sql.set_charset(share->access_charset); upd_tmp_tbl_prm.init(); upd_tmp_tbl_prm.field_count = 1; if (!(link_for_hash = (SPIDER_LINK_FOR_HASH *) @@ -11060,15 +11193,15 @@ int spider_oracle_handler::show_table_status( if (sts_mode == 1) { - if (!share->records) - share->records = 10000; - share->mean_rec_length = 65535; - share->data_file_length = 65535; - share->max_data_file_length = 65535; - share->index_file_length = 65535; - share->create_time = (time_t) 0; - share->update_time = (time_t) 0; - share->check_time = (time_t) 0; + if (!share->stat.records) + share->stat.records = 10000; + share->stat.mean_rec_length = 65535; + share->stat.data_file_length = 65535; + share->stat.max_data_file_length = 65535; + share->stat.index_file_length = 65535; + share->stat.create_time = (time_t) 0; + share->stat.update_time = (time_t) 0; + share->stat.check_time = (time_t) 0; } else { pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex); @@ -11167,16 +11300,9 @@ int spider_oracle_handler::show_table_status( pthread_mutex_unlock(&conn->mta_conn_mutex); error_num = res->fetch_table_status( sts_mode, - share->records, - share->mean_rec_length, - share->data_file_length, - share->max_data_file_length, - share->index_file_length, - auto_increment_value, - share->create_time, - share->update_time, - share->check_time + share->stat ); + auto_increment_value = share->stat.auto_increment_value; res->free_result(); delete res; if (error_num) @@ -12774,7 +12900,7 @@ int spider_oracle_handler::append_list_item_select( )) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN); - if ((error_num = spider_db_oracle_utility.append_name(str, + if ((error_num = spider_db_oracle_utility.append_escaped_name(str, item_name, length))) { DBUG_RETURN(error_num); diff --git a/storage/spider/spd_db_oracle.h b/storage/spider/spd_db_oracle.h index 28836f9e340..ebdc23a9bfa 100644 --- a/storage/spider/spd_db_oracle.h +++ b/storage/spider/spd_db_oracle.h @@ -32,6 +32,17 @@ public: uint name_length, CHARSET_INFO *name_charset ); + int append_escaped_name( + spider_string *str, + const char *name, + uint name_length + ); + int append_escaped_name_with_charset( + spider_string *str, + const char *name, + uint name_length, + CHARSET_INFO *name_charset + ); bool is_name_quote( const char head_code ); @@ -67,6 +78,14 @@ public: spider_string *str, bool sql_log_off ); + int append_wait_timeout( + spider_string *str, + int wait_timeout + ); + int append_sql_mode( + spider_string *str, + sql_mode_t sql_mode + ); int append_time_zone( spider_string *str, Time_zone *time_zone @@ -235,15 +254,7 @@ public: ); int fetch_table_status( int mode, - ha_rows &records, - ulong &mean_rec_length, - ulonglong &data_file_length, - ulonglong &max_data_file_length, - ulonglong &index_file_length, - ulonglong &auto_increment_value, - time_t &create_time, - time_t &update_time, - time_t &check_time + ha_statistics &stat ); int fetch_table_records( int mode, @@ -374,6 +385,11 @@ public: ); int next_result(); uint affected_rows(); + uint matched_rows(); + bool inserted_info( + spider_db_handler *handler, + ha_copy_info *copy_info + ); ulonglong last_insert_id(); int set_character_set( const char *csname @@ -430,6 +446,16 @@ public: bool sql_log_off, int *need_mon ); + bool set_wait_timeout_in_bulk_sql(); + int set_wait_timeout( + int wait_timeout, + int *need_mon + ); + bool set_sql_mode_in_bulk_sql(); + int set_sql_mode( + sql_mode_t sql_mode, + int *need_mon + ); bool set_time_zone_in_bulk_sql(); int set_time_zone( Time_zone *time_zone, diff --git a/storage/spider/spd_direct_sql.cc b/storage/spider/spd_direct_sql.cc index 7237d0877a7..09f23046455 100644 --- a/storage/spider/spd_direct_sql.cc +++ b/storage/spider/spd_direct_sql.cc @@ -1115,7 +1115,7 @@ int spider_udf_parse_direct_sql_param( ) { int error_num = 0, roop_count; char *param_string = NULL; - char *sprit_ptr[2]; + char *sprit_ptr; char *tmp_ptr, *tmp_ptr2, *start_ptr; int title_length; SPIDER_PARAM_STRING_PARSE param_string_parse; @@ -1154,23 +1154,17 @@ int spider_udf_parse_direct_sql_param( } DBUG_PRINT("info",("spider param_string=%s", param_string)); - sprit_ptr[0] = param_string; + sprit_ptr = param_string; param_string_parse.init(param_string, ER_SPIDER_INVALID_UDF_PARAM_NUM); - while (sprit_ptr[0]) + while (sprit_ptr) { - if ((sprit_ptr[1] = strchr(sprit_ptr[0], ','))) - { - *sprit_ptr[1] = '\0'; - sprit_ptr[1]++; - } - tmp_ptr = sprit_ptr[0]; - sprit_ptr[0] = sprit_ptr[1]; + tmp_ptr = sprit_ptr; while (*tmp_ptr == ' ' || *tmp_ptr == '\r' || *tmp_ptr == '\n' || *tmp_ptr == '\t') tmp_ptr++; if (*tmp_ptr == '\0') - continue; + break; title_length = 0; start_ptr = tmp_ptr; @@ -1183,6 +1177,11 @@ int spider_udf_parse_direct_sql_param( start_ptr++; } param_string_parse.set_param_title(tmp_ptr, tmp_ptr + title_length); + if ((error_num = param_string_parse.get_next_parameter_head( + start_ptr, &sprit_ptr))) + { + goto error; + } switch (title_length) { diff --git a/storage/spider/spd_environ.h b/storage/spider/spd_environ.h index ded2927482b..728cc7e1781 100644 --- a/storage/spider/spd_environ.h +++ b/storage/spider/spd_environ.h @@ -50,5 +50,7 @@ #if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100400 #define SPIDER_USE_CONST_ITEM_FOR_STRING_INT_REAL_DECIMAL_DATE_ITEM #define SPIDER_SQL_CACHE_IS_IN_LEX +#define SPIDER_LIKE_FUNC_HAS_GET_NEGATED +#define HA_HAS_CHECKSUM_EXTENDED #endif #endif /* SPD_ENVIRON_INCLUDED */ diff --git a/storage/spider/spd_err.h b/storage/spider/spd_err.h index a80d903bd6e..9889fcfa7fb 100644 --- a/storage/spider/spd_err.h +++ b/storage/spider/spd_err.h @@ -124,6 +124,9 @@ #define ER_SPIDER_CON_COUNT_ERROR_STR "Too many connections between spider and remote" #define ER_SPIDER_TABLE_OPEN_TIMEOUT_NUM 12714 #define ER_SPIDER_TABLE_OPEN_TIMEOUT_STR "Table %s.%s open timeout" +#define ER_SPIDER_SAME_SERVER_LINK_NUM 12720 +#define ER_SPIDER_SAME_SERVER_LINK_STR1 "Host:%s and Socket:%s aim self server. Please change spider_same_server_link parameter if this link is required." +#define ER_SPIDER_SAME_SERVER_LINK_STR2 "Host:%s and Port:%ld aim self server. Please change spider_same_server_link parameter if this link is required." #define ER_SPIDER_COND_SKIP_NUM 12801 #define ER_SPIDER_UNKNOWN_NUM 12500 diff --git a/storage/spider/spd_group_by_handler.cc b/storage/spider/spd_group_by_handler.cc index 8bd0eca507f..de041897239 100644 --- a/storage/spider/spd_group_by_handler.cc +++ b/storage/spider/spd_group_by_handler.cc @@ -1654,21 +1654,18 @@ group_by_handler *spider_create_group_by_handler( if (from->table->part_info) { DBUG_PRINT("info",("spider partition handler")); -#if defined(PARTITION_HAS_GET_CHILD_HANDLERS) && defined(PARTITION_HAS_GET_PART_SPEC) - ha_partition *partition = (ha_partition *) from->table->file; - part_id_range *part_spec = partition->get_part_spec(); - DBUG_PRINT("info",("spider part_spec->start_part=%u", part_spec->start_part)); - DBUG_PRINT("info",("spider part_spec->end_part=%u", part_spec->end_part)); - if ( - part_spec->start_part == partition->get_no_current_part_id() || - part_spec->start_part != part_spec->end_part - ) { +#if defined(PARTITION_HAS_GET_CHILD_HANDLERS) + partition_info *part_info = from->table->part_info; + uint bits = bitmap_bits_set(&part_info->read_partitions); + DBUG_PRINT("info",("spider bits=%u", bits)); + if (bits != 1) + { DBUG_PRINT("info",("spider using multiple partitions is not supported by this feature yet")); #else DBUG_PRINT("info",("spider partition is not supported by this feature yet")); #endif DBUG_RETURN(NULL); -#if defined(PARTITION_HAS_GET_CHILD_HANDLERS) && defined(PARTITION_HAS_GET_PART_SPEC) +#if defined(PARTITION_HAS_GET_CHILD_HANDLERS) } #endif } @@ -1686,17 +1683,18 @@ group_by_handler *spider_create_group_by_handler( /* all tables are const_table */ DBUG_RETURN(NULL); } -#if defined(PARTITION_HAS_GET_CHILD_HANDLERS) && defined(PARTITION_HAS_GET_PART_SPEC) +#if defined(PARTITION_HAS_GET_CHILD_HANDLERS) if (from->table->part_info) { + partition_info *part_info = from->table->part_info; + uint part = bitmap_get_first_set(&part_info->read_partitions); ha_partition *partition = (ha_partition *) from->table->file; - part_id_range *part_spec = partition->get_part_spec(); handler **handlers = partition->get_child_handlers(); - spider = (ha_spider *) handlers[part_spec->start_part]; + spider = (ha_spider *) handlers[part]; } else { #endif spider = (ha_spider *) from->table->file; -#if defined(PARTITION_HAS_GET_CHILD_HANDLERS) && defined(PARTITION_HAS_GET_PART_SPEC) +#if defined(PARTITION_HAS_GET_CHILD_HANDLERS) } #endif share = spider->share; @@ -1717,17 +1715,18 @@ group_by_handler *spider_create_group_by_handler( { if (from->table->const_table) continue; -#if defined(PARTITION_HAS_GET_CHILD_HANDLERS) && defined(PARTITION_HAS_GET_PART_SPEC) +#if defined(PARTITION_HAS_GET_CHILD_HANDLERS) if (from->table->part_info) { + partition_info *part_info = from->table->part_info; + uint part = bitmap_get_first_set(&part_info->read_partitions); ha_partition *partition = (ha_partition *) from->table->file; - part_id_range *part_spec = partition->get_part_spec(); handler **handlers = partition->get_child_handlers(); - spider = (ha_spider *) handlers[part_spec->start_part]; + spider = (ha_spider *) handlers[part]; } else { #endif spider = (ha_spider *) from->table->file; -#if defined(PARTITION_HAS_GET_CHILD_HANDLERS) && defined(PARTITION_HAS_GET_PART_SPEC) +#if defined(PARTITION_HAS_GET_CHILD_HANDLERS) } #endif share = spider->share; @@ -1755,17 +1754,18 @@ group_by_handler *spider_create_group_by_handler( do { if (from->table->const_table) continue; -#if defined(PARTITION_HAS_GET_CHILD_HANDLERS) && defined(PARTITION_HAS_GET_PART_SPEC) +#if defined(PARTITION_HAS_GET_CHILD_HANDLERS) if (from->table->part_info) { + partition_info *part_info = from->table->part_info; + uint part = bitmap_get_first_set(&part_info->read_partitions); ha_partition *partition = (ha_partition *) from->table->file; - part_id_range *part_spec = partition->get_part_spec(); handler **handlers = partition->get_child_handlers(); - spider = (ha_spider *) handlers[part_spec->start_part]; + spider = (ha_spider *) handlers[part]; } else { #endif spider = (ha_spider *) from->table->file; -#if defined(PARTITION_HAS_GET_CHILD_HANDLERS) && defined(PARTITION_HAS_GET_PART_SPEC) +#if defined(PARTITION_HAS_GET_CHILD_HANDLERS) } #endif share = spider->share; @@ -1908,17 +1908,18 @@ group_by_handler *spider_create_group_by_handler( { from = from->next_local; } -#if defined(PARTITION_HAS_GET_CHILD_HANDLERS) && defined(PARTITION_HAS_GET_PART_SPEC) +#if defined(PARTITION_HAS_GET_CHILD_HANDLERS) if (from->table->part_info) { + partition_info *part_info = from->table->part_info; + uint part = bitmap_get_first_set(&part_info->read_partitions); ha_partition *partition = (ha_partition *) from->table->file; - part_id_range *part_spec = partition->get_part_spec(); handler **handlers = partition->get_child_handlers(); - spider = (ha_spider *) handlers[part_spec->start_part]; + spider = (ha_spider *) handlers[part]; } else { #endif spider = (ha_spider *) from->table->file; -#if defined(PARTITION_HAS_GET_CHILD_HANDLERS) && defined(PARTITION_HAS_GET_PART_SPEC) +#if defined(PARTITION_HAS_GET_CHILD_HANDLERS) } #endif share = spider->share; @@ -1996,17 +1997,18 @@ group_by_handler *spider_create_group_by_handler( continue; fields->clear_conn_holder_from_conn(); -#if defined(PARTITION_HAS_GET_CHILD_HANDLERS) && defined(PARTITION_HAS_GET_PART_SPEC) +#if defined(PARTITION_HAS_GET_CHILD_HANDLERS) if (from->table->part_info) { + partition_info *part_info = from->table->part_info; + uint part = bitmap_get_first_set(&part_info->read_partitions); ha_partition *partition = (ha_partition *) from->table->file; - part_id_range *part_spec = partition->get_part_spec(); handler **handlers = partition->get_child_handlers(); - spider = (ha_spider *) handlers[part_spec->start_part]; + spider = (ha_spider *) handlers[part]; } else { #endif spider = (ha_spider *) from->table->file; -#if defined(PARTITION_HAS_GET_CHILD_HANDLERS) && defined(PARTITION_HAS_GET_PART_SPEC) +#if defined(PARTITION_HAS_GET_CHILD_HANDLERS) } #endif share = spider->share; diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h index b0a3dae72ba..95064fa4c72 100644 --- a/storage/spider/spd_include.h +++ b/storage/spider/spd_include.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2008-2018 Kentoku Shiba +/* Copyright (C) 2008-2019 Kentoku Shiba + Copyright (C) 2019 MariaDB corp This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ -#define SPIDER_DETAIL_VERSION "3.3.14" +#define SPIDER_DETAIL_VERSION "3.3.15" #define SPIDER_HEX_VERSION 0x0303 #if MYSQL_VERSION_ID < 50500 @@ -264,7 +265,7 @@ const char SPIDER_empty_string = ""; #define SPIDER_TMP_SHARE_LONG_COUNT 19 #define SPIDER_TMP_SHARE_LONGLONG_COUNT 3 -#define SPIDER_MEM_CALC_LIST_NUM 257 +#define SPIDER_MEM_CALC_LIST_NUM 268 #define SPIDER_CONN_META_BUF_LEN 64 #define SPIDER_BACKUP_DASTATUS \ @@ -296,6 +297,8 @@ typedef struct st_spider_thread volatile bool killed; volatile bool thd_wait; volatile bool first_free_wait; + volatile bool init_command; + volatile int error; pthread_t thread; pthread_cond_t cond; pthread_mutex_t mutex; @@ -453,6 +456,8 @@ typedef struct st_spider_conn bool disable_reconnect; int autocommit; int sql_log_off; + int wait_timeout; + sql_mode_t sql_mode; THD *thd; void *another_ha_first; void *another_ha_last; @@ -559,8 +564,10 @@ typedef struct st_spider_conn bool queued_ping; bool queued_trx_isolation; bool queued_semi_trx_isolation; + bool queued_wait_timeout; bool queued_autocommit; bool queued_sql_log_off; + bool queued_sql_mode; bool queued_time_zone; bool queued_trx_start; bool queued_xa_start; @@ -571,8 +578,10 @@ typedef struct st_spider_conn int queued_ping_link_idx; int queued_trx_isolation_val; int queued_semi_trx_isolation_val; + int queued_wait_timeout_val; bool queued_autocommit_val; bool queued_sql_log_off_val; + sql_mode_t queued_sql_mode_val; Time_zone *queued_time_zone_val; XID *queued_xa_start_xid; @@ -656,15 +665,7 @@ typedef struct st_spider_patition_share volatile bool crd_init; volatile time_t sts_get_time; volatile time_t crd_get_time; - ulonglong data_file_length; - ulonglong max_data_file_length; - ulonglong index_file_length; - ulonglong auto_increment_value; - ha_rows records; - ulong mean_rec_length; - time_t check_time; - time_t create_time; - time_t update_time; + ha_statistics stat; longlong *cardinality; /* @@ -891,17 +892,7 @@ typedef struct st_spider_share volatile bool auto_increment_init; volatile ulonglong auto_increment_lclval; */ - ulonglong data_file_length; - ulonglong max_data_file_length; - ulonglong index_file_length; -/* - ulonglong auto_increment_value; -*/ - ha_rows records; - ulong mean_rec_length; - time_t check_time; - time_t create_time; - time_t update_time; + ha_statistics stat; longlong static_records_for_status; longlong static_mean_rec_length; @@ -1465,7 +1456,7 @@ typedef struct st_spider_ip_port_conn { #ifdef SPIDER_HAS_HASH_VALUE_TYPE my_hash_value_type key_hash_value; #endif - char remote_ip_str[SPIDER_CONN_META_BUF_LEN]; + char *remote_ip_str; long remote_port; ulong ip_port_count; volatile ulong waiting_count; diff --git a/storage/spider/spd_init_query.h b/storage/spider/spd_init_query.h new file mode 100644 index 00000000000..4c58f8d80a4 --- /dev/null +++ b/storage/spider/spd_init_query.h @@ -0,0 +1,782 @@ +/* Copyright (C) 2010-2019 Kentoku Shiba + Copyright (C) 2019 MariaDB corp + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + This SQL script creates system tables for SPIDER + or fixes incompatibilities if ones already exist. +*/ + +static LEX_STRING spider_init_queries[] = { + {C_STRING_WITH_LEN( + "create table if not exists mysql.spider_xa(" + " format_id int not null default 0," + " gtrid_length int not null default 0," + " bqual_length int not null default 0," + " data char(128) charset binary not null default ''," + " status char(8) not null default ''," + " primary key (data, format_id, gtrid_length)," + " key idx1 (status)" + ") engine=MyISAM default charset=utf8 collate=utf8_bin" + )}, + {C_STRING_WITH_LEN( + "create table if not exists mysql.spider_xa_member(" + " format_id int not null default 0," + " gtrid_length int not null default 0," + " bqual_length int not null default 0," + " data char(128) charset binary not null default ''," + " scheme char(64) not null default ''," + " host char(64) not null default ''," + " port char(5) not null default ''," + " socket text not null," + " username char(64) not null default ''," + " password char(64) not null default ''," + " ssl_ca text," + " ssl_capath text," + " ssl_cert text," + " ssl_cipher char(64) default null," + " ssl_key text," + " ssl_verify_server_cert tinyint not null default 0," + " default_file text," + " default_group char(64) default null," + " key idx1 (data, format_id, gtrid_length, host)" + ") engine=MyISAM default charset=utf8 collate=utf8_bin" + )}, + {C_STRING_WITH_LEN( + "create table if not exists mysql.spider_xa_failed_log(" + " format_id int not null default 0," + " gtrid_length int not null default 0," + " bqual_length int not null default 0," + " data char(128) charset binary not null default ''," + " scheme char(64) not null default ''," + " host char(64) not null default ''," + " port char(5) not null default ''," + " socket text not null," + " username char(64) not null default ''," + " password char(64) not null default ''," + " ssl_ca text," + " ssl_capath text," + " ssl_cert text," + " ssl_cipher char(64) default null," + " ssl_key text," + " ssl_verify_server_cert tinyint not null default 0," + " default_file text," + " default_group char(64) default null," + " thread_id int default null," + " status char(8) not null default ''," + " failed_time timestamp not null default current_timestamp," + " key idx1 (data, format_id, gtrid_length, host)" + ") engine=MyISAM default charset=utf8 collate=utf8_bin" + )}, + {C_STRING_WITH_LEN( + "create table if not exists mysql.spider_tables(" + " db_name char(64) not null default ''," + " table_name char(199) not null default ''," + " link_id int not null default 0," + " priority bigint not null default 0," + " server char(64) default null," + " scheme char(64) default null," + " host char(64) default null," + " port char(5) default null," + " socket text," + " username char(64) default null," + " password char(64) default null," + " ssl_ca text," + " ssl_capath text," + " ssl_cert text," + " ssl_cipher char(64) default null," + " ssl_key text," + " ssl_verify_server_cert tinyint not null default 0," + " monitoring_binlog_pos_at_failing tinyint not null default 0," + " default_file text," + " default_group char(64) default null," + " tgt_db_name char(64) default null," + " tgt_table_name char(64) default null," + " link_status tinyint not null default 1," + " block_status tinyint not null default 0," + " static_link_id char(64) default null," + " primary key (db_name, table_name, link_id)," + " key idx1 (priority)," + " unique key uidx1 (db_name, table_name, static_link_id)" + ") engine=MyISAM default charset=utf8 collate=utf8_bin" + )}, + {C_STRING_WITH_LEN( + "create table if not exists mysql.spider_link_mon_servers(" + " db_name char(64) not null default ''," + " table_name char(199) not null default ''," + " link_id char(64) not null default ''," + " sid int unsigned not null default 0," + " server char(64) default null," + " scheme char(64) default null," + " host char(64) default null," + " port char(5) default null," + " socket text," + " username char(64) default null," + " password char(64) default null," + " ssl_ca text," + " ssl_capath text," + " ssl_cert text," + " ssl_cipher char(64) default null," + " ssl_key text," + " ssl_verify_server_cert tinyint not null default 0," + " default_file text," + " default_group char(64) default null," + " primary key (db_name, table_name, link_id, sid)" + ") engine=MyISAM default charset=utf8 collate=utf8_bin" + )}, + {C_STRING_WITH_LEN( + "create table if not exists mysql.spider_link_failed_log(" + " db_name char(64) not null default ''," + " table_name char(199) not null default ''," + " link_id char(64) not null default ''," + " failed_time timestamp not null default current_timestamp" + ") engine=MyISAM default charset=utf8 collate=utf8_bin" + )}, + {C_STRING_WITH_LEN( + "create table if not exists mysql.spider_table_position_for_recovery(" + " db_name char(64) not null default ''," + " table_name char(199) not null default ''," + " failed_link_id int not null default 0," + " source_link_id int not null default 0," + " file text," + " position text," + " gtid text," + " primary key (db_name, table_name, failed_link_id, source_link_id)" + ") engine=MyISAM default charset=utf8 collate=utf8_bin" + )}, + {C_STRING_WITH_LEN( + "create table if not exists mysql.spider_table_sts(" + " db_name char(64) not null default ''," + " table_name char(199) not null default ''," + " data_file_length bigint unsigned not null default 0," + " max_data_file_length bigint unsigned not null default 0," + " index_file_length bigint unsigned not null default 0," + " records bigint unsigned not null default 0," + " mean_rec_length bigint unsigned not null default 0," + " check_time datetime not null default '0000-00-00 00:00:00'," + " create_time datetime not null default '0000-00-00 00:00:00'," + " update_time datetime not null default '0000-00-00 00:00:00'," + " checksum bigint unsigned default null," + " primary key (db_name, table_name)" + ") engine=MyISAM default charset=utf8 collate=utf8_bin" + )}, + {C_STRING_WITH_LEN( + "create table if not exists mysql.spider_table_crd(" + " db_name char(64) not null default ''," + " table_name char(199) not null default ''," + " key_seq int unsigned not null default 0," + " cardinality bigint not null default 0," + " primary key (db_name, table_name, key_seq)" + ") engine=MyISAM default charset=utf8 collate=utf8_bin" + )}, +/* + If tables already exist and their definition differ + from the latest ones, we fix them here. +*/ + {C_STRING_WITH_LEN( + "drop procedure if exists mysql.spider_fix_one_table" + )}, + {C_STRING_WITH_LEN( + "drop procedure if exists mysql.spider_fix_system_tables" + )}, + {C_STRING_WITH_LEN( + "create procedure mysql.spider_fix_one_table" + " (tab_name char(255) charset utf8 collate utf8_bin," + " test_col_name char(255) charset utf8 collate utf8_bin," + " _sql text charset utf8 collate utf8_bin)" + "begin" + " set @col_exists := 0;" + " select 1 into @col_exists from INFORMATION_SCHEMA.COLUMNS" + " where TABLE_SCHEMA = 'mysql'" + " AND TABLE_NAME = tab_name" + " AND COLUMN_NAME = test_col_name;" + " if @col_exists = 0 then" + " select @stmt := _sql;" + " prepare sp_stmt1 from @stmt;" + " execute sp_stmt1;" + " end if;" + "end;" + )}, + {C_STRING_WITH_LEN( + "create procedure mysql.spider_fix_system_tables()" + "begin" + " select substring_index(substring_index(version(), '-', 2), '-', -1)" + " into @server_name;" + " select substring_index(version(), '.', 1)" + " into @server_major_version;" + " select substring_index(substring_index(version(), '.', 2), '.', -1)" + " into @server_minor_version;" +/* + Fix for 0.5 +*/ + " call mysql.spider_fix_one_table('spider_tables', 'server'," + " 'alter table mysql.spider_tables" + " add server char(64) default null," + " add scheme char(64) default null," + " add host char(64) default null," + " add port char(5) default null," + " add socket char(64) default null," + " add username char(64) default null," + " add password char(64) default null," + " add tgt_db_name char(64) default null," + " add tgt_table_name char(64) default null');" +/* + Fix for version 0.17 +*/ + " select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS" + " where TABLE_SCHEMA = 'mysql'" + " AND TABLE_NAME = 'spider_xa'" + " AND COLUMN_NAME = 'data';" + " if @col_type != 'binary(128)' then" + " alter table mysql.spider_xa" + " modify data binary(128) not null default '';" + " end if;" + " select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS" + " where TABLE_SCHEMA = 'mysql'" + " AND TABLE_NAME = 'spider_xa_member'" + " AND COLUMN_NAME = 'data';" + " if @col_type != 'binary(128)' then" + " alter table mysql.spider_xa_member" + " modify data binary(128) not null default '';" + " end if;" +/* + Fix for version 2.7 +*/ + " call mysql.spider_fix_one_table('spider_tables', 'link_id'," + " 'alter table mysql.spider_tables" + " add column link_id int not null default 0 after table_name," + " drop primary key," + " add primary key (db_name, table_name, link_id)');" +/* + Fix for version 2.8 +*/ + " call mysql.spider_fix_one_table('spider_tables', 'link_status'," + " 'alter table mysql.spider_tables" + " add column link_status tinyint not null default 1');" +/* + Fix for version 2.10 +*/ + " call mysql.spider_fix_one_table('spider_xa_member', 'ssl_ca'," + " 'alter table mysql.spider_xa_member" + " add column ssl_ca char(64) default null after password," + " add column ssl_capath char(64) default null after ssl_ca," + " add column ssl_cert char(64) default null after ssl_capath," + " add column ssl_cipher char(64) default null after ssl_cert," + " add column ssl_key char(64) default null after ssl_cipher," + " add column ssl_verify_server_cert tinyint not null default 0" + " after ssl_key," + " add column default_file char(64) default null" + " after ssl_verify_server_cert," + " add column default_group char(64) default null after default_file');" + " call mysql.spider_fix_one_table('spider_tables', 'ssl_ca'," + " 'alter table mysql.spider_tables" + " add column ssl_ca char(64) default null after password," + " add column ssl_capath char(64) default null after ssl_ca," + " add column ssl_cert char(64) default null after ssl_capath," + " add column ssl_cipher char(64) default null after ssl_cert," + " add column ssl_key char(64) default null after ssl_cipher," + " add column ssl_verify_server_cert tinyint not null default 0" + " after ssl_key," + " add column default_file char(64) default null" + " after ssl_verify_server_cert," + " add column default_group char(64) default null after default_file');" + " call mysql.spider_fix_one_table('spider_link_mon_servers', 'ssl_ca'," + " 'alter table mysql.spider_link_mon_servers" + " add column ssl_ca char(64) default null after password," + " add column ssl_capath char(64) default null after ssl_ca," + " add column ssl_cert char(64) default null after ssl_capath," + " add column ssl_cipher char(64) default null after ssl_cert," + " add column ssl_key char(64) default null after ssl_cipher," + " add column ssl_verify_server_cert tinyint not null default 0" + " after ssl_key," + " add column default_file char(64) default null" + " after ssl_verify_server_cert," + " add column default_group char(64) default null after default_file');" +/* + Fix for version 2.28 +*/ + " select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS" + " where TABLE_SCHEMA = 'mysql'" + " AND TABLE_NAME = 'spider_link_mon_servers'" + " AND COLUMN_NAME = 'sid';" + " if @col_type != 'int(10) unsigned' then" + " alter table mysql.spider_link_mon_servers" + " modify sid int unsigned not null default 0;" + " end if;" +/* + Fix for version 3.1 +*/ + " select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS" + " where TABLE_SCHEMA = 'mysql'" + " AND TABLE_NAME = 'spider_xa_member'" + " AND COLUMN_NAME = 'socket';" + " if @col_type = 'char(64)' then" + " alter table mysql.spider_xa_member" + " drop primary key," + " add index idx1 (data, format_id, gtrid_length, host)," + " modify socket text not null," + " modify ssl_ca text," + " modify ssl_capath text," + " modify ssl_cert text," + " modify ssl_key text," + " modify default_file text;" + " end if;" + " select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS" + " where TABLE_SCHEMA = 'mysql'" + " AND TABLE_NAME = 'spider_tables'" + " AND COLUMN_NAME = 'socket';" + " if @col_type = 'char(64)' then" + " alter table mysql.spider_tables" + " modify socket text," + " modify ssl_ca text," + " modify ssl_capath text," + " modify ssl_cert text," + " modify ssl_key text," + " modify default_file text;" + " end if;" + " select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS" + " where TABLE_SCHEMA = 'mysql'" + " AND TABLE_NAME = 'spider_link_mon_servers'" + " AND COLUMN_NAME = 'socket';" + " if @col_type = 'char(64)' then" + " alter table mysql.spider_link_mon_servers" + " modify socket text," + " modify ssl_ca text," + " modify ssl_capath text," + " modify ssl_cert text," + " modify ssl_key text," + " modify default_file text;" + " end if;" +/* + Fix for version 3.3.0 +*/ + " call mysql.spider_fix_one_table('spider_tables'," + " 'monitoring_binlog_pos_at_failing'," + " 'alter table mysql.spider_tables" + " add monitoring_binlog_pos_at_failing tinyint not null default 0" + " after ssl_verify_server_cert');" +/* + Fix for version 3.3.6 +*/ + " call mysql.spider_fix_one_table('spider_tables', 'block_status'," + " 'alter table mysql.spider_tables" + " add column block_status tinyint not null default 0" + " after link_status');" + " call mysql.spider_fix_one_table('spider_tables', 'static_link_id'," + " 'alter table mysql.spider_tables" + " add column static_link_id char(64) default null after block_status," + " add unique index uidx1 (db_name, table_name, static_link_id)');" + " select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS" + " where TABLE_SCHEMA = 'mysql'" + " AND TABLE_NAME = 'spider_link_mon_servers'" + " AND COLUMN_NAME = 'link_id';" + " if @col_type != 'char(64)' then" + " alter table mysql.spider_link_mon_servers" + " modify link_id char(64) not null default '';" + " end if;" + " select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS" + " where TABLE_SCHEMA = 'mysql'" + " AND TABLE_NAME = 'spider_link_failed_log'" + " AND COLUMN_NAME = 'link_id';" + " if @col_type != 'char(64)' then" + " alter table mysql.spider_link_failed_log" + " modify link_id char(64) not null default '';" + " end if;" +/* + Fix for version 3.3.10 +*/ + " select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS" + " where TABLE_SCHEMA = 'mysql'" + " AND TABLE_NAME = 'spider_tables'" + " AND COLUMN_NAME = 'table_name';" + " if @col_type != 'char(199)' then" + " alter table mysql.spider_tables" + " modify table_name char(199) not null default '';" + " end if;" + " select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS" + " where TABLE_SCHEMA = 'mysql'" + " AND TABLE_NAME = 'spider_link_mon_servers'" + " AND COLUMN_NAME = 'table_name';" + " if @col_type != 'char(199)' then" + " alter table mysql.spider_link_mon_servers" + " modify table_name char(199) not null default '';" + " end if;" + " select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS" + " where TABLE_SCHEMA = 'mysql'" + " AND TABLE_NAME = 'spider_link_failed_log'" + " AND COLUMN_NAME = 'table_name';" + " if @col_type != 'char(199)' then" + " alter table mysql.spider_link_failed_log" + " modify table_name char(199) not null default '';" + " end if;" + " select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS" + " where TABLE_SCHEMA = 'mysql'" + " AND TABLE_NAME = 'spider_table_position_for_recovery'" + " AND COLUMN_NAME = 'table_name';" + " if @col_type != 'char(199)' then" + " alter table mysql.spider_table_position_for_recovery" + " modify table_name char(199) not null default '';" + " end if;" + " select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS" + " where TABLE_SCHEMA = 'mysql'" + " AND TABLE_NAME = 'spider_table_sts'" + " AND COLUMN_NAME = 'table_name';" + " if @col_type != 'char(199)' then" + " alter table mysql.spider_table_sts" + " modify table_name char(199) not null default '';" + " end if;" + " select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS" + " where TABLE_SCHEMA = 'mysql'" + " AND TABLE_NAME = 'spider_table_crd'" + " AND COLUMN_NAME = 'table_name';" + " if @col_type != 'char(199)' then" + " alter table mysql.spider_table_crd" + " modify table_name char(199) not null default '';" + " end if;" +/* + Fix for version 3.3.15 +*/ + " call mysql.spider_fix_one_table('spider_table_sts', 'checksum'," + " 'alter table mysql.spider_table_sts" + " add column checksum bigint unsigned default null after update_time');" +/* + Fix for MariaDB 10.4: Crash-Safe system tables +*/ + " if @server_name = 'MariaDB' and" + " (" + " @server_major_version > 10 or" + " (" + " @server_major_version = 10 and" + " @server_minor_version >= 4" + " )" + " )" + " then" + " select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES" + " where TABLE_SCHEMA = 'mysql'" + " AND TABLE_NAME = 'spider_link_failed_log';" + " if @engine_name != 'Aria' then" + " alter table mysql.spider_link_failed_log" + " engine=Aria transactional=1;" + " end if;" + " select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES" + " where TABLE_SCHEMA = 'mysql'" + " AND TABLE_NAME = 'spider_link_mon_servers';" + " if @engine_name != 'Aria' then" + " alter table mysql.spider_link_mon_servers" + " engine=Aria transactional=1;" + " end if;" + " select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES" + " where TABLE_SCHEMA = 'mysql'" + " AND TABLE_NAME = 'spider_table_crd';" + " if @engine_name != 'Aria' then" + " alter table mysql.spider_table_crd" + " engine=Aria transactional=1;" + " end if;" + " select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES" + " where TABLE_SCHEMA = 'mysql'" + " AND TABLE_NAME = 'spider_table_position_for_recovery';" + " if @engine_name != 'Aria' then" + " alter table mysql.spider_table_position_for_recovery" + " engine=Aria transactional=1;" + " end if;" + " select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES" + " where TABLE_SCHEMA = 'mysql'" + " AND TABLE_NAME = 'spider_table_sts';" + " if @engine_name != 'Aria' then" + " alter table mysql.spider_table_sts" + " engine=Aria transactional=1;" + " end if;" + " select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES" + " where TABLE_SCHEMA = 'mysql'" + " AND TABLE_NAME = 'spider_tables';" + " if @engine_name != 'Aria' then" + " alter table mysql.spider_tables" + " engine=Aria transactional=1;" + " end if;" + " select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES" + " where TABLE_SCHEMA = 'mysql'" + " AND TABLE_NAME = 'spider_xa';" + " if @engine_name != 'Aria' then" + " alter table mysql.spider_xa" + " engine=Aria transactional=1;" + " end if;" + " select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES" + " where TABLE_SCHEMA = 'mysql'" + " AND TABLE_NAME = 'spider_xa_failed_log';" + " if @engine_name != 'Aria' then" + " alter table mysql.spider_xa_failed_log" + " engine=Aria transactional=1;" + " end if;" + " select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES" + " where TABLE_SCHEMA = 'mysql'" + " AND TABLE_NAME = 'spider_xa_member';" + " if @engine_name != 'Aria' then" + " alter table mysql.spider_xa_member" + " engine=Aria transactional=1;" + " end if;" + " end if;" + " if @server_name = 'MariaDB' and" + " (" + " @server_major_version > 10 or" + " (" + " @server_major_version = 10 and" + " @server_minor_version >= 6" + " )" + " )" + " then" + " /* table for ddl pushdown */" + " create table if not exists mysql.spider_rewrite_tables(" + " table_id bigint unsigned not null auto_increment," + " db_name char(64) not null default ''," + " table_name char(64) not null default ''," + " primary key (table_id)," + " unique uk1(db_name, table_name)" + " ) engine=Aria transactional=1 default charset=utf8 collate=utf8_bin;" + " create table if not exists mysql.spider_rewrite_table_tables(" + " table_id bigint unsigned not null," + " partition_id bigint unsigned not null auto_increment," + " partition_method varchar(18) default ''," + " partition_expression varchar(64) default ''," + " subpartition_method varchar(12) default ''," + " subpartition_expression varchar(64) default ''," + " connection_str text not null default ''," + " comment_str text not null default ''," + " primary key (table_id, partition_id)," + " unique uk1(table_id, partition_method, partition_expression," + " subpartition_method, subpartition_expression)" + " ) engine=Aria transactional=1 default charset=utf8 collate=utf8_bin;" + " create table if not exists mysql.spider_rewrite_table_partitions(" + " table_id bigint unsigned not null," + " partition_id bigint unsigned not null," + " partition_ordinal_position bigint unsigned not null auto_increment," + " partition_name varchar(64) not null default ''," + " partition_description varchar(64) not null default ''," + " connection_str text not null default ''," + " comment_str text not null default ''," + " primary key (table_id, partition_id, partition_ordinal_position)," + " unique key uk1 (table_id, partition_id, partition_name)" + " ) engine=Aria transactional=1 default charset=utf8 collate=utf8_bin;" + " create table if not exists mysql.spider_rewrite_table_subpartitions(" + " table_id bigint unsigned not null," + " partition_id bigint unsigned not null," + " partition_ordinal_position bigint unsigned not null," + " subpartition_ordinal_position bigint unsigned not null" + " auto_increment," + " subpartition_name varchar(64) not null default ''," + " subpartition_description varchar(64) not null default ''," + " connection_str text not null default ''," + " comment_str text not null default ''," + " primary key (table_id, partition_id, partition_ordinal_position," + " subpartition_ordinal_position)," + " unique key uk1 (table_id, partition_id, partition_ordinal_position," + " subpartition_name)" + " ) engine=Aria transactional=1 default charset=utf8 collate=utf8_bin;" + " create table if not exists mysql.spider_rewritten_tables(" + " db_name char(64) not null," + " table_name char(64) not null," + " table_id bigint unsigned not null," + " partition_id bigint unsigned not null," + " primary key (db_name, table_name, table_id, partition_id)" + " ) engine=Aria transactional=1 default charset=utf8 collate=utf8_bin;" + " end if;" + "end;" + )}, + {C_STRING_WITH_LEN( + "call mysql.spider_fix_system_tables" + )}, + {C_STRING_WITH_LEN( + "drop procedure mysql.spider_fix_one_table" + )}, + {C_STRING_WITH_LEN( + "drop procedure mysql.spider_fix_system_tables" + )}, +/* + Install a plugin and UDFs +*/ + {C_STRING_WITH_LEN( + "drop procedure if exists mysql.spider_plugin_installer" + )}, + {C_STRING_WITH_LEN( + "create procedure mysql.spider_plugin_installer()" + "begin" + " set @win_plugin := IF(@@version_compile_os like 'Win%', 1, 0);" +/* + Install spider plugin +*/ +/* + " set @have_spider_i_s_plugin := 0;" + " select @have_spider_i_s_plugin := 1 from INFORMATION_SCHEMA.plugins" + " where PLUGIN_NAME = 'SPIDER';" + " set @have_spider_plugin := 0;" + " select @have_spider_plugin := 1 from mysql.plugin" + " where name = 'spider';" + " if @have_spider_i_s_plugin = 0 then" + " if @have_spider_plugin = 1 then" + " / *" + " spider plugin is present in mysql.plugin but not in" + " information_schema.plugins. Remove spider plugin entry" + " in mysql.plugin first." + " * /" + " delete from mysql.plugin where name = 'spider';" + " end if;" + " if @win_plugin = 0 then " + " install plugin spider soname 'ha_spider.so';" + " else" + " install plugin spider soname 'ha_spider.dll';" + " end if;" + " end if;" +*/ +/* + Install spider_alloc_mem plugin +*/ + " set @have_spider_i_s_alloc_mem_plugin := 0;" + " select @have_spider_i_s_alloc_mem_plugin := 1" + " from INFORMATION_SCHEMA.plugins" + " where PLUGIN_NAME = 'SPIDER_ALLOC_MEM';" + " set @have_spider_alloc_mem_plugin := 0;" + " select @have_spider_alloc_mem_plugin := 1 from mysql.plugin" + " where name = 'spider_alloc_mem';" + " if @have_spider_i_s_alloc_mem_plugin = 0 then" + " if @have_spider_alloc_mem_plugin = 1 then" + " /*" + " spider_alloc_mem plugin is present in mysql.plugin but not in" + " information_schema.plugins. Remove spider_alloc_mem plugin entry" + " in mysql.plugin first." + " */" + " delete from mysql.plugin where name = 'spider_alloc_mem';" + " end if;" + " if @win_plugin = 0 then " + " install plugin spider_alloc_mem soname 'ha_spider.so';" + " else" + " install plugin spider_alloc_mem soname 'ha_spider.dll';" + " end if;" + " end if;" + " set @have_spider_direct_sql_udf := 0;" + " select @have_spider_direct_sql_udf := 1 from mysql.func" + " where name = 'spider_direct_sql';" + " if @have_spider_direct_sql_udf = 0 then" + " if @win_plugin = 0 then " + " create function spider_direct_sql returns int" + " soname 'ha_spider.so';" + " else" + " create function spider_direct_sql returns int" + " soname 'ha_spider.dll';" + " end if;" + " end if;" + " set @have_spider_bg_direct_sql_udf := 0;" + " select @have_spider_bg_direct_sql_udf := 1 from mysql.func" + " where name = 'spider_bg_direct_sql';" + " if @have_spider_bg_direct_sql_udf = 0 then" + " if @win_plugin = 0 then " + " create aggregate function spider_bg_direct_sql returns int" + " soname 'ha_spider.so';" + " else" + " create aggregate function spider_bg_direct_sql returns int" + " soname 'ha_spider.dll';" + " end if;" + " end if;" + " set @have_spider_ping_table_udf := 0;" + " select @have_spider_ping_table_udf := 1 from mysql.func" + " where name = 'spider_ping_table';" + " if @have_spider_ping_table_udf = 0 then" + " if @win_plugin = 0 then " + " create function spider_ping_table returns int" + " soname 'ha_spider.so';" + " else" + " create function spider_ping_table returns int" + " soname 'ha_spider.dll';" + " end if;" + " end if;" + " set @have_spider_copy_tables_udf := 0;" + " select @have_spider_copy_tables_udf := 1 from mysql.func" + " where name = 'spider_copy_tables';" + " if @have_spider_copy_tables_udf = 0 then" + " if @win_plugin = 0 then " + " create function spider_copy_tables returns int" + " soname 'ha_spider.so';" + " else" + " create function spider_copy_tables returns int" + " soname 'ha_spider.dll';" + " end if;" + " end if;" + " set @have_spider_flush_table_mon_cache_udf := 0;" + " select @have_spider_flush_table_mon_cache_udf := 1 from mysql.func" + " where name = 'spider_flush_table_mon_cache';" + " if @have_spider_flush_table_mon_cache_udf = 0 then" + " if @win_plugin = 0 then " + " create function spider_flush_table_mon_cache returns int" + " soname 'ha_spider.so';" + " else" + " create function spider_flush_table_mon_cache returns int" + " soname 'ha_spider.dll';" + " end if;" + " end if;" + " if @server_name = 'MariaDB' and" + " (" + " @server_major_version > 10 or" + " (" + " @server_major_version = 10 and" + " @server_minor_version >= 6" + " )" + " )" + " then" +/* + Install spider_rewrite plugin +*/ + " set @have_spider_i_s_rewrite_plugin := 0;" + " select @have_spider_i_s_rewrite_plugin := 1" + " from INFORMATION_SCHEMA.plugins" + " where PLUGIN_NAME = 'SPIDER_REWRITE';" + " set @have_spider_rewrite_plugin := 0;" + " select @have_spider_rewrite_plugin := 1 from mysql.plugin" + " where name = 'spider_rewrite';" + " if @have_spider_i_s_rewrite_plugin = 0 then" + " if @have_spider_rewrite_plugin = 1 then" + " /*" + " spider_rewrite plugin is present in mysql.plugin but not in" + " information_schema.plugins. Remove spider_rewrite plugin entry" + " in mysql.plugin first." + " */" + " delete from mysql.plugin where name = 'spider_rewrite';" + " end if;" + " if @win_plugin = 0 then " + " install plugin spider_rewrite soname 'ha_spider.so';" + " else" + " install plugin spider_rewrite soname 'ha_spider.dll';" + " end if;" + " end if;" + " set @have_spider_flush_rewrite_cache_udf := 0;" + " select @have_spider_flush_rewrite_cache_udf := 1 from mysql.func" + " where name = 'spider_flush_rewrite_cache';" + " if @have_spider_flush_rewrite_cache_udf = 0 then" + " if @win_plugin = 0 then " + " create function spider_flush_rewrite_cache returns int" + " soname 'ha_spider.so';" + " else" + " create function spider_flush_rewrite_cache returns int" + " soname 'ha_spider.dll';" + " end if;" + " end if;" + " end if;" + "end;" + )}, + {C_STRING_WITH_LEN( + "call mysql.spider_plugin_installer" + )}, + {C_STRING_WITH_LEN( + "drop procedure mysql.spider_plugin_installer" + )}, + {C_STRING_WITH_LEN("")} +}; diff --git a/storage/spider/spd_malloc.cc b/storage/spider/spd_malloc.cc index 2b5a5002c23..40b37ff4377 100644 --- a/storage/spider/spd_malloc.cc +++ b/storage/spider/spd_malloc.cc @@ -1,4 +1,5 @@ -/* Copyright (C) 2012-2017 Kentoku Shiba +/* Copyright (C) 2012-2019 Kentoku Shiba + Copyright (C) 2019 MariaDB corp This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1126,6 +1127,7 @@ void spider_string::q_append( ) { DBUG_ENTER("spider_string::q_append"); DBUG_PRINT("info",("spider this=%p", this)); + DBUG_ASSERT(str.alloced_length() >= str.length() + data_len); str.q_append(data, data_len); DBUG_VOID_RETURN; } @@ -1238,6 +1240,21 @@ void spider_string::append_escape_string( DBUG_VOID_RETURN; } +void spider_string::append_escape_string( + const char *st, + uint len, + CHARSET_INFO *cs +) { + DBUG_ENTER("spider_string::append_escape_string"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_ASSERT(mem_calc_inited); + DBUG_ASSERT((!current_alloc_mem && !str.is_alloced()) || + current_alloc_mem == str.alloced_length()); + str.length(str.length() + escape_string_for_mysql( + cs, (char *) str.ptr() + str.length(), 0, st, len)); + DBUG_VOID_RETURN; +} + bool spider_string::append_for_single_quote( const char *st, uint len diff --git a/storage/spider/spd_malloc.h b/storage/spider/spd_malloc.h index abbeb58d71c..9e97e039e04 100644 --- a/storage/spider/spd_malloc.h +++ b/storage/spider/spd_malloc.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2012-2014 Kentoku Shiba +/* Copyright (C) 2012-2019 Kentoku Shiba + Copyright (C) 2019 MariaDB corp This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,7 +20,7 @@ #define spider_bulk_malloc(A,B,C,...) \ spider_bulk_alloc_mem(A,B,__func__,__FILE__,__LINE__,C,__VA_ARGS__) #define spider_current_trx \ - (current_thd ? ((SPIDER_TRX *) thd_get_ha_data(current_thd, spider_hton_ptr)) : NULL) + (current_thd && spider_hton_ptr->slot != HA_SLOT_UNDEF ? ((SPIDER_TRX *) thd_get_ha_data(current_thd, spider_hton_ptr)) : NULL) #define init_calc_mem(A) init_mem_calc(A,__func__,__FILE__,__LINE__) diff --git a/storage/spider/spd_param.cc b/storage/spider/spd_param.cc index 61fd4339ca5..446ccc22141 100644 --- a/storage/spider/spd_param.cc +++ b/storage/spider/spd_param.cc @@ -3355,6 +3355,76 @@ int spider_param_slave_trx_isolation() DBUG_RETURN(spider_slave_trx_isolation); } +/* + -1 :not set + 0-:seconds of timeout + */ +static MYSQL_THDVAR_INT( + remote_wait_timeout, /* name */ + PLUGIN_VAR_RQCMDARG, /* opt */ + "Wait timeout on remote server", /* comment */ + NULL, /* check */ + NULL, /* update */ + -1, /* def */ + -1, /* min */ + 2147483647, /* max */ + 0 /* blk */ +); + +int spider_param_remote_wait_timeout( + THD *thd +) { + DBUG_ENTER("spider_param_remote_wait_timeout"); + if (likely(thd)) + DBUG_RETURN(THDVAR(thd, remote_wait_timeout)); + DBUG_RETURN(-1); +} + +/* + -1 :not set + 0-:seconds of timeout + */ +static MYSQL_THDVAR_INT( + wait_timeout, /* name */ + PLUGIN_VAR_RQCMDARG, /* opt */ + "Wait timeout of setting to remote server", /* comment */ + NULL, /* check */ + NULL, /* update */ + 604800, /* def */ + -1, /* min */ + 2147483647, /* max */ + 0 /* blk */ +); + +int spider_param_wait_timeout( + THD *thd +) { + DBUG_ENTER("spider_param_wait_timeout"); + if (likely(thd)) + DBUG_RETURN(THDVAR(thd, wait_timeout)); + DBUG_RETURN(604800); +} + +/* + FALSE: no sync + TRUE: sync + */ +static MYSQL_THDVAR_BOOL( + sync_sql_mode, /* name */ + PLUGIN_VAR_OPCMDARG, /* opt */ + "Sync sql_mode", /* comment */ + NULL, /* check */ + NULL, /* update */ + TRUE /* def */ +); + +bool spider_param_sync_sql_mode( + THD *thd +) { + DBUG_ENTER("spider_param_sync_sql_mode"); + DBUG_RETURN(THDVAR(thd, sync_sql_mode)); +} + static struct st_mysql_storage_engine spider_storage_engine = { MYSQL_HANDLERTON_INTERFACE_VERSION }; @@ -3505,6 +3575,9 @@ static struct st_mysql_sys_var* spider_system_variables[] = { MYSQL_SYSVAR(table_crd_thread_count), #endif MYSQL_SYSVAR(slave_trx_isolation), + MYSQL_SYSVAR(remote_wait_timeout), + MYSQL_SYSVAR(wait_timeout), + MYSQL_SYSVAR(sync_sql_mode), NULL }; diff --git a/storage/spider/spd_param.h b/storage/spider/spd_param.h index 4318515dd72..9ffb9e8c278 100644 --- a/storage/spider/spd_param.h +++ b/storage/spider/spd_param.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2008-2018 Kentoku Shiba +/* Copyright (C) 2008-2019 Kentoku Shiba + Copyright (C) 2019 MariaDB corp This program is free software); you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -421,3 +422,12 @@ uint spider_param_table_sts_thread_count(); uint spider_param_table_crd_thread_count(); #endif int spider_param_slave_trx_isolation(); +int spider_param_remote_wait_timeout( + THD *thd +); +int spider_param_wait_timeout( + THD *thd +); +bool spider_param_sync_sql_mode( + THD *thd +); diff --git a/storage/spider/spd_sys_table.cc b/storage/spider/spd_sys_table.cc index 9c97050d41c..ada48c4982d 100644 --- a/storage/spider/spd_sys_table.cc +++ b/storage/spider/spd_sys_table.cc @@ -229,85 +229,264 @@ TABLE *spider_open_sys_table( } } #endif - if (table_name_length == SPIDER_SYS_XA_TABLE_NAME_LEN) + switch (table_name_length) { - if ( - !memcmp(table_name, - SPIDER_SYS_XA_TABLE_NAME_STR, SPIDER_SYS_XA_TABLE_NAME_LEN) && - table->s->fields != SPIDER_SYS_XA_COL_CNT - ) { - spider_close_sys_table(thd, table, open_tables_backup, need_lock); - table = NULL; - my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, - ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), - SPIDER_SYS_XA_TABLE_NAME_STR); - *error_num = ER_SPIDER_SYS_TABLE_VERSION_NUM; - goto error_col_num_chk; - } - } else if (table_name_length == SPIDER_SYS_XA_MEMBER_TABLE_NAME_LEN) - { - if ( - !memcmp(table_name, - SPIDER_SYS_XA_MEMBER_TABLE_NAME_STR, - SPIDER_SYS_XA_MEMBER_TABLE_NAME_LEN) && - table->s->fields != SPIDER_SYS_XA_MEMBER_COL_CNT - ) { - spider_close_sys_table(thd, table, open_tables_backup, need_lock); - table = NULL; - my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, - ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), - SPIDER_SYS_XA_MEMBER_TABLE_NAME_STR); - *error_num = ER_SPIDER_SYS_TABLE_VERSION_NUM; - goto error_col_num_chk; - } - } else if (table_name_length == SPIDER_SYS_TABLES_TABLE_NAME_LEN) - { - if ( - !memcmp(table_name, - SPIDER_SYS_TABLES_TABLE_NAME_STR, - SPIDER_SYS_TABLES_TABLE_NAME_LEN) && - table->s->fields != SPIDER_SYS_TABLES_COL_CNT - ) { - spider_close_sys_table(thd, table, open_tables_backup, need_lock); - table = NULL; - my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, - ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), - SPIDER_SYS_TABLES_TABLE_NAME_STR); - *error_num = ER_SPIDER_SYS_TABLE_VERSION_NUM; - goto error_col_num_chk; - } - } else if (table_name_length == SPIDER_SYS_LINK_MON_TABLE_NAME_LEN) - { - if ( - !memcmp(table_name, - SPIDER_SYS_LINK_MON_TABLE_NAME_STR, - SPIDER_SYS_LINK_MON_TABLE_NAME_LEN) && - table->s->fields != SPIDER_SYS_LINK_MON_TABLE_COL_CNT - ) { - spider_close_sys_table(thd, table, open_tables_backup, need_lock); - table = NULL; - my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, - ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), - SPIDER_SYS_LINK_MON_TABLE_NAME_STR); - *error_num = ER_SPIDER_SYS_TABLE_VERSION_NUM; - goto error_col_num_chk; - } - } else if (table_name_length == SPIDER_SYS_POS_FOR_RECOVERY_TABLE_NAME_LEN) - { - if ( - !memcmp(table_name, - SPIDER_SYS_POS_FOR_RECOVERY_TABLE_NAME_STR, - SPIDER_SYS_POS_FOR_RECOVERY_TABLE_NAME_LEN) && - table->s->fields != SPIDER_SYS_POS_FOR_RECOVERY_TABLE_COL_CNT - ) { - spider_close_sys_table(thd, table, open_tables_backup, need_lock); - table = NULL; - my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, - ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), - SPIDER_SYS_POS_FOR_RECOVERY_TABLE_NAME_STR); - *error_num = ER_SPIDER_SYS_TABLE_VERSION_NUM; - goto error_col_num_chk; - } + case 9: + if (!memcmp(table_name, SPIDER_SYS_XA_TABLE_NAME_STR, + SPIDER_SYS_XA_TABLE_NAME_LEN)) + { + DBUG_PRINT("info",("spider checking for SYS_XA")); + if (table->s->fields != SPIDER_SYS_XA_COL_CNT) + { + spider_close_sys_table(thd, table, open_tables_backup, need_lock); + table = NULL; + my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, + ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), + SPIDER_SYS_XA_TABLE_NAME_STR); + *error_num = ER_SPIDER_SYS_TABLE_VERSION_NUM; + goto error_col_num_chk; + } + break; + } + DBUG_ASSERT(0); + break; + case 13: + if (!memcmp(table_name, SPIDER_SYS_TABLES_TABLE_NAME_STR, + SPIDER_SYS_TABLES_TABLE_NAME_LEN)) + { + DBUG_PRINT("info",("spider checking for SYS_TABLES")); + if (table->s->fields != SPIDER_SYS_TABLES_COL_CNT) + { + spider_close_sys_table(thd, table, open_tables_backup, need_lock); + table = NULL; + my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, + ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), + SPIDER_SYS_TABLES_TABLE_NAME_STR); + *error_num = ER_SPIDER_SYS_TABLE_VERSION_NUM; + goto error_col_num_chk; + } + break; + } + DBUG_ASSERT(0); + break; + case 16: + if (!memcmp(table_name, SPIDER_SYS_XA_MEMBER_TABLE_NAME_STR, + SPIDER_SYS_XA_MEMBER_TABLE_NAME_LEN)) + { + DBUG_PRINT("info",("spider checking for SYS_XA_MEMBER")); + if (table->s->fields != SPIDER_SYS_XA_MEMBER_COL_CNT) + { + spider_close_sys_table(thd, table, open_tables_backup, need_lock); + table = NULL; + my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, + ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), + SPIDER_SYS_XA_MEMBER_TABLE_NAME_STR); + *error_num = ER_SPIDER_SYS_TABLE_VERSION_NUM; + goto error_col_num_chk; + } + break; + } + if (!memcmp(table_name, SPIDER_SYS_TABLE_STS_TABLE_NAME_STR, + SPIDER_SYS_TABLE_STS_TABLE_NAME_LEN)) + { + DBUG_PRINT("info",("spider checking for SYS_TABLE_STS")); + if (table->s->fields != SPIDER_SYS_TABLE_STS_COL_CNT) + { + spider_close_sys_table(thd, table, open_tables_backup, need_lock); + table = NULL; + my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, + ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), + SPIDER_SYS_TABLE_STS_TABLE_NAME_STR); + *error_num = ER_SPIDER_SYS_TABLE_VERSION_NUM; + goto error_col_num_chk; + } + break; + } + if (!memcmp(table_name, SPIDER_SYS_TABLE_CRD_TABLE_NAME_STR, + SPIDER_SYS_TABLE_CRD_TABLE_NAME_LEN)) + { + DBUG_PRINT("info",("spider checking for SYS_TABLE_CRD")); + if (table->s->fields != SPIDER_SYS_TABLE_CRD_COL_CNT) + { + spider_close_sys_table(thd, table, open_tables_backup, need_lock); + table = NULL; + my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, + ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), + SPIDER_SYS_TABLE_CRD_TABLE_NAME_STR); + *error_num = ER_SPIDER_SYS_TABLE_VERSION_NUM; + goto error_col_num_chk; + } + break; + } + DBUG_ASSERT(0); + break; + case 20: + if (!memcmp(table_name, SPIDER_SYS_XA_FAILED_TABLE_NAME_STR, + SPIDER_SYS_XA_FAILED_TABLE_NAME_LEN)) + { + DBUG_PRINT("info",("spider checking for SYS_XA_FAILED")); + if (table->s->fields != SPIDER_SYS_XA_FAILED_TABLE_COL_CNT) + { + spider_close_sys_table(thd, table, open_tables_backup, need_lock); + table = NULL; + my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, + ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), + SPIDER_SYS_XA_FAILED_TABLE_NAME_STR); + *error_num = ER_SPIDER_SYS_TABLE_VERSION_NUM; + goto error_col_num_chk; + } + break; + } + DBUG_ASSERT(0); + break; + case 21: + if (!memcmp(table_name, SPIDER_SYS_RW_TBLS_TABLE_NAME_STR, + SPIDER_SYS_RW_TBLS_TABLE_NAME_LEN)) + { + DBUG_PRINT("info",("spider checking for SYS_RW_TBLS")); + if (table->s->fields != SPIDER_SYS_RW_TBLS_COL_CNT) + { + spider_close_sys_table(thd, table, open_tables_backup, need_lock); + table = NULL; + my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, + ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), + SPIDER_SYS_RW_TBLS_TABLE_NAME_STR); + *error_num = ER_SPIDER_SYS_TABLE_VERSION_NUM; + goto error_col_num_chk; + } + } + DBUG_ASSERT(0); + break; + case 22: + if (!memcmp(table_name, SPIDER_SYS_LINK_FAILED_TABLE_NAME_STR, + SPIDER_SYS_LINK_FAILED_TABLE_NAME_LEN)) + { + DBUG_PRINT("info",("spider checking for SYS_LINK_FAILED")); + if (table->s->fields != SPIDER_SYS_LINK_FAILED_TABLE_COL_CNT) + { + spider_close_sys_table(thd, table, open_tables_backup, need_lock); + table = NULL; + my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, + ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), + SPIDER_SYS_LINK_FAILED_TABLE_NAME_STR); + *error_num = ER_SPIDER_SYS_TABLE_VERSION_NUM; + goto error_col_num_chk; + } + break; + } + DBUG_ASSERT(0); + break; + case 23: + if (!memcmp(table_name, SPIDER_SYS_LINK_MON_TABLE_NAME_STR, + SPIDER_SYS_LINK_MON_TABLE_NAME_LEN)) + { + DBUG_PRINT("info",("spider checking for SYS_LINK_MON")); + if (table->s->fields != SPIDER_SYS_LINK_MON_TABLE_COL_CNT) + { + spider_close_sys_table(thd, table, open_tables_backup, need_lock); + table = NULL; + my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, + ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), + SPIDER_SYS_LINK_MON_TABLE_NAME_STR); + *error_num = ER_SPIDER_SYS_TABLE_VERSION_NUM; + goto error_col_num_chk; + } + break; + } + if (!memcmp(table_name, SPIDER_SYS_RWN_TBLS_TABLE_NAME_STR, + SPIDER_SYS_RWN_TBLS_TABLE_NAME_LEN)) + { + DBUG_PRINT("info",("spider checking for SYS_RWN_TBLS")); + if (table->s->fields != SPIDER_SYS_RWN_TBLS_COL_CNT) + { + spider_close_sys_table(thd, table, open_tables_backup, need_lock); + table = NULL; + my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, + ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), + SPIDER_SYS_RWN_TBLS_TABLE_NAME_STR); + *error_num = ER_SPIDER_SYS_TABLE_VERSION_NUM; + goto error_col_num_chk; + } + break; + } + DBUG_ASSERT(0); + break; + case 27: + if (!memcmp(table_name, SPIDER_SYS_RW_TBL_TBLS_TABLE_NAME_STR, + SPIDER_SYS_RW_TBL_TBLS_TABLE_NAME_LEN)) + { + DBUG_PRINT("info",("spider checking for SYS_RW_TBL_TBLS")); + if (table->s->fields != SPIDER_SYS_RW_TBL_TBLS_COL_CNT) + { + spider_close_sys_table(thd, table, open_tables_backup, need_lock); + table = NULL; + my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, + ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), + SPIDER_SYS_RW_TBL_TBLS_TABLE_NAME_STR); + *error_num = ER_SPIDER_SYS_TABLE_VERSION_NUM; + goto error_col_num_chk; + } + break; + } + DBUG_ASSERT(0); + break; + case 31: + if (!memcmp(table_name, SPIDER_SYS_RW_TBL_PTTS_TABLE_NAME_STR, + SPIDER_SYS_RW_TBL_PTTS_TABLE_NAME_LEN)) + { + DBUG_PRINT("info",("spider checking for SYS_RW_TBL_PTTS")); + if (table->s->fields != SPIDER_SYS_RW_TBL_PTTS_COL_CNT) + { + spider_close_sys_table(thd, table, open_tables_backup, need_lock); + table = NULL; + my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, + ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), + SPIDER_SYS_RW_TBL_PTTS_TABLE_NAME_STR); + *error_num = ER_SPIDER_SYS_TABLE_VERSION_NUM; + goto error_col_num_chk; + } + break; + } + DBUG_ASSERT(0); + break; + case 34: + if (!memcmp(table_name, SPIDER_SYS_POS_FOR_RECOVERY_TABLE_NAME_STR, + SPIDER_SYS_POS_FOR_RECOVERY_TABLE_NAME_LEN)) + { + DBUG_PRINT("info",("spider checking for SYS_POS_FOR_RECOVERY")); + if (table->s->fields != SPIDER_SYS_POS_FOR_RECOVERY_TABLE_COL_CNT) + { + spider_close_sys_table(thd, table, open_tables_backup, need_lock); + table = NULL; + my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, + ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), + SPIDER_SYS_POS_FOR_RECOVERY_TABLE_NAME_STR); + *error_num = ER_SPIDER_SYS_TABLE_VERSION_NUM; + goto error_col_num_chk; + } + break; + } + if (!memcmp(table_name, SPIDER_SYS_RW_TBL_SPTTS_TABLE_NAME_STR, + SPIDER_SYS_RW_TBL_SPTTS_TABLE_NAME_LEN)) + { + DBUG_PRINT("info",("spider checking for SYS_RW_TBL_SPTTS")); + if (table->s->fields != SPIDER_SYS_RW_TBL_SPTTS_COL_CNT) + { + spider_close_sys_table(thd, table, open_tables_backup, need_lock); + table = NULL; + my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, + ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), + SPIDER_SYS_RW_TBL_SPTTS_TABLE_NAME_STR); + *error_num = ER_SPIDER_SYS_TABLE_VERSION_NUM; + goto error_col_num_chk; + } + break; + } + DBUG_ASSERT(0); + break; + default: + DBUG_ASSERT(0); + break; } DBUG_RETURN(table); @@ -1240,28 +1419,29 @@ void spider_store_binlog_pos_gtid( void spider_store_table_sts_info( TABLE *table, - ulonglong *data_file_length, - ulonglong *max_data_file_length, - ulonglong *index_file_length, - ha_rows *records, - ulong *mean_rec_length, - time_t *check_time, - time_t *create_time, - time_t *update_time + ha_statistics *stat ) { MYSQL_TIME mysql_time; DBUG_ENTER("spider_store_table_sts_info"); - table->field[2]->store((longlong) *data_file_length, TRUE); - table->field[3]->store((longlong) *max_data_file_length, TRUE); - table->field[4]->store((longlong) *index_file_length, TRUE); - table->field[5]->store((longlong) *records, TRUE); - table->field[6]->store((longlong) *mean_rec_length, TRUE); - spd_tz_system->gmt_sec_to_TIME(&mysql_time, (my_time_t) *check_time); + table->field[2]->store((longlong) stat->data_file_length, TRUE); + table->field[3]->store((longlong) stat->max_data_file_length, TRUE); + table->field[4]->store((longlong) stat->index_file_length, TRUE); + table->field[5]->store((longlong) stat->records, TRUE); + table->field[6]->store((longlong) stat->mean_rec_length, TRUE); + spd_tz_system->gmt_sec_to_TIME(&mysql_time, (my_time_t) stat->check_time); table->field[7]->store_time(&mysql_time); - spd_tz_system->gmt_sec_to_TIME(&mysql_time, (my_time_t) *create_time); + spd_tz_system->gmt_sec_to_TIME(&mysql_time, (my_time_t) stat->create_time); table->field[8]->store_time(&mysql_time); - spd_tz_system->gmt_sec_to_TIME(&mysql_time, (my_time_t) *update_time); + spd_tz_system->gmt_sec_to_TIME(&mysql_time, (my_time_t) stat->update_time); table->field[9]->store_time(&mysql_time); + if (stat->checksum_null) + { + table->field[10]->set_null(); + table->field[10]->reset(); + } else { + table->field[10]->set_notnull(); + table->field[10]->store((longlong) stat->checksum, TRUE); + } DBUG_VOID_RETURN; } @@ -1386,14 +1566,7 @@ int spider_insert_or_update_table_sts( TABLE *table, const char *name, uint name_length, - ulonglong *data_file_length, - ulonglong *max_data_file_length, - ulonglong *index_file_length, - ha_rows *records, - ulong *mean_rec_length, - time_t *check_time, - time_t *create_time, - time_t *update_time + ha_statistics *stat ) { int error_num; char table_key[MAX_KEY_LENGTH]; @@ -1402,14 +1575,7 @@ int spider_insert_or_update_table_sts( spider_store_tables_name(table, name, name_length); spider_store_table_sts_info( table, - data_file_length, - max_data_file_length, - index_file_length, - records, - mean_rec_length, - check_time, - create_time, - update_time + stat ); if ((error_num = spider_check_sys_table_for_update_all_columns(table, table_key))) @@ -2427,6 +2593,7 @@ int spider_get_sys_tables_static_link_id( ) { int error_num = 0; DBUG_ENTER("spider_get_sys_tables_static_link_id"); + *static_link_id = NULL; if ( !table->field[24]->is_null() && (*static_link_id = get_field(mem_root, table->field[24])) @@ -2441,14 +2608,7 @@ int spider_get_sys_tables_static_link_id( void spider_get_sys_table_sts_info( TABLE *table, - ulonglong *data_file_length, - ulonglong *max_data_file_length, - ulonglong *index_file_length, - ha_rows *records, - ulong *mean_rec_length, - time_t *check_time, - time_t *create_time, - time_t *update_time + ha_statistics *stat ) { MYSQL_TIME mysql_time; #ifdef MARIADB_BASE_VERSION @@ -2458,35 +2618,43 @@ void spider_get_sys_table_sts_info( #endif long not_used_long; DBUG_ENTER("spider_get_sys_table_sts_info"); - *data_file_length = (ulonglong) table->field[2]->val_int(); - *max_data_file_length = (ulonglong) table->field[3]->val_int(); - *index_file_length = (ulonglong) table->field[4]->val_int(); - *records = (ha_rows) table->field[5]->val_int(); - *mean_rec_length = (ulong) table->field[6]->val_int(); + stat->data_file_length = (ulonglong) table->field[2]->val_int(); + stat->max_data_file_length = (ulonglong) table->field[3]->val_int(); + stat->index_file_length = (ulonglong) table->field[4]->val_int(); + stat->records = (ha_rows) table->field[5]->val_int(); + stat->mean_rec_length = (ulong) table->field[6]->val_int(); table->field[7]->get_date(&mysql_time, SPIDER_date_mode_t(0)); #ifdef MARIADB_BASE_VERSION - *check_time = (time_t) my_system_gmt_sec(&mysql_time, + stat->check_time = (time_t) my_system_gmt_sec(&mysql_time, ¬_used_long, ¬_used_uint); #else - *check_time = (time_t) my_system_gmt_sec(&mysql_time, + stat->check_time = (time_t) my_system_gmt_sec(&mysql_time, ¬_used_long, ¬_used_my_bool); #endif table->field[8]->get_date(&mysql_time, SPIDER_date_mode_t(0)); #ifdef MARIADB_BASE_VERSION - *create_time = (time_t) my_system_gmt_sec(&mysql_time, + stat->create_time = (time_t) my_system_gmt_sec(&mysql_time, ¬_used_long, ¬_used_uint); #else - *create_time = (time_t) my_system_gmt_sec(&mysql_time, + stat->create_time = (time_t) my_system_gmt_sec(&mysql_time, ¬_used_long, ¬_used_my_bool); #endif table->field[9]->get_date(&mysql_time, SPIDER_date_mode_t(0)); #ifdef MARIADB_BASE_VERSION - *update_time = (time_t) my_system_gmt_sec(&mysql_time, + stat->update_time = (time_t) my_system_gmt_sec(&mysql_time, ¬_used_long, ¬_used_uint); #else - *update_time = (time_t) my_system_gmt_sec(&mysql_time, + stat->update_time = (time_t) my_system_gmt_sec(&mysql_time, ¬_used_long, ¬_used_my_bool); #endif + if (table->field[10]->is_null()) + { + stat->checksum_null = TRUE; + stat->checksum = 0; + } else { + stat->checksum_null = FALSE; + stat->checksum = (ha_checksum) table->field[10]->val_int(); + } DBUG_VOID_RETURN; } @@ -2907,14 +3075,7 @@ int spider_sys_insert_or_update_table_sts( THD *thd, const char *name, uint name_length, - ulonglong *data_file_length, - ulonglong *max_data_file_length, - ulonglong *index_file_length, - ha_rows *records, - ulong *mean_rec_length, - time_t *check_time, - time_t *create_time, - time_t *update_time, + ha_statistics *stat, bool need_lock ) { int error_num; @@ -2937,14 +3098,7 @@ int spider_sys_insert_or_update_table_sts( table_sts, name, name_length, - data_file_length, - max_data_file_length, - index_file_length, - records, - mean_rec_length, - check_time, - create_time, - update_time + stat ))) goto error; spider_close_sys_table(thd, table_sts, &open_tables_backup, need_lock); @@ -3079,14 +3233,7 @@ int spider_sys_get_table_sts( THD *thd, const char *name, uint name_length, - ulonglong *data_file_length, - ulonglong *max_data_file_length, - ulonglong *index_file_length, - ha_rows *records, - ulong *mean_rec_length, - time_t *check_time, - time_t *create_time, - time_t *update_time, + ha_statistics *stat, bool need_lock ) { int error_num; @@ -3119,14 +3266,7 @@ int spider_sys_get_table_sts( } else { spider_get_sys_table_sts_info( table_sts, - data_file_length, - max_data_file_length, - index_file_length, - records, - mean_rec_length, - check_time, - create_time, - update_time + stat ); } diff --git a/storage/spider/spd_sys_table.h b/storage/spider/spd_sys_table.h index 9e2d54c3e28..df933ec61b8 100644 --- a/storage/spider/spd_sys_table.h +++ b/storage/spider/spd_sys_table.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2008-2018 Kentoku Shiba +/* Copyright (C) 2008-2019 Kentoku Shiba + Copyright (C) 2019 MariaDB corp This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -14,23 +15,33 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ #define SPIDER_SYS_XA_TABLE_NAME_STR "spider_xa" -#define SPIDER_SYS_XA_TABLE_NAME_LEN (sizeof(SPIDER_SYS_XA_TABLE_NAME_STR) - 1) +#define SPIDER_SYS_XA_TABLE_NAME_LEN 9 #define SPIDER_SYS_XA_MEMBER_TABLE_NAME_STR "spider_xa_member" -#define SPIDER_SYS_XA_MEMBER_TABLE_NAME_LEN (sizeof(SPIDER_SYS_XA_MEMBER_TABLE_NAME_STR) - 1) +#define SPIDER_SYS_XA_MEMBER_TABLE_NAME_LEN 16 #define SPIDER_SYS_TABLES_TABLE_NAME_STR "spider_tables" -#define SPIDER_SYS_TABLES_TABLE_NAME_LEN (sizeof(SPIDER_SYS_TABLES_TABLE_NAME_STR) - 1) +#define SPIDER_SYS_TABLES_TABLE_NAME_LEN 13 #define SPIDER_SYS_LINK_MON_TABLE_NAME_STR "spider_link_mon_servers" -#define SPIDER_SYS_LINK_MON_TABLE_NAME_LEN (sizeof(SPIDER_SYS_LINK_MON_TABLE_NAME_STR) - 1) +#define SPIDER_SYS_LINK_MON_TABLE_NAME_LEN 23 #define SPIDER_SYS_LINK_FAILED_TABLE_NAME_STR "spider_link_failed_log" -#define SPIDER_SYS_LINK_FAILED_TABLE_NAME_LEN (sizeof(SPIDER_SYS_LINK_FAILED_TABLE_NAME_STR) - 1) +#define SPIDER_SYS_LINK_FAILED_TABLE_NAME_LEN 22 #define SPIDER_SYS_XA_FAILED_TABLE_NAME_STR "spider_xa_failed_log" -#define SPIDER_SYS_XA_FAILED_TABLE_NAME_LEN (sizeof(SPIDER_SYS_XA_FAILED_TABLE_NAME_STR) - 1) +#define SPIDER_SYS_XA_FAILED_TABLE_NAME_LEN 20 #define SPIDER_SYS_POS_FOR_RECOVERY_TABLE_NAME_STR "spider_table_position_for_recovery" -#define SPIDER_SYS_POS_FOR_RECOVERY_TABLE_NAME_LEN (sizeof(SPIDER_SYS_POS_FOR_RECOVERY_TABLE_NAME_STR) - 1) +#define SPIDER_SYS_POS_FOR_RECOVERY_TABLE_NAME_LEN 34 #define SPIDER_SYS_TABLE_STS_TABLE_NAME_STR "spider_table_sts" -#define SPIDER_SYS_TABLE_STS_TABLE_NAME_LEN (sizeof(SPIDER_SYS_TABLE_STS_TABLE_NAME_STR) - 1) +#define SPIDER_SYS_TABLE_STS_TABLE_NAME_LEN 16 #define SPIDER_SYS_TABLE_CRD_TABLE_NAME_STR "spider_table_crd" -#define SPIDER_SYS_TABLE_CRD_TABLE_NAME_LEN (sizeof(SPIDER_SYS_TABLE_CRD_TABLE_NAME_STR) - 1) +#define SPIDER_SYS_TABLE_CRD_TABLE_NAME_LEN 16 +#define SPIDER_SYS_RW_TBLS_TABLE_NAME_STR "spider_rewrite_tables" +#define SPIDER_SYS_RW_TBLS_TABLE_NAME_LEN 21 +#define SPIDER_SYS_RW_TBL_TBLS_TABLE_NAME_STR "spider_rewrite_table_tables" +#define SPIDER_SYS_RW_TBL_TBLS_TABLE_NAME_LEN 27 +#define SPIDER_SYS_RW_TBL_PTTS_TABLE_NAME_STR "spider_rewrite_table_partitions" +#define SPIDER_SYS_RW_TBL_PTTS_TABLE_NAME_LEN 31 +#define SPIDER_SYS_RW_TBL_SPTTS_TABLE_NAME_STR "spider_rewrite_table_subpartitions" +#define SPIDER_SYS_RW_TBL_SPTTS_TABLE_NAME_LEN 34 +#define SPIDER_SYS_RWN_TBLS_TABLE_NAME_STR "spider_rewritten_tables" +#define SPIDER_SYS_RWN_TBLS_TABLE_NAME_LEN 23 #define SPIDER_SYS_XA_PREPARED_STR "PREPARED" #define SPIDER_SYS_XA_NOT_YET_STR "NOT YET" @@ -47,11 +58,18 @@ #define SPIDER_SYS_TABLES_IDX1_COL_CNT 1 #define SPIDER_SYS_TABLES_UIDX1_COL_CNT 3 #define SPIDER_SYS_LINK_MON_TABLE_COL_CNT 19 +#define SPIDER_SYS_LINK_FAILED_TABLE_COL_CNT 4 +#define SPIDER_SYS_XA_FAILED_TABLE_COL_CNT 21 #define SPIDER_SYS_POS_FOR_RECOVERY_TABLE_COL_CNT 7 -#define SPIDER_SYS_TABLE_STS_COL_CNT 10 +#define SPIDER_SYS_TABLE_STS_COL_CNT 11 #define SPIDER_SYS_TABLE_STS_PK_COL_CNT 2 #define SPIDER_SYS_TABLE_CRD_COL_CNT 4 #define SPIDER_SYS_TABLE_CRD_PK_COL_CNT 3 +#define SPIDER_SYS_RW_TBLS_COL_CNT 3 +#define SPIDER_SYS_RW_TBL_TBLS_COL_CNT 8 +#define SPIDER_SYS_RW_TBL_PTTS_COL_CNT 7 +#define SPIDER_SYS_RW_TBL_SPTTS_COL_CNT 8 +#define SPIDER_SYS_RWN_TBLS_COL_CNT 4 #define SPIDER_SYS_LINK_MON_TABLE_DB_NAME_SIZE 64 #define SPIDER_SYS_LINK_MON_TABLE_TABLE_NAME_SIZE 64 @@ -289,14 +307,7 @@ void spider_store_binlog_pos_gtid( void spider_store_table_sts_info( TABLE *table, - ulonglong *data_file_length, - ulonglong *max_data_file_length, - ulonglong *index_file_length, - ha_rows *records, - ulong *mean_rec_length, - time_t *check_time, - time_t *create_time, - time_t *update_time + ha_statistics *stat ); void spider_store_table_crd_info( @@ -330,14 +341,7 @@ int spider_insert_or_update_table_sts( TABLE *table, const char *name, uint name_length, - ulonglong *data_file_length, - ulonglong *max_data_file_length, - ulonglong *index_file_length, - ha_rows *records, - ulong *mean_rec_length, - time_t *check_time, - time_t *create_time, - time_t *update_time + ha_statistics *stat ); int spider_insert_or_update_table_crd( @@ -493,14 +497,7 @@ int spider_get_sys_tables_static_link_id( void spider_get_sys_table_sts_info( TABLE *table, - ulonglong *data_file_length, - ulonglong *max_data_file_length, - ulonglong *index_file_length, - ha_rows *records, - ulong *mean_rec_length, - time_t *check_time, - time_t *create_time, - time_t *update_time + ha_statistics *stat ); void spider_get_sys_table_crd_info( @@ -564,14 +561,7 @@ int spider_sys_insert_or_update_table_sts( THD *thd, const char *name, uint name_length, - ulonglong *data_file_length, - ulonglong *max_data_file_length, - ulonglong *index_file_length, - ha_rows *records, - ulong *mean_rec_length, - time_t *check_time, - time_t *create_time, - time_t *update_time, + ha_statistics *stat, bool need_lock ); @@ -602,14 +592,7 @@ int spider_sys_get_table_sts( THD *thd, const char *name, uint name_length, - ulonglong *data_file_length, - ulonglong *max_data_file_length, - ulonglong *index_file_length, - ha_rows *records, - ulong *mean_rec_length, - time_t *check_time, - time_t *create_time, - time_t *update_time, + ha_statistics *stat, bool need_lock ); diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index ca3b7fa08ed..fd0ece10c1b 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -1,4 +1,5 @@ -/* Copyright (C) 2008-2018 Kentoku Shiba +/* Copyright (C) 2008-2019 Kentoku Shiba + Copyright (C) 2019 MariaDB corp This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,6 +30,7 @@ #include "sql_servers.h" #include "sql_select.h" #include "tztime.h" +#include "sql_parse.h" #endif #include "spd_err.h" #include "spd_param.h" @@ -44,6 +46,7 @@ #include "spd_direct_sql.h" #include "spd_malloc.h" #include "spd_group_by_handler.h" +#include "spd_init_query.h" /* Background thread management */ #ifdef SPIDER_HAS_NEXT_THREAD_ID @@ -122,8 +125,13 @@ HASH *spd_db_att_xid_cache; struct charset_info_st *spd_charset_utf8_bin; const char **spd_defaults_extra_file; const char **spd_defaults_file; +const char **spd_mysqld_unix_port; +uint *spd_mysqld_port; bool volatile *spd_abort_loop; Time_zone *spd_tz_system; +static int *spd_mysqld_server_started; +static pthread_mutex_t *spd_LOCK_server_started; +static pthread_cond_t *spd_COND_server_started; extern long spider_conn_mutex_id; handlerton *spider_hton_ptr; SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE]; @@ -1970,7 +1978,7 @@ int spider_parse_connect_info( ) { int error_num = 0; char *connect_string = NULL; - char *sprit_ptr[2]; + char *sprit_ptr; char *tmp_ptr, *tmp_ptr2, *start_ptr; int roop_count; int title_length; @@ -2163,23 +2171,17 @@ int spider_parse_connect_info( break; } - sprit_ptr[0] = connect_string; + sprit_ptr = connect_string; connect_string_parse.init(connect_string, ER_SPIDER_INVALID_CONNECT_INFO_NUM); - while (sprit_ptr[0]) + while (sprit_ptr) { - if ((sprit_ptr[1] = strchr(sprit_ptr[0], ','))) - { - *sprit_ptr[1] = '\0'; - sprit_ptr[1]++; - } - tmp_ptr = sprit_ptr[0]; - sprit_ptr[0] = sprit_ptr[1]; + tmp_ptr = sprit_ptr; while (*tmp_ptr == ' ' || *tmp_ptr == '\r' || *tmp_ptr == '\n' || *tmp_ptr == '\t') tmp_ptr++; if (*tmp_ptr == '\0') - continue; + break; title_length = 0; start_ptr = tmp_ptr; @@ -2192,6 +2194,11 @@ int spider_parse_connect_info( start_ptr++; } connect_string_parse.set_param_title(tmp_ptr, tmp_ptr + title_length); + if ((error_num = connect_string_parse.get_next_parameter_head( + start_ptr, &sprit_ptr))) + { + goto error; + } switch (title_length) { @@ -4378,6 +4385,9 @@ SPIDER_SHARE *spider_create_share( uchar *tmp_cardinality_upd, *tmp_table_mon_mutex_bitmap; char buf[MAX_FIELD_WIDTH], *buf_pos; char link_idx_str[SPIDER_SQL_INT_LEN]; +#ifdef HA_HAS_CHECKSUM_EXTENDED + bool checksum_support = TRUE; +#endif DBUG_ENTER("spider_create_share"); length = (uint) strlen(table_name); bitmap_size = spider_bitmap_size(table_share->fields); @@ -4536,8 +4546,24 @@ SPIDER_SHARE *spider_create_share( { goto error_init_dbton; } +#ifdef HA_HAS_CHECKSUM_EXTENDED + if ( + spider_dbton[roop_count].db_access_type == SPIDER_DB_ACCESS_TYPE_SQL && + !share->dbton_share[roop_count]->checksum_support() + ) { + checksum_support = FALSE; + } +#endif } } +#ifdef HA_HAS_CHECKSUM_EXTENDED + if (checksum_support) + { + share->additional_table_flags |= + HA_HAS_OLD_CHECKSUM | + HA_HAS_NEW_CHECKSUM; + } +#endif DBUG_RETURN(share); /* @@ -5003,8 +5029,7 @@ SPIDER_SHARE *spider_get_share( share->init_error = TRUE; share->init_error_time = (time_t) time((time_t*) 0); share->init = TRUE; - spider_free_share(share); - goto error_but_no_delete; + goto error_after_alloc_conn_keys; } if ( @@ -5051,8 +5076,7 @@ SPIDER_SHARE *spider_get_share( share->init_error = TRUE; share->init_error_time = (time_t) time((time_t*) 0); share->init = TRUE; - spider_free_share(share); - goto error_but_no_delete; + goto error_after_alloc_dbton_handler; } spider->conns[roop_count]->error_mode &= spider->error_mode; } @@ -5070,8 +5094,7 @@ SPIDER_SHARE *spider_get_share( share->init_error = TRUE; share->init_error_time = (time_t) time((time_t*) 0); share->init = TRUE; - spider_free_share(share); - goto error_but_no_delete; + goto error_after_alloc_dbton_handler; } char *table_name = db + table_share->db.length + 1; memcpy(db, table_share->db.str, table_share->db.length); @@ -5086,16 +5109,14 @@ SPIDER_SHARE *spider_get_share( share->init_error = TRUE; share->init_error_time = (time_t) time((time_t*) 0); share->init = TRUE; - spider_free_share(share); - goto error_but_no_delete; + goto error_after_alloc_dbton_handler; } else if (search_link_idx == -2) { *error_num = HA_ERR_OUT_OF_MEM; share->init_error = TRUE; share->init_error_time = (time_t) time((time_t*) 0); share->init = TRUE; - spider_free_share(share); - goto error_but_no_delete; + goto error_after_alloc_dbton_handler; } spider->search_link_idx = search_link_idx; @@ -5152,8 +5173,7 @@ SPIDER_SHARE *spider_get_share( share->init = TRUE; pthread_mutex_unlock(&share->crd_mutex); pthread_mutex_unlock(&share->sts_mutex); - spider_free_share(share); - goto error_but_no_delete; + goto error_after_alloc_dbton_handler; } } @@ -5162,28 +5182,48 @@ SPIDER_SHARE *spider_get_share( !same_server_link || load_sts_at_startup ) && - spider_get_sts(share, spider->search_link_idx, tmp_time, + (*error_num = spider_get_sts(share, spider->search_link_idx, tmp_time, spider, sts_interval, sts_mode, #ifdef WITH_PARTITION_STORAGE_ENGINE sts_sync, #endif - 1, HA_STATUS_VARIABLE | HA_STATUS_CONST | HA_STATUS_AUTO) + 1, HA_STATUS_VARIABLE | HA_STATUS_CONST | HA_STATUS_AUTO)) ) { - thd->clear_error(); + if (*error_num != ER_SPIDER_SYS_TABLE_VERSION_NUM) + { + thd->clear_error(); + } else { + pthread_mutex_unlock(&share->crd_mutex); + pthread_mutex_unlock(&share->sts_mutex); + share->init_error = TRUE; + share->init_error_time = (time_t) time((time_t*) 0); + share->init = TRUE; + goto error_after_alloc_dbton_handler; + } } if ( ( !same_server_link || load_crd_at_startup ) && - spider_get_crd(share, spider->search_link_idx, tmp_time, + (*error_num = spider_get_crd(share, spider->search_link_idx, tmp_time, spider, table, crd_interval, crd_mode, #ifdef WITH_PARTITION_STORAGE_ENGINE crd_sync, #endif - 1) + 1)) ) { - thd->clear_error(); + if (*error_num != ER_SPIDER_SYS_TABLE_VERSION_NUM) + { + thd->clear_error(); + } else { + pthread_mutex_unlock(&share->crd_mutex); + pthread_mutex_unlock(&share->sts_mutex); + share->init_error = TRUE; + share->init_error_time = (time_t) time((time_t*) 0); + share->init = TRUE; + goto error_after_alloc_dbton_handler; + } } pthread_mutex_unlock(&share->crd_mutex); pthread_mutex_unlock(&share->sts_mutex); @@ -5520,7 +5560,7 @@ SPIDER_SHARE *spider_get_share( spider->dbton_handler[dbton_id] = NULL; } } - goto error_but_no_delete; + goto error_after_alloc_conn_keys; } if ( @@ -5564,8 +5604,7 @@ SPIDER_SHARE *spider_get_share( FALSE ); } - spider_free_share(share); - goto error_but_no_delete; + goto error_after_alloc_dbton_handler; } spider->conns[roop_count]->error_mode &= spider->error_mode; } @@ -5580,8 +5619,7 @@ SPIDER_SHARE *spider_get_share( if (!db) { *error_num = HA_ERR_OUT_OF_MEM; - spider_free_share(share); - goto error_but_no_delete; + goto error_after_alloc_dbton_handler; } char *table_name = db + table_share->db.length + 1; memcpy(db, table_share->db.str, table_share->db.length); @@ -5593,13 +5631,11 @@ SPIDER_SHARE *spider_get_share( ER_SPIDER_ALL_LINKS_FAILED_STR, MYF(0), db, table_name); my_afree(db); *error_num = ER_SPIDER_ALL_LINKS_FAILED_NUM; - spider_free_share(share); - goto error_but_no_delete; + goto error_after_alloc_dbton_handler; } else if (search_link_idx == -2) { *error_num = HA_ERR_OUT_OF_MEM; - spider_free_share(share); - goto error_but_no_delete; + goto error_after_alloc_dbton_handler; } spider->search_link_idx = search_link_idx; @@ -5658,8 +5694,7 @@ SPIDER_SHARE *spider_get_share( spider_init_error_table->init_error_msg, MYF(0)); pthread_mutex_unlock(&share->crd_mutex); pthread_mutex_unlock(&share->sts_mutex); - spider_free_share(share); - goto error_but_no_delete; + goto error_after_alloc_dbton_handler; } } @@ -5668,28 +5703,42 @@ SPIDER_SHARE *spider_get_share( !same_server_link || load_sts_at_startup ) && - spider_get_sts(share, spider->search_link_idx, + (*error_num = spider_get_sts(share, spider->search_link_idx, tmp_time, spider, sts_interval, sts_mode, #ifdef WITH_PARTITION_STORAGE_ENGINE sts_sync, #endif - 1, HA_STATUS_VARIABLE | HA_STATUS_CONST | HA_STATUS_AUTO) + 1, HA_STATUS_VARIABLE | HA_STATUS_CONST | HA_STATUS_AUTO)) ) { - thd->clear_error(); + if (*error_num != ER_SPIDER_SYS_TABLE_VERSION_NUM) + { + thd->clear_error(); + } else { + pthread_mutex_unlock(&share->crd_mutex); + pthread_mutex_unlock(&share->sts_mutex); + goto error_after_alloc_dbton_handler; + } } if ( ( !same_server_link || load_crd_at_startup ) && - spider_get_crd(share, spider->search_link_idx, + (*error_num = spider_get_crd(share, spider->search_link_idx, tmp_time, spider, table, crd_interval, crd_mode, #ifdef WITH_PARTITION_STORAGE_ENGINE crd_sync, #endif - 1) + 1)) ) { - thd->clear_error(); + if (*error_num != ER_SPIDER_SYS_TABLE_VERSION_NUM) + { + thd->clear_error(); + } else { + pthread_mutex_unlock(&share->crd_mutex); + pthread_mutex_unlock(&share->sts_mutex); + goto error_after_alloc_dbton_handler; + } } } share->init_error = FALSE; @@ -5702,6 +5751,22 @@ SPIDER_SHARE *spider_get_share( DBUG_PRINT("info",("spider share=%p", share)); DBUG_RETURN(share); +error_after_alloc_dbton_handler: + for (roop_count = 0; roop_count < (int) share->use_dbton_count; ++roop_count) + { + uint dbton_id = share->use_dbton_ids[roop_count]; + if (spider->dbton_handler[dbton_id]) + { + delete spider->dbton_handler[dbton_id]; + spider->dbton_handler[dbton_id] = NULL; + } + } +error_after_alloc_conn_keys: + spider_free(spider_current_trx, spider->conn_keys, MYF(0)); + spider->conn_keys = NULL; + spider_free_share(share); + goto error_but_no_delete; + error_hash_insert: spider_free_share_resource_only(share); error_alloc_share: @@ -5780,14 +5845,7 @@ int spider_free_share( thd, share->lgtm_tblhnd_share->table_name, share->lgtm_tblhnd_share->table_name_length, - &share->data_file_length, - &share->max_data_file_length, - &share->index_file_length, - &share->records, - &share->mean_rec_length, - &share->check_time, - &share->create_time, - &share->update_time, + &share->stat, FALSE ); } @@ -6163,21 +6221,7 @@ void spider_copy_sts_to_pt_share( SPIDER_SHARE *share ) { DBUG_ENTER("spider_copy_sts_to_pt_share"); - memcpy(&partition_share->data_file_length, &share->data_file_length, - sizeof(ulonglong) * 4 + sizeof(ha_rows) + - sizeof(ulong) + sizeof(time_t) * 3); -/* - partition_share->data_file_length = share->data_file_length; - partition_share->max_data_file_length = share->max_data_file_length; - partition_share->index_file_length = share->index_file_length; - partition_share->auto_increment_value = - share->lgtm_tblhnd_share->auto_increment_value; - partition_share->records = share->records; - partition_share->mean_rec_length = share->mean_rec_length; - partition_share->check_time = share->check_time; - partition_share->create_time = share->create_time; - partition_share->update_time = share->update_time; -*/ + partition_share->stat = share->stat; DBUG_VOID_RETURN; } @@ -6186,23 +6230,7 @@ void spider_copy_sts_to_share( SPIDER_PARTITION_SHARE *partition_share ) { DBUG_ENTER("spider_copy_sts_to_share"); - memcpy(&share->data_file_length, &partition_share->data_file_length, - sizeof(ulonglong) * 4 + sizeof(ha_rows) + - sizeof(ulong) + sizeof(time_t) * 3); -/* - share->data_file_length = partition_share->data_file_length; - share->max_data_file_length = partition_share->max_data_file_length; - share->index_file_length = partition_share->index_file_length; - share->lgtm_tblhnd_share->auto_increment_value = - partition_share->auto_increment_value; - DBUG_PRINT("info",("spider auto_increment_value=%llu", - share->lgtm_tblhnd_share->auto_increment_value)); - share->records = partition_share->records; - share->mean_rec_length = partition_share->mean_rec_length; - share->check_time = partition_share->check_time; - share->create_time = partition_share->create_time; - share->update_time = partition_share->update_time; -*/ + share->stat = partition_share->stat; DBUG_VOID_RETURN; } @@ -6548,6 +6576,30 @@ handler* spider_create_handler( MEM_ROOT *mem_root ) { DBUG_ENTER("spider_create_handler"); +#ifndef WITHOUT_SPIDER_BG_SEARCH + SPIDER_THREAD *thread = &spider_table_sts_threads[0]; + if (unlikely(thread->init_command)) + { + THD *thd = current_thd; + pthread_cond_t *cond = thd->mysys_var->current_cond; + pthread_mutex_t *mutex = thd->mysys_var->current_mutex; + /* wait for finishing init_command */ + pthread_mutex_lock(&thread->mutex); + if (unlikely(thread->init_command)) + { + thd->mysys_var->current_cond = &thread->sync_cond; + thd->mysys_var->current_mutex = &thread->mutex; + pthread_cond_wait(&thread->sync_cond, &thread->mutex); + } + pthread_mutex_unlock(&thread->mutex); + thd->mysys_var->current_cond = cond; + thd->mysys_var->current_mutex = mutex; + if (thd->killed) + { + DBUG_RETURN(NULL); + } + } +#endif DBUG_RETURN(new (mem_root) ha_spider(hton, table)); } @@ -6959,6 +7011,10 @@ int spider_db_init( GetProcAddress(current_module, "my_defaults_extra_file"); spd_defaults_file = (const char **) GetProcAddress(current_module, "my_defaults_file"); + spd_mysqld_unix_port = (const char **) + GetProcAddress(current_module, "?mysqld_unix_port@@3PADA"); + spd_mysqld_port = (uint *) + GetProcAddress(current_module, "?mysqld_port@@3IA"); spd_abort_loop = (bool volatile *) GetProcAddress(current_module, "?abort_loop@@3_NC"); spd_tz_system = *(Time_zone **) @@ -6967,6 +7023,13 @@ int spider_db_init( #else GetProcAddress(current_module, "?my_tz_SYSTEM@@3PAVTime_zone@@A"); #endif + spd_mysqld_server_started = (int *) + GetProcAddress(current_module, "?mysqld_server_started@@3HA"); + spd_LOCK_server_started = (pthread_mutex_t *) + GetProcAddress(current_module, + "?LOCK_server_started@@3Ust_mysql_mutex@@A"); + spd_COND_server_started = (pthread_cond_t *) + GetProcAddress(current_module, "?COND_server_started@@3Ust_mysql_cond@@A"); #else #ifndef SPIDER_HAS_NEXT_THREAD_ID spd_db_att_thread_id = &thread_id; @@ -6985,8 +7048,13 @@ int spider_db_init( spd_charset_utf8_bin = &my_charset_utf8_bin; spd_defaults_extra_file = &my_defaults_extra_file; spd_defaults_file = &my_defaults_file; + spd_mysqld_unix_port = (const char **) &mysqld_unix_port; + spd_mysqld_port = &mysqld_port; spd_abort_loop = &abort_loop; spd_tz_system = my_tz_SYSTEM; + spd_mysqld_server_started = &mysqld_server_started; + spd_LOCK_server_started = &LOCK_server_started; + spd_COND_server_started = &COND_server_started; #endif #ifdef HAVE_PSI_INTERFACE @@ -7272,6 +7340,7 @@ int spider_db_init( NullS)) ) goto error_alloc_mon_mutxes; + spider_table_sts_threads[0].init_command = TRUE; for (roop_count = 0; roop_count < (int) spider_param_table_sts_thread_count(); @@ -7323,7 +7392,6 @@ int spider_db_init( } } } - DBUG_RETURN(0); #ifndef WITHOUT_SPIDER_BG_SEARCH @@ -7624,10 +7692,8 @@ int spider_get_sts( if ( sts_sync == 0 ) { -#endif /* get */ get_type = 1; -#ifdef WITH_PARTITION_STORAGE_ENGINE } else if ( !share->partition_share->sts_init ) { @@ -7666,14 +7732,7 @@ int spider_get_sts( current_thd, share->lgtm_tblhnd_share->table_name, share->lgtm_tblhnd_share->table_name_length, - &share->data_file_length, - &share->max_data_file_length, - &share->index_file_length, - &share->records, - &share->mean_rec_length, - &share->check_time, - &share->create_time, - &share->update_time, + &share->stat, FALSE ); if ( @@ -7781,10 +7840,8 @@ int spider_get_crd( if ( crd_sync == 0 ) { -#endif /* get */ get_type = 1; -#ifdef WITH_PARTITION_STORAGE_ENGINE } else if ( !share->partition_share->crd_init ) { @@ -8404,16 +8461,9 @@ void spider_free_tmp_dbton_handler( TABLE_LIST *spider_get_parent_table_list( ha_spider *spider ) { - TABLE *table = spider->get_table(); - TABLE_LIST *table_list = table->pos_in_table_list; + TABLE *table = spider->get_top_table(); DBUG_ENTER("spider_get_parent_table_list"); - if (table_list) - { - while (table_list->parent_l) - table_list = table_list->parent_l; - DBUG_RETURN(table_list); - } - DBUG_RETURN(NULL); + DBUG_RETURN(table->pos_in_table_list); } List<Index_hint> *spider_get_index_hints( @@ -8847,6 +8897,13 @@ bool spider_check_direct_order_limit( break; } } + if (!spider_all_part_in_order((ORDER *) select_lex->group_list.first, + spider->get_table())) + { + DBUG_PRINT("info",("spider FALSE by group condition")); + first_check = FALSE; + spider->result_list.direct_distinct = FALSE; + } #endif } @@ -8912,6 +8969,98 @@ bool spider_check_direct_order_limit( DBUG_RETURN(FALSE); } +#ifdef HANDLER_HAS_DIRECT_AGGREGATE +bool spider_all_part_in_order( + ORDER *order, + TABLE *table +) { + TABLE_LIST *parent; + partition_info *part_info; + Field **part_fields; + ORDER *ptr; + Item *item; + Item_field *item_field; + DBUG_ENTER("spider_all_part_in_order"); + while (TRUE) + { + DBUG_PRINT("info", ("spider table_name = %s", table->s->db.str)); + DBUG_PRINT("info",("spider part_info=%p", table->part_info)); + if ((part_info = table->part_info)) + { + for (part_fields = part_info->full_part_field_array; + *part_fields; ++part_fields) + { + DBUG_PRINT("info", ("spider part_field = %s", + SPIDER_field_name_str(*part_fields))); + for (ptr = order; ptr; ptr = ptr->next) + { + item = *ptr->item; + if (item->type() != Item::FIELD_ITEM) + { + continue; + } + item_field = (Item_field *) item; + Field *field = item_field->field; + if (!field) + { + continue; + } + DBUG_PRINT("info", ("spider field_name = %s.%s", + field->table->s->db.str, SPIDER_field_name_str(field))); + if (*part_fields == spider_field_exchange(table->file, field)) + { + break; + } + } + if (!ptr) + { + DBUG_RETURN(FALSE); + } + } + } + if (!(parent = table->pos_in_table_list->parent_l)) + { + break; + } + table = parent->table; + } + DBUG_RETURN(TRUE); +} + +Field *spider_field_exchange( + handler *handler, + Field *field +) { + DBUG_ENTER("spider_field_exchange"); +#ifdef HA_CAN_BULK_ACCESS + if (handler->is_bulk_access_clone) + { + handler = handler->pt_clone_source_handler; + } +#endif + DBUG_PRINT("info",("spider in field=%p", field)); + DBUG_PRINT("info",("spider in field->table=%p", field->table)); +#ifdef HANDLER_HAS_TOP_TABLE_FIELDS + if (handler->set_top_table_fields) + { + DBUG_PRINT("info",("spider top_table=%p", handler->top_table)); + if (field->table != handler->top_table) + DBUG_RETURN(NULL); + if (!(field = handler->top_table_field[field->field_index])) + DBUG_RETURN(NULL); + } else { +#endif + DBUG_PRINT("info",("spider table=%p", handler->get_table())); + if (field->table != handler->get_table()) + DBUG_RETURN(NULL); +#ifdef HANDLER_HAS_TOP_TABLE_FIELDS + } +#endif + DBUG_PRINT("info",("spider out field=%p", field)); + DBUG_RETURN(field); +} +#endif + int spider_set_direct_limit_offset( ha_spider *spider ) { @@ -9206,7 +9355,9 @@ int spider_discover_table_structure( str.q_append(share->table_name.str, share->table_name.length); str.q_append(SPIDER_SQL_LCL_NAME_QUOTE_STR, SPIDER_SQL_LCL_NAME_QUOTE_LEN); str.q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN); +#ifdef WITH_PARTITION_STORAGE_ENGINE str_len = str.length(); +#endif #ifdef SPIDER_HAS_HASH_VALUE_TYPE my_hash_value_type hash_value = my_calc_hash(&spider_open_tables, (uchar*) table_name, table_name_length); @@ -9881,6 +10032,53 @@ void *spider_table_bg_sts_action( trx->thd = thd; /* init end */ + if (thread->init_command) + { + uint i = 0; + tmp_disable_binlog(thd); + thd->security_ctx->skip_grants(); + thd->client_capabilities |= CLIENT_MULTI_RESULTS; + if (!(*spd_mysqld_server_started) && !thd->killed) + { + pthread_mutex_lock(spd_LOCK_server_started); + thd->mysys_var->current_cond = spd_COND_server_started; + thd->mysys_var->current_mutex = spd_LOCK_server_started; + if (!(*spd_mysqld_server_started) && !thd->killed) + { + pthread_cond_wait(spd_COND_server_started, spd_LOCK_server_started); + } + pthread_mutex_unlock(spd_LOCK_server_started); + thd->mysys_var->current_cond = &thread->cond; + thd->mysys_var->current_mutex = &thread->mutex; + } + while (spider_init_queries[i].length && !thd->killed) + { + dispatch_command(COM_QUERY, thd, spider_init_queries[i].str, + (uint) spider_init_queries[i].length, FALSE, FALSE); + if (unlikely(thd->is_error())) + { + fprintf(stderr, "[ERROR] %s\n", spider_stmt_da_message(thd)); + thd->clear_error(); + break; + } + ++i; + } + thd->mysys_var->current_cond = &thread->cond; + thd->mysys_var->current_mutex = &thread->mutex; + thd->client_capabilities -= CLIENT_MULTI_RESULTS; + reenable_binlog(thd); + thread->init_command = FALSE; + pthread_cond_broadcast(&thread->sync_cond); + } + if (thd->killed) + { + thread->killed = TRUE; + } + if (thd->killed) + { + thread->killed = TRUE; + } + while (TRUE) { DBUG_PRINT("info",("spider bg sts loop start")); diff --git a/storage/spider/spd_table.h b/storage/spider/spd_table.h index 362ebf263ca..6aaac2046e4 100644 --- a/storage/spider/spd_table.h +++ b/storage/spider/spd_table.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2008-2017 Kentoku Shiba +/* Copyright (C) 2008-2019 Kentoku Shiba + Copyright (C) 2019 MariaDB corp This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -179,6 +180,94 @@ typedef struct st_spider_param_string_parse DBUG_RETURN(error_num); } + inline int get_next_parameter_head(char *st, char **nx) + { + DBUG_ENTER("get_next_parameter_head"); + char *sq = strchr(st, '\''); + char *dq = strchr(st, '"'); + if (!sq && !dq) + { + DBUG_RETURN(print_param_error()); + } + else if (!sq || sq > dq) + { + while (1) + { + ++dq; + if (*dq == '\\') + { + ++dq; + } + else if (*dq == '"') + { + break; + } + else if (*dq == '\0') + { + DBUG_RETURN(print_param_error()); + } + } + while (1) + { + ++dq; + if (*dq == '\0') + { + *nx = dq; + break; + } + else if (*dq == ',') + { + *dq = '\0'; + *nx = dq + 1; + break; + } + else if (*dq != ' ' && *dq != '\r' && *dq != '\n' && *dq != '\t') + { + DBUG_RETURN(print_param_error()); + } + } + } + else + { + while (1) + { + ++sq; + if (*sq == '\\') + { + ++sq; + } + else if (*sq == '\'') + { + break; + } + else if (*sq == '\0') + { + DBUG_RETURN(print_param_error()); + } + } + while (1) + { + ++sq; + if (*sq == '\0') + { + *nx = sq; + break; + } + else if (*sq == ',') + { + *sq = '\0'; + *nx = sq + 1; + break; + } + else if (*sq != ' ' && *sq != '\r' && *sq != '\n' && *sq != '\t') + { + DBUG_RETURN(print_param_error()); + } + } + } + DBUG_RETURN(0); + } + /** Restore the current parameter's input delimiter characters in the parameter string. They were NULLed during parameter parsing. @@ -638,6 +727,18 @@ bool spider_check_direct_order_limit( ha_spider *spider ); +#ifdef HANDLER_HAS_DIRECT_AGGREGATE +bool spider_all_part_in_order( + ORDER *order, + TABLE *table +); + +Field *spider_field_exchange( + handler *handler, + Field *field +); +#endif + int spider_set_direct_limit_offset( ha_spider* spider ); diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc index bb9f11793cb..4f8296f1d01 100644 --- a/storage/spider/spd_trx.cc +++ b/storage/spider/spd_trx.cc @@ -1,4 +1,5 @@ -/* Copyright (C) 2008-2018 Kentoku Shiba +/* Copyright (C) 2008-2019 Kentoku Shiba + Copyright (C) 2019 MariaDB corp This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1667,6 +1668,32 @@ int spider_check_and_set_sql_log_off( DBUG_RETURN(0); } +int spider_check_and_set_wait_timeout( + THD *thd, + SPIDER_CONN *conn, + int *need_mon +) { + int wait_timeout; + DBUG_ENTER("spider_check_and_set_wait_timeout"); + + wait_timeout = spider_param_wait_timeout(thd); + if (wait_timeout > 0) + { + spider_conn_queue_wait_timeout(conn, wait_timeout); + } + DBUG_RETURN(0); +} + +int spider_check_and_set_sql_mode( + THD *thd, + SPIDER_CONN *conn, + int *need_mon +) { + DBUG_ENTER("spider_check_and_set_sql_mode"); + spider_conn_queue_sql_mode(conn, thd->variables.sql_mode); + DBUG_RETURN(0); +} + int spider_check_and_set_time_zone( THD *thd, SPIDER_CONN *conn, @@ -1690,8 +1717,9 @@ int spider_check_and_set_time_zone( DBUG_RETURN(0); } -int spider_xa_lock( - XID_STATE *xid_state +static int spider_xa_lock( + XID_STATE *xid_state, + XID *xid ) { THD *thd = current_thd; int error_num; @@ -1709,7 +1737,7 @@ int spider_xa_lock( #endif old_proc_info = thd_proc_info(thd, "Locking xid by Spider"); #ifdef SPIDER_XID_USES_xid_cache_iterate - if (xid_cache_insert(thd, xid_state)) + if (xid_cache_insert(thd, xid_state, xid)) { error_num = (spider_stmt_da_sql_errno(thd) == ER_XAER_DUPID ? ER_SPIDER_XA_LOCKED_NUM : HA_ERR_OUT_OF_MEM); @@ -1774,7 +1802,7 @@ error: DBUG_RETURN(error_num); } -int spider_xa_unlock( +static int spider_xa_unlock( XID_STATE *xid_state ) { THD *thd = current_thd; @@ -1866,6 +1894,11 @@ int spider_internal_start_trx( if ( (error_num = spider_check_and_set_sql_log_off(thd, conn, &spider->need_mons[link_idx])) || + (error_num = spider_check_and_set_wait_timeout(thd, conn, + &spider->need_mons[link_idx])) || + (spider_param_sync_sql_mode(thd) && + (error_num = spider_check_and_set_sql_mode(thd, conn, + &spider->need_mons[link_idx]))) || (sync_autocommit && (error_num = spider_check_and_set_autocommit(thd, conn, &spider->need_mons[link_idx]))) @@ -1891,7 +1924,7 @@ int spider_internal_start_trx( if (!trx->trx_start) { if ( - thd->transaction.xid_state.xa_state == XA_ACTIVE && + thd->transaction.xid_state.is_explicit_XA() && spider_param_support_xa() ) { trx->trx_xa = TRUE; @@ -1929,12 +1962,10 @@ int spider_internal_start_trx( thd->server_id)); #endif - trx->internal_xid_state.xa_state = XA_ACTIVE; - trx->internal_xid_state.xid.set(&trx->xid); #ifdef SPIDER_XID_STATE_HAS_in_thd trx->internal_xid_state.in_thd = 1; #endif - if ((error_num = spider_xa_lock(&trx->internal_xid_state))) + if ((error_num = spider_xa_lock(&trx->internal_xid_state, &trx->xid))) { if (error_num == ER_SPIDER_XA_LOCKED_NUM) my_message(error_num, ER_SPIDER_XA_LOCKED_STR, MYF(0)); @@ -2197,8 +2228,10 @@ int spider_internal_xa_commit( spider_close_sys_table(thd, table_xa, &open_tables_backup, TRUE); table_xa_opened = FALSE; } - spider_xa_unlock(&trx->internal_xid_state); - trx->internal_xid_state.xa_state = XA_NOTR; + if (trx->internal_xa) + { + spider_xa_unlock(&trx->internal_xid_state); + } DBUG_RETURN(0); error: @@ -2208,8 +2241,10 @@ error: spider_close_sys_table(thd, table_xa_member, &open_tables_backup, TRUE); error_in_commit: error_open_table: - spider_xa_unlock(&trx->internal_xid_state); - trx->internal_xid_state.xa_state = XA_NOTR; + if (trx->internal_xa) + { + spider_xa_unlock(&trx->internal_xid_state); + } DBUG_RETURN(error_num); } @@ -2435,8 +2470,10 @@ int spider_internal_xa_rollback( spider_close_sys_table(thd, table_xa, &open_tables_backup, TRUE); table_xa_opened = FALSE; } - spider_xa_unlock(&trx->internal_xid_state); - trx->internal_xid_state.xa_state = XA_NOTR; + if (trx->internal_xa) + { + spider_xa_unlock(&trx->internal_xid_state); + } DBUG_RETURN(0); error: @@ -2446,8 +2483,10 @@ error: spider_close_sys_table(thd, table_xa_member, &open_tables_backup, TRUE); error_in_rollback: error_open_table: - spider_xa_unlock(&trx->internal_xid_state); - trx->internal_xid_state.xa_state = XA_NOTR; + if (trx->internal_xa) + { + spider_xa_unlock(&trx->internal_xid_state); + } DBUG_RETURN(error_num); } @@ -2616,8 +2655,6 @@ int spider_internal_xa_prepare( spider_close_sys_table(thd, table_xa, &open_tables_backup, TRUE); table_xa_opened = FALSE; } - if (internal_xa) - trx->internal_xid_state.xa_state = XA_PREPARED; DBUG_RETURN(0); error: diff --git a/storage/spider/spd_trx.h b/storage/spider/spd_trx.h index dec1db4d863..3883ec49723 100644 --- a/storage/spider/spd_trx.h +++ b/storage/spider/spd_trx.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2008-2014 Kentoku Shiba +/* Copyright (C) 2008-2019 Kentoku Shiba + Copyright (C) 2019 MariaDB corp This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -99,18 +100,22 @@ int spider_check_and_set_sql_log_off( int *need_mon ); -int spider_check_and_set_time_zone( +int spider_check_and_set_wait_timeout( THD *thd, SPIDER_CONN *conn, int *need_mon ); -int spider_xa_lock( - XID_STATE *xid_state +int spider_check_and_set_sql_mode( + THD *thd, + SPIDER_CONN *conn, + int *need_mon ); -int spider_xa_unlock( - XID_STATE *xid_state +int spider_check_and_set_time_zone( + THD *thd, + SPIDER_CONN *conn, + int *need_mon ); int spider_start_internal_consistent_snapshot( |