Commit 227f2948 authored by Barry Perlman's avatar Barry Perlman Committed by Yoni Fogel

[t:3560] Use new db->hot_optimize() to flatten tree. Previously used scan

to flatten tree, but scanning a tree no longer flattens it with orthodox pushing.  Refs #3560.

git-svn-id: file:///svn/toku/tokudb@38627 c7de825b-a66e-492c-adef-691d508d4ae1
parent 7daff2b5
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
* checkpoint * checkpoint
* note file size * note file size
* lots of deletes * lots of deletes
* optimize (flatten tree)
* checkpoint * checkpoint
* note file size * note file size
* *
...@@ -112,42 +113,14 @@ delete_n (u_int32_t ah) ...@@ -112,42 +113,14 @@ delete_n (u_int32_t ah)
} }
static void static void
scan(int n) { optimize(void) {
DBT k,v; if (verbose) printf("Filesize: begin optimize dictionary\n");
DBC *dbc; int r = db->hot_optimize(db, NULL, NULL);
int i,r;
r = db->cursor(db, 0, &dbc, 0);
CKERR(r); CKERR(r);
memset(&k, 0, sizeof(k)); if (verbose) printf("Filesize: end optimize dictionary\n");
memset(&v, 0, sizeof(v));
r = dbc->c_get(dbc, &k, &v, DB_FIRST);
if (r==0) {
nread++;
// if (verbose) printf("First read, r = %0X, key = %0X (size=%d)\n", r, *(uint32_t*)k.data, k.size);
}
else if (r == DB_NOTFOUND) {
nread_notfound++;
// if (verbose) printf("First read failed: %d\n", r);
}
else
nread_failed++;
for (i = 1; i<n; i++) {
r = dbc->c_get(dbc, &k, &v, DB_NEXT);
if (r == 0) {
nread++;
// if (verbose) printf("read key = %0X (size=%d)\n", *(uint32_t*)k.data, k.size);
}
else if (r == DB_NOTFOUND)
nread_notfound++;
else
nread_failed++;
}
r = dbc->c_close(dbc);
CKERR(r);
} }
static void static void
get_file_pathname(void) { get_file_pathname(void) {
DBT dname; DBT dname;
...@@ -199,9 +172,7 @@ test_filesize (void) ...@@ -199,9 +172,7 @@ test_filesize (void)
for (i = preserve; i<(N); i++) { // leave a little at the beginning for (i = preserve; i<(N); i++) { // leave a little at the beginning
delete_n(i + offset); delete_n(i + offset);
} }
if (verbose) printf("Filesize: Doing scan\n"); optimize();
scan(N);
if (verbose) printf("Filesize: Did scan\n");
r = env->txn_checkpoint(env, 0, 0, 0); r = env->txn_checkpoint(env, 0, 0, 0);
CKERR(r); CKERR(r);
...@@ -214,7 +185,7 @@ test_filesize (void) ...@@ -214,7 +185,7 @@ test_filesize (void)
for (i = preserve; i<(N); i++) { // leave a little at the beginning for (i = preserve; i<(N); i++) { // leave a little at the beginning
delete_n(i + offset); delete_n(i + offset);
} }
scan(N); optimize();
r = env->txn_checkpoint(env, 0, 0, 0); r = env->txn_checkpoint(env, 0, 0, 0);
CKERR(r); CKERR(r);
sizeM = getsizeM(); sizeM = getsizeM();
......
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