summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <monty@tramp.mysql.fi>2001-10-29 10:49:35 +0200
committerunknown <monty@tramp.mysql.fi>2001-10-29 10:49:35 +0200
commitb3a974963dee53187668e9f467310069b4a67fcc (patch)
treefc5532fe3c9a3bc29a1e71b5db41e1b702f4980a /myisam
parent440de598ee325364b89468c8bd66925956b0e66f (diff)
downloadmariadb-git-b3a974963dee53187668e9f467310069b4a67fcc.tar.gz
Fixed error message when opening a not-MyISAM file.
Extended MODIFY and CHANGE in ALTER TABLE to accept the AFTER keyword. Extended MyISAM to handle records > 16M. Docs/manual.texi: Updated state of different modules. Rewrote description of 'perror' and 'Packet too large'. myisam/mi_dynrec.c: Extended MyISAM to handle records > 16M myisam/mi_open.c: Fix error message when opening a not-MyISAM file. myisam/myisamdef.h: Extended MyISAM to handle records > 16M mysql-test/r/alter_table.result: Added test for CHANGE col ... AFTER mysql-test/t/alter_table.test: Added test for CHANGE col ... AFTER sql/sql_table.cc: Extended MODIFY and CHANGE in ALTER TABLE to accept the AFTER keyword. sql/sql_yacc.yy: Extended MODIFY and CHANGE in ALTER TABLE to accept the AFTER keyword. BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
Diffstat (limited to 'myisam')
-rw-r--r--myisam/mi_dynrec.c41
-rw-r--r--myisam/mi_open.c2
-rw-r--r--myisam/myisamdef.h3
3 files changed, 34 insertions, 12 deletions
diff --git a/myisam/mi_dynrec.c b/myisam/mi_dynrec.c
index c07fa5aa080..4facda91626 100644
--- a/myisam/mi_dynrec.c
+++ b/myisam/mi_dynrec.c
@@ -190,6 +190,8 @@ static int _mi_find_writepos(MI_INFO *info,
my_errno=HA_ERR_RECORD_FILE_FULL;
DBUG_RETURN(-1);
}
+ if (*length > MI_MAX_BLOCK_LENGTH)
+ *length=MI_MAX_BLOCK_LENGTH;
info->state->data_file_length+= *length;
info->s->state.split++;
info->update|=HA_STATE_WRITE_AT_END;
@@ -370,19 +372,30 @@ int _mi_write_part_record(MI_INFO *info,
info->s->state.dellink : info->state->data_file_length;
if (*flag == 0) /* First block */
{
- head_length=5+8+long_block*2;
- temp[0]=5+(uchar) long_block;
- if (long_block)
+ if (*reclength > MI_MAX_BLOCK_LENGTH)
{
- mi_int3store(temp+1,*reclength);
+ head_length= 16;
+ temp[0]=13;
+ mi_int4store(temp+1,*reclength);
mi_int3store(temp+4,length-head_length);
- mi_sizestore((byte*) temp+7,next_filepos);
+ mi_sizestore((byte*) temp+8,next_filepos);
}
else
{
- mi_int2store(temp+1,*reclength);
- mi_int2store(temp+3,length-head_length);
- mi_sizestore((byte*) temp+5,next_filepos);
+ head_length=5+8+long_block*2;
+ temp[0]=5+(uchar) long_block;
+ if (long_block)
+ {
+ mi_int3store(temp+1,*reclength);
+ mi_int3store(temp+4,length-head_length);
+ mi_sizestore((byte*) temp+7,next_filepos);
+ }
+ else
+ {
+ mi_int2store(temp+1,*reclength);
+ mi_int2store(temp+3,length-head_length);
+ mi_sizestore((byte*) temp+5,next_filepos);
+ }
}
}
else
@@ -1433,10 +1446,10 @@ uint _mi_get_block_info(MI_BLOCK_INFO *info, File file, my_off_t filepos)
}
else
{
- if (info->header[0] > 6)
+ if (info->header[0] > 6 && info->header[0] != 13)
return_val=BLOCK_SYNC_ERROR;
}
- info->next_filepos= HA_OFFSET_ERROR; /* Dummy ifall no next block */
+ info->next_filepos= HA_OFFSET_ERROR; /* Dummy if no next block */
switch (info->header[0]) {
case 0:
@@ -1470,6 +1483,14 @@ uint _mi_get_block_info(MI_BLOCK_INFO *info, File file, my_off_t filepos)
info->filepos=filepos+4;
return return_val | BLOCK_FIRST | BLOCK_LAST;
+ case 13:
+ info->rec_len=mi_uint4korr(header+1);
+ info->block_len=info->data_len=mi_uint3korr(header+5);
+ info->next_filepos=mi_sizekorr(header+8);
+ info->second_read=1;
+ info->filepos=filepos+16;
+ return return_val | BLOCK_FIRST;
+
case 3:
info->rec_len=info->data_len=mi_uint2korr(header+1);
info->block_len=info->rec_len+ (uint) header[3];
diff --git a/myisam/mi_open.c b/myisam/mi_open.c
index 675dac38d41..6da1dc926c5 100644
--- a/myisam/mi_open.c
+++ b/myisam/mi_open.c
@@ -115,7 +115,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
DBUG_PRINT("error",("Wrong header in %s",name_buff));
DBUG_DUMP("error_dump",(char*) share->state.header.file_version,
head_length);
- my_errno=HA_ERR_CRASHED;
+ my_errno=HA_ERR_WRONG_TABLE_DEF;
goto err;
}
share->options= mi_uint2korr(share->state.header.options);
diff --git a/myisam/myisamdef.h b/myisam/myisamdef.h
index 33837dfda00..ea77d700234 100644
--- a/myisam/myisamdef.h
+++ b/myisam/myisamdef.h
@@ -356,7 +356,8 @@ struct st_myisam_info {
#define MI_DYN_MAX_BLOCK_LENGTH ((1L << 24)-4L)
#define MI_DYN_MAX_ROW_LENGTH (MI_DYN_MAX_BLOCK_LENGTH - MI_SPLIT_LENGTH)
#define MI_DYN_ALIGN_SIZE 4 /* Align blocks on this */
-#define MI_MAX_DYN_HEADER_BYTE 12 /* max header byte for dynamic rows */
+#define MI_MAX_DYN_HEADER_BYTE 13 /* max header byte for dynamic rows */
+#define MI_MAX_BLOCK_LENGTH (((ulong) 1 << 24)-1)
#define MEMMAP_EXTRA_MARGIN 7 /* Write this as a suffix for file */