summaryrefslogtreecommitdiff
path: root/sql/opt_subselect.cc
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2019-05-09 17:38:22 +0200
committerVladislav Vaintroub <wlad@mariadb.com>2019-05-09 18:58:16 +0200
commitad36d38024cf82724f5e9589fc9fe4ad57fcf390 (patch)
treec4921ca39005b5709ff1287f086de708ddd8f5ad /sql/opt_subselect.cc
parent44b8b002f56d5d0c5da3d600276965c41d9ab7bf (diff)
downloadmariadb-git-ad36d38024cf82724f5e9589fc9fe4ad57fcf390.tar.gz
MDEV-19235 MariaDB Server compiled for 128 Indexes crashes at startupbb-10.4-wlad-MDEV-19235
With MAX_INDEXIES=64(default), key_map=Bitmap<64> is just a wrapper around ulonglong and thus "trivial" (can be bzero-ed, or memcpy-ed, and stays valid still) With MAX_INDEXES=128, key_map = Bitmap<128> is not a "trivial" type anymore. The implementation uses MY_BITMAP, and MY_BITMAP contains pointers which make Bitmap invalid, when it is memcpy-ed/bzero-ed. The problem in 10.4 is that there are many new key_map members, inside TABLE or KEY, and those are often memcopied and bzeroed The fix makes Bitmap "trivial", by inlining most of MY_BITMAP functionality. pointers/heap allocations are not used anymore.
Diffstat (limited to 'sql/opt_subselect.cc')
-rw-r--r--sql/opt_subselect.cc11
1 files changed, 3 insertions, 8 deletions
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index 2fedd8a4ed3..2d99b4d72be 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -4337,17 +4337,12 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd)
table->temp_pool_slot = temp_pool_slot;
table->copy_blobs= 1;
table->in_use= thd;
- table->quick_keys.init();
- table->covering_keys.init();
- table->keys_in_use_for_query.init();
table->s= share;
init_tmp_table_share(thd, share, "", 0, tmpname, tmpname);
share->blob_field= blob_field;
share->table_charset= NULL;
share->primary_key= MAX_KEY; // Indicate no primary key
- share->keys_for_keyread.init();
- share->keys_in_use.init();
/* Create the field */
{
@@ -4361,9 +4356,9 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd)
if (!field)
DBUG_RETURN(0);
field->table= table;
- field->key_start.init(0);
- field->part_of_key.init(0);
- field->part_of_sortkey.init(0);
+ field->key_start.clear_all();
+ field->part_of_key.clear_all();
+ field->part_of_sortkey.clear_all();
field->unireg_check= Field::NONE;
field->flags= (NOT_NULL_FLAG | BINARY_FLAG | NO_DEFAULT_VALUE_FLAG);
field->reset_fields();