Commit 4b541223 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:4375], merge to main

git-svn-id: file:///svn/toku/tokudb@38666 c7de825b-a66e-492c-adef-691d508d4ae1
parent 599b880c
#ident "$Id$"
#ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
static int brt_root_put_cmd_XY (BRT brt, BRT_MSG *md, TOKUTXN txn) {
int r;
if ((r = toku_read_and_pin_brt_header(brt->cf, &brt->h))) {
if (0) { died0: toku_unpin_brt_header(brt); }
return r;
}
CACHEKEY *rootp = toku_calculate_root_offset_pointer(brt->h);
if ((r=cachetable_get_and_pin(brt->cf, *rootp, &node_v, NULL,
toku_brtnode_flush_callback, toku_brtnode_fetch_callback, (void*)(long)brt->h->nodesize))) {
goto died0;
}
node=node_v;
if (0) {
died1:
cachetable_unpin(brt->cf, node->thisnodename, node->dirty, brtnodesize(node));
goto died0;
}
node->parent_brtnode = 0;
result = brtnode_put_cmd_XY(brt, node, cmd, txn);
// It's still pinned, and it may be too big or the fanout may be too large.
if (node->height>0 && node->u.n.n_children==TREE_FANOUT) {
// Must split it.
r = do_split_node(node, &nodea, &nodeb, &splitk); // On error: node is unmodified
if (r!=0) goto died1;
// node is garbage, and nodea and nodeb are pinned
r = brt_init_new_root(brt, nodea, nodeb, splitk, rootp); // On error: root is unmodified and nodea and nodeb are both unpinned
if (r!=0) goto died0;
// nodea and nodeb are unpinned, and the root has been fixed
// up to point at a new node (*rootp) containing two children
// (nodea and nodeb). nodea and nodeb are unpinned. *rootp is still pinned
node = *rootp;
}
// Now the fanout is small enough.
// But the node could still be too large.
if (toku_serialize_brtnode_size(node)>node->nodesize) {
}
}
...@@ -352,20 +352,19 @@ ct_maybe_merge_child(struct flusher_advice *fa, ...@@ -352,20 +352,19 @@ ct_maybe_merge_child(struct flusher_advice *fa,
toku_unpin_brtnode_off_client_thread(h, parent); toku_unpin_brtnode_off_client_thread(h, parent);
toku_unpin_brtnode_off_client_thread(h, child); toku_unpin_brtnode_off_client_thread(h, child);
// grab ydb lock, if it exists, if we are running a brt BRTNODE root_node = NULL;
// layer test, there may be no ydb lock and that is ok {
toku_cachetable_call_ydb_lock(h->cf); toku_brtheader_grab_treelock(h);
CACHEKEY *rootp;
u_int32_t fullhash; u_int32_t fullhash;
rootp = toku_calculate_root_offset_pointer(h, &fullhash); CACHEKEY *rootp = toku_calculate_root_offset_pointer(h, &fullhash);
struct brtnode_fetch_extra bfe; struct brtnode_fetch_extra bfe;
fill_bfe_for_full_read(&bfe, h); fill_bfe_for_full_read(&bfe, h);
BRTNODE root_node;
toku_pin_brtnode_off_client_thread(h, *rootp, fullhash, &bfe, 0,NULL, &root_node); toku_pin_brtnode_off_client_thread(h, *rootp, fullhash, &bfe, 0,NULL, &root_node);
toku_assert_entire_node_in_memory(root_node); toku_assert_entire_node_in_memory(root_node);
// release ydb lock, if it exists, if we are running a brt
// layer test, there may be no ydb lock and that is ok toku_brtheader_release_treelock(h);
toku_cachetable_call_ydb_unlock(h->cf); }
(void) __sync_fetch_and_add(&brt_flusher_status.cleaner_num_leaf_merges_started, 1); (void) __sync_fetch_and_add(&brt_flusher_status.cleaner_num_leaf_merges_started, 1);
(void) __sync_fetch_and_add(&brt_flusher_status.cleaner_num_leaf_merges_running, 1); (void) __sync_fetch_and_add(&brt_flusher_status.cleaner_num_leaf_merges_running, 1);
......
...@@ -44,7 +44,7 @@ typedef struct brt_flusher_status { ...@@ -44,7 +44,7 @@ typedef struct brt_flusher_status {
uint64_t balance_leaf; // number of times a leaf node is balanced inside brt uint64_t balance_leaf; // number of times a leaf node is balanced inside brt
} BRT_FLUSHER_STATUS_S, *BRT_FLUSHER_STATUS; } BRT_FLUSHER_STATUS_S, *BRT_FLUSHER_STATUS;
void toku_brt_flusher_status_init(void); void toku_brt_flusher_status_init(void) __attribute__((__constructor__));
void toku_brt_flusher_get_status(BRT_FLUSHER_STATUS); void toku_brt_flusher_get_status(BRT_FLUSHER_STATUS);
/** /**
...@@ -139,6 +139,7 @@ typedef struct brt_hot_status { ...@@ -139,6 +139,7 @@ typedef struct brt_hot_status {
uint64_t max_root_flush_count; // max number of flushes from root ever required to optimize a tree uint64_t max_root_flush_count; // max number of flushes from root ever required to optimize a tree
} BRT_HOT_STATUS_S, *BRT_HOT_STATUS; } BRT_HOT_STATUS_S, *BRT_HOT_STATUS;
void toku_brt_hot_status_init(void) __attribute__((__constructor__));
void toku_brt_hot_get_status(BRT_HOT_STATUS); void toku_brt_hot_get_status(BRT_HOT_STATUS);
/** /**
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <brt-flusher-internal.h> #include <brt-flusher-internal.h>
#include <brt-cachetable-wrappers.h> #include <brt-cachetable-wrappers.h>
#include <brt-internal.h> #include <brt-internal.h>
#include <valgrind/drd.h>
// Member Descirption: // Member Descirption:
// 1. highest_pivot_key - this is the key that corresponds to the // 1. highest_pivot_key - this is the key that corresponds to the
...@@ -29,6 +30,12 @@ struct hot_flusher_extra { ...@@ -29,6 +30,12 @@ struct hot_flusher_extra {
static BRT_HOT_STATUS_S hot_status; static BRT_HOT_STATUS_S hot_status;
void
toku_brt_hot_status_init(void)
{
DRD_IGNORE_VAR(hot_status.max_root_flush_count);
}
void void
toku_brt_hot_get_status(BRT_HOT_STATUS s) { toku_brt_hot_get_status(BRT_HOT_STATUS s) {
*s = hot_status; *s = hot_status;
...@@ -224,15 +231,22 @@ toku_brt_hot_optimize(BRT brt, ...@@ -224,15 +231,22 @@ toku_brt_hot_optimize(BRT brt,
// start of HOT operation // start of HOT operation
(void) __sync_fetch_and_add(&hot_status.num_started, 1); (void) __sync_fetch_and_add(&hot_status.num_started, 1);
// Higher level logic prevents a dictionary from being deleted or truncated {
// during a hot optimize operation. Doing so would violate the hot optimize contract. toku_cachetable_call_ydb_lock(brt->h->cf);
toku_brt_header_note_hot_begin(brt);
toku_cachetable_call_ydb_unlock(brt->h->cf);
}
// Higher level logic prevents a dictionary from being deleted or
// truncated during a hot optimize operation. Doing so would violate
// the hot optimize contract.
do { do {
BRTNODE root; BRTNODE root;
CACHEKEY *rootp; CACHEKEY *rootp;
u_int32_t fullhash; u_int32_t fullhash;
// Grab YDB Lock. {
toku_cachetable_call_ydb_lock(brt->h->cf); toku_brtheader_grab_treelock(brt->h);
// Get root node (the first parent of each successive HOT // Get root node (the first parent of each successive HOT
// call.) // call.)
...@@ -246,27 +260,23 @@ toku_brt_hot_optimize(BRT brt, ...@@ -246,27 +260,23 @@ toku_brt_hot_optimize(BRT brt,
0, 0,
NULL, NULL,
&root); &root);
toku_assert_entire_node_in_memory(root); toku_assert_entire_node_in_memory(root);
toku_brtheader_release_treelock(brt->h);
}
// Prepare HOT diagnostics. // Prepare HOT diagnostics.
if (loop_count == 0) { if (loop_count == 0) {
// The first time through, capture msn from root and set // The first time through, capture msn from root
// info in header while holding ydb lock.
msn_at_start_of_hot = root->max_msn_applied_to_node_on_disk; msn_at_start_of_hot = root->max_msn_applied_to_node_on_disk;
toku_brt_header_note_hot_begin(brt);
} }
loop_count++; loop_count++;
if (loop_count > hot_status.max_root_flush_count) { if (loop_count > hot_status.max_root_flush_count) {
// This is threadsafe, since we're holding the ydb lock.
hot_status.max_root_flush_count = loop_count; hot_status.max_root_flush_count = loop_count;
} }
// Release YDB Lock.
toku_cachetable_call_ydb_unlock(brt->h->cf);
// Initialize the maximum current key. We need to do this for // Initialize the maximum current key. We need to do this for
// every traversal. // every traversal.
if (flusher.max_current_key.data) { if (flusher.max_current_key.data) {
...@@ -319,14 +329,19 @@ toku_brt_hot_optimize(BRT brt, ...@@ -319,14 +329,19 @@ toku_brt_hot_optimize(BRT brt,
// More diagnostics. // More diagnostics.
{ {
BOOL success = false; BOOL success = false;
if (r == 0) success = true; if (r == 0) { success = true; }
{
toku_cachetable_call_ydb_lock(brt->h->cf); toku_cachetable_call_ydb_lock(brt->h->cf);
toku_brt_header_note_hot_complete(brt, success, msn_at_start_of_hot); toku_brt_header_note_hot_complete(brt, success, msn_at_start_of_hot);
toku_cachetable_call_ydb_unlock(brt->h->cf); toku_cachetable_call_ydb_unlock(brt->h->cf);
if (success) }
if (success) {
(void) __sync_fetch_and_add(&hot_status.num_completed, 1); (void) __sync_fetch_and_add(&hot_status.num_completed, 1);
else } else {
(void) __sync_fetch_and_add(&hot_status.num_aborted, 1); (void) __sync_fetch_and_add(&hot_status.num_aborted, 1);
} }
}
return r; return r;
} }
...@@ -350,6 +350,11 @@ struct brt_header { ...@@ -350,6 +350,11 @@ struct brt_header {
enum brtheader_type type; enum brtheader_type type;
struct brt_header * checkpoint_header; struct brt_header * checkpoint_header;
CACHEFILE cf; CACHEFILE cf;
// lock used by a thread to pin the root node to start a descent into
// the tree. This lock protects the blocknum of the root node. Any
// thread that wants to descend down the tree starting at the root
// must grab this lock before pinning the root.
toku_pthread_mutex_t tree_lock;
u_int64_t checkpoint_count; // Free-running counter incremented once per checkpoint (toggling LSB). u_int64_t checkpoint_count; // Free-running counter incremented once per checkpoint (toggling LSB).
// LSB indicates which header location is used on disk so this // LSB indicates which header location is used on disk so this
// counter is effectively a boolean which alternates with each checkpoint. // counter is effectively a boolean which alternates with each checkpoint.
...@@ -372,7 +377,7 @@ struct brt_header { ...@@ -372,7 +377,7 @@ struct brt_header {
int64_t num_blocks_to_upgrade_14; // Number of v14 blocks still not newest version. int64_t num_blocks_to_upgrade_14; // Number of v14 blocks still not newest version.
unsigned int nodesize; unsigned int nodesize;
unsigned int basementnodesize; unsigned int basementnodesize;
BLOCKNUM root; // roots of the dictionary BLOCKNUM root_blocknum; // roots of the dictionary
unsigned int flags; unsigned int flags;
DESCRIPTOR_S descriptor; DESCRIPTOR_S descriptor;
...@@ -773,6 +778,10 @@ toku_verify_brtnode (BRT brt, ...@@ -773,6 +778,10 @@ toku_verify_brtnode (BRT brt,
int recurse, int verbose, int keep_going_on_failure) int recurse, int verbose, int keep_going_on_failure)
__attribute__ ((warn_unused_result)); __attribute__ ((warn_unused_result));
void toku_brtheader_init_treelock(struct brt_header* h);
void toku_brtheader_destroy_treelock(struct brt_header* h);
void toku_brtheader_grab_treelock(struct brt_header* h);
void toku_brtheader_release_treelock(struct brt_header* h);
void toku_brtheader_free (struct brt_header *h); void toku_brtheader_free (struct brt_header *h);
int toku_brtheader_close (CACHEFILE cachefile, int fd, void *header_v, char **error_string, BOOL oplsn_valid, LSN oplsn) __attribute__((__warn_unused_result__)); int toku_brtheader_close (CACHEFILE cachefile, int fd, void *header_v, char **error_string, BOOL oplsn_valid, LSN oplsn) __attribute__((__warn_unused_result__));
int toku_brtheader_begin_checkpoint (LSN checkpoint_lsn, void *header_v) __attribute__((__warn_unused_result__)); int toku_brtheader_begin_checkpoint (LSN checkpoint_lsn, void *header_v) __attribute__((__warn_unused_result__));
......
...@@ -1883,7 +1883,7 @@ int toku_serialize_brt_header_to_wbuf (struct wbuf *wbuf, struct brt_header *h, ...@@ -1883,7 +1883,7 @@ int toku_serialize_brt_header_to_wbuf (struct wbuf *wbuf, struct brt_header *h,
//printf("%s:%d bta=%lu size=%lu\n", __FILE__, __LINE__, h->block_translation_address_on_disk, 4 + 16*h->translated_blocknum_limit); //printf("%s:%d bta=%lu size=%lu\n", __FILE__, __LINE__, h->block_translation_address_on_disk, 4 + 16*h->translated_blocknum_limit);
wbuf_DISKOFF(wbuf, translation_location_on_disk); wbuf_DISKOFF(wbuf, translation_location_on_disk);
wbuf_DISKOFF(wbuf, translation_size_on_disk); wbuf_DISKOFF(wbuf, translation_size_on_disk);
wbuf_BLOCKNUM(wbuf, h->root); wbuf_BLOCKNUM(wbuf, h->root_blocknum);
wbuf_int(wbuf, h->flags); wbuf_int(wbuf, h->flags);
wbuf_int(wbuf, h->layout_version_original); wbuf_int(wbuf, h->layout_version_original);
wbuf_int(wbuf, h->build_id_original); wbuf_int(wbuf, h->build_id_original);
...@@ -2132,6 +2132,8 @@ deserialize_brtheader (int fd, struct rbuf *rb, struct brt_header **brth) { ...@@ -2132,6 +2132,8 @@ deserialize_brtheader (int fd, struct rbuf *rb, struct brt_header **brth) {
lazy_assert(translation_address_on_disk>0); lazy_assert(translation_address_on_disk>0);
lazy_assert(translation_size_on_disk>0); lazy_assert(translation_size_on_disk>0);
// initialize the tree lock
toku_brtheader_init_treelock(h);
// printf("%s:%d translated_blocknum_limit=%ld, block_translation_address_on_disk=%ld\n", __FILE__, __LINE__, h->translated_blocknum_limit, h->block_translation_address_on_disk); // printf("%s:%d translated_blocknum_limit=%ld, block_translation_address_on_disk=%ld\n", __FILE__, __LINE__, h->translated_blocknum_limit, h->block_translation_address_on_disk);
//Load translation table //Load translation table
{ {
...@@ -2151,7 +2153,7 @@ deserialize_brtheader (int fd, struct rbuf *rb, struct brt_header **brth) { ...@@ -2151,7 +2153,7 @@ deserialize_brtheader (int fd, struct rbuf *rb, struct brt_header **brth) {
toku_free(tbuf); toku_free(tbuf);
} }
h->root = rbuf_blocknum(&rc); h->root_blocknum = rbuf_blocknum(&rc);
h->flags = rbuf_int(&rc); h->flags = rbuf_int(&rc);
h->layout_version_original = rbuf_int(&rc); h->layout_version_original = rbuf_int(&rc);
h->build_id_original = rbuf_int(&rc); h->build_id_original = rbuf_int(&rc);
......
...@@ -79,7 +79,7 @@ int toku_testsetup_root(BRT brt, BLOCKNUM blocknum) { ...@@ -79,7 +79,7 @@ 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->cf, MAX_LSN, &brt->h, &ignore_if_was_already_open); int r = toku_read_brt_header_and_store_in_cachefile(brt, brt->cf, MAX_LSN, &brt->h, &ignore_if_was_already_open);
if (r!=0) return r; if (r!=0) return r;
brt->h->root = blocknum; brt->h->root_blocknum = blocknum;
return 0; return 0;
} }
......
...@@ -394,12 +394,16 @@ done: ...@@ -394,12 +394,16 @@ done:
int int
toku_verify_brt_with_progress (BRT brt, int (*progress_callback)(void *extra, float progress), void *progress_extra, int verbose, int keep_on_going) { toku_verify_brt_with_progress (BRT brt, int (*progress_callback)(void *extra, float progress), void *progress_extra, int verbose, int keep_on_going) {
assert(brt->h); assert(brt->h);
toku_cachetable_call_ydb_lock(brt->cf); BRTNODE root_node = NULL;
{
toku_brtheader_grab_treelock(brt->h);
u_int32_t root_hash; u_int32_t root_hash;
CACHEKEY *rootp = toku_calculate_root_offset_pointer(brt->h, &root_hash); CACHEKEY *rootp = toku_calculate_root_offset_pointer(brt->h, &root_hash);
BRTNODE root_node;
toku_get_node_for_verify(*rootp, brt, &root_node); toku_get_node_for_verify(*rootp, brt, &root_node);
toku_cachetable_call_ydb_unlock(brt->cf);
toku_brtheader_release_treelock(brt->h);
}
int r = toku_verify_brtnode(brt, ZERO_MSN, ZERO_MSN, root_node, -1, NULL, NULL, progress_callback, progress_extra, 1, verbose, keep_on_going); int r = toku_verify_brtnode(brt, ZERO_MSN, ZERO_MSN, root_node, -1, NULL, NULL, progress_callback, progress_extra, 1, verbose, keep_on_going);
if (r == 0) { if (r == 0) {
toku_brtheader_lock(brt->h); toku_brtheader_lock(brt->h);
......
This diff is collapsed.
...@@ -102,7 +102,7 @@ dump_header (int f, struct brt_header **header, CACHEFILE cf) { ...@@ -102,7 +102,7 @@ dump_header (int f, struct brt_header **header, CACHEFILE cf) {
printf(" dirty=%d\n", h->dirty); printf(" dirty=%d\n", h->dirty);
printf(" nodesize=%u\n", h->nodesize); printf(" nodesize=%u\n", h->nodesize);
printf(" basementnodesize=%u\n", h->basementnodesize); printf(" basementnodesize=%u\n", h->basementnodesize);
printf(" unnamed_root=%" PRId64 "\n", h->root.b); printf(" unnamed_root=%" PRId64 "\n", h->root_blocknum.b);
printf(" flags=%u\n", h->flags); printf(" flags=%u\n", h->flags);
dump_descriptor(&h->descriptor); dump_descriptor(&h->descriptor);
printf(" estimated numrows=%" PRId64 "\n", h->in_memory_stats.numrows); printf(" estimated numrows=%" PRId64 "\n", h->in_memory_stats.numrows);
...@@ -498,7 +498,7 @@ main (int argc, const char *const argv[]) { ...@@ -498,7 +498,7 @@ main (int argc, const char *const argv[]) {
} }
} }
} else if (rootnode) { } else if (rootnode) {
dump_node(f, h->root, h); dump_node(f, h->root_blocknum, h);
} else { } else {
printf("Block translation:"); printf("Block translation:");
......
...@@ -2463,7 +2463,7 @@ static int toku_loader_write_brt_from_q (BRTLOADER bl, ...@@ -2463,7 +2463,7 @@ static int toku_loader_write_brt_from_q (BRTLOADER bl,
{ {
invariant(sts.n_subtrees==1); invariant(sts.n_subtrees==1);
out.h->root = make_blocknum(sts.subtrees[0].block); out.h->root_blocknum = make_blocknum(sts.subtrees[0].block);
toku_free(sts.subtrees); sts.subtrees = NULL; toku_free(sts.subtrees); sts.subtrees = NULL;
// write the descriptor // write the descriptor
......
...@@ -176,7 +176,7 @@ toku_logger_open_rollback(TOKULOGGER logger, CACHETABLE cachetable, BOOL create) ...@@ -176,7 +176,7 @@ toku_logger_open_rollback(TOKULOGGER logger, CACHETABLE cachetable, BOOL create)
//Verify it is empty //Verify it is empty
assert(!t->h->panic); assert(!t->h->panic);
//Must have no data blocks (rollback logs or otherwise). //Must have no data blocks (rollback logs or otherwise).
toku_block_verify_no_data_blocks_except_root_unlocked(t->h->blocktable, t->h->root); toku_block_verify_no_data_blocks_except_root_unlocked(t->h->blocktable, t->h->root_blocknum);
toku_brtheader_unlock(t->h); toku_brtheader_unlock(t->h);
BOOL is_empty; BOOL is_empty;
is_empty = toku_brt_is_empty_fast(t); is_empty = toku_brt_is_empty_fast(t);
...@@ -206,7 +206,7 @@ toku_logger_close_rollback(TOKULOGGER logger, BOOL recovery_failed) { ...@@ -206,7 +206,7 @@ toku_logger_close_rollback(TOKULOGGER logger, BOOL recovery_failed) {
if (!h->panic) { //If paniced, it is safe to close. if (!h->panic) { //If paniced, it is safe to close.
assert(!h->dirty); //Must not be dirty. assert(!h->dirty); //Must not be dirty.
//Must have no data blocks (rollback logs or otherwise). //Must have no data blocks (rollback logs or otherwise).
toku_block_verify_no_data_blocks_except_root_unlocked(h->blocktable, h->root); toku_block_verify_no_data_blocks_except_root_unlocked(h->blocktable, h->root_blocknum);
} }
assert(!toku_list_empty(&h->live_brts)); // there is always one brt associated with the header assert(!toku_list_empty(&h->live_brts)); // there is always one brt associated with the header
brt_to_close = toku_list_struct(toku_list_head(&h->live_brts), struct brt, live_brt_link); brt_to_close = toku_list_struct(toku_list_head(&h->live_brts), struct brt, live_brt_link);
......
...@@ -326,6 +326,7 @@ test_prefetching(void) { ...@@ -326,6 +326,7 @@ test_prefetching(void) {
brt_h->type = BRTHEADER_CURRENT; brt_h->type = BRTHEADER_CURRENT;
brt_h->panic = 0; brt_h->panic_string = 0; brt_h->panic = 0; brt_h->panic_string = 0;
brt_h->basementnodesize = 128*1024; brt_h->basementnodesize = 128*1024;
toku_brtheader_init_treelock(brt_h);
toku_blocktable_create_new(&brt_h->blocktable); toku_blocktable_create_new(&brt_h->blocktable);
//Want to use block #20 //Want to use block #20
BLOCKNUM b = make_blocknum(0); BLOCKNUM b = make_blocknum(0);
...@@ -360,6 +361,7 @@ test_prefetching(void) { ...@@ -360,6 +361,7 @@ test_prefetching(void) {
toku_free(sn.childkeys); toku_free(sn.childkeys);
toku_block_free(brt_h->blocktable, BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE); toku_block_free(brt_h->blocktable, BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE);
toku_brtheader_destroy_treelock(brt_h);
toku_blocktable_destroy(&brt_h->blocktable); toku_blocktable_destroy(&brt_h->blocktable);
toku_free(brt_h); toku_free(brt_h);
toku_free(brt); toku_free(brt);
......
...@@ -277,6 +277,7 @@ test_serialize_nonleaf(void) { ...@@ -277,6 +277,7 @@ test_serialize_nonleaf(void) {
brt_h->type = BRTHEADER_CURRENT; brt_h->type = BRTHEADER_CURRENT;
brt_h->panic = 0; brt_h->panic_string = 0; brt_h->panic = 0; brt_h->panic_string = 0;
brt_h->basementnodesize = 128*1024; brt_h->basementnodesize = 128*1024;
toku_brtheader_init_treelock(brt_h);
toku_blocktable_create_new(&brt_h->blocktable); toku_blocktable_create_new(&brt_h->blocktable);
//Want to use block #20 //Want to use block #20
BLOCKNUM b = make_blocknum(0); BLOCKNUM b = make_blocknum(0);
...@@ -310,6 +311,7 @@ test_serialize_nonleaf(void) { ...@@ -310,6 +311,7 @@ test_serialize_nonleaf(void) {
toku_free(sn.childkeys); toku_free(sn.childkeys);
toku_block_free(brt_h->blocktable, BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE); toku_block_free(brt_h->blocktable, BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE);
toku_brtheader_destroy_treelock(brt_h);
toku_blocktable_destroy(&brt_h->blocktable); toku_blocktable_destroy(&brt_h->blocktable);
toku_free(brt_h); toku_free(brt_h);
toku_free(brt); toku_free(brt);
...@@ -361,6 +363,7 @@ test_serialize_leaf(void) { ...@@ -361,6 +363,7 @@ test_serialize_leaf(void) {
brt_h->type = BRTHEADER_CURRENT; brt_h->type = BRTHEADER_CURRENT;
brt_h->panic = 0; brt_h->panic_string = 0; brt_h->panic = 0; brt_h->panic_string = 0;
brt_h->basementnodesize = 128*1024; brt_h->basementnodesize = 128*1024;
toku_brtheader_init_treelock(brt_h);
toku_blocktable_create_new(&brt_h->blocktable); toku_blocktable_create_new(&brt_h->blocktable);
//Want to use block #20 //Want to use block #20
BLOCKNUM b = make_blocknum(0); BLOCKNUM b = make_blocknum(0);
...@@ -401,6 +404,7 @@ test_serialize_leaf(void) { ...@@ -401,6 +404,7 @@ test_serialize_leaf(void) {
toku_free(sn.childkeys); toku_free(sn.childkeys);
toku_block_free(brt_h->blocktable, BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE); toku_block_free(brt_h->blocktable, BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE);
toku_brtheader_destroy_treelock(brt_h);
toku_blocktable_destroy(&brt_h->blocktable); toku_blocktable_destroy(&brt_h->blocktable);
toku_free(brt_h); toku_free(brt_h);
toku_free(brt); toku_free(brt);
......
...@@ -108,6 +108,7 @@ test_serialize_leaf(int valsize, int nelts, double entropy) { ...@@ -108,6 +108,7 @@ test_serialize_leaf(int valsize, int nelts, double entropy) {
brt_h->panic = 0; brt_h->panic_string = 0; brt_h->panic = 0; brt_h->panic_string = 0;
brt_h->basementnodesize = 128*1024; brt_h->basementnodesize = 128*1024;
brt_h->compare_fun = long_key_cmp; brt_h->compare_fun = long_key_cmp;
toku_brtheader_init_treelock(brt_h);
toku_blocktable_create_new(&brt_h->blocktable); toku_blocktable_create_new(&brt_h->blocktable);
//Want to use block #20 //Want to use block #20
BLOCKNUM b = make_blocknum(0); BLOCKNUM b = make_blocknum(0);
...@@ -161,6 +162,7 @@ test_serialize_leaf(int valsize, int nelts, double entropy) { ...@@ -161,6 +162,7 @@ test_serialize_leaf(int valsize, int nelts, double entropy) {
toku_block_free(brt_h->blocktable, BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE); toku_block_free(brt_h->blocktable, BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE);
toku_blocktable_destroy(&brt_h->blocktable); toku_blocktable_destroy(&brt_h->blocktable);
toku_brtheader_destroy_treelock(brt_h);
toku_free(brt_h); toku_free(brt_h);
toku_free(brt); toku_free(brt);
...@@ -235,6 +237,7 @@ test_serialize_nonleaf(int valsize, int nelts, double entropy) { ...@@ -235,6 +237,7 @@ test_serialize_nonleaf(int valsize, int nelts, double entropy) {
brt_h->panic = 0; brt_h->panic_string = 0; brt_h->panic = 0; brt_h->panic_string = 0;
brt_h->basementnodesize = 128*1024; brt_h->basementnodesize = 128*1024;
brt_h->compare_fun = long_key_cmp; brt_h->compare_fun = long_key_cmp;
toku_brtheader_init_treelock(brt_h);
toku_blocktable_create_new(&brt_h->blocktable); toku_blocktable_create_new(&brt_h->blocktable);
//Want to use block #20 //Want to use block #20
BLOCKNUM b = make_blocknum(0); BLOCKNUM b = make_blocknum(0);
...@@ -285,6 +288,7 @@ test_serialize_nonleaf(int valsize, int nelts, double entropy) { ...@@ -285,6 +288,7 @@ test_serialize_nonleaf(int valsize, int nelts, double entropy) {
toku_block_free(brt_h->blocktable, BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE); toku_block_free(brt_h->blocktable, BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE);
toku_blocktable_destroy(&brt_h->blocktable); toku_blocktable_destroy(&brt_h->blocktable);
toku_brtheader_destroy_treelock(brt_h);
toku_free(brt_h); toku_free(brt_h);
toku_free(brt); toku_free(brt);
......
...@@ -237,6 +237,7 @@ test_serialize_leaf_check_msn(enum brtnode_verify_type bft) { ...@@ -237,6 +237,7 @@ test_serialize_leaf_check_msn(enum brtnode_verify_type bft) {
brt_h->type = BRTHEADER_CURRENT; brt_h->type = BRTHEADER_CURRENT;
brt_h->panic = 0; brt_h->panic_string = 0; brt_h->panic = 0; brt_h->panic_string = 0;
brt_h->basementnodesize = 128*1024; brt_h->basementnodesize = 128*1024;
toku_brtheader_init_treelock(brt_h);
toku_blocktable_create_new(&brt_h->blocktable); toku_blocktable_create_new(&brt_h->blocktable);
//Want to use block #20 //Want to use block #20
BLOCKNUM b = make_blocknum(0); BLOCKNUM b = make_blocknum(0);
...@@ -317,6 +318,7 @@ test_serialize_leaf_check_msn(enum brtnode_verify_type bft) { ...@@ -317,6 +318,7 @@ test_serialize_leaf_check_msn(enum brtnode_verify_type bft) {
toku_block_free(brt_h->blocktable, BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE); toku_block_free(brt_h->blocktable, BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE);
toku_blocktable_destroy(&brt_h->blocktable); toku_blocktable_destroy(&brt_h->blocktable);
toku_brtheader_destroy_treelock(brt_h);
toku_free(brt_h); toku_free(brt_h);
toku_free(brt); toku_free(brt);
...@@ -375,6 +377,7 @@ test_serialize_leaf_with_large_pivots(enum brtnode_verify_type bft) { ...@@ -375,6 +377,7 @@ test_serialize_leaf_with_large_pivots(enum brtnode_verify_type bft) {
brt_h->type = BRTHEADER_CURRENT; brt_h->type = BRTHEADER_CURRENT;
brt_h->panic = 0; brt_h->panic_string = 0; brt_h->panic = 0; brt_h->panic_string = 0;
brt_h->basementnodesize = 128*1024; brt_h->basementnodesize = 128*1024;
toku_brtheader_init_treelock(brt_h);
toku_blocktable_create_new(&brt_h->blocktable); toku_blocktable_create_new(&brt_h->blocktable);
//Want to use block #20 //Want to use block #20
BLOCKNUM b = make_blocknum(0); BLOCKNUM b = make_blocknum(0);
...@@ -455,6 +458,7 @@ test_serialize_leaf_with_large_pivots(enum brtnode_verify_type bft) { ...@@ -455,6 +458,7 @@ test_serialize_leaf_with_large_pivots(enum brtnode_verify_type bft) {
toku_block_free(brt_h->blocktable, BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE); toku_block_free(brt_h->blocktable, BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE);
toku_blocktable_destroy(&brt_h->blocktable); toku_blocktable_destroy(&brt_h->blocktable);
toku_brtheader_destroy_treelock(brt_h);
toku_free(brt_h); toku_free(brt_h);
toku_free(brt); toku_free(brt);
...@@ -509,6 +513,7 @@ test_serialize_leaf_with_many_rows(enum brtnode_verify_type bft) { ...@@ -509,6 +513,7 @@ test_serialize_leaf_with_many_rows(enum brtnode_verify_type bft) {
brt_h->type = BRTHEADER_CURRENT; brt_h->type = BRTHEADER_CURRENT;
brt_h->panic = 0; brt_h->panic_string = 0; brt_h->panic = 0; brt_h->panic_string = 0;
brt_h->basementnodesize = 128*1024; brt_h->basementnodesize = 128*1024;
toku_brtheader_init_treelock(brt_h);
toku_blocktable_create_new(&brt_h->blocktable); toku_blocktable_create_new(&brt_h->blocktable);
//Want to use block #20 //Want to use block #20
BLOCKNUM b = make_blocknum(0); BLOCKNUM b = make_blocknum(0);
...@@ -587,6 +592,7 @@ test_serialize_leaf_with_many_rows(enum brtnode_verify_type bft) { ...@@ -587,6 +592,7 @@ test_serialize_leaf_with_many_rows(enum brtnode_verify_type bft) {
toku_block_free(brt_h->blocktable, BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE); toku_block_free(brt_h->blocktable, BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE);
toku_blocktable_destroy(&brt_h->blocktable); toku_blocktable_destroy(&brt_h->blocktable);
toku_brtheader_destroy_treelock(brt_h);
toku_free(brt_h); toku_free(brt_h);
toku_free(brt); toku_free(brt);
...@@ -648,6 +654,7 @@ test_serialize_leaf_with_large_rows(enum brtnode_verify_type bft) { ...@@ -648,6 +654,7 @@ test_serialize_leaf_with_large_rows(enum brtnode_verify_type bft) {
brt_h->type = BRTHEADER_CURRENT; brt_h->type = BRTHEADER_CURRENT;
brt_h->panic = 0; brt_h->panic_string = 0; brt_h->panic = 0; brt_h->panic_string = 0;
brt_h->basementnodesize = 128*1024; brt_h->basementnodesize = 128*1024;
toku_brtheader_init_treelock(brt_h);
toku_blocktable_create_new(&brt_h->blocktable); toku_blocktable_create_new(&brt_h->blocktable);
//Want to use block #20 //Want to use block #20
BLOCKNUM b = make_blocknum(0); BLOCKNUM b = make_blocknum(0);
...@@ -731,6 +738,7 @@ test_serialize_leaf_with_large_rows(enum brtnode_verify_type bft) { ...@@ -731,6 +738,7 @@ test_serialize_leaf_with_large_rows(enum brtnode_verify_type bft) {
toku_block_free(brt_h->blocktable, BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE); toku_block_free(brt_h->blocktable, BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE);
toku_blocktable_destroy(&brt_h->blocktable); toku_blocktable_destroy(&brt_h->blocktable);
toku_brtheader_destroy_treelock(brt_h);
toku_free(brt_h); toku_free(brt_h);
toku_free(brt); toku_free(brt);
...@@ -803,6 +811,7 @@ test_serialize_leaf_with_empty_basement_nodes(enum brtnode_verify_type bft) { ...@@ -803,6 +811,7 @@ test_serialize_leaf_with_empty_basement_nodes(enum brtnode_verify_type bft) {
brt_h->type = BRTHEADER_CURRENT; brt_h->type = BRTHEADER_CURRENT;
brt_h->panic = 0; brt_h->panic_string = 0; brt_h->panic = 0; brt_h->panic_string = 0;
brt_h->basementnodesize = 128*1024; brt_h->basementnodesize = 128*1024;
toku_brtheader_init_treelock(brt_h);
toku_blocktable_create_new(&brt_h->blocktable); toku_blocktable_create_new(&brt_h->blocktable);
//Want to use block #20 //Want to use block #20
BLOCKNUM b = make_blocknum(0); BLOCKNUM b = make_blocknum(0);
...@@ -878,6 +887,7 @@ test_serialize_leaf_with_empty_basement_nodes(enum brtnode_verify_type bft) { ...@@ -878,6 +887,7 @@ test_serialize_leaf_with_empty_basement_nodes(enum brtnode_verify_type bft) {
toku_block_free(brt_h->blocktable, BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE); toku_block_free(brt_h->blocktable, BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE);
toku_blocktable_destroy(&brt_h->blocktable); toku_blocktable_destroy(&brt_h->blocktable);
toku_brtheader_destroy_treelock(brt_h);
toku_free(brt_h); toku_free(brt_h);
toku_free(brt); toku_free(brt);
...@@ -924,6 +934,7 @@ test_serialize_leaf_with_multiple_empty_basement_nodes(enum brtnode_verify_type ...@@ -924,6 +934,7 @@ test_serialize_leaf_with_multiple_empty_basement_nodes(enum brtnode_verify_type
brt_h->type = BRTHEADER_CURRENT; brt_h->type = BRTHEADER_CURRENT;
brt_h->panic = 0; brt_h->panic_string = 0; brt_h->panic = 0; brt_h->panic_string = 0;
brt_h->basementnodesize = 128*1024; brt_h->basementnodesize = 128*1024;
toku_brtheader_init_treelock(brt_h);
toku_blocktable_create_new(&brt_h->blocktable); toku_blocktable_create_new(&brt_h->blocktable);
//Want to use block #20 //Want to use block #20
BLOCKNUM b = make_blocknum(0); BLOCKNUM b = make_blocknum(0);
...@@ -988,6 +999,7 @@ test_serialize_leaf_with_multiple_empty_basement_nodes(enum brtnode_verify_type ...@@ -988,6 +999,7 @@ test_serialize_leaf_with_multiple_empty_basement_nodes(enum brtnode_verify_type
toku_block_free(brt_h->blocktable, BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE); toku_block_free(brt_h->blocktable, BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE);
toku_blocktable_destroy(&brt_h->blocktable); toku_blocktable_destroy(&brt_h->blocktable);
toku_brtheader_destroy_treelock(brt_h);
toku_free(brt_h); toku_free(brt_h);
toku_free(brt); toku_free(brt);
...@@ -1047,6 +1059,7 @@ test_serialize_leaf(enum brtnode_verify_type bft) { ...@@ -1047,6 +1059,7 @@ test_serialize_leaf(enum brtnode_verify_type bft) {
brt_h->type = BRTHEADER_CURRENT; brt_h->type = BRTHEADER_CURRENT;
brt_h->panic = 0; brt_h->panic_string = 0; brt_h->panic = 0; brt_h->panic_string = 0;
brt_h->basementnodesize = 128*1024; brt_h->basementnodesize = 128*1024;
toku_brtheader_init_treelock(brt_h);
toku_blocktable_create_new(&brt_h->blocktable); toku_blocktable_create_new(&brt_h->blocktable);
//Want to use block #20 //Want to use block #20
BLOCKNUM b = make_blocknum(0); BLOCKNUM b = make_blocknum(0);
...@@ -1125,6 +1138,7 @@ test_serialize_leaf(enum brtnode_verify_type bft) { ...@@ -1125,6 +1138,7 @@ test_serialize_leaf(enum brtnode_verify_type bft) {
toku_block_free(brt_h->blocktable, BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE); toku_block_free(brt_h->blocktable, BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE);
toku_blocktable_destroy(&brt_h->blocktable); toku_blocktable_destroy(&brt_h->blocktable);
toku_brtheader_destroy_treelock(brt_h);
toku_free(brt_h); toku_free(brt_h);
toku_free(brt); toku_free(brt);
...@@ -1189,6 +1203,7 @@ test_serialize_nonleaf(enum brtnode_verify_type bft) { ...@@ -1189,6 +1203,7 @@ test_serialize_nonleaf(enum brtnode_verify_type bft) {
brt_h->type = BRTHEADER_CURRENT; brt_h->type = BRTHEADER_CURRENT;
brt_h->panic = 0; brt_h->panic_string = 0; brt_h->panic = 0; brt_h->panic_string = 0;
brt_h->basementnodesize = 128*1024; brt_h->basementnodesize = 128*1024;
toku_brtheader_init_treelock(brt_h);
toku_blocktable_create_new(&brt_h->blocktable); toku_blocktable_create_new(&brt_h->blocktable);
//Want to use block #20 //Want to use block #20
BLOCKNUM b = make_blocknum(0); BLOCKNUM b = make_blocknum(0);
...@@ -1321,6 +1336,7 @@ test_serialize_nonleaf(enum brtnode_verify_type bft) { ...@@ -1321,6 +1336,7 @@ test_serialize_nonleaf(enum brtnode_verify_type bft) {
toku_block_free(brt_h->blocktable, BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE); toku_block_free(brt_h->blocktable, BLOCK_ALLOCATOR_TOTAL_HEADER_RESERVE);
toku_blocktable_destroy(&brt_h->blocktable); toku_blocktable_destroy(&brt_h->blocktable);
toku_brtheader_destroy_treelock(brt_h);
toku_free(brt_h); toku_free(brt_h);
toku_free(brt); toku_free(brt);
......
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