diff options
author | Kentoku SHIBA <kentokushiba@gmail.com> | 2015-05-05 03:09:34 +0900 |
---|---|---|
committer | Kentoku SHIBA <kentokushiba@gmail.com> | 2015-05-05 03:09:34 +0900 |
commit | 9130cc7f3c516bba0dc729dd388af0710d1f28d3 (patch) | |
tree | cbe0a497e2f2fb188e3afa17cca34bf7862bbf5e /storage/spider | |
parent | 060ec5b6b9384456695b6fc903ccfeb8c7ccd298 (diff) | |
download | mariadb-git-9130cc7f3c516bba0dc729dd388af0710d1f28d3.tar.gz |
update Spider to 3.2.21
Diffstat (limited to 'storage/spider')
-rw-r--r-- | storage/spider/ha_spider.cc | 29 | ||||
-rw-r--r-- | storage/spider/spd_db_mysql.cc | 60 | ||||
-rw-r--r-- | storage/spider/spd_db_oracle.cc | 60 | ||||
-rw-r--r-- | storage/spider/spd_include.h | 8 | ||||
-rw-r--r-- | storage/spider/spd_param.cc | 27 | ||||
-rw-r--r-- | storage/spider/spd_param.h | 4 | ||||
-rw-r--r-- | storage/spider/spd_table.cc | 26 |
7 files changed, 162 insertions, 52 deletions
diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 40d5c0e8450..b4602e5aa4f 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2014 Kentoku Shiba +/* Copyright (C) 2008-2015 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 @@ -8529,12 +8529,16 @@ int ha_spider::info( } else if (tmp_auto_increment_mode == 1 && !share->lgtm_tblhnd_share->auto_increment_init) { + DBUG_PRINT("info",("spider auto_increment_value=%llu", + share->lgtm_tblhnd_share->auto_increment_value)); share->lgtm_tblhnd_share->auto_increment_lclval = share->lgtm_tblhnd_share->auto_increment_value; share->lgtm_tblhnd_share->auto_increment_init = TRUE; stats.auto_increment_value = share->lgtm_tblhnd_share->auto_increment_value; } else { + DBUG_PRINT("info",("spider auto_increment_value=%llu", + share->lgtm_tblhnd_share->auto_increment_value)); stats.auto_increment_value = share->lgtm_tblhnd_share->auto_increment_value; } @@ -9198,12 +9202,18 @@ bool ha_spider::need_info_for_auto_inc() DBUG_ENTER("ha_spider::need_info_for_auto_inc"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider return=%s", ( - !spider_param_auto_increment_mode(thd, share->auto_increment_mode) && - !info_auto_called + !share->lgtm_tblhnd_share->auto_increment_init || + ( + !spider_param_auto_increment_mode(thd, share->auto_increment_mode) && + !info_auto_called + ) ) ? "TRUE" : "FALSE")); DBUG_RETURN(( - !spider_param_auto_increment_mode(thd, share->auto_increment_mode) && - !info_auto_called + !share->lgtm_tblhnd_share->auto_increment_init || + ( + !spider_param_auto_increment_mode(thd, share->auto_increment_mode) && + !info_auto_called + ) )); } #endif @@ -9245,6 +9255,10 @@ int ha_spider::update_auto_increment() DBUG_PRINT("info",("spider force_auto_increment=FALSE")); } */ + DBUG_PRINT("info",("spider auto_increment_mode=%d", + auto_increment_mode)); + DBUG_PRINT("info",("spider next_number_field=%lld", + table->next_number_field->val_int())); if ( auto_increment_mode == 1 && !( @@ -9256,6 +9270,8 @@ int ha_spider::update_auto_increment() lock_here = TRUE; pthread_mutex_lock(&share->lgtm_tblhnd_share->auto_increment_mutex); next_insert_id = share->lgtm_tblhnd_share->auto_increment_value; + DBUG_PRINT("info",("spider auto_increment_value=%llu", + share->lgtm_tblhnd_share->auto_increment_value)); } if ((error_num = handler::update_auto_increment())) { @@ -10843,6 +10859,9 @@ int ha_spider::rename_table( pthread_mutex_unlock(&spider_lgtm_tblhnd_share_mutex); goto error; } + DBUG_PRINT("info", + ("spider auto_increment_init=%s", + from_lgtm_tblhnd_share->auto_increment_init ? "TRUE" : "FALSE")); to_lgtm_tblhnd_share->auto_increment_init = from_lgtm_tblhnd_share->auto_increment_init; to_lgtm_tblhnd_share->auto_increment_lclval = diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index e4d9d150bcd..1b40265e9b6 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -5384,28 +5384,46 @@ void spider_mysql_handler::create_tmp_bka_table_name( int *tmp_table_name_length, int link_idx ) { - uint adjust_length = - mysql_share->db_nm_max_length - - mysql_share->db_names_str[spider->conn_link_idx[link_idx]].length() + - mysql_share->table_nm_max_length - - mysql_share->table_names_str[spider->conn_link_idx[link_idx]].length(), - length; + uint adjust_length, length; DBUG_ENTER("spider_mysql_handler::create_tmp_bka_table_name"); - *tmp_table_name_length = mysql_share->db_nm_max_length + - mysql_share->table_nm_max_length; - memset(tmp_table_name, ' ', adjust_length); - tmp_table_name += adjust_length; - memcpy(tmp_table_name, mysql_share->db_names_str[link_idx].c_ptr(), - mysql_share->db_names_str[link_idx].length()); - tmp_table_name += mysql_share->db_names_str[link_idx].length(); - length = my_sprintf(tmp_table_name, (tmp_table_name, - "%s%s%p%s", SPIDER_SQL_DOT_STR, SPIDER_SQL_TMP_BKA_STR, spider, - SPIDER_SQL_UNDERSCORE_STR)); - *tmp_table_name_length += length; - tmp_table_name += length; - memcpy(tmp_table_name, - mysql_share->table_names_str[spider->conn_link_idx[link_idx]].c_ptr(), - mysql_share->table_names_str[spider->conn_link_idx[link_idx]].length()); + if (spider_param_bka_table_name_type(current_thd, + mysql_share->spider_share-> + bka_table_name_types[spider->conn_link_idx[link_idx]]) == 1) + { + adjust_length = + mysql_share->db_nm_max_length - + mysql_share->db_names_str[spider->conn_link_idx[link_idx]].length() + + mysql_share->table_nm_max_length - + mysql_share->table_names_str[spider->conn_link_idx[link_idx]].length(); + *tmp_table_name_length = mysql_share->db_nm_max_length + + mysql_share->table_nm_max_length; + memset(tmp_table_name, ' ', adjust_length); + tmp_table_name += adjust_length; + memcpy(tmp_table_name, mysql_share->db_names_str[link_idx].c_ptr(), + mysql_share->db_names_str[link_idx].length()); + tmp_table_name += mysql_share->db_names_str[link_idx].length(); + length = my_sprintf(tmp_table_name, (tmp_table_name, + "%s%s%p%s", SPIDER_SQL_DOT_STR, SPIDER_SQL_TMP_BKA_STR, spider, + SPIDER_SQL_UNDERSCORE_STR)); + *tmp_table_name_length += length; + tmp_table_name += length; + memcpy(tmp_table_name, + mysql_share->table_names_str[spider->conn_link_idx[link_idx]].c_ptr(), + mysql_share->table_names_str[spider->conn_link_idx[link_idx]].length()); + } else { + adjust_length = + mysql_share->db_nm_max_length - + mysql_share->db_names_str[spider->conn_link_idx[link_idx]].length(); + *tmp_table_name_length = mysql_share->db_nm_max_length; + memset(tmp_table_name, ' ', adjust_length); + tmp_table_name += adjust_length; + memcpy(tmp_table_name, mysql_share->db_names_str[link_idx].c_ptr(), + mysql_share->db_names_str[link_idx].length()); + tmp_table_name += mysql_share->db_names_str[link_idx].length(); + length = my_sprintf(tmp_table_name, (tmp_table_name, + "%s%s%p", SPIDER_SQL_DOT_STR, SPIDER_SQL_TMP_BKA_STR, spider)); + *tmp_table_name_length += length; + } DBUG_VOID_RETURN; } diff --git a/storage/spider/spd_db_oracle.cc b/storage/spider/spd_db_oracle.cc index d536020e513..d86da799bee 100644 --- a/storage/spider/spd_db_oracle.cc +++ b/storage/spider/spd_db_oracle.cc @@ -5103,28 +5103,46 @@ void spider_oracle_handler::create_tmp_bka_table_name( int *tmp_table_name_length, int link_idx ) { - uint adjust_length = - oracle_share->db_nm_max_length - - oracle_share->db_names_str[spider->conn_link_idx[link_idx]].length() + - oracle_share->table_nm_max_length - - oracle_share->table_names_str[spider->conn_link_idx[link_idx]].length(), - length; + uint adjust_length, length; DBUG_ENTER("spider_oracle_handler::create_tmp_bka_table_name"); - *tmp_table_name_length = oracle_share->db_nm_max_length + - oracle_share->table_nm_max_length; - memset(tmp_table_name, ' ', adjust_length); - tmp_table_name += adjust_length; - memcpy(tmp_table_name, oracle_share->db_names_str[link_idx].c_ptr(), - oracle_share->db_names_str[link_idx].length()); - tmp_table_name += oracle_share->db_names_str[link_idx].length(); - length = my_sprintf(tmp_table_name, (tmp_table_name, - "%s%s%p%s", SPIDER_SQL_DOT_STR, SPIDER_SQL_TMP_BKA_STR, spider, - SPIDER_SQL_UNDERSCORE_STR)); - *tmp_table_name_length += length; - tmp_table_name += length; - memcpy(tmp_table_name, - oracle_share->table_names_str[spider->conn_link_idx[link_idx]].c_ptr(), - oracle_share->table_names_str[spider->conn_link_idx[link_idx]].length()); + if (spider_param_bka_table_name_type(current_thd, + mysql_share->spider_share-> + bka_table_name_types[spider->conn_link_idx[link_idx]]) == 1) + { + adjust_length = + oracle_share->db_nm_max_length - + oracle_share->db_names_str[spider->conn_link_idx[link_idx]].length() + + oracle_share->table_nm_max_length - + oracle_share->table_names_str[spider->conn_link_idx[link_idx]].length(); + *tmp_table_name_length = oracle_share->db_nm_max_length + + oracle_share->table_nm_max_length; + memset(tmp_table_name, ' ', adjust_length); + tmp_table_name += adjust_length; + memcpy(tmp_table_name, oracle_share->db_names_str[link_idx].c_ptr(), + oracle_share->db_names_str[link_idx].length()); + tmp_table_name += oracle_share->db_names_str[link_idx].length(); + length = my_sprintf(tmp_table_name, (tmp_table_name, + "%s%s%p%s", SPIDER_SQL_DOT_STR, SPIDER_SQL_TMP_BKA_STR, spider, + SPIDER_SQL_UNDERSCORE_STR)); + *tmp_table_name_length += length; + tmp_table_name += length; + memcpy(tmp_table_name, + oracle_share->table_names_str[spider->conn_link_idx[link_idx]].c_ptr(), + oracle_share->table_names_str[spider->conn_link_idx[link_idx]].length()); + } else { + adjust_length = + oracle_share->db_nm_max_length - + oracle_share->db_names_str[spider->conn_link_idx[link_idx]].length(); + *tmp_table_name_length = oracle_share->db_nm_max_length; + memset(tmp_table_name, ' ', adjust_length); + tmp_table_name += adjust_length; + memcpy(tmp_table_name, oracle_share->db_names_str[link_idx].c_ptr(), + oracle_share->db_names_str[link_idx].length()); + tmp_table_name += oracle_share->db_names_str[link_idx].length(); + length = my_sprintf(tmp_table_name, (tmp_table_name, + "%s%s%p", SPIDER_SQL_DOT_STR, SPIDER_SQL_TMP_BKA_STR, spider)); + *tmp_table_name_length += length; + } DBUG_VOID_RETURN; } diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h index 9c7eebb65c8..9f27bd6acf8 100644 --- a/storage/spider/spd_include.h +++ b/storage/spider/spd_include.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2014 Kentoku Shiba +/* Copyright (C) 2008-2015 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,7 +13,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#define SPIDER_DETAIL_VERSION "3.2.18" +#define SPIDER_DETAIL_VERSION "3.2.21" #define SPIDER_HEX_VERSION 0x0302 #if MYSQL_VERSION_ID < 50500 @@ -141,7 +141,7 @@ #define SPIDER_TMP_SHARE_CHAR_PTR_COUNT 19 #define SPIDER_TMP_SHARE_UINT_COUNT 17 -#define SPIDER_TMP_SHARE_LONG_COUNT 15 +#define SPIDER_TMP_SHARE_LONG_COUNT 16 #define SPIDER_TMP_SHARE_LONGLONG_COUNT 3 #define SPIDER_MEM_CALC_LIST_NUM 247 @@ -864,6 +864,7 @@ typedef struct st_spider_share long *net_read_timeouts; long *net_write_timeouts; long *access_balances; + long *bka_table_name_types; uint *server_names_lengths; uint *tgt_table_names_lengths; @@ -967,6 +968,7 @@ typedef struct st_spider_share uint net_read_timeouts_length; uint net_write_timeouts_length; uint access_balances_length; + uint bka_table_name_types_length; /* for dbton */ uchar dbton_bitmap[spider_bitmap_size(SPIDER_DBTON_SIZE)]; diff --git a/storage/spider/spd_param.cc b/storage/spider/spd_param.cc index 2b1e87313d1..7376bfc0499 100644 --- a/storage/spider/spd_param.cc +++ b/storage/spider/spd_param.cc @@ -2960,6 +2960,32 @@ int spider_param_delete_all_rows_type( delete_all_rows_type : THDVAR(thd, delete_all_rows_type)); } +/* + -1 :use table parameter + 0 :compact + 1 :add original table name + */ +static MYSQL_THDVAR_INT( + bka_table_name_type, /* name */ + PLUGIN_VAR_RQCMDARG, /* opt */ + "The type of temporary table name for bka", /* comment */ + NULL, /* check */ + NULL, /* update */ + -1, /* def */ + -1, /* min */ + 1, /* max */ + 0 /* blk */ +); + +int spider_param_bka_table_name_type( + THD *thd, + int bka_table_name_type +) { + DBUG_ENTER("spider_param_bka_table_name_type"); + DBUG_RETURN(THDVAR(thd, bka_table_name_type) == -1 ? + bka_table_name_type : THDVAR(thd, bka_table_name_type)); +} + static struct st_mysql_storage_engine spider_storage_engine = { MYSQL_HANDLERTON_INTERFACE_VERSION }; @@ -3093,6 +3119,7 @@ static struct st_mysql_sys_var* spider_system_variables[] = { MYSQL_SYSVAR(casual_read), MYSQL_SYSVAR(dry_access), MYSQL_SYSVAR(delete_all_rows_type), + MYSQL_SYSVAR(bka_table_name_type), NULL }; diff --git a/storage/spider/spd_param.h b/storage/spider/spd_param.h index e68143aa774..32db0403159 100644 --- a/storage/spider/spd_param.h +++ b/storage/spider/spd_param.h @@ -383,3 +383,7 @@ int spider_param_delete_all_rows_type( THD *thd, int delete_all_rows_type ); +int spider_param_bka_table_name_type( + THD *thd, + int bka_table_name_type +); diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 084d6aed68c..bece31d4603 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2014 Kentoku Shiba +/* Copyright (C) 2008-2015 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 @@ -771,6 +771,8 @@ int spider_free_share_alloc( spider_free(spider_current_trx, share->net_write_timeouts, MYF(0)); if (share->access_balances) spider_free(spider_current_trx, share->access_balances, MYF(0)); + if (share->bka_table_name_types) + spider_free(spider_current_trx, share->bka_table_name_types, MYF(0)); #ifndef WITHOUT_SPIDER_BG_SEARCH if (share->monitoring_bg_interval) spider_free(spider_current_trx, share->monitoring_bg_interval, MYF(0)); @@ -1987,6 +1989,8 @@ int spider_parse_connect_info( SPIDER_PARAM_STR("bke", bka_engine); SPIDER_PARAM_INT_WITH_MAX("bkm", bka_mode, 0, 2); SPIDER_PARAM_INT("bsz", bulk_size, 0); + SPIDER_PARAM_LONG_LIST_WITH_MAX("btt", bka_table_name_types, + 0, 1); SPIDER_PARAM_INT_WITH_MAX("bum", bulk_update_mode, 0, 2); SPIDER_PARAM_INT("bus", bulk_update_size, 0); #ifndef WITHOUT_SPIDER_BG_SEARCH @@ -2335,6 +2339,8 @@ int spider_parse_connect_info( #if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET) SPIDER_PARAM_LONGLONG("hs_result_free_size", hs_result_free_size, 0); #endif + SPIDER_PARAM_LONG_LIST_WITH_MAX("bka_table_name_type", + bka_table_name_types, 0, 1); error_num = ER_SPIDER_INVALID_CONNECT_INFO_NUM; my_printf_error(error_num, ER_SPIDER_INVALID_CONNECT_INFO_STR, MYF(0), tmp_ptr); @@ -2482,6 +2488,8 @@ int spider_parse_connect_info( share->all_link_count = share->net_write_timeouts_length; if (share->all_link_count < share->access_balances_length) share->all_link_count = share->access_balances_length; + if (share->all_link_count < share->bka_table_name_types_length) + share->all_link_count = share->bka_table_name_types_length; if ((error_num = spider_increase_string_list( &share->server_names, &share->server_names_lengths, @@ -2711,6 +2719,11 @@ int spider_parse_connect_info( &share->access_balances_length, share->all_link_count))) goto error; + if ((error_num = spider_increase_long_list( + &share->bka_table_name_types, + &share->bka_table_name_types_length, + share->all_link_count))) + goto error; /* copy for tables start */ share_alter = &share->alter_table; @@ -3400,6 +3413,8 @@ int spider_set_connect_info_default( share->net_write_timeouts[roop_count] = 600; if (share->access_balances[roop_count] == -1) share->access_balances[roop_count] = 100; + if (share->bka_table_name_types[roop_count] == -1) + share->bka_table_name_types[roop_count] = 0; } #ifndef WITHOUT_SPIDER_BG_SEARCH @@ -7494,6 +7509,7 @@ void spider_set_tmp_share_pointer( tmp_share->net_write_timeouts = &tmp_long[13]; tmp_long[13] = -1; tmp_share->access_balances = &tmp_long[14]; + tmp_share->bka_table_name_types = &tmp_long[15]; tmp_share->monitoring_limit = &tmp_longlong[0]; tmp_share->monitoring_sid = &tmp_longlong[1]; #ifndef WITHOUT_SPIDER_BG_SEARCH @@ -7563,6 +7579,7 @@ void spider_set_tmp_share_pointer( tmp_share->net_read_timeouts_length = 1; tmp_share->net_write_timeouts_length = 1; tmp_share->access_balances_length = 1; + tmp_share->bka_table_name_types_length = 1; #ifndef WITHOUT_SPIDER_BG_SEARCH tmp_share->monitoring_bg_kind[0] = -1; @@ -8136,10 +8153,15 @@ bool spider_check_index_merge( DBUG_PRINT("info",("spider join is null")); DBUG_RETURN(FALSE); } + if (!join->join_tab) + { + DBUG_PRINT("info",("spider join->join_tab is null")); + DBUG_RETURN(FALSE); + } for (roop_count = 0; roop_count < spider_join_table_count(join); ++roop_count) { JOIN_TAB *join_tab = &join->join_tab[roop_count]; - if (join_tab && join_tab->table == table) + if (join_tab->table == table) { DBUG_PRINT("info",("spider join_tab->type=%u", join_tab->type)); if ( |