Commit 6bd2f900 authored by Jan Lindström's avatar Jan Lindström

MDEV-6288: Innodb causes server crash after disk full, then can't

ALTER TABLE any more.
parent 80a02037
create table t1(a int not null primary key, b int) engine=innodb;
create procedure innodb_insert_proc (repeat_count int)
begin
declare current_num int;
set current_num = 0;
while current_num < repeat_count do
insert into t1 values(current_num, current_num);
set current_num = current_num + 1;
end while;
end//
commit;
set autocommit=0;
call innodb_insert_proc(10000);
commit;
set autocommit=1;
set DEBUG_DBUG='+d,ib_os_aio_func_io_failure_28';
alter table t1 add testcol int;
ERROR HY000: The table 't1' is full
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
set DEBUG_DBUG='+d,ib_os_aio_func_io_failure_28_2';
alter table t1 add testcol int;
ERROR HY000: The table 't1' is full
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
set DEBUG_DBUG=NULL;
alter table t1 add testcol2 int;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
`testcol2` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
select count(1) from t1;
count(1)
10000
drop procedure innodb_insert_proc;
drop table t1;
# MDEV-6288: Innodb causes server crash after disk full, then can't ALTER TABLE any more
--source include/have_xtradb.inc
# DEBUG_SYNC must be compiled in.
--source include/have_debug_sync.inc
create table t1(a int not null primary key, b int) engine=innodb;
delimiter //;
create procedure innodb_insert_proc (repeat_count int)
begin
declare current_num int;
set current_num = 0;
while current_num < repeat_count do
insert into t1 values(current_num, current_num);
set current_num = current_num + 1;
end while;
end//
delimiter ;//
commit;
set autocommit=0;
call innodb_insert_proc(10000);
commit;
set autocommit=1;
# This caused crash earlier
set DEBUG_DBUG='+d,ib_os_aio_func_io_failure_28';
--error 1114
alter table t1 add testcol int;
show create table t1;
# This caused crash earlier
set DEBUG_DBUG='+d,ib_os_aio_func_io_failure_28_2';
--error 1114
alter table t1 add testcol int;
show create table t1;
set DEBUG_DBUG=NULL;
alter table t1 add testcol2 int;
show create table t1;
select count(1) from t1;
drop procedure innodb_insert_proc;
drop table t1;
......@@ -5543,7 +5543,7 @@ _fil_io(
ulint mode;
fil_space_t* space;
fil_node_t* node;
ibool ret;
ibool ret=TRUE;
ulint is_log;
ulint wake_later;
os_offset_t offset;
......@@ -5767,7 +5767,6 @@ _fil_io(
offset, len);
}
#endif /* !UNIV_HOTBACKUP */
ut_a(ret);
if (mode == OS_AIO_SYNC) {
/* The i/o operation is already completed when we return from
......@@ -5782,7 +5781,11 @@ _fil_io(
ut_ad(fil_validate_skip());
}
return(DB_SUCCESS);
if (!ret) {
return(DB_OUT_OF_FILE_SPACE);
} else {
return(DB_SUCCESS);
}
}
#ifndef UNIV_HOTBACKUP
......
......@@ -3167,6 +3167,9 @@ error_handling:
case DB_DUPLICATE_KEY:
my_error(ER_DUP_KEY, MYF(0), "SYS_INDEXES");
break;
case DB_OUT_OF_FILE_SPACE:
my_error_innodb(error, table_name, user_table->flags);
break;
default:
my_error_innodb(error, table_name, user_table->flags);
}
......
......@@ -4720,8 +4720,10 @@ os_aio_func(
wake_later = mode & OS_AIO_SIMULATED_WAKE_LATER;
mode = mode & (~OS_AIO_SIMULATED_WAKE_LATER);
if (mode == OS_AIO_SYNC)
{
DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
mode = OS_AIO_SYNC;);
if (mode == OS_AIO_SYNC) {
ibool ret;
/* This is actually an ordinary synchronous read or write:
no need to use an i/o-handler thread */
......@@ -4735,7 +4737,18 @@ os_aio_func(
ret = os_file_write(name, file, buf, offset, n);
}
ut_a(ret);
DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
os_has_said_disk_full = FALSE;);
DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
ret = 0;);
DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
errno = 28;);
if (!ret) {
fprintf(stderr, "FAIL");
}
return ret;
}
......@@ -5564,7 +5577,13 @@ consecutive_loop:
aio_slot->offset, total_len);
}
ut_a(ret);
DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28_2",
os_has_said_disk_full = FALSE;);
DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28_2",
ret = 0;);
DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28_2",
errno = 28;);
srv_set_io_thread_op_info(global_segment, "file i/o done");
if (aio_slot->type == OS_FILE_READ && n_consecutive > 1) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment