LP:916975 - Crash in handler::mark_trx_read_write on ALTER TABLE after REPAIR non-existing partition

Description

#3 0x081ba181 in handle_segfault (sig=11) at /home/elenst/maria-5.5/sql/mysqld.cc:2921
#4 <signal handler called>
#5 0x083e9e65 in handler::mark_trx_read_write (this=0x0) at /home/elenst/maria-5.5/sql/handler.h:2671
#6 0x083e8e1b in handler::ha_write_row (this=0x0, buf=0xa163dc8 "\371\005") at /home/elenst/maria-5.5/sql/handler.cc:5017
#7 0x08861325 in ha_partition::write_row (this=0xa1638c0, buf=0xa163dc8 "\371\005")
at /home/elenst/maria-5.5/sql/ha_partition.cc:3409
#8 0x083e8e49 in handler::ha_write_row (this=0xa1638c0, buf=0xa163dc8 "\371\005")
at /home/elenst/maria-5.5/sql/handler.cc:5020
#9 0x082eb76e in copy_data_between_tables (thd=0xa0aab80, from=0xa1a0e20, to=0xa152798, create=..., ignore=false,
order_num=1, order=0xa156048, copied=0x826771e0, deleted=0x826771d8, keys_onoff=LEAVE_AS_IS, error_if_not_empty=false)
at /home/elenst/maria-5.5/sql/sql_table.cc:7305
#10 0x082e9937 in mysql_alter_table (thd=0xa0aab80, new_db=0xa155f98 "test", new_name=0xa155b70 "t", create_info=0x82677708,
table_list=0xa155b98, alter_info=0x826777a0, order_num=1, order=0xa156048, ignore=false, require_online=false)
at /home/elenst/maria-5.5/sql/sql_table.cc:6646
#11 0x08536363 in Alter_table_statement::execute (this=0xa156078, thd=0xa0aab80)
at /home/elenst/maria-5.5/sql/sql_alter.cc:106
#12 0x0825fcc8 in mysql_execute_command (thd=0xa0aab80) at /home/elenst/maria-5.5/sql/sql_parse.cc:4422
#13 0x08262b02 in mysql_parse (thd=0xa0aab80, rawbuf=0xa155ae8 "ALTER TABLE t ORDER BY b", length=24, parser_state=0x82677db8)
at /home/elenst/maria-5.5/sql/sql_parse.cc:5698
#14 0x08256fb5 in dispatch_command (command=COM_QUERY, thd=0xa0aab80, packet=0xa149639 "ALTER TABLE t ORDER BY b",
packet_length=24) at /home/elenst/maria-5.5/sql/sql_parse.cc:1049
#15 0x0825647a in do_command (thd=0xa0aab80) at /home/elenst/maria-5.5/sql/sql_parse.cc:788
#16 0x0833dd18 in do_handle_one_connection (thd_arg=0xa0aab80) at /home/elenst/maria-5.5/sql/sql_connect.cc:1225
#17 0x0833d866 in handle_one_connection (arg=0xa0aab80) at /home/elenst/maria-5.5/sql/sql_connect.cc:1140
#18 0x0855b199 in pfs_spawn_thread (arg=0xa1aa490) at /home/elenst/maria-5.5/storage/perfschema/pfs.cc:1015
#19 0xb771bb25 in start_thread () from /lib/libpthread.so.0

bzr version-info
revision-id: <email address hidden>
date: 2012-01-11 13:35:27 +0100
build-date: 2012-01-16 03:06:55 +0400
revno: 3214
branch-nick: maria-5.5

Also reproducible on MySQL 5.5.20 and 5.6.4, filed as http://bugs.mysql.com/bug.php?id=64038.

Test case:

CREATE TABLE t ( a INT, b INT );
INSERT INTO t VALUES (5,3),(5,6);
ALTER TABLE t PARTITION BY KEY(b) PARTITIONS 3 ;
ALTER TABLE t REPAIR PARTITION p1, p3;
ALTER TABLE t ORDER BY b;

Environment

None

Status

Assignee

Sergei Golubchik

Reporter

Elena Stepanova

Labels

Fix versions

Priority

Major
Configure