MDEV-7685: MariaDB - server crashes when inserting more rows than
available space on disk Add error handling when disk full situation happens and intentionally bring server down with stacktrace because on all cases InnoDB can't continue anyway.
This commit is contained in:
parent
ec16d1b62f
commit
a7fd11b31d
@ -1,63 +0,0 @@
|
||||
call mtr.add_suppression("InnoDB: Error: row_merge_drop_indexes_dict failed with error code*");
|
||||
create table t1(a int, 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(20000);
|
||||
commit;
|
||||
set autocommit=1;
|
||||
create table t2(a int) engine=innodb;
|
||||
show create table t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
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) DEFAULT NULL,
|
||||
`b` int(11) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
alter table t2 add testcol int;
|
||||
ERROR HY000: The table 't2' is full
|
||||
alter table t1 add testcol int;
|
||||
ERROR HY000: The table 't1' is full
|
||||
alter table t1 add testcol int;
|
||||
ERROR HY000: The table 't1' is full
|
||||
alter table t1 add testcol2 int;
|
||||
ERROR HY000: The table 't1' is full
|
||||
alter table t1 add testcol3 int;
|
||||
ERROR HY000: The table 't1' is full
|
||||
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) DEFAULT NULL,
|
||||
`b` int(11) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
drop table t2;
|
||||
alter table t1 add testcol2 int;
|
||||
ERROR HY000: The table 't1' is full
|
||||
alter table t1 add testcol3 int;
|
||||
ERROR HY000: The table 't1' is full
|
||||
call innodb_insert_proc(20000);
|
||||
set autocommit=0;
|
||||
call innodb_insert_proc(20000);
|
||||
commit;
|
||||
set autocommit=1;
|
||||
set DEBUG_DBUG='';
|
||||
drop procedure innodb_insert_proc;
|
||||
drop table t1;
|
||||
drop table if exists t2;
|
@ -1 +0,0 @@
|
||||
--innodb-use-native-aio=0
|
@ -1,75 +0,0 @@
|
||||
# MDEV-6288: Innodb causes server crash after disk full, then can't ALTER TABLE any more
|
||||
--source include/have_innodb.inc
|
||||
--source include/not_windows.inc
|
||||
--source include/not_valgrind.inc
|
||||
--source include/not_embedded.inc
|
||||
|
||||
# DEBUG_SYNC must be compiled in.
|
||||
--source include/have_debug_sync.inc
|
||||
|
||||
call mtr.add_suppression("InnoDB: Error: row_merge_drop_indexes_dict failed with error code*");
|
||||
|
||||
create table t1(a int, 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(20000);
|
||||
commit;
|
||||
set autocommit=1;
|
||||
|
||||
create table t2(a int) engine=innodb;
|
||||
show create table t2;
|
||||
|
||||
# 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;
|
||||
--error 1114
|
||||
alter table t2 add testcol int;
|
||||
--error 1114
|
||||
alter table t1 add testcol int;
|
||||
--error 1114
|
||||
alter table t1 add testcol int;
|
||||
--error 1114
|
||||
alter table t1 add testcol2 int;
|
||||
--error 1114
|
||||
alter table t1 add testcol3 int;
|
||||
--error 1114
|
||||
alter table t1 add testcol int;
|
||||
show create table t1;
|
||||
--error 0,1051
|
||||
drop table t2;
|
||||
--error 1114
|
||||
alter table t1 add testcol2 int;
|
||||
--error 1114
|
||||
alter table t1 add testcol3 int;
|
||||
--error 0,1114
|
||||
call innodb_insert_proc(20000);
|
||||
set autocommit=0;
|
||||
--error 0,1114
|
||||
call innodb_insert_proc(20000);
|
||||
commit;
|
||||
set autocommit=1;
|
||||
|
||||
set DEBUG_DBUG='';
|
||||
|
||||
drop procedure innodb_insert_proc;
|
||||
drop table t1;
|
||||
--disable_warnings
|
||||
drop table if exists t2;
|
||||
--enable_warnings
|
||||
|
||||
|
@ -3055,12 +3055,6 @@ func_start:
|
||||
/* 2. Allocate a new page to the index */
|
||||
new_block = btr_page_alloc(cursor->index, hint_page_no, direction,
|
||||
btr_page_get_level(page, mtr), mtr, mtr);
|
||||
|
||||
/* Play safe, if new page is not allocated */
|
||||
if (!new_block) {
|
||||
return(rec);
|
||||
}
|
||||
|
||||
new_page = buf_block_get_frame(new_block);
|
||||
new_page_zip = buf_block_get_page_zip(new_block);
|
||||
btr_page_create(new_block, new_page_zip, cursor->index,
|
||||
|
@ -128,6 +128,7 @@ my_error_innodb(
|
||||
break;
|
||||
case DB_OUT_OF_FILE_SPACE:
|
||||
my_error(ER_RECORD_FILE_FULL, MYF(0), table);
|
||||
ut_error;
|
||||
break;
|
||||
case DB_TEMP_FILE_WRITE_FAILURE:
|
||||
my_error(ER_GET_ERRMSG, MYF(0),
|
||||
|
@ -617,7 +617,7 @@ os_file_handle_error_cond_exit(
|
||||
os_has_said_disk_full = TRUE;
|
||||
|
||||
fflush(stderr);
|
||||
|
||||
ut_error;
|
||||
return(FALSE);
|
||||
|
||||
case OS_FILE_AIO_RESOURCES_RESERVED:
|
||||
@ -4607,7 +4607,7 @@ os_aio_func(
|
||||
mode = mode & (~OS_AIO_SIMULATED_WAKE_LATER);
|
||||
|
||||
DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
|
||||
mode = OS_AIO_SYNC; os_has_said_disk_full = TRUE;);
|
||||
mode = OS_AIO_SYNC; os_has_said_disk_full = FALSE;);
|
||||
|
||||
if (mode == OS_AIO_SYNC
|
||||
#ifdef WIN_ASYNC_IO
|
||||
@ -4639,7 +4639,11 @@ os_aio_func(
|
||||
ret = os_file_write_func(name, file, buf, offset, n);
|
||||
|
||||
DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
|
||||
os_has_said_disk_full = TRUE; ret = 0; errno = 28;);
|
||||
os_has_said_disk_full = FALSE; ret = 0; errno = 28;);
|
||||
|
||||
if (!ret) {
|
||||
os_file_handle_error_cond_exit(name, "os_file_write_func", TRUE, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -5463,9 +5467,14 @@ consecutive_loop:
|
||||
aio_slot->offset, total_len);
|
||||
|
||||
DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
|
||||
os_has_said_disk_full = TRUE;
|
||||
os_has_said_disk_full = FALSE;
|
||||
ret = 0;
|
||||
errno = 28;);
|
||||
|
||||
if (!ret) {
|
||||
os_file_handle_error_cond_exit(aio_slot->name, "os_file_write_func", TRUE, FALSE);
|
||||
}
|
||||
|
||||
} else {
|
||||
ret = os_file_read(
|
||||
aio_slot->file, combined_buf,
|
||||
|
@ -3097,12 +3097,6 @@ func_start:
|
||||
/* 2. Allocate a new page to the index */
|
||||
new_block = btr_page_alloc(cursor->index, hint_page_no, direction,
|
||||
btr_page_get_level(page, mtr), mtr, mtr);
|
||||
|
||||
/* Play safe, if new page is not allocated */
|
||||
if (!new_block) {
|
||||
return(rec);
|
||||
}
|
||||
|
||||
new_page = buf_block_get_frame(new_block);
|
||||
new_page_zip = buf_block_get_page_zip(new_block);
|
||||
btr_page_create(new_block, new_page_zip, cursor->index,
|
||||
|
@ -128,6 +128,7 @@ my_error_innodb(
|
||||
break;
|
||||
case DB_OUT_OF_FILE_SPACE:
|
||||
my_error(ER_RECORD_FILE_FULL, MYF(0), table);
|
||||
ut_error;
|
||||
break;
|
||||
case DB_TEMP_FILE_WRITE_FAILURE:
|
||||
my_error(ER_GET_ERRMSG, MYF(0),
|
||||
|
@ -716,6 +716,7 @@ os_file_handle_error_cond_exit(
|
||||
|
||||
fflush(stderr);
|
||||
|
||||
ut_error;
|
||||
return(FALSE);
|
||||
|
||||
case OS_FILE_AIO_RESOURCES_RESERVED:
|
||||
@ -4735,7 +4736,7 @@ os_aio_func(
|
||||
mode = mode & (~OS_AIO_SIMULATED_WAKE_LATER);
|
||||
|
||||
DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
|
||||
mode = OS_AIO_SYNC; os_has_said_disk_full = TRUE;);
|
||||
mode = OS_AIO_SYNC; os_has_said_disk_full = FALSE;);
|
||||
|
||||
if (mode == OS_AIO_SYNC) {
|
||||
ibool ret;
|
||||
@ -4751,7 +4752,11 @@ os_aio_func(
|
||||
ret = os_file_write(name, file, buf, offset, n);
|
||||
|
||||
DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
|
||||
os_has_said_disk_full = TRUE; ret = 0; errno = 28;);
|
||||
os_has_said_disk_full = FALSE; ret = 0; errno = 28;);
|
||||
|
||||
if (!ret) {
|
||||
os_file_handle_error_cond_exit(name, "os_file_write_func", TRUE, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!ret) {
|
||||
@ -5582,7 +5587,12 @@ consecutive_loop:
|
||||
aio_slot->offset, total_len);
|
||||
|
||||
DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
|
||||
os_has_said_disk_full = TRUE; ret = 0; errno = 28;);
|
||||
os_has_said_disk_full = FALSE; ret = 0; errno = 28;);
|
||||
|
||||
if (!ret) {
|
||||
os_file_handle_error_cond_exit(aio_slot->name, "os_file_write_func", TRUE, FALSE);
|
||||
}
|
||||
|
||||
} else {
|
||||
ret = os_file_read(
|
||||
aio_slot->file, combined_buf,
|
||||
|
Loading…
x
Reference in New Issue
Block a user