Commit d9639d75 authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

[t:4741] finish removing brt_header reference from brtnode


git-svn-id: file:///svn/toku/tokudb@43554 c7de825b-a66e-492c-adef-691d508d4ae1
parent e63ac314
...@@ -95,8 +95,7 @@ create_new_brtnode_with_dep_nodes( ...@@ -95,8 +95,7 @@ create_new_brtnode_with_dep_nodes(
n_children, n_children,
h->layout_version, h->layout_version,
h->nodesize, h->nodesize,
h->flags, h->flags);
h);
assert((*result)->nodesize > 0); assert((*result)->nodesize > 0);
(*result)->fullhash = fullhash; (*result)->fullhash = fullhash;
......
...@@ -808,8 +808,7 @@ brtleaf_split( ...@@ -808,8 +808,7 @@ brtleaf_split(
num_children_in_b, num_children_in_b,
h->layout_version, h->layout_version,
h->nodesize, h->nodesize,
h->flags, h->flags);
h);
assert(B->nodesize > 0); assert(B->nodesize > 0);
B->fullhash = fullhash; B->fullhash = fullhash;
} }
......
...@@ -226,7 +226,6 @@ struct __attribute__((__packed__)) brtnode_partition { ...@@ -226,7 +226,6 @@ struct __attribute__((__packed__)) brtnode_partition {
struct brtnode { struct brtnode {
MSN max_msn_applied_to_node_on_disk; // max_msn_applied that will be written to disk MSN max_msn_applied_to_node_on_disk; // max_msn_applied that will be written to disk
struct brt_header *h; // in-memory only
unsigned int nodesize; unsigned int nodesize;
unsigned int flags; unsigned int flags;
BLOCKNUM thisnodename; // Which block number is this node? BLOCKNUM thisnodename; // Which block number is this node?
...@@ -436,12 +435,14 @@ void ...@@ -436,12 +435,14 @@ void
toku_create_compressed_partition_from_available( toku_create_compressed_partition_from_available(
BRTNODE node, BRTNODE node,
int childnum, int childnum,
enum toku_compression_method compression_method,
SUB_BLOCK sb SUB_BLOCK sb
); );
void rebalance_brtnode_leaf(BRTNODE node, unsigned int basementnodesize); void rebalance_brtnode_leaf(BRTNODE node, unsigned int basementnodesize);
int toku_serialize_brtnode_to_memory (BRTNODE node, int toku_serialize_brtnode_to_memory (BRTNODE node,
BRTNODE_DISK_DATA* ndd, BRTNODE_DISK_DATA* ndd,
unsigned int basementnodesize, unsigned int basementnodesize,
enum toku_compression_method compression_method,
BOOL do_rebalancing, BOOL do_rebalancing,
BOOL in_parallel, BOOL in_parallel,
/*out*/ size_t *n_bytes_to_write, /*out*/ size_t *n_bytes_to_write,
...@@ -721,7 +722,7 @@ void toku_create_new_brtnode (BRT t, BRTNODE *result, int height, int n_children ...@@ -721,7 +722,7 @@ void toku_create_new_brtnode (BRT t, BRTNODE *result, int height, int n_children
// Effect: Fill in N as an empty brtnode. // Effect: Fill in N as an empty brtnode.
void toku_initialize_empty_brtnode (BRTNODE n, BLOCKNUM nodename, int height, int num_children, void toku_initialize_empty_brtnode (BRTNODE n, BLOCKNUM nodename, int height, int num_children,
int layout_version, unsigned int nodesize, unsigned int flags, struct brt_header *h); int layout_version, unsigned int nodesize, unsigned int flags);
unsigned int toku_brtnode_which_child(BRTNODE node, const DBT *k, unsigned int toku_brtnode_which_child(BRTNODE node, const DBT *k,
DESCRIPTOR desc, brt_compare_func cmp) DESCRIPTOR desc, brt_compare_func cmp)
......
...@@ -670,20 +670,24 @@ rebalance_brtnode_leaf(BRTNODE node, unsigned int basementnodesize) ...@@ -670,20 +670,24 @@ rebalance_brtnode_leaf(BRTNODE node, unsigned int basementnodesize)
} // end of rebalance_brtnode_leaf() } // end of rebalance_brtnode_leaf()
static void static void
serialize_and_compress_partition(BRTNODE node, int childnum, SUB_BLOCK sb) serialize_and_compress_partition(BRTNODE node,
int childnum,
enum toku_compression_method compression_method,
SUB_BLOCK sb)
{ {
serialize_brtnode_partition(node, childnum, sb); serialize_brtnode_partition(node, childnum, sb);
compress_brtnode_sub_block(sb, node->h->compression_method); compress_brtnode_sub_block(sb, compression_method);
} }
void void
toku_create_compressed_partition_from_available( toku_create_compressed_partition_from_available(
BRTNODE node, BRTNODE node,
int childnum, int childnum,
enum toku_compression_method compression_method,
SUB_BLOCK sb SUB_BLOCK sb
) )
{ {
serialize_and_compress_partition(node, childnum, sb); serialize_and_compress_partition(node, childnum, compression_method, sb);
// //
// now we have an sb that would be ready for being written out, // now we have an sb that would be ready for being written out,
// but we are not writing it out, we are storing it in cache for a potentially // but we are not writing it out, we are storing it in cache for a potentially
...@@ -710,9 +714,12 @@ toku_create_compressed_partition_from_available( ...@@ -710,9 +714,12 @@ toku_create_compressed_partition_from_available(
static void static void
serialize_and_compress_serially(BRTNODE node, int npartitions, struct sub_block sb[]) { serialize_and_compress_serially(BRTNODE node,
int npartitions,
enum toku_compression_method compression_method,
struct sub_block sb[]) {
for (int i = 0; i < npartitions; i++) { for (int i = 0; i < npartitions; i++) {
serialize_and_compress_partition(node, i, &sb[i]); serialize_and_compress_partition(node, i, compression_method, &sb[i]);
} }
} }
...@@ -720,6 +727,7 @@ struct serialize_compress_work { ...@@ -720,6 +727,7 @@ struct serialize_compress_work {
struct work base; struct work base;
BRTNODE node; BRTNODE node;
int i; int i;
enum toku_compression_method compression_method;
struct sub_block *sb; struct sub_block *sb;
}; };
...@@ -731,16 +739,19 @@ serialize_and_compress_worker(void *arg) { ...@@ -731,16 +739,19 @@ serialize_and_compress_worker(void *arg) {
if (w == NULL) if (w == NULL)
break; break;
int i = w->i; int i = w->i;
serialize_and_compress_partition(w->node, i, &w->sb[i]); serialize_and_compress_partition(w->node, i, w->compression_method, &w->sb[i]);
} }
workset_release_ref(ws); workset_release_ref(ws);
return arg; return arg;
} }
static void static void
serialize_and_compress_in_parallel(BRTNODE node, int npartitions, struct sub_block sb[]) { serialize_and_compress_in_parallel(BRTNODE node,
int npartitions,
enum toku_compression_method compression_method,
struct sub_block sb[]) {
if (npartitions == 1) { if (npartitions == 1) {
serialize_and_compress_partition(node, 0, &sb[0]); serialize_and_compress_partition(node, 0, compression_method, &sb[0]);
} else { } else {
int T = num_cores; int T = num_cores;
if (T > npartitions) if (T > npartitions)
...@@ -752,7 +763,10 @@ serialize_and_compress_in_parallel(BRTNODE node, int npartitions, struct sub_blo ...@@ -752,7 +763,10 @@ serialize_and_compress_in_parallel(BRTNODE node, int npartitions, struct sub_blo
struct serialize_compress_work work[npartitions]; struct serialize_compress_work work[npartitions];
workset_lock(&ws); workset_lock(&ws);
for (int i = 0; i < npartitions; i++) { for (int i = 0; i < npartitions; i++) {
work[i] = (struct serialize_compress_work) { .node = node, .i = i, .sb = sb }; work[i] = (struct serialize_compress_work) { .node = node,
.i = i,
.compression_method = compression_method,
.sb = sb };
workset_put_locked(&ws, &work[i].base); workset_put_locked(&ws, &work[i].base);
} }
workset_unlock(&ws); workset_unlock(&ws);
...@@ -773,6 +787,7 @@ int ...@@ -773,6 +787,7 @@ int
toku_serialize_brtnode_to_memory (BRTNODE node, toku_serialize_brtnode_to_memory (BRTNODE node,
BRTNODE_DISK_DATA* ndd, BRTNODE_DISK_DATA* ndd,
unsigned int basementnodesize, unsigned int basementnodesize,
enum toku_compression_method compression_method,
BOOL do_rebalancing, BOOL do_rebalancing,
BOOL in_parallel, // for loader is TRUE, for toku_brtnode_flush_callback, is false BOOL in_parallel, // for loader is TRUE, for toku_brtnode_flush_callback, is false
/*out*/ size_t *n_bytes_to_write, /*out*/ size_t *n_bytes_to_write,
...@@ -800,17 +815,17 @@ toku_serialize_brtnode_to_memory (BRTNODE node, ...@@ -800,17 +815,17 @@ toku_serialize_brtnode_to_memory (BRTNODE node,
// First, let's serialize and compress the individual sub blocks // First, let's serialize and compress the individual sub blocks
// //
if (in_parallel) { if (in_parallel) {
serialize_and_compress_in_parallel(node, npartitions, sb); serialize_and_compress_in_parallel(node, npartitions, compression_method, sb);
} }
else { else {
serialize_and_compress_serially(node, npartitions, sb); serialize_and_compress_serially(node, npartitions, compression_method, sb);
} }
// //
// Now lets create a sub-block that has the common node information, // Now lets create a sub-block that has the common node information,
// This does NOT include the header // This does NOT include the header
// //
serialize_brtnode_info(node, &sb_node_info); serialize_brtnode_info(node, &sb_node_info);
compress_brtnode_sub_block(&sb_node_info, node->h->compression_method); compress_brtnode_sub_block(&sb_node_info, compression_method);
// now we have compressed each of our pieces into individual sub_blocks, // now we have compressed each of our pieces into individual sub_blocks,
// we can put the header and all the subblocks into a single buffer // we can put the header and all the subblocks into a single buffer
...@@ -896,6 +911,7 @@ toku_serialize_brtnode_to (int fd, BLOCKNUM blocknum, BRTNODE node, BRTNODE_DISK ...@@ -896,6 +911,7 @@ toku_serialize_brtnode_to (int fd, BLOCKNUM blocknum, BRTNODE node, BRTNODE_DISK
node, node,
ndd, ndd,
h->basementnodesize, h->basementnodesize,
h->compression_method,
do_rebalancing, do_rebalancing,
FALSE, // in_parallel FALSE, // in_parallel
&n_to_write, &n_to_write,
......
...@@ -666,7 +666,6 @@ void toku_brtnode_clone_callback( ...@@ -666,7 +666,6 @@ void toku_brtnode_clone_callback(
} }
cloned_node->max_msn_applied_to_node_on_disk = node->max_msn_applied_to_node_on_disk; cloned_node->max_msn_applied_to_node_on_disk = node->max_msn_applied_to_node_on_disk;
cloned_node->h = node->h;
cloned_node->nodesize = node->nodesize; cloned_node->nodesize = node->nodesize;
cloned_node->flags = node->flags; cloned_node->flags = node->flags;
cloned_node->thisnodename = node->thisnodename; cloned_node->thisnodename = node->thisnodename;
...@@ -800,7 +799,6 @@ int toku_brtnode_fetch_callback (CACHEFILE UU(cachefile), int fd, BLOCKNUM noden ...@@ -800,7 +799,6 @@ int toku_brtnode_fetch_callback (CACHEFILE UU(cachefile), int fd, BLOCKNUM noden
} }
if (r == 0) { if (r == 0) {
(*node)->h = bfe->h; // copy reference to header from bfe
*sizep = make_brtnode_pair_attr(*node); *sizep = make_brtnode_pair_attr(*node);
*dirtyp = (*node)->dirty; // deserialize could mark the node as dirty (presumably for upgrade) *dirtyp = (*node)->dirty; // deserialize could mark the node as dirty (presumably for upgrade)
} }
...@@ -857,7 +855,7 @@ void toku_brtnode_pe_est_callback( ...@@ -857,7 +855,7 @@ void toku_brtnode_pe_est_callback(
} }
static void static void
compress_internal_node_partition(BRTNODE node, int i) compress_internal_node_partition(BRTNODE node, int i, enum toku_compression_method compression_method)
{ {
// if we should evict, compress the // if we should evict, compress the
// message buffer into a sub_block // message buffer into a sub_block
...@@ -866,7 +864,7 @@ compress_internal_node_partition(BRTNODE node, int i) ...@@ -866,7 +864,7 @@ compress_internal_node_partition(BRTNODE node, int i)
SUB_BLOCK sb = NULL; SUB_BLOCK sb = NULL;
sb = toku_xmalloc(sizeof(struct sub_block)); sb = toku_xmalloc(sizeof(struct sub_block));
sub_block_init(sb); sub_block_init(sb);
toku_create_compressed_partition_from_available(node, i, sb); toku_create_compressed_partition_from_available(node, i, compression_method, sb);
// now free the old partition and replace it with this // now free the old partition and replace it with this
destroy_nonleaf_childinfo(BNC(node,i)); destroy_nonleaf_childinfo(BNC(node,i));
...@@ -907,7 +905,7 @@ int toku_brtnode_pe_callback (void *brtnode_pv, PAIR_ATTR UU(old_attr), PAIR_ATT ...@@ -907,7 +905,7 @@ int toku_brtnode_pe_callback (void *brtnode_pv, PAIR_ATTR UU(old_attr), PAIR_ATT
if (BP_STATE(node,i) == PT_AVAIL) { if (BP_STATE(node,i) == PT_AVAIL) {
if (BP_SHOULD_EVICT(node,i)) { if (BP_SHOULD_EVICT(node,i)) {
STATUS_VALUE(BRT_PARTIAL_EVICTIONS_NONLEAF)++; STATUS_VALUE(BRT_PARTIAL_EVICTIONS_NONLEAF)++;
cilk_spawn compress_internal_node_partition(node, i); cilk_spawn compress_internal_node_partition(node, i, h->compression_method);
} }
else { else {
BP_SWEEP_CLOCK(node,i); BP_SWEEP_CLOCK(node,i);
...@@ -1247,7 +1245,7 @@ void toku_brtnode_free (BRTNODE *nodep) { ...@@ -1247,7 +1245,7 @@ void toku_brtnode_free (BRTNODE *nodep) {
} }
void void
toku_initialize_empty_brtnode (BRTNODE n, BLOCKNUM nodename, int height, int num_children, int layout_version, unsigned int nodesize, unsigned int flags, struct brt_header *h) toku_initialize_empty_brtnode (BRTNODE n, BLOCKNUM nodename, int height, int num_children, int layout_version, unsigned int nodesize, unsigned int flags)
// Effect: Fill in N as an empty brtnode. // Effect: Fill in N as an empty brtnode.
{ {
assert(layout_version != 0); assert(layout_version != 0);
...@@ -1259,7 +1257,6 @@ toku_initialize_empty_brtnode (BRTNODE n, BLOCKNUM nodename, int height, int num ...@@ -1259,7 +1257,6 @@ toku_initialize_empty_brtnode (BRTNODE n, BLOCKNUM nodename, int height, int num
STATUS_VALUE(BRT_CREATE_NONLEAF)++; STATUS_VALUE(BRT_CREATE_NONLEAF)++;
n->max_msn_applied_to_node_on_disk = ZERO_MSN; // correct value for root node, harmless for others n->max_msn_applied_to_node_on_disk = ZERO_MSN; // correct value for root node, harmless for others
n->h = h;
n->nodesize = nodesize; n->nodesize = nodesize;
n->flags = flags; n->flags = flags;
n->thisnodename = nodename; n->thisnodename = nodename;
...@@ -1305,7 +1302,7 @@ brt_init_new_root(struct brt_header *h, BRTNODE nodea, BRTNODE nodeb, DBT splitk ...@@ -1305,7 +1302,7 @@ brt_init_new_root(struct brt_header *h, BRTNODE nodea, BRTNODE nodeb, DBT splitk
assert(newroot); assert(newroot);
*rootp=newroot_diskoff; *rootp=newroot_diskoff;
assert(new_height > 0); assert(new_height > 0);
toku_initialize_empty_brtnode (newroot, newroot_diskoff, new_height, 2, h->layout_version, h->nodesize, h->flags, h); toku_initialize_empty_brtnode (newroot, newroot_diskoff, new_height, 2, h->layout_version, h->nodesize, h->flags);
//printf("new_root %lld %d %lld %lld\n", newroot_diskoff, newroot->height, nodea->thisnodename, nodeb->thisnodename); //printf("new_root %lld %d %lld %lld\n", newroot_diskoff, newroot->height, nodea->thisnodename, nodeb->thisnodename);
//printf("%s:%d Splitkey=%p %s\n", __FILE__, __LINE__, splitkey, splitkey); //printf("%s:%d Splitkey=%p %s\n", __FILE__, __LINE__, splitkey, splitkey);
toku_copyref_dbt(&newroot->childkeys[0], splitk); toku_copyref_dbt(&newroot->childkeys[0], splitk);
......
...@@ -341,7 +341,7 @@ brtheader_note_unpin_by_checkpoint (CACHEFILE UU(cachefile), void *header_v) ...@@ -341,7 +341,7 @@ brtheader_note_unpin_by_checkpoint (CACHEFILE UU(cachefile), void *header_v)
static int setup_initial_brtheader_root_node (struct brt_header* h, BLOCKNUM blocknum) { static int setup_initial_brtheader_root_node (struct brt_header* h, BLOCKNUM blocknum) {
BRTNODE XMALLOC(node); BRTNODE XMALLOC(node);
toku_initialize_empty_brtnode(node, blocknum, 0, 1, h->layout_version, h->nodesize, h->flags, h); toku_initialize_empty_brtnode(node, blocknum, 0, 1, h->layout_version, h->nodesize, h->flags);
BP_STATE(node,0) = PT_AVAIL; BP_STATE(node,0) = PT_AVAIL;
u_int32_t fullhash = toku_cachetable_hash(h->cf, blocknum); u_int32_t fullhash = toku_cachetable_hash(h->cf, blocknum);
......
...@@ -2134,15 +2134,15 @@ static struct leaf_buf *start_leaf (struct dbout *out, const DESCRIPTOR UU(desc) ...@@ -2134,15 +2134,15 @@ static struct leaf_buf *start_leaf (struct dbout *out, const DESCRIPTOR UU(desc)
} }
BRTNODE XMALLOC(node); BRTNODE XMALLOC(node);
toku_initialize_empty_brtnode(node, lbuf->blocknum, 0 /*height*/, 1 /*basement nodes*/, BRT_LAYOUT_VERSION, target_nodesize, 0, out->h); toku_initialize_empty_brtnode(node, lbuf->blocknum, 0 /*height*/, 1 /*basement nodes*/, BRT_LAYOUT_VERSION, target_nodesize, 0);
BP_STATE(node, 0) = PT_AVAIL; BP_STATE(node, 0) = PT_AVAIL;
lbuf->node = node; lbuf->node = node;
return lbuf; return lbuf;
} }
static void finish_leafnode (struct dbout *out, struct leaf_buf *lbuf, int progress_allocation, BRTLOADER bl, uint32_t target_basementnodesize); static void finish_leafnode (struct dbout *out, struct leaf_buf *lbuf, int progress_allocation, BRTLOADER bl, uint32_t target_basementnodesize, enum toku_compression_method target_compression_method);
static int write_nonleaves (BRTLOADER bl, FIDX pivots_fidx, struct dbout *out, struct subtrees_info *sts, const DESCRIPTOR descriptor, uint32_t target_nodesize, uint32_t target_basementnodesize); static int write_nonleaves (BRTLOADER bl, FIDX pivots_fidx, struct dbout *out, struct subtrees_info *sts, const DESCRIPTOR descriptor, uint32_t target_nodesize, uint32_t target_basementnodesize, enum toku_compression_method target_compression_method);
static void add_pair_to_leafnode (struct leaf_buf *lbuf, unsigned char *key, int keylen, unsigned char *val, int vallen, int this_leafentry_size, STAT64INFO stats_to_update); static void add_pair_to_leafnode (struct leaf_buf *lbuf, unsigned char *key, int keylen, unsigned char *val, int vallen, int this_leafentry_size, STAT64INFO stats_to_update);
static int write_translation_table (struct dbout *out, long long *off_of_translation_p); static int write_translation_table (struct dbout *out, long long *off_of_translation_p);
static int write_header (struct dbout *out, long long translation_location_on_disk, long long translation_size_on_disk); static int write_header (struct dbout *out, long long translation_location_on_disk, long long translation_size_on_disk);
...@@ -2316,7 +2316,7 @@ static int toku_loader_write_brt_from_q (BRTLOADER bl, ...@@ -2316,7 +2316,7 @@ static int toku_loader_write_brt_from_q (BRTLOADER bl,
break; break;
} }
cilk_spawn finish_leafnode(&out, lbuf, progress_this_node, bl, target_basementnodesize); cilk_spawn finish_leafnode(&out, lbuf, progress_this_node, bl, target_basementnodesize, target_compression_method);
lbuf = NULL; lbuf = NULL;
r = allocate_block(&out, &lblock); r = allocate_block(&out, &lblock);
...@@ -2354,7 +2354,7 @@ static int toku_loader_write_brt_from_q (BRTLOADER bl, ...@@ -2354,7 +2354,7 @@ static int toku_loader_write_brt_from_q (BRTLOADER bl,
allocate_node(&sts, lblock); allocate_node(&sts, lblock);
{ {
int p = progress_allocation/2; int p = progress_allocation/2;
finish_leafnode(&out, lbuf, p, bl, target_basementnodesize); finish_leafnode(&out, lbuf, p, bl, target_basementnodesize, target_compression_method);
progress_allocation -= p; progress_allocation -= p;
} }
} }
...@@ -2380,7 +2380,7 @@ static int toku_loader_write_brt_from_q (BRTLOADER bl, ...@@ -2380,7 +2380,7 @@ static int toku_loader_write_brt_from_q (BRTLOADER bl,
} }
} }
r = write_nonleaves(bl, pivots_file, &out, &sts, descriptor, target_nodesize, target_basementnodesize); r = write_nonleaves(bl, pivots_file, &out, &sts, descriptor, target_nodesize, target_basementnodesize, target_compression_method);
if (r) { if (r) {
result = r; goto error; result = r; goto error;
} }
...@@ -2710,14 +2710,14 @@ static int write_literal(struct dbout *out, void*data, size_t len) { ...@@ -2710,14 +2710,14 @@ static int write_literal(struct dbout *out, void*data, size_t len) {
return result; return result;
} }
static void finish_leafnode (struct dbout *out, struct leaf_buf *lbuf, int progress_allocation, BRTLOADER bl, uint32_t target_basementnodesize) { static void finish_leafnode (struct dbout *out, struct leaf_buf *lbuf, int progress_allocation, BRTLOADER bl, uint32_t target_basementnodesize, enum toku_compression_method target_compression_method) {
int result = 0; int result = 0;
// serialize leaf to buffer // serialize leaf to buffer
size_t serialized_leaf_size = 0; size_t serialized_leaf_size = 0;
char *serialized_leaf = NULL; char *serialized_leaf = NULL;
BRTNODE_DISK_DATA ndd = NULL; BRTNODE_DISK_DATA ndd = NULL;
result = toku_serialize_brtnode_to_memory(lbuf->node, &ndd, target_basementnodesize, TRUE, TRUE, &serialized_leaf_size, &serialized_leaf); result = toku_serialize_brtnode_to_memory(lbuf->node, &ndd, target_basementnodesize, target_compression_method, TRUE, TRUE, &serialized_leaf_size, &serialized_leaf);
// write it out // write it out
if (result == 0) { if (result == 0) {
...@@ -2895,7 +2895,7 @@ static int setup_nonleaf_block (int n_children, ...@@ -2895,7 +2895,7 @@ static int setup_nonleaf_block (int n_children,
static void write_nonleaf_node (BRTLOADER bl, struct dbout *out, int64_t blocknum_of_new_node, int n_children, static void write_nonleaf_node (BRTLOADER bl, struct dbout *out, int64_t blocknum_of_new_node, int n_children,
DBT *pivots, /* must free this array, as well as the things it points t */ DBT *pivots, /* must free this array, as well as the things it points t */
struct subtree_info *subtree_info, int height, const DESCRIPTOR UU(desc), uint32_t target_nodesize, uint32_t target_basementnodesize) struct subtree_info *subtree_info, int height, const DESCRIPTOR UU(desc), uint32_t target_nodesize, uint32_t target_basementnodesize, enum toku_compression_method target_compression_method)
{ {
//Nodes do not currently touch descriptors //Nodes do not currently touch descriptors
invariant(height > 0); invariant(height > 0);
...@@ -2904,7 +2904,7 @@ static void write_nonleaf_node (BRTLOADER bl, struct dbout *out, int64_t blocknu ...@@ -2904,7 +2904,7 @@ static void write_nonleaf_node (BRTLOADER bl, struct dbout *out, int64_t blocknu
BRTNODE XMALLOC(node); BRTNODE XMALLOC(node);
toku_initialize_empty_brtnode(node, make_blocknum(blocknum_of_new_node), height, n_children, toku_initialize_empty_brtnode(node, make_blocknum(blocknum_of_new_node), height, n_children,
BRT_LAYOUT_VERSION, target_nodesize, 0, out->h); BRT_LAYOUT_VERSION, target_nodesize, 0);
node->totalchildkeylens = 0; node->totalchildkeylens = 0;
for (int i=0; i<n_children-1; i++) { for (int i=0; i<n_children-1; i++) {
toku_clone_dbt(&node->childkeys[i], pivots[i]); toku_clone_dbt(&node->childkeys[i], pivots[i]);
...@@ -2921,7 +2921,7 @@ static void write_nonleaf_node (BRTLOADER bl, struct dbout *out, int64_t blocknu ...@@ -2921,7 +2921,7 @@ static void write_nonleaf_node (BRTLOADER bl, struct dbout *out, int64_t blocknu
size_t n_bytes; size_t n_bytes;
char *bytes; char *bytes;
int r; int r;
r = toku_serialize_brtnode_to_memory(node, &ndd, target_basementnodesize, TRUE, TRUE, &n_bytes, &bytes); r = toku_serialize_brtnode_to_memory(node, &ndd, target_basementnodesize, target_compression_method, TRUE, TRUE, &n_bytes, &bytes);
if (r) { if (r) {
result = r; result = r;
} else { } else {
...@@ -2958,7 +2958,7 @@ static void write_nonleaf_node (BRTLOADER bl, struct dbout *out, int64_t blocknu ...@@ -2958,7 +2958,7 @@ static void write_nonleaf_node (BRTLOADER bl, struct dbout *out, int64_t blocknu
brt_loader_set_panic(bl, result, TRUE); brt_loader_set_panic(bl, result, TRUE);
} }
static int write_nonleaves (BRTLOADER bl, FIDX pivots_fidx, struct dbout *out, struct subtrees_info *sts, const DESCRIPTOR descriptor, uint32_t target_nodesize, uint32_t target_basementnodesize) { static int write_nonleaves (BRTLOADER bl, FIDX pivots_fidx, struct dbout *out, struct subtrees_info *sts, const DESCRIPTOR descriptor, uint32_t target_nodesize, uint32_t target_basementnodesize, enum toku_compression_method target_compression_method) {
int result = 0; int result = 0;
int height = 1; int height = 1;
...@@ -3006,7 +3006,7 @@ static int write_nonleaves (BRTLOADER bl, FIDX pivots_fidx, struct dbout *out, s ...@@ -3006,7 +3006,7 @@ static int write_nonleaves (BRTLOADER bl, FIDX pivots_fidx, struct dbout *out, s
result = r; result = r;
break; break;
} else { } else {
cilk_spawn write_nonleaf_node(bl, out, blocknum_of_new_node, n_per_block, pivots, subtree_info, height, descriptor, target_nodesize, target_basementnodesize); // frees all the data structures that go into making the node. cilk_spawn write_nonleaf_node(bl, out, blocknum_of_new_node, n_per_block, pivots, subtree_info, height, descriptor, target_nodesize, target_basementnodesize, target_compression_method); // frees all the data structures that go into making the node.
n_subtrees_used += n_per_block; n_subtrees_used += n_per_block;
} }
} }
...@@ -3029,7 +3029,7 @@ static int write_nonleaves (BRTLOADER bl, FIDX pivots_fidx, struct dbout *out, s ...@@ -3029,7 +3029,7 @@ static int write_nonleaves (BRTLOADER bl, FIDX pivots_fidx, struct dbout *out, s
if (r) { if (r) {
result = r; result = r;
} else { } else {
cilk_spawn write_nonleaf_node(bl, out, blocknum_of_new_node, n_first, pivots, subtree_info, height, descriptor, target_nodesize, target_basementnodesize); cilk_spawn write_nonleaf_node(bl, out, blocknum_of_new_node, n_first, pivots, subtree_info, height, descriptor, target_nodesize, target_basementnodesize, target_compression_method);
n_blocks_left -= n_first; n_blocks_left -= n_first;
n_subtrees_used += n_first; n_subtrees_used += n_first;
} }
...@@ -3048,7 +3048,7 @@ static int write_nonleaves (BRTLOADER bl, FIDX pivots_fidx, struct dbout *out, s ...@@ -3048,7 +3048,7 @@ static int write_nonleaves (BRTLOADER bl, FIDX pivots_fidx, struct dbout *out, s
if (r) { if (r) {
result = r; result = r;
} else { } else {
cilk_spawn write_nonleaf_node(bl, out, blocknum_of_new_node, n_blocks_left, pivots, subtree_info, height, descriptor, target_nodesize, target_basementnodesize); cilk_spawn write_nonleaf_node(bl, out, blocknum_of_new_node, n_blocks_left, pivots, subtree_info, height, descriptor, target_nodesize, target_basementnodesize, target_compression_method);
n_subtrees_used += n_blocks_left; n_subtrees_used += n_blocks_left;
} }
} }
......
...@@ -273,7 +273,7 @@ flush_to_internal(BRT t) { ...@@ -273,7 +273,7 @@ flush_to_internal(BRT t) {
BRTNODE XMALLOC(child); BRTNODE XMALLOC(child);
BLOCKNUM blocknum = { 42 }; BLOCKNUM blocknum = { 42 };
toku_initialize_empty_brtnode(child, blocknum, 1, 1, BRT_LAYOUT_VERSION, 128*1024, 0, my_header); toku_initialize_empty_brtnode(child, blocknum, 1, 1, BRT_LAYOUT_VERSION, 128*1024, 0);
destroy_nonleaf_childinfo(BNC(child, 0)); destroy_nonleaf_childinfo(BNC(child, 0));
set_BNC(child, 0, child_bnc); set_BNC(child, 0, child_bnc);
BP_STATE(child, 0) = PT_AVAIL; BP_STATE(child, 0) = PT_AVAIL;
...@@ -403,7 +403,7 @@ flush_to_internal_multiple(BRT t) { ...@@ -403,7 +403,7 @@ flush_to_internal_multiple(BRT t) {
BRTNODE XMALLOC(child); BRTNODE XMALLOC(child);
BLOCKNUM blocknum = { 42 }; BLOCKNUM blocknum = { 42 };
toku_initialize_empty_brtnode(child, blocknum, 1, 8, BRT_LAYOUT_VERSION, 128*1024, 0, my_header); toku_initialize_empty_brtnode(child, blocknum, 1, 8, BRT_LAYOUT_VERSION, 128*1024, 0);
for (i = 0; i < 8; ++i) { for (i = 0; i < 8; ++i) {
destroy_nonleaf_childinfo(BNC(child, i)); destroy_nonleaf_childinfo(BNC(child, i));
set_BNC(child, i, child_bncs[i]); set_BNC(child, i, child_bncs[i]);
...@@ -534,7 +534,7 @@ flush_to_leaf(BRT t, bool make_leaf_up_to_date, bool use_flush) { ...@@ -534,7 +534,7 @@ flush_to_leaf(BRT t, bool make_leaf_up_to_date, bool use_flush) {
BRTNODE XMALLOC(child); BRTNODE XMALLOC(child);
BLOCKNUM blocknum = { 42 }; BLOCKNUM blocknum = { 42 };
toku_initialize_empty_brtnode(child, blocknum, 0, 8, BRT_LAYOUT_VERSION, 128*1024, 0, my_header); toku_initialize_empty_brtnode(child, blocknum, 0, 8, BRT_LAYOUT_VERSION, 128*1024, 0);
for (i = 0; i < 8; ++i) { for (i = 0; i < 8; ++i) {
destroy_basement_node(BLB(child, i)); destroy_basement_node(BLB(child, i));
set_BLB(child, i, child_blbs[i]); set_BLB(child, i, child_blbs[i]);
...@@ -610,7 +610,7 @@ flush_to_leaf(BRT t, bool make_leaf_up_to_date, bool use_flush) { ...@@ -610,7 +610,7 @@ flush_to_leaf(BRT t, bool make_leaf_up_to_date, bool use_flush) {
} else { } else {
BRTNODE XMALLOC(parentnode); BRTNODE XMALLOC(parentnode);
BLOCKNUM parentblocknum = { 17 }; BLOCKNUM parentblocknum = { 17 };
toku_initialize_empty_brtnode(parentnode, parentblocknum, 1, 1, BRT_LAYOUT_VERSION, 128*1024, 0, my_header); toku_initialize_empty_brtnode(parentnode, parentblocknum, 1, 1, BRT_LAYOUT_VERSION, 128*1024, 0);
destroy_nonleaf_childinfo(BNC(parentnode, 0)); destroy_nonleaf_childinfo(BNC(parentnode, 0));
set_BNC(parentnode, 0, parent_bnc); set_BNC(parentnode, 0, parent_bnc);
BP_STATE(parentnode, 0) = PT_AVAIL; BP_STATE(parentnode, 0) = PT_AVAIL;
...@@ -761,7 +761,7 @@ flush_to_leaf_with_keyrange(BRT t, bool make_leaf_up_to_date) { ...@@ -761,7 +761,7 @@ flush_to_leaf_with_keyrange(BRT t, bool make_leaf_up_to_date) {
BRTNODE XMALLOC(child); BRTNODE XMALLOC(child);
BLOCKNUM blocknum = { 42 }; BLOCKNUM blocknum = { 42 };
toku_initialize_empty_brtnode(child, blocknum, 0, 8, BRT_LAYOUT_VERSION, 128*1024, 0, my_header); toku_initialize_empty_brtnode(child, blocknum, 0, 8, BRT_LAYOUT_VERSION, 128*1024, 0);
for (i = 0; i < 8; ++i) { for (i = 0; i < 8; ++i) {
destroy_basement_node(BLB(child, i)); destroy_basement_node(BLB(child, i));
set_BLB(child, i, child_blbs[i]); set_BLB(child, i, child_blbs[i]);
...@@ -832,7 +832,7 @@ flush_to_leaf_with_keyrange(BRT t, bool make_leaf_up_to_date) { ...@@ -832,7 +832,7 @@ flush_to_leaf_with_keyrange(BRT t, bool make_leaf_up_to_date) {
BRTNODE XMALLOC(parentnode); BRTNODE XMALLOC(parentnode);
BLOCKNUM parentblocknum = { 17 }; BLOCKNUM parentblocknum = { 17 };
toku_initialize_empty_brtnode(parentnode, parentblocknum, 1, 1, BRT_LAYOUT_VERSION, 128*1024, 0, my_header); toku_initialize_empty_brtnode(parentnode, parentblocknum, 1, 1, BRT_LAYOUT_VERSION, 128*1024, 0);
destroy_nonleaf_childinfo(BNC(parentnode, 0)); destroy_nonleaf_childinfo(BNC(parentnode, 0));
set_BNC(parentnode, 0, parent_bnc); set_BNC(parentnode, 0, parent_bnc);
BP_STATE(parentnode, 0) = PT_AVAIL; BP_STATE(parentnode, 0) = PT_AVAIL;
...@@ -944,8 +944,8 @@ compare_apply_and_flush(BRT t, bool make_leaf_up_to_date) { ...@@ -944,8 +944,8 @@ compare_apply_and_flush(BRT t, bool make_leaf_up_to_date) {
BRTNODE XMALLOC(child1), XMALLOC(child2); BRTNODE XMALLOC(child1), XMALLOC(child2);
BLOCKNUM blocknum = { 42 }; BLOCKNUM blocknum = { 42 };
toku_initialize_empty_brtnode(child1, blocknum, 0, 8, BRT_LAYOUT_VERSION, 128*1024, 0, my_header); toku_initialize_empty_brtnode(child1, blocknum, 0, 8, BRT_LAYOUT_VERSION, 128*1024, 0);
toku_initialize_empty_brtnode(child2, blocknum, 0, 8, BRT_LAYOUT_VERSION, 128*1024, 0, my_header); toku_initialize_empty_brtnode(child2, blocknum, 0, 8, BRT_LAYOUT_VERSION, 128*1024, 0);
for (i = 0; i < 8; ++i) { for (i = 0; i < 8; ++i) {
destroy_basement_node(BLB(child1, i)); destroy_basement_node(BLB(child1, i));
set_BLB(child1, i, child1_blbs[i]); set_BLB(child1, i, child1_blbs[i]);
...@@ -1020,7 +1020,7 @@ compare_apply_and_flush(BRT t, bool make_leaf_up_to_date) { ...@@ -1020,7 +1020,7 @@ compare_apply_and_flush(BRT t, bool make_leaf_up_to_date) {
BRTNODE XMALLOC(parentnode); BRTNODE XMALLOC(parentnode);
BLOCKNUM parentblocknum = { 17 }; BLOCKNUM parentblocknum = { 17 };
toku_initialize_empty_brtnode(parentnode, parentblocknum, 1, 1, BRT_LAYOUT_VERSION, 128*1024, 0, my_header); toku_initialize_empty_brtnode(parentnode, parentblocknum, 1, 1, BRT_LAYOUT_VERSION, 128*1024, 0);
destroy_nonleaf_childinfo(BNC(parentnode, 0)); destroy_nonleaf_childinfo(BNC(parentnode, 0));
set_BNC(parentnode, 0, parent_bnc); set_BNC(parentnode, 0, parent_bnc);
BP_STATE(parentnode, 0) = PT_AVAIL; BP_STATE(parentnode, 0) = PT_AVAIL;
......
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