Commit 7dc6680b authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

refs #5666 fix filesize.tdb


git-svn-id: file:///svn/toku/tokudb@49988 c7de825b-a66e-492c-adef-691d508d4ae1
parent a3221f86
......@@ -581,7 +581,7 @@ if(BUILD_TESTING OR BUILD_SRC_TESTS)
add_test(ydb/keyrange-random-get1.tdb keyrange.tdb --get 1 --random_keys 1 --envdir dir.keyrange-random-get1.tdb)
else ()
message(WARNING "TODO(leif): re-enable keyrange tests, see #5666")
declare_custom_tests(filesize.tdb keyrange-merge.tdb)
declare_custom_tests(keyrange-merge.tdb)
list(REMOVE_ITEM abortrecover_tests recover-flt1.abortrecover)
endif ()
add_test(ydb/keyrange-loader-get0.tdb keyrange.tdb --get 0 --loader 1 --envdir dir.keyrange-loader-get0.tdb)
......
......@@ -156,7 +156,7 @@ getsizeM(void) {
}
static void
test_filesize (void)
test_filesize (bool sequential)
{
int N=1<<14;
int r, i, sizeM;
......@@ -166,9 +166,15 @@ test_filesize (void)
for (int iter = 0; iter < 3; iter++) {
int offset = N * iter;
if (sequential) {
for (i=0; i<N; i++) {
insert_n(i + offset, INSERT_BIG);
}
} else {
for (i=N-1; i>=0; --i) {
insert_n(i + offset, INSERT_BIG);
}
}
r = env->txn_checkpoint(env, 0, 0, 0);
CKERR(r);
......@@ -186,9 +192,15 @@ test_filesize (void)
sizeM = getsizeM();
if (verbose) printf("Filesize after iteration %d deletion and checkpoint 1 = %dM\n", iter, sizeM);
if (sequential) {
for (i=0; i<N; i++) {
insert_n(i + offset, INSERT_SMALL);
}
} else {
for (i=N-1; i>=0; --i) {
insert_n(i + offset, INSERT_SMALL);
}
}
for (i = preserve; i<(N); i++) { // leave a little at the beginning
delete_n(i + offset);
}
......@@ -197,7 +209,7 @@ test_filesize (void)
CKERR(r);
sizeM = getsizeM();
if (verbose) printf("Filesize after iteration %d deletion and checkpoint 2 = %dM\n", iter, sizeM);
assert(sizeM < sizefirst);
assert(sizeM <= sizefirst);
if (verbose) printf("ninsert = %d\n", ninsert);
if (verbose) printf("nread = %d, nread_notfound = %d, nread_failed = %d\n", nread, nread_notfound, nread_failed);
......@@ -209,7 +221,16 @@ int test_main (int argc __attribute__((__unused__)), char * const argv[] __attri
parse_args(argc, argv);
setup();
if (verbose) print_engine_status(env);
test_filesize();
test_filesize(true);
if (verbose) {
print_engine_status(env);
}
check_fragmentation();
if (verbose) print_fragmentation();
close_em();
setup();
if (verbose) print_engine_status(env);
test_filesize(false);
if (verbose) {
print_engine_status(env);
}
......
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