Bug #47879 | Backup of partitioned tables with subpartitions can crash server | ||
---|---|---|---|
Submitted: | 6 Oct 2009 22:12 | Modified: | 7 Mar 2010 19:52 |
Reporter: | Victor Kirkebo | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Backup | Severity: | S3 (Non-critical) |
Version: | 5.4.4,6.0 | OS: | Any |
Assigned to: | Chuck Bell | CPU Architecture: | Any |
Tags: | backup core dump partition subpartition |
[6 Oct 2009 22:12]
Victor Kirkebo
[6 Oct 2009 23:23]
MySQL Verification Team
Thank you for the bug report. miguel@txg:~/dbs$ 6.0/libexec/mysqld 091006 20:19:55 InnoDB: Started; log sequence number 0 46409 091006 20:19:55 [Note] Event Scheduler: Loaded 0 events 091006 20:19:55 [Note] 6.0/libexec/mysqld: ready for connections. Version: '6.0.12-alpha-debug' socket: '/tmp/mysql.sock' port: 3306 Source distribution 091006 20:20:35 [Note] Backup: Starting backup process 091006 20:20:35 - mysqld got signal 11 ; 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. 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. key_buffer_size=8384512 read_buffer_size=131072 max_used_connections=1 max_threads=151 thread_count=1 connection_count=1 It is possible that mysqld could use up to key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 338403 K bytes of memory Hope that's ok; if not, decrease some variables in the equation. thd: 0x2dd6488 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 = 0x7fa47d3700e0 thread_stack 0x40000 6.0/libexec/mysqld(my_print_stacktrace+0x32) [0xc58ff5] 6.0/libexec/mysqld(handle_segfault+0x2a6) [0x6c12e7] /lib64/libpthread.so.0 [0x7fa48ac2cf30] 6.0/libexec/mysqld [0xd1c834] 6.0/libexec/mysqld(Backup_info::find_backup_engine(backup::Table_ref const&)+0x58) [0xd1c934] 6.0/libexec/mysqld(Backup_info::add_table(backup::Image_info::Db&, obs::Obj*)+0x5f) [0xd1cc77] 6.0/libexec/mysqld(Backup_info::add_db_items(backup::Image_info::Db&)+0xf7) [0xd1ce9f] 6.0/libexec/mysqld(Backup_info::add_dbs(THD*, List<st_mysql_lex_string>&)+0x2c2) [0xd1d82a] 6.0/libexec/mysqld(execute_backup_command(THD*, LEX*, String*, bool, bool)+0x327) [0xd057d9] 6.0/libexec/mysqld(mysql_execute_command(THD*)+0x1288) [0x6d3537] 6.0/libexec/mysqld(mysql_parse(THD*, char const*, unsigned int, char const**)+0x276) [0x6db177] 6.0/libexec/mysqld(dispatch_command(enum_server_command, THD*, char*, unsigned int)+0x978) [0x6dbc83] 6.0/libexec/mysqld(do_command(THD*)+0x22b) [0x6dd15e] 6.0/libexec/mysqld(handle_one_connection+0x11a) [0x6ca935]
[5 Nov 2009 22:27]
Chuck Bell
When there are storage engines, the partition_element->engine_type is NULL. The code was not written to detect this and hence crashes trying to access it's member and array. The solution then is to detect when there are subpartitions and traverse the subpartitions until a storage engine is found. Here is a sample code patch that solves the crash and shows how the subpartition code is traversed. === modified file 'sql/backup/backup_info.cc' --- sql/backup/backup_info.cc 2009-10-23 15:41:56 +0000 +++ sql/backup/backup_info.cc 2009-11-05 22:17:12 +0000 @@ -68,6 +68,11 @@ storage_engine_ref get_storage_engine(TH while ((p_el= p_it++)) { + List_iterator<partition_element> p_sub_it(p_el->subpartitions); + if (!p_el->engine_type) + { + p_el= p_sub_it++; + } if (!se_tmp) { se_tmp= hton2plugin[p_el->engine_type->slot]; Preliminary Design ------------------ The get_storage_engine() method shall be changed to detect the presence of subpartitions and traverse that list until either another subpartition is found (which will be traversed) or a storage engine is found. This should allow cascading subpartitions (if permitted).
[5 Nov 2009 22:46]
Chuck Bell
The paragraph above should read (stewpid type ahead/autocorrect): When there are subpartitions the partition_element->engine_type is NULL. Rather, there is a subpartitions array that must be examined instead. The code was not written to detect this and hence crashes trying to access partition_element->engine_type's array (it doesn't exist).
[6 Nov 2009 16:12]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/89632 2888 Chuck Bell 2009-11-06 BUG#47879 : Backup of partitioned tables with subpartitions can crash server Tables with subpartitions cause backup to crash the server. The reason is the code is not designed to detect subpartitions and tries to access a member of a struct that does not exist. This patch detects when subpartions exist and reassign the pointers in the loop to traverse the subpartitions list instead when subpartitions are detected. @ mysql-test/suite/backup_engines/r/backup_partition.result Corrected result file. @ mysql-test/suite/backup_engines/t/backup_partition.test New tables added to test backup of tables with subpartitions. @ sql/backup/backup_info.cc Code added to detect subpartitions and traverse those lists instead.
[12 Nov 2009 17:17]
Ingo Strüwing
I suspect a problem, please see email.
[13 Nov 2009 14:29]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/90363 2888 Chuck Bell 2009-11-13 BUG#47879 : Backup of partitioned tables with subpartitions can crash server Tables with subpartitions cause backup to crash the server. The reason is the code is not designed to detect subpartitions and tries to access a member of a struct that does not exist. This patch changes the code to search not only the partition lists but also the sub partitions lists. @ mysql-test/suite/backup_engines/r/backup_partition.result Corrected result file. @ mysql-test/suite/backup_engines/t/backup_partition.test New tables added to test backup of tables with subpartitions. @ sql/backup/backup_info.cc Added new method to correctly traverse the partition and sub partition lists.
[16 Nov 2009 15:59]
Ingo Strüwing
Approved.
[18 Nov 2009 16:42]
Ritheesh Vedire
Approved.
[18 Nov 2009 16:48]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/90886 2888 Chuck Bell 2009-11-18 BUG#47879 : Backup of partitioned tables with subpartitions can crash server Tables with subpartitions cause backup to crash the server. The reason is the code is not designed to detect subpartitions and tries to access a member of a struct that does not exist. This patch changes the code to search not only the partition lists but also the sub partitions lists. @ mysql-test/suite/backup_engines/r/backup_partition.result Corrected result file. @ mysql-test/suite/backup_engines/t/backup_partition.test New tables added to test backup of tables with subpartitions. @ sql/backup/backup_info.cc Added new method to correctly traverse the partition and sub partition lists.
[18 Nov 2009 17:30]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/90891 2889 Chuck Bell 2009-11-18 [merge] Local merge before push of BUG#47879.
[20 Feb 2010 9:19]
Bugs System
Pushed into 6.0.14-alpha (revid:ingo.struewing@sun.com-20100218152520-s4v1ld76bif06eqn) (version source revid:ingo.struewing@sun.com-20100119103538-wtp5alpz4p2jayl5) (merge vers: 6.0.14-alpha) (pib:16)
[7 Mar 2010 19:52]
Paul DuBois
Noted in 6.0.14 changelog. Attempts to use BACKUP DATABASE for partitioned tables with subpartitions caused a server crash.