Commit 44062af0 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

#3623 change the stat64 test to not expect exact stats. messages may be...

#3623 change the stat64 test to not expect exact stats.  messages may be buffered in the tree and not yet pushed to the leaf refs[t:3623]

git-svn-id: file:///svn/toku/tokudb@32756 c7de825b-a66e-492c-adef-691d508d4ae1
parent 2f1acd49
......@@ -56,24 +56,61 @@ test_stat64 (unsigned int N) {
}
r=txn->commit(txn, 0); CKERR(r);
// get and verify stats, should be treated as estimates
r=env->txn_begin(env, 0, &txn, 0); CKERR(r);
DB_BTREE_STAT64 s;
r=db->stat64(db, txn, &s); CKERR(r);
if (verbose) {
r = system("ls -l " ENVDIR);
{
DB_BTREE_STAT64 s;
r=db->stat64(db, txn, &s); CKERR(r);
if (verbose) {
r = system("ls -l " ENVDIR);
CKERR(r);
printf("nkeys=%" PRIu64 "\nndata=%" PRIu64 "\ndsize=%" PRIu64 "\n",
s.bt_nkeys, s.bt_ndata, s.bt_dsize);
printf("fsize=%" PRIu64 "\n", s.bt_fsize);
printf("expected dsize=%" PRIu64 "\n", dsize);
}
assert(s.bt_nkeys <= N);
assert(s.bt_ndata <= N);
assert(s.bt_dsize <= dsize);
assert(s.bt_fsize > N);
}
r=txn->commit(txn, 0); CKERR(r);
// get the last row, this forces the root estimates to be updated
{
r = env->txn_begin(env, NULL, &txn, 0); CKERR(r);
DBC *c = NULL;
r = db->cursor(db, txn, &c, 0); CKERR(r);
DBT key = {.size = 0};
DBT val = {.size = 0};
r = c->c_get(c, &key, &val, DB_LAST);
CKERR(r);
printf("nkeys=%" PRIu64 "\nndata=%" PRIu64 "\ndsize=%" PRIu64 "\n",
s.bt_nkeys, s.bt_ndata, s.bt_dsize);
printf("fsize=%" PRIu64 "\n", s.bt_fsize);
printf("expected dsize=%" PRIu64 "\n", dsize);
r = c->c_close(c); CKERR(r);
r = txn->commit(txn, 0); CKERR(r);
}
// get and verify stats
r=env->txn_begin(env, 0, &txn, 0); CKERR(r);
{
DB_BTREE_STAT64 s;
r=db->stat64(db, txn, &s); CKERR(r);
if (verbose) {
r = system("ls -l " ENVDIR);
CKERR(r);
printf("nkeys=%" PRIu64 "\nndata=%" PRIu64 "\ndsize=%" PRIu64 "\n",
s.bt_nkeys, s.bt_ndata, s.bt_dsize);
printf("fsize=%" PRIu64 "\n", s.bt_fsize);
printf("expected dsize=%" PRIu64 "\n", dsize);
}
assert(s.bt_nkeys == N);
assert(s.bt_ndata == N);
assert(s.bt_dsize == dsize);
assert(s.bt_fsize > N);
}
assert(s.bt_nkeys==N);
assert(s.bt_ndata==N);
assert(s.bt_dsize==dsize);
assert(s.bt_fsize>N);
r=txn->commit(txn, 0); CKERR(r);
r=db->close(db, 0); CKERR(r);
r=env->close(env, 0); CKERR(r);
}
......
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