Commit b0149426 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

#2875 refs[t:2875] check ascending keys, check expected primary key, check...

#2875 refs[t:2875] check ascending keys, check expected primary key, check expected number of rows in the loader-stress-test

git-svn-id: file:///svn/toku/tokudb@22986 c7de825b-a66e-492c-adef-691d508d4ae1
parent 6254a06a
...@@ -215,10 +215,13 @@ static int put_multiple_generate(DB *dest_db, DB *src_db, DBT *dest_key, DBT *de ...@@ -215,10 +215,13 @@ static int put_multiple_generate(DB *dest_db, DB *src_db, DBT *dest_key, DBT *de
static void check_results(DB **dbs) static void check_results(DB **dbs)
{ {
for(int j=0;j<NUM_DBS;j++){ for(int j=0;j<NUM_DBS;j++){
unsigned int prev_k = 0, prev_v = 0;
DBT key, val; DBT key, val;
unsigned int k=0, v=0; unsigned int k=0, v=0;
dbt_init(&key, &k, sizeof(unsigned int)); dbt_init(&key, &k, sizeof(unsigned int));
dbt_init(&val, &v, sizeof(unsigned int)); dbt_init(&val, &v, sizeof(unsigned int));
int r; int r;
unsigned int pkey_for_db_key; unsigned int pkey_for_db_key;
...@@ -229,8 +232,12 @@ static void check_results(DB **dbs) ...@@ -229,8 +232,12 @@ static void check_results(DB **dbs)
DBC *cursor; DBC *cursor;
r = dbs[j]->cursor(dbs[j], txn, &cursor, 0); r = dbs[j]->cursor(dbs[j], txn, &cursor, 0);
CKERR(r); CKERR(r);
for(int i=0;i<NUM_ROWS;i++) { for(int i = 0; i < NUM_ROWS+1; i++) {
r = cursor->c_get(cursor, &key, &val, DB_NEXT); r = cursor->c_get(cursor, &key, &val, DB_NEXT);
if (r == DB_NOTFOUND) {
assert(i == NUM_ROWS); // check that there are exactly NUM_ROWS in the dictionary
break;
}
CKERR(r); CKERR(r);
k = *(unsigned int*)key.data; k = *(unsigned int*)key.data;
pkey_for_db_key = (j == 0) ? k : inv_twiddle32(k, j); pkey_for_db_key = (j == 0) ? k : inv_twiddle32(k, j);
...@@ -238,6 +245,17 @@ static void check_results(DB **dbs) ...@@ -238,6 +245,17 @@ static void check_results(DB **dbs)
// test that we have the expected keys and values // test that we have the expected keys and values
assert((unsigned int)pkey_for_db_key == (unsigned int)pkey_for_val(v, j)); assert((unsigned int)pkey_for_db_key == (unsigned int)pkey_for_val(v, j));
// printf(" DB[%d] key = %10u, val = %10u, pkey_for_db_key = %10u, pkey_for_val=%10d\n", j, v, k, pkey_for_db_key, pkey_for_val(v, j)); // printf(" DB[%d] key = %10u, val = %10u, pkey_for_db_key = %10u, pkey_for_val=%10d\n", j, v, k, pkey_for_db_key, pkey_for_val(v, j));
// check the primary key == i+1
if (j == 0)
assert(k == (unsigned int)(i+1));
// check prev_key < key
if (i > 0)
assert(prev_k < k);
// update prev = current
prev_k = k; prev_v = v;
} }
if ( verbose ) {printf("."); fflush(stdout);} if ( verbose ) {printf("."); fflush(stdout);}
r = cursor->c_close(cursor); r = cursor->c_close(cursor);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment