summaryrefslogtreecommitdiff
path: root/heap
diff options
context:
space:
mode:
authorunknown <monty@work.mysql.com>2001-09-13 09:52:35 +0200
committerunknown <monty@work.mysql.com>2001-09-13 09:52:35 +0200
commitc96bf55b9c8641d4b1c2ece0c0314071bc1022df (patch)
tree1fb0fbca5b7a4edebe2c26a5ed0b272e92bc21f2 /heap
parent9e4206b990df875e063a07784c77cc39dc394654 (diff)
parentc88dd9b291cf7fe9086102d74d255f4b880d1486 (diff)
downloadmariadb-git-c96bf55b9c8641d4b1c2ece0c0314071bc1022df.tar.gz
Merge with 3.23.42
configure.in: Auto merged BitKeeper/deleted/.del-violite.c~d7b85be615595ace: Auto merged BitKeeper/deleted/.del-violite.c~984c09cffe14a11b: Auto merged client/Makefile.am: Auto merged client/mysql.cc: Auto merged client/mysqlbinlog.cc: Auto merged heap/hp_test2.c: Auto merged include/global.h: Auto merged include/my_pthread.h: Auto merged include/myisam.h: Auto merged libmysql/libmysql.c: Auto merged libmysql/net.c: Auto merged myisam/sort.c: Auto merged sql-bench/test-create.sh: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/lock.cc: Auto merged sql/log_event.cc: Auto merged sql/mini_client.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/net_serv.cc: Auto merged mysql-test/t/merge.test: Auto merged sql/ha_innobase.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_table.cc: Auto merged support-files/mysql.spec.sh: Auto merged mysql-test/t/bdb.test: Auto merged Docs/manual.texi: merge myisam/myisampack.c: merge
Diffstat (limited to 'heap')
-rw-r--r--heap/hp_test2.c55
-rw-r--r--heap/hp_update.c12
-rw-r--r--heap/hp_write.c2
3 files changed, 32 insertions, 37 deletions
diff --git a/heap/hp_test2.c b/heap/hp_test2.c
index 0f7afca5a93..12bd61474da 100644
--- a/heap/hp_test2.c
+++ b/heap/hp_test2.c
@@ -45,13 +45,11 @@ static int calc_check(byte *buf,uint length);
/* Huvudprogrammet */
-int main(argc,argv)
-int argc;
-char *argv[];
+int main(int argc, char *argv[])
{
register uint i,j;
uint ant,n1,n2,n3;
- uint reclength,write_count,update,delete,check2,dupp_keys,found_key;
+ uint reclength,write_count,update,opt_delete,check2,dupp_keys,found_key;
int error;
ulong pos;
unsigned long key_check;
@@ -70,7 +68,7 @@ char *argv[];
get_options(argc,argv);
reclength=37;
- write_count=update=delete=0;
+ write_count=update=opt_delete=0;
key_check=0;
keyinfo[0].seg=keyseg;
@@ -169,7 +167,7 @@ char *argv[];
printf("error: %d; can't delete record: \"%s\"\n", my_errno,record);
goto err;
}
- delete++;
+ opt_delete++;
key1[atoi(record+keyinfo[0].seg[0].start)]--;
key3[atoi(record+keyinfo[2].seg[0].start)]=0;
key_check-=atoi(record);
@@ -198,7 +196,7 @@ char *argv[];
{
if (heap_scan_init(file))
goto err;
- j=rnd(write_count-delete);
+ j=rnd(write_count-opt_delete);
while ((error=heap_scan(file,record) == HA_ERR_RECORD_DELETED) ||
(!error && j))
{
@@ -271,7 +269,7 @@ char *argv[];
key_check-=atoi(record3);
key1[atoi(record+keyinfo[0].seg[0].start)]--;
key3[atoi(record+keyinfo[2].seg[0].start)]=0;
- delete++;
+ opt_delete++;
ant=2;
while ((error=heap_rnext(file,record3)) == 0 ||
error == HA_ERR_RECORD_DELETED)
@@ -291,21 +289,21 @@ char *argv[];
}
if (!silent)
- printf("- Read last key - delete - prev - prev - delete - prev -> first\n");
+ printf("- Read last key - delete - prev - prev - opt_delete - prev -> first\n");
if (heap_rlast(file,record3)) goto err;
if (heap_delete(file,record3)) goto err;
key_check-=atoi(record3);
key1[atoi(record+keyinfo[0].seg[0].start)]--;
key3[atoi(record+keyinfo[2].seg[0].start)]=0;
- delete++;
+ opt_delete++;
if (heap_rprev(file,record3) || heap_rprev(file,record3))
goto err;
if (heap_delete(file,record3)) goto err;
key_check-=atoi(record3);
key1[atoi(record+keyinfo[0].seg[0].start)]--;
key3[atoi(record+keyinfo[2].seg[0].start)]=0;
- delete++;
+ opt_delete++;
ant=3;
while ((error=heap_rprev(file,record3)) == 0 ||
error == HA_ERR_RECORD_DELETED)
@@ -340,7 +338,7 @@ char *argv[];
goto err;
if (heap_delete(file,record3)) goto err;
key_check-=atoi(record3);
- delete++;
+ opt_delete++;
key1[atoi(record+keyinfo[0].seg[0].start)]--;
key3[atoi(record+keyinfo[2].seg[0].start)]=0;
ant=0;
@@ -348,9 +346,9 @@ char *argv[];
error == HA_ERR_RECORD_DELETED)
if (! error)
ant++;
- if (ant != write_count-delete)
+ if (ant != write_count-opt_delete)
{
- printf("next: Found: %d records of %d\n",ant,write_count-delete);
+ printf("next: Found: %d records of %d\n",ant,write_count-opt_delete);
goto end;
}
if (heap_check_heap(file,0))
@@ -361,7 +359,7 @@ char *argv[];
puts("- Test if: Read rrnd - same - rkey - same");
DBUG_PRINT("progpos",("Read rrnd - same"));
- pos=rnd(write_count-delete-5)+5;
+ pos=rnd(write_count-opt_delete-5)+5;
heap_scan_init(file);
i=5;
while ((error=heap_scan(file,record)) == HA_ERR_RECORD_DELETED ||
@@ -399,14 +397,14 @@ char *argv[];
{
HEAPINFO info;
heap_info(file,&info,0);
- /* We have to test with delete +1 as this may be the case if the last
+ /* We have to test with opt_delete +1 as this may be the case if the last
inserted row was a duplicate key */
- if (info.records != write_count-delete ||
- (info.deleted != delete && info.deleted != delete+1))
+ if (info.records != write_count-opt_delete ||
+ (info.deleted != opt_delete && info.deleted != opt_delete+1))
{
puts("Wrong info from heap_info");
printf("Got: records: %ld(%d) deleted: %ld(%d)\n",
- info.records,write_count-delete,info.deleted,delete);
+ info.records,write_count-opt_delete,info.deleted,opt_delete);
}
}
@@ -429,10 +427,10 @@ char *argv[];
check+=calc_check(record,reclength);
}
}
- if (ant != write_count-delete)
+ if (ant != write_count-opt_delete)
{
printf("rrnd: I can only find: %d records of %d\n", ant,
- write_count-delete);
+ write_count-opt_delete);
goto end;
}
if (heap_extra(file,HA_EXTRA_NO_CACHE))
@@ -460,10 +458,10 @@ char *argv[];
check2+=calc_check(record,reclength);
}
}
- if (ant != write_count-delete)
+ if (ant != write_count-opt_delete)
{
printf("scan: I can only find: %d records of %d\n", ant,
- write_count-delete);
+ write_count-opt_delete);
goto end;
}
#ifdef OLD_HEAP_VERSION
@@ -552,7 +550,7 @@ char *argv[];
write_count++;
if (heap_delete(file,record))
goto err;
- delete++;
+ opt_delete++;
}
pos++;
}
@@ -570,7 +568,7 @@ char *argv[];
end:
printf("\nFollowing test have been made:\n");
- printf("Write records: %d\nUpdate records: %d\nDelete records: %d\n", write_count,update,delete);
+ printf("Write records: %d\nUpdate records: %d\nDelete records: %d\n", write_count,update,opt_delete);
heap_clear(file);
if (heap_close(file) || (file2 && heap_close(file2)))
goto err;
@@ -629,8 +627,7 @@ static int get_options(int argc,char *argv[])
/* Generate a random value in intervall 0 <=x <= n */
-static int rnd(max_value)
-int max_value;
+static int rnd(int max_value)
{
return (int) ((rand() & 32767)/32767.0*max_value);
} /* rnd */
@@ -650,9 +647,7 @@ static sig_handler endprog(int sig_number __attribute__((unused)))
}
}
-static int calc_check(buf,length)
-byte *buf;
-uint length;
+static int calc_check(byte *buf, uint length)
{
int check=0;
while (length--)
diff --git a/heap/hp_update.c b/heap/hp_update.c
index 5eb4562ca5c..a1d9c51e9dd 100644
--- a/heap/hp_update.c
+++ b/heap/hp_update.c
@@ -18,7 +18,7 @@
#include "heapdef.h"
-int heap_update(HP_INFO *info, const byte *old, const byte *new)
+int heap_update(HP_INFO *info, const byte *old, const byte *heap_new)
{
uint key;
byte *pos;
@@ -35,16 +35,16 @@ int heap_update(HP_INFO *info, const byte *old, const byte *new)
for (key=0 ; key < share->keys ; key++)
{
- if (_hp_rec_key_cmp(share->keydef+key,old,new))
+ if (_hp_rec_key_cmp(share->keydef+key,old,heap_new))
{
if (_hp_delete_key(info,share->keydef+key,old,pos,key ==
(uint) info->lastinx) ||
- _hp_write_key(share,share->keydef+key,new,pos))
+ _hp_write_key(share,share->keydef+key,heap_new,pos))
goto err;
}
}
- memcpy(pos,new,(size_t) share->reclength);
+ memcpy(pos,heap_new,(size_t) share->reclength);
if (++(share->records) == share->blength) share->blength+= share->blength;
DBUG_RETURN(0);
@@ -54,9 +54,9 @@ int heap_update(HP_INFO *info, const byte *old, const byte *new)
info->errkey=key;
do
{
- if (_hp_rec_key_cmp(share->keydef+key,old,new))
+ if (_hp_rec_key_cmp(share->keydef+key,old,heap_new))
{
- if (_hp_delete_key(info,share->keydef+key,new,pos,0) ||
+ if (_hp_delete_key(info,share->keydef+key,heap_new,pos,0) ||
_hp_write_key(share,share->keydef+key,old,pos))
break;
}
diff --git a/heap/hp_write.c b/heap/hp_write.c
index e74183276f7..12b5c638f78 100644
--- a/heap/hp_write.c
+++ b/heap/hp_write.c
@@ -38,7 +38,7 @@ int heap_write(HP_INFO *info, const byte *record)
DBUG_ENTER("heap_write");
#ifndef DBUG_OFF
- if (info->mode && O_RDONLY)
+ if (info->mode & O_RDONLY)
{
DBUG_RETURN(my_errno=EACCES);
}