[t:4875], memset header to 0 when creating it, get rid of calls to toku_read_brt_header_and_store_in_cachefile in brt-test-helpers

git-svn-id: file:///svn/toku/tokudb@43428 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
Zardosht Kasheff 2013-04-17 00:00:28 -04:00 committed by Yoni Fogel
parent f3a3fe1e44
commit 445f9283d5
2 changed files with 1 additions and 6 deletions

View file

@ -35,8 +35,6 @@ BOOL ignore_if_was_already_open;
int toku_testsetup_leaf(BRT brt, BLOCKNUM *blocknum, int n_children, char **keys, int *keylens) {
BRTNODE node;
assert(testsetup_initialized);
int r = toku_read_brt_header_and_store_in_cachefile(brt, brt->h->cf, MAX_LSN, &brt->h, &ignore_if_was_already_open);
if (r!=0) return r;
toku_create_new_brtnode(brt, &node, 0, n_children);
int i;
for (i=0; i<n_children; i++) {
@ -58,8 +56,6 @@ int toku_testsetup_nonleaf (BRT brt, int height, BLOCKNUM *blocknum, int n_child
BRTNODE node;
assert(testsetup_initialized);
assert(n_children<=BRT_FANOUT);
int r = toku_read_brt_header_and_store_in_cachefile(brt, brt->h->cf, MAX_LSN, &brt->h, &ignore_if_was_already_open);
if (r!=0) return r;
toku_create_new_brtnode(brt, &node, height, n_children);
int i;
for (i=0; i<n_children; i++) {
@ -77,8 +73,6 @@ int toku_testsetup_nonleaf (BRT brt, int height, BLOCKNUM *blocknum, int n_child
int toku_testsetup_root(BRT brt, BLOCKNUM blocknum) {
assert(testsetup_initialized);
int r = toku_read_brt_header_and_store_in_cachefile(brt, brt->h->cf, MAX_LSN, &brt->h, &ignore_if_was_already_open);
if (r!=0) return r;
brt->h->root_blocknum = blocknum;
return 0;
}

View file

@ -408,6 +408,7 @@ toku_create_new_brtheader(BRT t, CACHEFILE cf, TOKUTXN txn) {
r = ENOMEM;
goto exit;
}
memset(t->h, 0, sizeof(struct brt_header));
t->h->layout_version = BRT_LAYOUT_VERSION;
t->h->layout_version_original = BRT_LAYOUT_VERSION;