Skip to content

Commit cc4d920

Browse files
committed
MDEV-33813 ERROR 1021 (HY000): Disk full (./org/test1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
The problem with MariaDB waiting was fixed earlier. However the server still gives the old error,in case of disk full, that includes "waiting for someone to free some space" even if there is now wait. This commit changes the error message for the non waiting case to: Disk got full writing 'db.table' (Errcode: 28 "No space left on device") Disk got full writing 'test.t1' (Errcode: 28 "No space left on device")Disk got full writing 'test.t1' (Errcode: 28 "No space left on device")Disk got full writing 'test.t1' (Errcode: 28 "No space left on device")
1 parent 15139c8 commit cc4d920

File tree

4 files changed

+36
-2
lines changed

4 files changed

+36
-2
lines changed

mysql-test/main/myisam-big.result

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
drop table if exists t1,t2;
2+
call mtr.add_suppression("Index.*try to repair it");
3+
call mtr.add_suppression("Disk got full");
4+
call mtr.add_suppression("Got an error from thread_id");
25
create table t1 (id int, sometext varchar(100)) engine=myisam;
36
insert into t1 values (1, "hello"),(2, "hello2"),(4, "hello3"),(4, "hello4");
47
create table t2 like t1;
@@ -43,4 +46,9 @@ connection default;
4346
connection con2;
4447
disconnect con2;
4548
connection default;
49+
SET @saved_dbug = @@SESSION.debug_dbug;
50+
SET debug_dbug='+d,simulate_file_pwrite_error';
51+
insert into t1 select * from t2;
52+
ERROR HY000: Disk got full writing 'test.t1' (Errcode: 28 "No space left on device")
53+
SET debug_dbug= @saved_dbug;
4654
drop table t1,t2;

mysql-test/main/myisam-big.test

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
#
22
# Test bugs in the MyISAM code that require more space/time
33
--source include/big_test.inc
4+
--source include/have_debug.inc
45

56
# Initialise
67
--disable_warnings
78
drop table if exists t1,t2;
89
--enable_warnings
910

11+
call mtr.add_suppression("Index.*try to repair it");
12+
call mtr.add_suppression("Disk got full");
13+
call mtr.add_suppression("Got an error from thread_id");
14+
1015
#
1116
# BUG#925377:
1217
# Querying myisam table metadata while 'alter table..enable keys' is
@@ -61,4 +66,12 @@ connection con2;
6166
reap;
6267
disconnect con2;
6368
connection default;
69+
70+
#
71+
# Test error message from disk full
72+
SET @saved_dbug = @@SESSION.debug_dbug;
73+
SET debug_dbug='+d,simulate_file_pwrite_error';
74+
--error ER_DISK_FULL
75+
insert into t1 select * from t2;
76+
SET debug_dbug= @saved_dbug;
6477
drop table t1,t2;

mysys/my_pread.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,15 @@ size_t my_pwrite(int Filedes, const uchar *Buffer, size_t Count,
158158
#else
159159
writtenbytes= pwrite(Filedes, Buffer, Count, offset);
160160
#endif
161+
162+
DBUG_EXECUTE_IF ("simulate_file_pwrite_error",
163+
if (writtenbytes == Count &&
164+
my_seek(Filedes, 0, SEEK_END, MYF(0)) > 1024*1024L)
165+
{
166+
errno= ENOSPC;
167+
writtenbytes= (size_t) -1;
168+
});
169+
161170
if (writtenbytes == Count)
162171
break;
163172
my_errno= errno;

sql/handler.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ int ha_init_errors(void)
499499
SETMSG(HA_ERR_INDEX_COL_TOO_LONG, ER_DEFAULT(ER_INDEX_COLUMN_TOO_LONG));
500500
SETMSG(HA_ERR_INDEX_CORRUPT, ER_DEFAULT(ER_INDEX_CORRUPT));
501501
SETMSG(HA_FTS_INVALID_DOCID, "Invalid InnoDB FTS Doc ID");
502-
SETMSG(HA_ERR_DISK_FULL, ER_DEFAULT(ER_DISK_FULL));
502+
SETMSG(HA_ERR_DISK_FULL, "Disk got full writing '%s'");
503503
SETMSG(HA_ERR_FTS_TOO_MANY_WORDS_IN_PHRASE, "Too many words in a FTS phrase or proximity search");
504504
SETMSG(HA_ERR_FK_DEPTH_EXCEEDED, "Foreign key cascade delete/update exceeds");
505505
SETMSG(HA_ERR_TABLESPACE_MISSING, ER_DEFAULT(ER_TABLESPACE_MISSING));
@@ -4456,8 +4456,12 @@ void handler::print_error(int error, myf errflag)
44564456
break;
44574457
case ENOSPC:
44584458
case HA_ERR_DISK_FULL:
4459-
textno= ER_DISK_FULL;
44604459
SET_FATAL_ERROR; // Ensure error is logged
4460+
my_printf_error(ER_DISK_FULL, "Disk got full writing '%s.%s' (Errcode: %M)",
4461+
MYF(errflag | ME_ERROR_LOG),
4462+
table_share->db.str, table_share->table_name.str,
4463+
error);
4464+
DBUG_VOID_RETURN;
44614465
break;
44624466
case HA_ERR_KEY_NOT_FOUND:
44634467
case HA_ERR_NO_ACTIVE_RECORD:

0 commit comments

Comments
 (0)