From e3868ee07273b1ea2c495d92891fd7d1ed1eea9e Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 6 Nov 2015 13:02:19 +0200 Subject: Don't store vcol bitmaps in TABLE if table doesn't have virtual fields. (Makes TABLE a bit smaller) --- sql/sql_insert.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'sql/sql_insert.cc') diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 8d36a763b90..574e0892872 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -2470,6 +2470,9 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd) if (share->vfields) { + if (!(copy->def_vcol_set= (MY_BITMAP*) alloc_root(client_thd->mem_root, + sizeof(MY_BITMAP)))) + goto error; copy->vfield= vfield; for (field= copy->field; *field; field++) { @@ -2502,13 +2505,17 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd) copy->def_read_set.bitmap= (my_bitmap_map*) bitmap; copy->def_write_set.bitmap= ((my_bitmap_map*) (bitmap + share->column_bitmap_size)); - copy->def_vcol_set.bitmap= ((my_bitmap_map*) - (bitmap + 2*share->column_bitmap_size)); + if (share->vfields) + { + my_bitmap_init(copy->def_vcol_set, + (my_bitmap_map*) (bitmap + 2*share->column_bitmap_size), + share->fields, FALSE); + copy->vcol_set= copy->def_vcol_set; + } copy->tmp_set.bitmap= 0; // To catch errors - bzero((char*) bitmap, share->column_bitmap_size*3); + bzero((char*) bitmap, share->column_bitmap_size + (share->vfields ? 3 : 2)); copy->read_set= ©->def_read_set; copy->write_set= ©->def_write_set; - copy->vcol_set= ©->def_vcol_set; DBUG_RETURN(copy); -- cgit v1.2.1