summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2001-12-11 20:47:07 +0200
committerunknown <monty@hundin.mysql.fi>2001-12-11 20:47:07 +0200
commitf0f71accfc2b6fcc6dfeaa1ac4b8b73d071ff3a1 (patch)
tree7a48a4172fd7a54a74071294b9d020715838c648 /myisam
parent65feab359f6c72c98ef32ba6e458735b12533db4 (diff)
parent72ec7dfc65734e623cd91d424a91ee82077fac8c (diff)
downloadmariadb-git-f0f71accfc2b6fcc6dfeaa1ac4b8b73d071ff3a1.tar.gz
Merge work:/home/bk/mysql-4.0 into hundin.mysql.fi:/my/bk/mysql-4.0
Docs/manual.texi: Auto merged sql/sql_yacc.yy: Auto merged
Diffstat (limited to 'myisam')
-rw-r--r--myisam/mi_check.c48
-rw-r--r--myisam/mi_dynrec.c12
-rw-r--r--myisam/myisamdef.h2
3 files changed, 39 insertions, 23 deletions
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index ad095c8e546..7839de20bb8 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -1288,8 +1288,6 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
my_close(info->dfile,MYF(0));
info->dfile=new_file;
info->state->data_file_length=sort_info->filepos;
- /* Only whole records */
- share->state.split=info->state->records+info->state->del;
share->state.version=(ulong) time((time_t*) 0); /* Force reopen */
}
else
@@ -1962,7 +1960,6 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
share->state.state.data_file_length = info->state->data_file_length
= sort_info->filepos;
/* Only whole records */
- share->state.split=info->state->records+info->state->del;
share->state.version=(ulong) time((time_t*) 0);
my_close(info->dfile,MYF(0));
info->dfile=new_file;
@@ -2183,9 +2180,11 @@ static int sort_get_next_record(SORT_INFO *sort_info)
}
sort_info->start_recpos=sort_info->pos;
if (!sort_info->fix_datafile)
+ {
sort_info->filepos=sort_info->pos;
+ share->state.split++;
+ }
sort_info->max_pos=(sort_info->pos+=share->base.pack_reclength);
- share->state.split++;
if (*sort_info->record)
{
if (param->calc_checksum)
@@ -2356,7 +2355,8 @@ static int sort_get_next_record(SORT_INFO *sort_info)
continue;
}
- share->state.split++;
+ if (!sort_info->fix_datafile && (b_type & BLOCK_DELETED))
+ share->state.split++;
if (! found_record++)
{
sort_info->find_length=left_length=block_info.rec_len;
@@ -2494,10 +2494,12 @@ static int sort_get_next_record(SORT_INFO *sort_info)
}
info->checksum=mi_checksum(info,sort_info->record);
if (!sort_info->fix_datafile)
+ {
sort_info->filepos=sort_info->pos;
+ share->state.split++;
+ }
sort_info->max_pos=(sort_info->pos=block_info.filepos+
block_info.rec_len);
- share->state.split++;
info->packed_length=block_info.rec_len;
if (param->calc_checksum)
param->glob_crc+= info->checksum;
@@ -2535,6 +2537,7 @@ int sort_write_record(SORT_INFO *sort_info)
DBUG_RETURN(1);
}
sort_info->filepos+=share->base.pack_reclength;
+ info->s->state.split++;
/* sort_info->param->glob_crc+=mi_static_checksum(info, sort_info->record); */
break;
case DYNAMIC_RECORD:
@@ -2559,20 +2562,28 @@ int sort_write_record(SORT_INFO *sort_info)
}
info->checksum=mi_checksum(info,sort_info->record);
reclength=_mi_rec_pack(info,from,sort_info->record);
- /* sort_info->param->glob_crc+=info->checksum; */
- block_length=reclength+ 3 + test(reclength >= (65520-3));
- if (block_length < share->base.min_block_length)
- block_length=share->base.min_block_length;
flag=0;
- info->update|=HA_STATE_WRITE_AT_END;
- block_length=MY_ALIGN(block_length,MI_DYN_ALIGN_SIZE);
- if (_mi_write_part_record(info,0L,block_length,HA_OFFSET_ERROR,
- &from,&reclength,&flag))
+ /* sort_info->param->glob_crc+=info->checksum; */
+
+ do
{
- mi_check_print_error(param,"%d when writing to datafile",my_errno);
- DBUG_RETURN(1);
- }
- sort_info->filepos+=block_length;
+ block_length=reclength+ 3 + test(reclength >= (65520-3));
+ if (block_length < share->base.min_block_length)
+ block_length=share->base.min_block_length;
+ info->update|=HA_STATE_WRITE_AT_END;
+ block_length=MY_ALIGN(block_length,MI_DYN_ALIGN_SIZE);
+ if (block_length > MI_MAX_BLOCK_LENGTH)
+ block_length=MI_MAX_BLOCK_LENGTH;
+ if (_mi_write_part_record(info,0L,block_length,
+ sort_info->filepos+block_length,
+ &from,&reclength,&flag))
+ {
+ mi_check_print_error(param,"%d when writing to datafile",my_errno);
+ DBUG_RETURN(1);
+ }
+ sort_info->filepos+=block_length;
+ info->s->state.split++;
+ } while (reclength);
/* sort_info->param->glob_crc+=info->checksum; */
break;
case COMPRESSED_RECORD:
@@ -2588,6 +2599,7 @@ int sort_write_record(SORT_INFO *sort_info)
}
/* sort_info->param->glob_crc+=info->checksum; */
sort_info->filepos+=reclength+length;
+ info->s->state.split++;
break;
}
}
diff --git a/myisam/mi_dynrec.c b/myisam/mi_dynrec.c
index dfe1b7053de..b5f5ca7fd33 100644
--- a/myisam/mi_dynrec.c
+++ b/myisam/mi_dynrec.c
@@ -64,11 +64,13 @@ int _mi_write_blob_record(MI_INFO *info, const byte *record)
MI_DYN_DELETE_BLOCK_HEADER+1;
reclength=info->s->base.pack_reclength+
_my_calc_total_blob_length(info,record)+ extra;
+#ifdef NOT_USED /* We now support big rows */
if (reclength > MI_DYN_MAX_ROW_LENGTH)
{
my_errno=HA_ERR_TO_BIG_ROW;
return -1;
}
+#endif
if (!(rec_buff=(byte*) my_alloca(reclength)))
{
my_errno=ENOMEM;
@@ -93,11 +95,13 @@ int _mi_update_blob_record(MI_INFO *info, my_off_t pos, const byte *record)
MI_DYN_DELETE_BLOCK_HEADER;
reclength=info->s->base.pack_reclength+
_my_calc_total_blob_length(info,record)+ extra;
+#ifdef NOT_USED /* We now support big rows */
if (reclength > MI_DYN_MAX_ROW_LENGTH)
{
my_errno=HA_ERR_TO_BIG_ROW;
return -1;
}
+#endif
if (!(rec_buff=(byte*) my_alloca(reclength)))
{
my_errno=ENOMEM;
@@ -130,14 +134,14 @@ static int write_dynamic_record(MI_INFO *info, const byte *record,
DBUG_ENTER("write_dynamic_record");
flag=0;
- while (reclength)
+ do
{
if (_mi_find_writepos(info,reclength,&filepos,&length))
goto err;
if (_mi_write_part_record(info,filepos,length,info->s->state.dellink,
(byte**) &record,&reclength,&flag))
goto err;
- }
+ } while (reclength);
DBUG_RETURN(0);
err:
@@ -377,7 +381,7 @@ int _mi_write_part_record(MI_INFO *info,
head_length= 16;
temp[0]=13;
mi_int4store(temp+1,*reclength);
- mi_int3store(temp+4,length-head_length);
+ mi_int3store(temp+5,length-head_length);
mi_sizestore((byte*) temp+8,next_filepos);
}
else
@@ -1441,7 +1445,7 @@ uint _mi_get_block_info(MI_BLOCK_INFO *info, File file, my_off_t filepos)
DBUG_DUMP("header",(byte*) header,MI_BLOCK_INFO_HEADER_LENGTH);
if (info->second_read)
{
- if (info->header[0] <= 6)
+ if (info->header[0] <= 6 || info->header[0] == 13)
return_val=BLOCK_SYNC_ERROR;
}
else
diff --git a/myisam/myisamdef.h b/myisam/myisamdef.h
index 203101a2f48..e9d3461fe9a 100644
--- a/myisam/myisamdef.h
+++ b/myisam/myisamdef.h
@@ -359,7 +359,7 @@ struct st_myisam_info {
#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 13 /* max header byte for dynamic rows */
-#define MI_MAX_BLOCK_LENGTH (((ulong) 1 << 24)-1)
+#define MI_MAX_BLOCK_LENGTH ((((ulong) 1 << 24)-1) & (~ (ulong) (MI_DYN_ALIGN_SIZE-1)))
#define MEMMAP_EXTRA_MARGIN 7 /* Write this as a suffix for file */