From 4d980a4701540f06c3d49405ddca2e8d2c65e1d4 Mon Sep 17 00:00:00 2001 From: Kentoku SHIBA Date: Tue, 25 Mar 2014 05:34:57 +0900 Subject: delete all rows type --- storage/spider/ha_spider.cc | 2 ++ storage/spider/spd_include.h | 1 + storage/spider/spd_param.cc | 27 +++++++++++++++++++++++++++ storage/spider/spd_param.h | 4 ++++ storage/spider/spd_table.cc | 12 ++++++++++++ 5 files changed, 46 insertions(+) (limited to 'storage/spider') diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index c883eeee008..d4d597e276f 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -9994,6 +9994,8 @@ int ha_spider::delete_all_rows() backup_error_status(); DBUG_ENTER("ha_spider::delete_all_rows"); DBUG_PRINT("info",("spider this=%p", this)); + if (spider_param_delete_all_rows_type(thd, share->delete_all_rows_type)) + DBUG_RETURN(HA_ERR_WRONG_COMMAND); if (spider_param_read_only_mode(thd, share->read_only_mode)) { my_printf_error(ER_SPIDER_READ_ONLY_NUM, ER_SPIDER_READ_ONLY_STR, MYF(0), diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h index f1190607057..9f3d7f8ab89 100644 --- a/storage/spider/spd_include.h +++ b/storage/spider/spd_include.h @@ -759,6 +759,7 @@ typedef struct st_spider_share int force_bulk_delete; #endif int casual_read; + int delete_all_rows_type; int bka_mode; char *bka_engine; diff --git a/storage/spider/spd_param.cc b/storage/spider/spd_param.cc index ba18d1716d2..9813c7597fd 100644 --- a/storage/spider/spd_param.cc +++ b/storage/spider/spd_param.cc @@ -2934,6 +2934,32 @@ my_bool spider_param_dry_access() DBUG_RETURN(spider_dry_access); } +/* + -1 :use table parameter + 0 :fast + 1 :correct delete row number + */ +static MYSQL_THDVAR_INT( + delete_all_rows_type, /* name */ + PLUGIN_VAR_RQCMDARG, /* opt */ + "The type of delete_all_rows", /* comment */ + NULL, /* check */ + NULL, /* update */ + -1, /* def */ + -1, /* min */ + 1, /* max */ + 0 /* blk */ +); + +int spider_param_delete_all_rows_type( + THD *thd, + int delete_all_rows_type +) { + DBUG_ENTER("spider_param_delete_all_rows_type"); + DBUG_RETURN(THDVAR(thd, delete_all_rows_type) == -1 ? + delete_all_rows_type : THDVAR(thd, delete_all_rows_type)); +} + static struct st_mysql_storage_engine spider_storage_engine = { MYSQL_HANDLERTON_INTERFACE_VERSION }; @@ -3066,6 +3092,7 @@ static struct st_mysql_sys_var* spider_system_variables[] = { MYSQL_SYSVAR(internal_xa_id_type), MYSQL_SYSVAR(casual_read), MYSQL_SYSVAR(dry_access), + MYSQL_SYSVAR(delete_all_rows_type), NULL }; diff --git a/storage/spider/spd_param.h b/storage/spider/spd_param.h index 49952ba3e34..e68143aa774 100644 --- a/storage/spider/spd_param.h +++ b/storage/spider/spd_param.h @@ -379,3 +379,7 @@ int spider_param_casual_read( int casual_read ); my_bool spider_param_dry_access(); +int spider_param_delete_all_rows_type( + THD *thd, + int delete_all_rows_type +); diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 4e3634d7984..e868bae19ce 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -1793,6 +1793,7 @@ int spider_parse_connect_info( share->force_bulk_delete = -1; #endif share->casual_read = -1; + share->delete_all_rows_type = -1; #ifdef WITH_PARTITION_STORAGE_ENGINE for (roop_count = 4; roop_count > 0; roop_count--) @@ -1930,6 +1931,7 @@ int spider_parse_connect_info( 2147483647); SPIDER_PARAM_INT_WITH_MAX("ctp", crd_type, 0, 2); SPIDER_PARAM_DOUBLE("cwg", crd_weight, 1); + SPIDER_PARAM_INT_WITH_MAX("dat", delete_all_rows_type, 0, 1); SPIDER_PARAM_INT_WITH_MAX("ddi", direct_dup_insert, 0, 1); SPIDER_PARAM_STR_LIST("dff", tgt_default_files); SPIDER_PARAM_STR_LIST("dfg", tgt_default_groups); @@ -2262,6 +2264,8 @@ int spider_parse_connect_info( case 20: SPIDER_PARAM_LONGLONG_LIST_WITH_MAX( "monitoring_server_id", monitoring_sid, 0, 4294967295LL); + SPIDER_PARAM_INT_WITH_MAX( + "delete_all_rows_type", delete_all_rows_type, 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); @@ -3441,6 +3445,14 @@ int spider_set_connect_info_default( #endif if (share->casual_read == -1) share->casual_read = 0; + if (share->delete_all_rows_type == -1) + { +#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS + share->delete_all_rows_type = 1; +#else + share->delete_all_rows_type = 0; +#endif + } if (share->bka_mode == -1) share->bka_mode = 1; if (!share->bka_engine) -- cgit v1.2.1