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")
This commit is contained in:
Monty
2025-02-26 16:32:06 +02:00
parent 15139c88a8
commit cc4d9200c4
4 changed files with 36 additions and 2 deletions

View File

@ -1,4 +1,7 @@
drop table if exists t1,t2;
call mtr.add_suppression("Index.*try to repair it");
call mtr.add_suppression("Disk got full");
call mtr.add_suppression("Got an error from thread_id");
create table t1 (id int, sometext varchar(100)) engine=myisam;
insert into t1 values (1, "hello"),(2, "hello2"),(4, "hello3"),(4, "hello4");
create table t2 like t1;
@ -43,4 +46,9 @@ connection default;
connection con2;
disconnect con2;
connection default;
SET @saved_dbug = @@SESSION.debug_dbug;
SET debug_dbug='+d,simulate_file_pwrite_error';
insert into t1 select * from t2;
ERROR HY000: Disk got full writing 'test.t1' (Errcode: 28 "No space left on device")
SET debug_dbug= @saved_dbug;
drop table t1,t2;

View File

@ -1,12 +1,17 @@
#
# Test bugs in the MyISAM code that require more space/time
--source include/big_test.inc
--source include/have_debug.inc
# Initialise
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
call mtr.add_suppression("Index.*try to repair it");
call mtr.add_suppression("Disk got full");
call mtr.add_suppression("Got an error from thread_id");
#
# BUG#925377:
# Querying myisam table metadata while 'alter table..enable keys' is
@ -61,4 +66,12 @@ connection con2;
reap;
disconnect con2;
connection default;
#
# Test error message from disk full
SET @saved_dbug = @@SESSION.debug_dbug;
SET debug_dbug='+d,simulate_file_pwrite_error';
--error ER_DISK_FULL
insert into t1 select * from t2;
SET debug_dbug= @saved_dbug;
drop table t1,t2;

View File

@ -158,6 +158,15 @@ size_t my_pwrite(int Filedes, const uchar *Buffer, size_t Count,
#else
writtenbytes= pwrite(Filedes, Buffer, Count, offset);
#endif
DBUG_EXECUTE_IF ("simulate_file_pwrite_error",
if (writtenbytes == Count &&
my_seek(Filedes, 0, SEEK_END, MYF(0)) > 1024*1024L)
{
errno= ENOSPC;
writtenbytes= (size_t) -1;
});
if (writtenbytes == Count)
break;
my_errno= errno;

View File

@ -499,7 +499,7 @@ int ha_init_errors(void)
SETMSG(HA_ERR_INDEX_COL_TOO_LONG, ER_DEFAULT(ER_INDEX_COLUMN_TOO_LONG));
SETMSG(HA_ERR_INDEX_CORRUPT, ER_DEFAULT(ER_INDEX_CORRUPT));
SETMSG(HA_FTS_INVALID_DOCID, "Invalid InnoDB FTS Doc ID");
SETMSG(HA_ERR_DISK_FULL, ER_DEFAULT(ER_DISK_FULL));
SETMSG(HA_ERR_DISK_FULL, "Disk got full writing '%s'");
SETMSG(HA_ERR_FTS_TOO_MANY_WORDS_IN_PHRASE, "Too many words in a FTS phrase or proximity search");
SETMSG(HA_ERR_FK_DEPTH_EXCEEDED, "Foreign key cascade delete/update exceeds");
SETMSG(HA_ERR_TABLESPACE_MISSING, ER_DEFAULT(ER_TABLESPACE_MISSING));
@ -4456,8 +4456,12 @@ void handler::print_error(int error, myf errflag)
break;
case ENOSPC:
case HA_ERR_DISK_FULL:
textno= ER_DISK_FULL;
SET_FATAL_ERROR; // Ensure error is logged
my_printf_error(ER_DISK_FULL, "Disk got full writing '%s.%s' (Errcode: %M)",
MYF(errflag | ME_ERROR_LOG),
table_share->db.str, table_share->table_name.str,
error);
DBUG_VOID_RETURN;
break;
case HA_ERR_KEY_NOT_FOUND:
case HA_ERR_NO_ACTIVE_RECORD: