Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

MDEV-36017 Alter table aborts when temporary directory is full #3903

Open
wants to merge 1 commit into
base: 10.6
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions mysql-test/suite/innodb/r/alter_temp_fail.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# MDEV-36017 Alter table aborts when temporary
# directory is full
#
CREATE TABLE t1(f1 INT NOT NULL, f2 CHAR(100),
f3 CHAR(100))ENGINE=InnoDB;
INSERT INTO t1 SELECT seq, 'a', 'b' FROM seq_1_to_4096;
SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit";
ALTER TABLE t1 ADD KEY(f1), ADD INDEX(f3(10));
connect con1,localhost,root,,,;
SET DEBUG_SYNC="now WAIT_FOR dml_start";
BEGIN;
INSERT INTO t1 SELECT * FROM t1;
SET DEBUG_DBUG="+d,os_file_write_fail";
COMMIT;
SET DEBUG_DBUG="-d,os_file_write_fail";
SET DEBUG_SYNC="now SIGNAL dml_commit";
connection default;
ERROR HY000: Temporary file write failure
disconnect con1;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
1 change: 1 addition & 0 deletions mysql-test/suite/innodb/t/alter_temp_fail.opt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--innodb_sort_buffer_size=64k
28 changes: 28 additions & 0 deletions mysql-test/suite/innodb/t/alter_temp_fail.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
--source include/have_innodb.inc
--source include/have_sequence.inc
--source include/have_debug.inc
--echo #
--echo # MDEV-36017 Alter table aborts when temporary
--echo # directory is full
--echo #
CREATE TABLE t1(f1 INT NOT NULL, f2 CHAR(100),
f3 CHAR(100))ENGINE=InnoDB;
INSERT INTO t1 SELECT seq, 'a', 'b' FROM seq_1_to_4096;
SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit";
SEND ALTER TABLE t1 ADD KEY(f1), ADD INDEX(f3(10));

connect(con1,localhost,root,,,);
SET DEBUG_SYNC="now WAIT_FOR dml_start";
BEGIN;
INSERT INTO t1 SELECT * FROM t1;
SET DEBUG_DBUG="+d,os_file_write_fail";
COMMIT;
SET DEBUG_DBUG="-d,os_file_write_fail";
SET DEBUG_SYNC="now SIGNAL dml_commit";

connection default;
--error ER_TEMP_FILE_WRITE_FAILURE
reap;
disconnect con1;
CHECK TABLE t1;
DROP TABLE t1;
2 changes: 1 addition & 1 deletion storage/innobase/fil/fil0fil.cc
Original file line number Diff line number Diff line change
@@ -591,7 +591,7 @@ fil_space_extend_must_retry(
*success = os_file_set_size(node->name, node->handle, new_size,
node->punch_hole == 1);

os_has_said_disk_full = *success;
os_has_said_disk_full = !*success;
if (*success) {
os_file_flush(node->handle);
last_page_no = size;
5 changes: 5 additions & 0 deletions storage/innobase/row/row0log.cc
Original file line number Diff line number Diff line change
@@ -398,12 +398,17 @@ bool row_log_online_op(dict_index_t *index, const dtuple_t *tuple,
}

log->tail.blocks++;
DBUG_EXECUTE_IF("os_file_write_fail",
log->error= DB_TEMP_FILE_WRITE_FAIL;
goto write_failed;);

if (os_file_write(
IORequestWrite,
"(modification log)",
log->fd,
buf, byte_offset, srv_sort_buf_size)
!= DB_SUCCESS) {
log->error= DB_TEMP_FILE_WRITE_FAIL;
write_failed:
index->type |= DICT_CORRUPT;
}