diff options
Diffstat (limited to 'storage/myisam/rt_test.c')
-rw-r--r-- | storage/myisam/rt_test.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/storage/myisam/rt_test.c b/storage/myisam/rt_test.c index 7d15afd12ef..6c73c9db13c 100644 --- a/storage/myisam/rt_test.c +++ b/storage/myisam/rt_test.c @@ -105,14 +105,20 @@ static int run_test(const char *filename) int nrecords=sizeof(rt_data)/(sizeof(double)*4);/* 3000;*/ int rec_length=0; int uniques=0; - int i; + int i, max_i; int error; int row_count=0; uchar record[MAX_REC_LENGTH]; uchar read_record[MAX_REC_LENGTH]; int upd= 10; ha_rows hrows; - + + bzero(&uniquedef, sizeof(uniquedef)); + bzero(&create_info, sizeof(create_info)); + bzero(recinfo, sizeof(recinfo)); + bzero(keyinfo, sizeof(keyinfo)); + bzero(keyseg, sizeof(keyseg)); + /* Define a column for NULLs and DEL markers*/ recinfo[0].type=FIELD_NORMAL; @@ -147,7 +153,6 @@ static int run_test(const char *filename) if (!silent) printf("- Creating isam-file\n"); - bzero((char*) &create_info,sizeof(create_info)); create_info.max_rows=10000000; if (mi_create(filename, @@ -194,7 +199,7 @@ static int run_test(const char *filename) create_record(record,i); bzero((char*) read_record,MAX_REC_LENGTH); - error=mi_rkey(file,read_record,0,record+1,0,HA_READ_MBR_EQUAL); + error=mi_rkey(file,read_record,0,record+1,HA_WHOLE_KEY,HA_READ_MBR_EQUAL); if (error && error!=HA_ERR_KEY_NOT_FOUND) { @@ -233,7 +238,8 @@ static int run_test(const char *filename) if (!silent) printf("- Updating rows with position\n"); - for (i=0; i < (nrecords - nrecords/4) ; i++) + /* We are looking for nrecords-necords/2 non-deleted records */ + for (i=0, max_i= nrecords - nrecords/2; i < max_i ; i++) { my_errno=0; bzero((char*) read_record,MAX_REC_LENGTH); @@ -241,7 +247,11 @@ static int run_test(const char *filename) if (error) { if (error==HA_ERR_RECORD_DELETED) + { + printf("found deleted record\n"); + max_i++; /* don't count such record */ continue; + } printf("pos: %2d mi_rrnd: %3d errno: %3d\n",i,error,my_errno); goto err; } @@ -266,7 +276,8 @@ static int run_test(const char *filename) create_record(record, nrecords*4/5); print_record(record,0," search for\n"); - if ((error=mi_rkey(file,read_record,0,record+1,0,HA_READ_MBR_INTERSECT))) + if ((error=mi_rkey(file,read_record,0,record+1,HA_WHOLE_KEY, + HA_READ_MBR_INTERSECT))) { printf("mi_rkey: %3d errno: %3d\n",error,my_errno); goto err; |