Commit 8c36a8f9 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:4875], memset header to 0 when creating it, get rid of calls to...

[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
parent 69373adc
...@@ -35,8 +35,6 @@ BOOL ignore_if_was_already_open; ...@@ -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) { int toku_testsetup_leaf(BRT brt, BLOCKNUM *blocknum, int n_children, char **keys, int *keylens) {
BRTNODE node; BRTNODE node;
assert(testsetup_initialized); 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); toku_create_new_brtnode(brt, &node, 0, n_children);
int i; int i;
for (i=0; i<n_children; 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 ...@@ -58,8 +56,6 @@ int toku_testsetup_nonleaf (BRT brt, int height, BLOCKNUM *blocknum, int n_child
BRTNODE node; BRTNODE node;
assert(testsetup_initialized); assert(testsetup_initialized);
assert(n_children<=BRT_FANOUT); 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); toku_create_new_brtnode(brt, &node, height, n_children);
int i; int i;
for (i=0; i<n_children; 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 ...@@ -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) { int toku_testsetup_root(BRT brt, BLOCKNUM blocknum) {
assert(testsetup_initialized); 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; brt->h->root_blocknum = blocknum;
return 0; return 0;
} }
......
...@@ -408,6 +408,7 @@ toku_create_new_brtheader(BRT t, CACHEFILE cf, TOKUTXN txn) { ...@@ -408,6 +408,7 @@ toku_create_new_brtheader(BRT t, CACHEFILE cf, TOKUTXN txn) {
r = ENOMEM; r = ENOMEM;
goto exit; goto exit;
} }
memset(t->h, 0, sizeof(struct brt_header));
t->h->layout_version = BRT_LAYOUT_VERSION; t->h->layout_version = BRT_LAYOUT_VERSION;
t->h->layout_version_original = BRT_LAYOUT_VERSION; t->h->layout_version_original = BRT_LAYOUT_VERSION;
......
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