← Back to team overview

maria-discuss team mailing list archive

Crash when adding a column to a very large table



MariaDB 10.1.16 with a 3-node galera cluster.

We had 187GB free disk space and had the gcache set to 800GB. We started firing write traffic at the cluster and then began testing the process of performing DDL on a single node in RSU mode. Our command was a single ALTER TABLE statement that added a column to a ~160GB table.

While this was occurring we were firing around 20GB/hour of write traffic at the cluster which was being collected in the gcache for catchup after the node completed the DDL.

At around 3h 45min into the DDL process the node performing it crashed with an error indicating it was unable to write to a temporary ibdata file. There was still plenty of disk space available.

Full crash log is below, if anyone can shed light on this we'd be very grateful.

My own research so far suggests that the problem is because the ALTER TABLE statement inserts all of the rows into the newly rebuilt table at once, effectively requiring a rollback to be created for every row in the table and this is just too much for *some limit* that I haven't worked out yet. I saw a suggestion[1] to increase the number of ibdata files but this doesn't really make sense to me given that we have two and the second one is set to autoextend.

It's a very slow debug process so I'd like to get a reasonable idea of what happened here before starting another test run.


[1] http://dba.stackexchange.com/questions/68319/mysql-index-creation-failing-on-table-is-full


2016-07-27  8:45:59 140258863733504 [Note] InnoDB: Online DDL : Start
2016-07-27 8:45:59 140258863733504 [Note] InnoDB: Online DDL : Start reading clustered index of the table and create temporary files 2016-07-27 9:42:23 140258863733504 [Note] InnoDB: Online DDL : End of reading clustered index of the table and create temporary files 2016-07-27 9:42:23 140258863733504 [Note] InnoDB: Online DDL : Start merge-sorting index `PRIMARY` (1 / 4), estimated cost : 14.7886 2016-07-27 9:42:23 140258863733504 [Note] InnoDB: Online DDL : merge-sorting has estimated 72714 runs 2016-07-27 11:47:05 140258863733504 [Note] InnoDB: Online DDL : End of merge-sorting index `PRIMARY` (1 / 4) 2016-07-27 11:47:05 140258863733504 [Note] InnoDB: Online DDL : Start building index `PRIMARY` (1 / 4), estimated cost : 22.1242 2016-07-27 12:26:52 7f908fbfdb00 InnoDB: Error: Write to file ./db/#sql-ib16588-3044794026.ibd failed at offset 54409560064. InnoDB: 1048576 bytes should have been written, only 991232 were written. InnoDB: Operating system error n2016-07-27 12:26:52 140258863733504 [Note] InnoDB: Online DDL : Completed 2016-07-27 12:26:53 7f908fbfdb00 InnoDB: Assertion failure in thread 140258863733504 in file handler0alter.cc line 137
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.6/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
160727 12:26:53 [ERROR] mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary or one of the libraries it was linked against is corrupt, improperly built, or misconfigured. This error can also be caused by malfunctioning hardware.

To report this bug, see https://mariadb.com/kb/en/reporting-bugs

We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.

Server version: 10.1.16-MariaDB
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 37895560 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x0x7ebbabfb9008
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0x7f908fbfd180 thread_stack 0x48400
(my_addr_resolve failure: fork)
/usr/sbin/mysqld(my_print_stacktrace+0x2b) [0x555e557caaab]
/usr/sbin/mysqld(handle_fatal_signal+0x475) [0x555e55327ef5]
/lib64/libpthread.so.0(+0xf100) [0x7f90982ce100]
/lib64/libc.so.6(gsignal+0x37) [0x7f909663b5f7]
/lib64/libc.so.6(abort+0x148) [0x7f909663cce8]
/usr/sbin/mysqld(+0x734ff9) [0x555e55491ff9]
/usr/sbin/mysqld(+0x736eec) [0x555e55493eec]
/usr/sbin/mysqld(+0x3a4c24) [0x555e55101c24]
/usr/sbin/mysqld(mysql_alter_table(THD*, char*, char*, HA_CREATE_INFO*, TABLE_LIST*, Alter_info*, unsigned int, st_order*, bool)+0x27f9) [0x555e5523dff9] /usr/sbin/mysqld(Sql_cmd_alter_table::execute(THD*)+0x5d7) [0x555e5527f8b7]
/usr/sbin/mysqld(mysql_execute_command(THD*)+0x140f) [0x555e551b533f]
/usr/sbin/mysqld(mysql_parse(THD*, char*, unsigned int, Parser_state*)+0x28d) [0x555e551bd1ed]
/usr/sbin/mysqld(+0x4602ec) [0x555e551bd2ec]
/usr/sbin/mysqld(dispatch_command(enum_server_command, THD*, char*, unsigned int)+0x1c63) [0x555e551bf673]
/usr/sbin/mysqld(do_command(THD*)+0x16b) [0x555e551c023b]
/usr/sbin/mysqld(do_handle_one_connection(THD*)+0x17f) [0x555e5527c74f]
/usr/sbin/mysqld(handle_one_connection+0x47) [0x555e5527c8a7]
/lib64/libpthread.so.0(+0x7dc5) [0x7f90982c6dc5]
/lib64/libc.so.6(clone+0x6d) [0x7f90966fcc9d]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x7ebb7102f020): is an invalid pointer
Connection ID (thread ID): 212

Optimizer switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=off

The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.

We think the query pointer is invalid, but we will try to print it anyway.
Query: alter table delivery_person add column boris int(11) null

160727 12:26:58 mysqld_safe Number of processes running now: 0
160727 12:26:58 mysqld_safe WSREP: not restarting wsrep node automatically 160727 12:26:58 mysqld_safe mysqld from pid file /mysql/data/galera0.pid ended