Below is the list of changes that have just been committed into a local
4.1 repository of hf. When hf does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-11-10 23:11:37+04:00, holyfoot@stripped +4 -0
Bug #31305 myisam tables crash when they are near capacity.
When we insert a record into MYISAM table which is almost 'full',
we first write record data in the free space inside a file, and then
check if we have enough space after the end of the file.
So if we don't have the space, table will left corrupted.
Similar error also happens when we updata MYISAM tables.
Fixed by modifying write_dynamic_record and update_dynamic_record functions
to check for free space before writing parts of a record
BitKeeper/etc/ignore@stripped, 2007-11-10 23:11:34+04:00, holyfoot@stripped +2 -0
Added libmysql_r/client_settings.h libmysqld/ha_blackhole.cc to the ignore list
myisam/mi_dynrec.c@stripped, 2007-11-10 23:11:34+04:00, holyfoot@stripped +59 -0
Bug #31305 myisam tables crash when they are near capacity.
now we check space left in table in write_dynamic_record
and update_dynamic_record functions.
If we don't have enough room for the new (updated) record, return with the
error.
mysql-test/r/almost_full.result@stripped, 2007-11-10 23:11:34+04:00, holyfoot@stripped +321
-0
New BitKeeper file ``mysql-test/r/almost_full.result''
mysql-test/r/almost_full.result@stripped, 2007-11-10 23:11:34+04:00, holyfoot@stripped +0 -0
mysql-test/t/almost_full.test@stripped, 2007-11-10 23:11:34+04:00, holyfoot@stripped +32 -0
New BitKeeper file ``mysql-test/t/almost_full.test''
mysql-test/t/almost_full.test@stripped, 2007-11-10 23:11:34+04:00, holyfoot@stripped +0 -0
diff -Nrup a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore
--- a/BitKeeper/etc/ignore 2007-02-28 18:03:46 +04:00
+++ b/BitKeeper/etc/ignore 2007-11-10 23:11:34 +04:00
@@ -1068,3 +1068,5 @@ include/check_abi
include/mysql_h.ic
mysql-test/r/blackhole.log
mysql-test/lib/init_db.sql
+libmysql_r/client_settings.h
+libmysqld/ha_blackhole.cc
diff -Nrup a/myisam/mi_dynrec.c b/myisam/mi_dynrec.c
--- a/myisam/mi_dynrec.c 2006-12-01 19:11:41 +04:00
+++ b/myisam/mi_dynrec.c 2007-11-10 23:11:34 +04:00
@@ -145,6 +145,29 @@ static int write_dynamic_record(MI_INFO
DBUG_ENTER("write_dynamic_record");
flag=0;
+
+ /*
+ Check if we have enough room for the new record.
+ First we do simplified check to make usual case faster.
+ Then we do more precise check for the space left.
+ Though it still is not absolutely precise, as
+ we always use MAX_HEADER_LEGNTH while it can be
+ less in the most of the cases
+ */
+
+ if (unlikely(info->s->base.max_data_file_length -
+ info->state->data_file_length <
+ reclength + MI_MAX_DYN_BLOCK_HEADER))
+ {
+ if (info->s->base.max_data_file_length - info->state->data_file_length +
+ info->state->empty - info->state->del * MI_MAX_DYN_BLOCK_HEADER <
+ reclength + MI_MAX_DYN_BLOCK_HEADER)
+ {
+ my_errno=HA_ERR_RECORD_FILE_FULL;
+ DBUG_RETURN(1);
+ }
+ }
+
do
{
if (_mi_find_writepos(info,reclength,&filepos,&length))
@@ -577,6 +600,40 @@ static int update_dynamic_record(MI_INFO
DBUG_ENTER("update_dynamic_record");
flag=block_info.second_read=0;
+ /*
+ Check if we have enough room for the record.
+ First we do simplified check to make usual case faster.
+ Then we do more precise check for the space left.
+ Though it still is not absolutely precise, as
+ we always use MI_MAX_DYN_BLOCK_HEADER while it can be
+ less in the most of the cases
+ */
+
+ if (unlikely(info->s->base.max_data_file_length -
+ info->state->data_file_length < reclength))
+ {
+ if ((error=_mi_get_block_info(&block_info,info->dfile,filepos))
+ & (BLOCK_DELETED | BLOCK_ERROR | BLOCK_SYNC_ERROR | BLOCK_FATAL_ERROR))
+ {
+ DBUG_PRINT("error",("Got wrong block info"));
+ if (!(error & BLOCK_FATAL_ERROR))
+ my_errno=HA_ERR_WRONG_IN_RECORD;
+ goto err;
+ }
+
+ if (block_info.rec_len < reclength)
+ {
+ if (info->s->base.max_data_file_length - info->state->data_file_length
+
+ info->state->empty - info->state->del * MI_MAX_DYN_BLOCK_HEADER
<
+ reclength - block_info.rec_len + MI_MAX_DYN_BLOCK_HEADER)
+ {
+ my_errno=HA_ERR_RECORD_FILE_FULL;
+ goto err;
+ }
+ }
+ block_info.second_read=0;
+ }
+
while (reclength > 0)
{
if (filepos != info->s->state.dellink)
@@ -596,6 +653,8 @@ static int update_dynamic_record(MI_INFO
{
uint tmp=MY_ALIGN(reclength - length + 3 +
test(reclength >= 65520L),MI_DYN_ALIGN_SIZE);
+
+
/* Don't create a block bigger than MI_MAX_BLOCK_LENGTH */
tmp= min(length+tmp, MI_MAX_BLOCK_LENGTH)-length;
/* Check if we can extend this block */
diff -Nrup a/mysql-test/r/almost_full.result b/mysql-test/r/almost_full.result
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/mysql-test/r/almost_full.result 2007-11-10 23:11:34 +04:00
@@ -0,0 +1,321 @@
+drop table if exists t1;
+set global myisam_data_pointer_size=2;
+CREATE TABLE t1 (a int auto_increment primary key not null, b longtext) ENGINE=MyISAM;
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+INSERT INTO t1 SET b=repeat('a',abs(200));
+DELETE FROM t1 WHERE a=1 or a=5;
+INSERT INTO t1 SET b=repeat('a',abs(600));
+ERROR HY000: The table 't1' is full
+CHECK TABLE t1 EXTENDED;
+Table Op Msg_type Msg_text
+test.t1 check warning Datafile is almost full, 65448 of 65534 used
+test.t1 check status OK
+UPDATE t1 SET b=repeat('a', abs(800));
+ERROR HY000: The table 't1' is full
+CHECK TABLE t1 EXTENDED;
+Table Op Msg_type Msg_text
+test.t1 check warning Datafile is almost full, 65448 of 65534 used
+test.t1 check status OK
+drop table t1;
+set global myisam_data_pointer_size=4;
diff -Nrup a/mysql-test/t/almost_full.test b/mysql-test/t/almost_full.test
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/mysql-test/t/almost_full.test 2007-11-10 23:11:34 +04:00
@@ -0,0 +1,32 @@
+#
+# Some special cases with empty tables
+#
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+set global myisam_data_pointer_size=2;
+CREATE TABLE t1 (a int auto_increment primary key not null, b longtext) ENGINE=MyISAM;
+
+let $1= 303;
+while ($1)
+{
+ INSERT INTO t1 SET b=repeat('a',abs(200));
+ dec $1;
+}
+
+DELETE FROM t1 WHERE a=1 or a=5;
+
+--error 1114
+INSERT INTO t1 SET b=repeat('a',abs(600));
+CHECK TABLE t1 EXTENDED;
+
+--error 1114
+UPDATE t1 SET b=repeat('a', abs(800));
+CHECK TABLE t1 EXTENDED;
+
+drop table t1;
+set global myisam_data_pointer_size=4;
+
+# End of 4.1 tests