MDEV4786 - merge 10.0-monty → 10.0

sql/sql_table.cc:
  Removed false assertion that HA_NO_COPY_ON_ALTER is merge specific.
  This flag is used at least by Spider and Connect.
storage/spider/ha_spider.cc:
  Renamed THD::stmt_da -> THD::get_stmt_da().
  Renamed KEY::key_parts -> KEY::user_defined_key_parts.
  Renamed ALTER_* flags -> Alter_info::ALTER_*.
storage/spider/spd_conn.cc:
  Renamed THD::stmt_da -> THD::get_stmt_da().
storage/spider/spd_db_conn.cc:
  Renamed MYSQL_ERROR -> Sql_condition.
  Renamed KEY::key_parts -> KEY::user_defined_key_parts.
storage/spider/spd_db_include.h:
  current_comment_start argument of generate_parition_syntax()
  was removed during merge.
storage/spider/spd_db_mysql.cc:
  Renamed KEY::key_parts -> KEY::user_defined_key_parts.
storage/spider/spd_ping_table.cc:
  Renamed THD::stmt_da -> THD::get_stmt_da().
storage/spider/spd_table.cc:
  Include my_getopt.h so that it exports my_defaults_file and
  my_defaults_extra_file.
  Renamed KEY::key_parts -> KEY::user_defined_key_parts.
This commit is contained in:
Sergey Vojtovich 2013-07-23 17:22:02 +04:00
parent 13dca0125a
commit 43946c0888
8 changed files with 59 additions and 60 deletions

View File

@ -8305,8 +8305,6 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
}
else
{
/* Should be MERGE only */
DBUG_ASSERT(new_table->file->ht->db_type == DB_TYPE_MRG_MYISAM);
if (!table->s->tmp_table &&
wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN))
goto err_new_table_cleanup;

View File

@ -7840,7 +7840,7 @@ int ha_spider::info(
thd->main_da.message());
#else
strmov(spider_init_error_table->init_error_msg,
thd->stmt_da->message());
thd->get_stmt_da()->message());
#endif
spider_init_error_table->init_error_time =
(time_t) time((time_t*) 0);
@ -8066,7 +8066,7 @@ ha_rows ha_spider::records_in_range(
thd->main_da.message());
#else
strmov(spider_init_error_table->init_error_msg,
thd->stmt_da->message());
thd->get_stmt_da()->message());
#endif
spider_init_error_table->init_error_time =
(time_t) time((time_t*) 0);
@ -8110,7 +8110,7 @@ ha_rows ha_spider::records_in_range(
KEY *key_info = &table->key_info[inx];
key_part_map full_key_part_map =
make_prev_keypart_map(key_info->key_parts);
make_prev_keypart_map(key_info->user_defined_key_parts);
key_part_map start_key_part_map;
key_part_map end_key_part_map;
key_part_map tgt_key_part_map;
@ -8308,7 +8308,7 @@ int ha_spider::check_crd()
thd->main_da.message());
#else
strmov(spider_init_error_table->init_error_msg,
thd->stmt_da->message());
thd->get_stmt_da()->message());
#endif
spider_init_error_table->init_error_time =
(time_t) time((time_t*) 0);
@ -9726,9 +9726,9 @@ int ha_spider::create(
if (
(thd->lex->alter_info.flags &
(
ALTER_ADD_PARTITION | ALTER_DROP_PARTITION |
ALTER_COALESCE_PARTITION | ALTER_REORGANIZE_PARTITION |
ALTER_TABLE_REORG | ALTER_REBUILD_PARTITION
Alter_info::ALTER_ADD_PARTITION | Alter_info::ALTER_DROP_PARTITION |
Alter_info::ALTER_COALESCE_PARTITION | Alter_info::ALTER_REORGANIZE_PARTITION |
Alter_info::ALTER_TABLE_REORG | Alter_info::ALTER_REBUILD_PARTITION
)
) &&
memcmp(name + strlen(name) - 5, "#TMP#", 5)
@ -9873,9 +9873,9 @@ int ha_spider::rename_table(
if (
(thd->lex->alter_info.flags &
(
ALTER_ADD_PARTITION | ALTER_DROP_PARTITION |
ALTER_COALESCE_PARTITION | ALTER_REORGANIZE_PARTITION |
ALTER_TABLE_REORG | ALTER_REBUILD_PARTITION
Alter_info::ALTER_ADD_PARTITION | Alter_info::ALTER_DROP_PARTITION |
Alter_info::ALTER_COALESCE_PARTITION | Alter_info::ALTER_REORGANIZE_PARTITION |
Alter_info::ALTER_TABLE_REORG | Alter_info::ALTER_REBUILD_PARTITION
)
)
)
@ -10000,9 +10000,9 @@ int ha_spider::delete_table(
sql_command == SQLCOM_ALTER_TABLE &&
(thd->lex->alter_info.flags &
(
ALTER_ADD_PARTITION | ALTER_DROP_PARTITION |
ALTER_COALESCE_PARTITION | ALTER_REORGANIZE_PARTITION |
ALTER_TABLE_REORG | ALTER_REBUILD_PARTITION
Alter_info::ALTER_ADD_PARTITION | Alter_info::ALTER_DROP_PARTITION |
Alter_info::ALTER_COALESCE_PARTITION | Alter_info::ALTER_REORGANIZE_PARTITION |
Alter_info::ALTER_TABLE_REORG | Alter_info::ALTER_REBUILD_PARTITION
)
)
)
@ -10614,7 +10614,7 @@ void ha_spider::set_select_column_mode()
/* need primary key columns */
key_info = &table_share->key_info[table_share->primary_key];
key_part = key_info->key_part;
for (roop_count = 0; roop_count < (int) key_info->key_parts;
for (roop_count = 0; roop_count < (int) key_info->user_defined_key_parts;
roop_count++)
{
field = key_part[roop_count].field;

View File

@ -2255,7 +2255,7 @@ void *spider_bg_conn_action(
#if MYSQL_VERSION_ID < 50500
strmov(result_list->bgs_error_msg, thd->main_da.message());
#else
strmov(result_list->bgs_error_msg, thd->stmt_da->message());
strmov(result_list->bgs_error_msg, thd->get_stmt_da()->message());
#endif
}
if (!dbton_handler->need_lock_before_set_sql_for_exec(sql_type))
@ -2309,7 +2309,7 @@ void *spider_bg_conn_action(
thd->main_da.message());
#else
strmov(result_list->bgs_error_msg,
thd->stmt_da->message());
thd->get_stmt_da()->message());
#endif
} else
spider_db_discard_multiple_result(spider, conn->link_idx,
@ -2332,7 +2332,7 @@ void *spider_bg_conn_action(
thd->main_da.message());
#else
strmov(result_list->bgs_error_msg,
thd->stmt_da->message());
thd->get_stmt_da()->message());
#endif
} else {
spider->connection_ids[conn->link_idx] = conn->connection_id;
@ -2350,7 +2350,7 @@ void *spider_bg_conn_action(
thd->main_da.message());
#else
strmov(result_list->bgs_error_msg,
thd->stmt_da->message());
thd->get_stmt_da()->message());
#endif
}
} else {
@ -2364,7 +2364,7 @@ void *spider_bg_conn_action(
#if MYSQL_VERSION_ID < 50500
strmov(result_list->bgs_error_msg, thd->main_da.message());
#else
strmov(result_list->bgs_error_msg, thd->stmt_da->message());
strmov(result_list->bgs_error_msg, thd->get_stmt_da()->message());
#endif
}
#ifdef HA_CAN_BULK_ACCESS
@ -2387,7 +2387,7 @@ void *spider_bg_conn_action(
#if MYSQL_VERSION_ID < 50500
strmov(result_list->bgs_error_msg, thd->main_da.message());
#else
strmov(result_list->bgs_error_msg, thd->stmt_da->message());
strmov(result_list->bgs_error_msg, thd->get_stmt_da()->message());
#endif
conn->mta_conn_mutex_unlock_later = FALSE;
}
@ -2420,9 +2420,9 @@ void *spider_bg_conn_action(
strmov((char *) bg_direct_sql->bg_error_msg,
thd->main_da.message());
#else
bg_direct_sql->bg_error = thd->stmt_da->sql_errno();
bg_direct_sql->bg_error = thd->get_stmt_da()->sql_errno();
strmov((char *) bg_direct_sql->bg_error_msg,
thd->stmt_da->message());
thd->get_stmt_da()->message());
#endif
pthread_mutex_unlock(direct_sql->bg_mutex);
is_error = TRUE;

View File

@ -680,7 +680,7 @@ int spider_db_errorno(
current_thd &&
spider_param_force_commit(current_thd) == 1
) {
push_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN,
error_num, conn->db_conn->get_error());
if (!conn->mta_conn_mutex_unlock_later)
{
@ -1387,13 +1387,13 @@ int spider_db_append_key_columns(
SPIDER_RESULT_LIST *result_list = &spider->result_list;
KEY *key_info = result_list->key_info;
uint key_name_length, key_count;
key_part_map full_key_part_map = make_prev_keypart_map(key_info->key_parts);
key_part_map full_key_part_map = make_prev_keypart_map(key_info->user_defined_key_parts);
key_part_map start_key_part_map;
char tmp_buf[MAX_FIELD_WIDTH];
DBUG_ENTER("spider_db_append_key_columns");
start_key_part_map = start_key->keypart_map & full_key_part_map;
DBUG_PRINT("info", ("spider key_info->key_parts=%u", key_info->key_parts));
DBUG_PRINT("info", ("spider key_info->user_defined_key_parts=%u", key_info->user_defined_key_parts));
DBUG_PRINT("info", ("spider full_key_part_map=%lu", full_key_part_map));
DBUG_PRINT("info", ("spider start_key_part_map=%lu", start_key_part_map));
@ -1533,7 +1533,7 @@ int spider_db_append_key_where_internal(
}
if (key_info)
full_key_part_map = make_prev_keypart_map(key_info->key_parts);
full_key_part_map = make_prev_keypart_map(key_info->user_defined_key_parts);
else
full_key_part_map = 0;
@ -1549,8 +1549,8 @@ int spider_db_append_key_where_internal(
end_key_part_map = 0;
use_both = FALSE;
}
DBUG_PRINT("info", ("spider key_info->key_parts=%u", key_info ?
key_info->key_parts : 0));
DBUG_PRINT("info", ("spider key_info->user_defined_key_parts=%u", key_info ?
key_info->user_defined_key_parts : 0));
DBUG_PRINT("info", ("spider full_key_part_map=%lu", full_key_part_map));
DBUG_PRINT("info", ("spider start_key_part_map=%lu", start_key_part_map));
DBUG_PRINT("info", ("spider end_key_part_map=%lu", end_key_part_map));
@ -2699,7 +2699,7 @@ int spider_db_fetch_key(
for (
key_part = key_info->key_part,
part_num = 0;
part_num < key_info->key_parts;
part_num < key_info->user_defined_key_parts;
key_part++,
part_num++
) {
@ -4635,7 +4635,7 @@ int spider_db_seek_tmp_key(
for (
key_part = key_info->key_part,
part_num = 0;
part_num < key_info->key_parts;
part_num < key_info->user_defined_key_parts;
key_part++,
part_num++
) {
@ -4782,7 +4782,7 @@ void spider_db_set_cardinarity(
for (roop_count = 0; roop_count < (int) table->s->keys; roop_count++)
{
key_info = &table->key_info[roop_count];
for (roop_count2 = 0; roop_count2 < (int) key_info->key_parts;
for (roop_count2 = 0; roop_count2 < (int) key_info->user_defined_key_parts;
roop_count2++)
{
key_part = &key_info->key_part[roop_count2];
@ -5438,7 +5438,7 @@ int spider_db_update_auto_increment(
for (roop_count = first_set ? 1 : 0;
roop_count < (int) affected_rows;
roop_count++)
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_SPIDER_AUTOINC_VAL_IS_DIFFERENT_NUM,
ER_SPIDER_AUTOINC_VAL_IS_DIFFERENT_STR);
}
@ -5454,7 +5454,7 @@ int spider_db_update_auto_increment(
#endif
) {
for (roop_count = 0; roop_count < (int) affected_rows; roop_count++)
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_SPIDER_AUTOINC_VAL_IS_DIFFERENT_NUM,
ER_SPIDER_AUTOINC_VAL_IS_DIFFERENT_STR);
}
@ -7759,7 +7759,7 @@ uint spider_db_check_ft_idx(
key_info = &table->key_info[roop_count];
if (
key_info->algorithm == HA_KEY_ALG_FULLTEXT &&
item_count - 1 == key_info->key_parts
item_count - 1 == key_info->user_defined_key_parts
) {
match1 = TRUE;
for (roop_count2 = 1; roop_count2 < item_count; roop_count2++)
@ -7770,7 +7770,7 @@ uint spider_db_check_ft_idx(
DBUG_RETURN(MAX_KEY);
match2 = FALSE;
for (key_part = key_info->key_part, part_num = 0;
part_num < key_info->key_parts; key_part++, part_num++)
part_num < key_info->user_defined_key_parts; key_part++, part_num++)
{
if (key_part->field == field)
{

View File

@ -25,7 +25,7 @@
#define SPIDER_HAS_APPEND_FOR_SINGLE_QUOTE
#define SPIDER_HAS_SHOW_SIMPLE_FUNC
#endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100003
#if 0 && defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100003
#define SPIDER_GENERATE_PARTITION_SYNTAX_HAS_CURRENT_COMMENT_START
#endif

View File

@ -4268,7 +4268,7 @@ int spider_mysql_share::append_key_select(
const KEY *key_info = &table_share->key_info[idx];
DBUG_ENTER("spider_mysql_share::append_key_select");
for (key_part = key_info->key_part, part_num = 0;
part_num < key_info->key_parts; key_part++, part_num++)
part_num < key_info->user_defined_key_parts; key_part++, part_num++)
{
field = key_part->field;
field_length = column_name_str[field->field_index].length();
@ -4595,7 +4595,7 @@ int spider_mysql_handler::append_key_column_types(
SPIDER_RESULT_LIST *result_list = &spider->result_list;
KEY *key_info = result_list->key_info;
uint key_name_length, key_count;
key_part_map full_key_part_map = make_prev_keypart_map(key_info->key_parts);
key_part_map full_key_part_map = make_prev_keypart_map(key_info->user_defined_key_parts);
key_part_map start_key_part_map;
KEY_PART_INFO *key_part;
Field *field;
@ -4606,7 +4606,7 @@ int spider_mysql_handler::append_key_column_types(
tmp_str.init_calc_mem(115);
start_key_part_map = start_key->keypart_map & full_key_part_map;
DBUG_PRINT("info", ("spider key_info->key_parts=%u", key_info->key_parts));
DBUG_PRINT("info", ("spider key_info->user_defined_key_parts=%u", key_info->user_defined_key_parts));
DBUG_PRINT("info", ("spider full_key_part_map=%lu", full_key_part_map));
DBUG_PRINT("info", ("spider start_key_part_map=%lu", start_key_part_map));
@ -4662,7 +4662,7 @@ int spider_mysql_handler::append_key_join_columns_for_bka(
) {
KEY *key_info = spider->result_list.key_info;
uint length, key_name_length, key_count;
key_part_map full_key_part_map = make_prev_keypart_map(key_info->key_parts);
key_part_map full_key_part_map = make_prev_keypart_map(key_info->user_defined_key_parts);
key_part_map start_key_part_map;
KEY_PART_INFO *key_part;
Field *field;
@ -4671,7 +4671,7 @@ int spider_mysql_handler::append_key_join_columns_for_bka(
DBUG_ENTER("spider_mysql_handler::append_key_join_columns_for_bka");
DBUG_PRINT("info",("spider this=%p", this));
start_key_part_map = start_key->keypart_map & full_key_part_map;
DBUG_PRINT("info", ("spider key_info->key_parts=%u", key_info->key_parts));
DBUG_PRINT("info", ("spider key_info->user_defined_key_parts=%u", key_info->user_defined_key_parts));
DBUG_PRINT("info", ("spider full_key_part_map=%lu", full_key_part_map));
DBUG_PRINT("info", ("spider start_key_part_map=%lu", start_key_part_map));
@ -5768,7 +5768,7 @@ int spider_mysql_handler::append_key_select_with_alias(
int field_length;
DBUG_ENTER("spider_mysql_handler::append_key_select_with_alias");
for (key_part = key_info->key_part, part_num = 0;
part_num < key_info->key_parts; key_part++, part_num++)
part_num < key_info->user_defined_key_parts; key_part++, part_num++)
{
field = key_part->field;
field_length = mysql_share->column_name_str[field->field_index].length();
@ -6049,13 +6049,13 @@ int spider_mysql_handler::append_key_column_values(
KEY *key_info = result_list->key_info;
uint length;
uint store_length;
key_part_map full_key_part_map = make_prev_keypart_map(key_info->key_parts);
key_part_map full_key_part_map = make_prev_keypart_map(key_info->user_defined_key_parts);
key_part_map start_key_part_map;
KEY_PART_INFO *key_part;
Field *field;
DBUG_ENTER("spider_mysql_handler::append_key_column_values");
start_key_part_map = start_key->keypart_map & full_key_part_map;
DBUG_PRINT("info", ("spider key_info->key_parts=%u", key_info->key_parts));
DBUG_PRINT("info", ("spider key_info->user_defined_key_parts=%u", key_info->user_defined_key_parts));
DBUG_PRINT("info", ("spider full_key_part_map=%lu", full_key_part_map));
DBUG_PRINT("info", ("spider start_key_part_map=%lu", start_key_part_map));
@ -6598,13 +6598,13 @@ int spider_mysql_handler::append_match_against(
ft_init_key = ft_info->key;
key_info = &table->key_info[ft_info->inx];
DBUG_PRINT("info", ("spider key_info->key_parts=%u",
key_info->key_parts));
DBUG_PRINT("info", ("spider key_info->user_defined_key_parts=%u",
key_info->user_defined_key_parts));
for (
key_part = key_info->key_part,
key_count = 0;
key_count < (int) key_info->key_parts;
key_count < (int) key_info->user_defined_key_parts;
key_part++,
key_count++
) {
@ -6814,7 +6814,7 @@ int spider_mysql_handler::append_key_order_for_merge_with_alias(
for (
key_part = key_info->key_part,
length = 1;
length <= (int) key_info->key_parts;
length <= (int) key_info->user_defined_key_parts;
key_part++,
length++
) {
@ -7016,7 +7016,7 @@ int spider_mysql_handler::append_key_order_with_alias(
for (
key_part = key_info->key_part + result_list->key_order,
length = 1;
length + result_list->key_order < (int) key_info->key_parts &&
length + result_list->key_order < (int) key_info->user_defined_key_parts &&
length < result_list->max_order;
key_part++,
length++
@ -7050,7 +7050,7 @@ int spider_mysql_handler::append_key_order_with_alias(
}
}
if (
length + result_list->key_order <= (int) key_info->key_parts &&
length + result_list->key_order <= (int) key_info->user_defined_key_parts &&
length <= result_list->max_order
) {
field = key_part->field;
@ -7082,7 +7082,7 @@ int spider_mysql_handler::append_key_order_with_alias(
for (
key_part = key_info->key_part + result_list->key_order,
length = 1;
length + result_list->key_order < (int) key_info->key_parts &&
length + result_list->key_order < (int) key_info->user_defined_key_parts &&
length < result_list->max_order;
key_part++,
length++
@ -7116,7 +7116,7 @@ int spider_mysql_handler::append_key_order_with_alias(
}
}
if (
length + result_list->key_order <= (int) key_info->key_parts &&
length + result_list->key_order <= (int) key_info->user_defined_key_parts &&
length <= result_list->max_order
) {
field = key_part->field;
@ -10480,7 +10480,7 @@ int spider_mysql_copy_table::append_copy_where(
sql.q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
Field *field;
KEY_PART_INFO *key_part = key_info->key_part;
for (roop_count = key_info->key_parts - 1; roop_count >= 0; roop_count--)
for (roop_count = key_info->user_defined_key_parts - 1; roop_count >= 0; roop_count--)
{
for (roop_count2 = 0; roop_count2 < roop_count; roop_count2++)
{
@ -10525,7 +10525,7 @@ int spider_mysql_copy_table::append_key_order_str(
Field *field;
DBUG_ENTER("spider_mysql_copy_table::append_key_order_str");
DBUG_PRINT("info",("spider this=%p", this));
if ((int) key_info->key_parts > start_pos)
if ((int) key_info->user_defined_key_parts > start_pos)
{
if (sql.reserve(SPIDER_SQL_ORDER_LEN))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@ -10535,7 +10535,7 @@ int spider_mysql_copy_table::append_key_order_str(
for (
key_part = key_info->key_part + start_pos,
length = 0;
length + start_pos < (int) key_info->key_parts;
length + start_pos < (int) key_info->user_defined_key_parts;
key_part++,
length++
) {
@ -10565,7 +10565,7 @@ int spider_mysql_copy_table::append_key_order_str(
for (
key_part = key_info->key_part + start_pos,
length = 0;
length + start_pos < (int) key_info->key_parts;
length + start_pos < (int) key_info->user_defined_key_parts;
key_part++,
length++
) {

View File

@ -1159,7 +1159,7 @@ my_bool spider_ping_table_init_body(
#if MYSQL_VERSION_ID < 50500
strcpy(message, thd->main_da.message());
#else
strcpy(message, thd->stmt_da->message());
strcpy(message, thd->get_stmt_da()->message());
#endif
goto error;
}

View File

@ -21,6 +21,7 @@
#else
#include "sql_priv.h"
#include "probes_mysql.h"
#include "my_getopt.h"
#include "sql_class.h"
#include "sql_partition.h"
#include "sql_servers.h"
@ -6985,7 +6986,7 @@ bool spider_check_pk_update(
key_info = &table_share->key_info[table_share->primary_key];
key_part = key_info->key_part;
for (roop_count = 0; roop_count < (int) key_info->key_parts; roop_count++)
for (roop_count = 0; roop_count < (int) key_info->user_defined_key_parts; roop_count++)
{
if (bitmap_is_set(table->write_set,
key_part[roop_count].field->field_index))