Skip to content

Commit 81753e7

Browse files
author
Aakanksha Verma
committed
Bug #26492721 MYSQL/INNODB CRASHES DURING ALTER TABLE
PROBLEM While doing an alter table that does multiple change columns , the heap assigned for the particular table increases and corresponding increase to dict_sys->size isn't done because of which the dict_sys->size keeps decreasing with every iteration of set of alter tables provided in the bug page hitting the assertion dict_sys->size > 0 . FIX Fix is to add a check for any table heap size increase during change column and add the increased value of heap size to dict_sys->size to avoid it getting diminished on subsequent runs of alter tables. Reviewed by: Jimmy Yang<[email protected]> RB: 17817
1 parent ed05c87 commit 81753e7

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

storage/innobase/dict/dict0mem.cc

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*****************************************************************************
22
3-
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
3+
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
44
Copyright (c) 2012, Facebook Inc.
55
66
This program is free software; you can redistribute it and/or modify it under
@@ -300,11 +300,20 @@ dict_mem_table_col_rename_low(
300300
char* col_names;
301301

302302
if (to_len > from_len) {
303+
ulint table_size_before_rename_col
304+
= mem_heap_get_size(table->heap);
303305
col_names = static_cast<char*>(
304306
mem_heap_alloc(
305307
table->heap,
306308
full_len + to_len - from_len));
307-
309+
ulint table_size_after_rename_col
310+
= mem_heap_get_size(table->heap);
311+
if (table_size_before_rename_col
312+
!= table_size_after_rename_col) {
313+
dict_sys->size +=
314+
table_size_after_rename_col
315+
- table_size_before_rename_col;
316+
}
308317
memcpy(col_names, table->col_names, prefix_len);
309318
} else {
310319
col_names = const_cast<char*>(table->col_names);

0 commit comments

Comments
 (0)