diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-07-15 18:01:22 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-07-15 18:01:22 +0200 |
commit | e1c76b80d91c43a9f17d9ec4c96e4dcb72efb1a2 (patch) | |
tree | ba4f3d737607d1a87e68b4e48e1f41119bee3b82 /sql | |
parent | b427da7651f348550deb886024c0d3101720f00e (diff) | |
download | mariadb-git-e1c76b80d91c43a9f17d9ec4c96e4dcb72efb1a2.tar.gz |
Fixes for innodb suite, merging tests from 5.6.
Includes 5.6 changesets for:
*****
Fix for BUG#13489996 valgrind:conditional jump or move depends on uninitialised values-field_blob.
blob_ptr_size was not initialized properly: remove this variable.
*****
Bug#14021323 CRASH IN FIELD::SET_NULL WHEN INSERTING ROWS TO NEW TABLE
*****
Diffstat (limited to 'sql')
-rw-r--r-- | sql/field.cc | 7 | ||||
-rw-r--r-- | sql/field.h | 6 | ||||
-rw-r--r-- | sql/field_conv.cc | 4 | ||||
-rw-r--r-- | sql/item.cc | 5 | ||||
-rw-r--r-- | sql/opt_subselect.cc | 1 | ||||
-rw-r--r-- | sql/sql_class.cc | 1 | ||||
-rw-r--r-- | sql/sql_const.h | 1 | ||||
-rw-r--r-- | sql/sql_insert.cc | 1 | ||||
-rw-r--r-- | sql/sql_select.cc | 7 | ||||
-rw-r--r-- | sql/sql_table.cc | 9 | ||||
-rw-r--r-- | sql/table.cc | 2 | ||||
-rw-r--r-- | sql/table.h | 1 | ||||
-rw-r--r-- | sql/unireg.cc | 1 |
13 files changed, 17 insertions, 29 deletions
diff --git a/sql/field.cc b/sql/field.cc index a70bbe08469..d84baac41f5 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1759,7 +1759,7 @@ uint Field::fill_cache_field(CACHE_FIELD *copy) if (flags & BLOB_FLAG) { copy->type= CACHE_BLOB; - copy->length-= table->s->blob_ptr_size; + copy->length-= portable_sizeof_char_ptr; return copy->length; } else if (!zero_pack() && @@ -9572,11 +9572,6 @@ Create_field::Create_field(Field *old_field,Field *orig_field) option_list= old_field->option_list; option_struct= old_field->option_struct; - /* Fix if the original table had 4 byte pointer blobs */ - if (flags & BLOB_FLAG) - pack_length= (pack_length- old_field->table->s->blob_ptr_size + - portable_sizeof_char_ptr); - switch (sql_type) { case MYSQL_TYPE_BLOB: switch (pack_length - portable_sizeof_char_ptr) { diff --git a/sql/field.h b/sql/field.h index f58833629b2..3b4285c9cc9 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1986,6 +1986,7 @@ public: Field_blob(uint32 packlength_arg) :Field_longstr((uchar*) 0, 0, (uchar*) "", 0, NONE, "temp", system_charset_info), packlength(packlength_arg) {} + /* Note that the default copy constructor is used, in clone() */ enum_field_types type() const { return MYSQL_TYPE_BLOB;} bool match_collation_to_optimize_range() const { return TRUE; } enum ha_base_keytype key_type() const @@ -2011,7 +2012,7 @@ public: uint32 key_length() const { return 0; } void sort_string(uchar *buff,uint length); uint32 pack_length() const - { return (uint32) (packlength+table->s->blob_ptr_size); } + { return (uint32) (packlength + portable_sizeof_char_ptr); } /** Return the packed length without the pointer size added. @@ -2486,9 +2487,6 @@ public: { return 255 - FRM_VCOL_HEADER_SIZE(interval != NULL); } - -private: - const String empty_set_string; }; diff --git a/sql/field_conv.cc b/sql/field_conv.cc index c652ee12c93..c4cc8d53ae4 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -712,8 +712,8 @@ Copy_field::get_copy_func(Field *to,Field *from) if (from_length != to_length) { // Correct pointer to point at char pointer - to_ptr+= to_length - to->table->s->blob_ptr_size; - from_ptr+= from_length- from->table->s->blob_ptr_size; + to_ptr+= to_length - portable_sizeof_char_ptr; + from_ptr+= from_length - portable_sizeof_char_ptr; return do_copy_blob; } } diff --git a/sql/item.cc b/sql/item.cc index f004f25b18c..ab7806cfd0e 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -5673,10 +5673,6 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table, bool fixed_length) field= new Field_double((uchar*) 0, max_length, null_ptr, 0, Field::NONE, name, decimals, 0, unsigned_flag); break; - case MYSQL_TYPE_NULL: - field= new Field_null((uchar*) 0, max_length, Field::NONE, - name, &my_charset_bin); - break; case MYSQL_TYPE_INT24: field= new Field_medium((uchar*) 0, max_length, null_ptr, 0, Field::NONE, name, 0, unsigned_flag); @@ -5709,6 +5705,7 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table, bool fixed_length) /* This case should never be chosen */ DBUG_ASSERT(0); /* If something goes awfully wrong, it's better to get a string than die */ + case MYSQL_TYPE_NULL: case MYSQL_TYPE_STRING: if (fixed_length && !too_big_for_varchar()) { diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index c3ddf3831c4..aa31c44a385 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -3919,7 +3919,6 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd) table->s= share; init_tmp_table_share(thd, share, "", 0, tmpname, tmpname); share->blob_field= blob_field; - share->blob_ptr_size= portable_sizeof_char_ptr; share->table_charset= NULL; share->primary_key= MAX_KEY; // Indicate no primary key share->keys_for_keyread.init(); diff --git a/sql/sql_class.cc b/sql/sql_class.cc index f7b6fc529b2..bd8f72d408d 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -129,6 +129,7 @@ Key::Key(const Key &rhs, MEM_ROOT *mem_root) Foreign_key::Foreign_key(const Foreign_key &rhs, MEM_ROOT *mem_root) :Key(rhs,mem_root), + ref_db(rhs.ref_db), ref_table(rhs.ref_table), ref_columns(rhs.ref_columns,mem_root), delete_opt(rhs.delete_opt), diff --git a/sql/sql_const.h b/sql/sql_const.h index 9849f10b6ac..ec91fd02289 100644 --- a/sql/sql_const.h +++ b/sql/sql_const.h @@ -76,7 +76,6 @@ /* Some portable defines */ -#define portable_sizeof_char_ptr 8 #define STRING_BUFFER_USUAL_SIZE 80 /* Memory allocated when parsing a statement / saving a statement */ diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 12222fddca9..37b355f1d66 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -3839,7 +3839,6 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info, init_tmp_table_share(thd, &share, "", 0, "", ""); tmp_table.s->db_create_options=0; - tmp_table.s->blob_ptr_size= portable_sizeof_char_ptr; tmp_table.null_row= 0; tmp_table.maybe_null= 0; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index f865be44ea3..cf01cd330f9 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -14436,7 +14436,6 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields, table->s= share; init_tmp_table_share(thd, share, "", 0, tmpname, tmpname); share->blob_field= blob_field; - share->blob_ptr_size= portable_sizeof_char_ptr; share->table_charset= param->table_charset; share->primary_key= MAX_KEY; // Indicate no primary key share->keys_for_keyread.init(); @@ -15163,7 +15162,6 @@ TABLE *create_virtual_tmp_table(THD *thd, List<Create_field> &field_list) table->temp_pool_slot= MY_BIT_NONE; share->blob_field= blob_field; share->fields= field_count; - share->blob_ptr_size= portable_sizeof_char_ptr; setup_tmp_table_column_bitmaps(table, bitmaps); /* Create all fields and calculate the total length of record */ @@ -15371,7 +15369,8 @@ bool create_internal_tmp_table(TABLE *table, KEY *keyinfo, seg->type= ((keyinfo->key_part[i].key_type & FIELDFLAG_BINARY) ? HA_KEYTYPE_VARBINARY2 : HA_KEYTYPE_VARTEXT2); - seg->bit_start= (uint8)(field->pack_length() - share->blob_ptr_size); + seg->bit_start= (uint8)(field->pack_length() - + portable_sizeof_char_ptr); seg->flag= HA_BLOB_PART; seg->length=0; // Whole blob in unique constraint } @@ -15533,7 +15532,7 @@ bool create_internal_tmp_table(TABLE *table, KEY *keyinfo, seg->type= ((keyinfo->key_part[i].key_type & FIELDFLAG_BINARY) ? HA_KEYTYPE_VARBINARY2 : HA_KEYTYPE_VARTEXT2); - seg->bit_start= (uint8)(field->pack_length() - share->blob_ptr_size); + seg->bit_start= (uint8)(field->pack_length() - portable_sizeof_char_ptr); seg->flag= HA_BLOB_PART; seg->length=0; // Whole blob in unique constraint } diff --git a/sql/sql_table.cc b/sql/sql_table.cc index ef8115f8407..f0ad42fe6b2 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -5410,6 +5410,10 @@ static bool fill_alter_inplace_info(THD *thd, */ for (f_ptr= table->field; (field= *f_ptr); f_ptr++) { + /* Clear marker for renamed or dropped field + which we are going to set later. */ + field->flags&= ~(FIELD_IS_RENAMED | FIELD_IS_DROPPED); + /* Use transformed info to evaluate flags for storage engine. */ uint new_field_index= 0; new_field_it.init(alter_info->create_list); @@ -5498,6 +5502,7 @@ static bool fill_alter_inplace_info(THD *thd, if (my_strcasecmp(system_charset_info, field->field_name, new_field->field_name)) { + field->flags|= FIELD_IS_RENAMED; ha_alter_info->handler_flags|= Alter_inplace_info::ALTER_COLUMN_NAME; rename_column_in_stat_tables(thd, table, field, new_field->field_name); @@ -5543,6 +5548,7 @@ static bool fill_alter_inplace_info(THD *thd, Corresponding storage engine flag should be already set. */ DBUG_ASSERT(ha_alter_info->handler_flags & Alter_inplace_info::DROP_COLUMN); + field->flags|= FIELD_IS_DROPPED; } } @@ -6895,8 +6901,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, if (key->type == Key::FOREIGN_KEY && ((Foreign_key *)key)->validate(new_create_list)) goto err; - if (key->type != Key::FOREIGN_KEY) - new_key_list.push_back(key); + new_key_list.push_back(key); if (key->name.str && !my_strcasecmp(system_charset_info, key->name.str, primary_key_name)) { diff --git a/sql/table.cc b/sql/table.cc index a7d330636c9..a386510f180 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -868,8 +868,6 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, share->table_charset= default_charset_info; } share->db_record_offset= 1; - if (db_create_options & HA_OPTION_LONG_BLOB_PTR) - share->blob_ptr_size= portable_sizeof_char_ptr; error=4; share->max_rows= uint4korr(head+18); share->min_rows= uint4korr(head+22); diff --git a/sql/table.h b/sql/table.h index 2508c5f76da..1e4774e021e 100644 --- a/sql/table.h +++ b/sql/table.h @@ -655,7 +655,6 @@ struct TABLE_SHARE enum ha_choice page_checksum; uint ref_count; /* How many TABLE objects uses this */ - uint blob_ptr_size; /* 4 or 8 */ uint key_block_size; /* create key_block_size, if used */ uint stats_sample_pages; /* number of pages to sample during stats estimation, if used, otherwise 0. */ diff --git a/sql/unireg.cc b/sql/unireg.cc index a546fb769b3..fca4dc200c3 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -1122,7 +1122,6 @@ static bool make_empty_rec(THD *thd, File file,enum legacy_db_type table_type, } table.in_use= thd; - table.s->blob_ptr_size= portable_sizeof_char_ptr; null_count=0; if (!(table_options & HA_OPTION_PACK_RECORD)) |