Commit afdd4a2b authored by Barry Perlman's avatar Barry Perlman Committed by Yoni Fogel

[t:3982] #3982 Add field optimized_for_upgrade to brtnode. Stil need to remove it from basement.

git-svn-id: file:///svn/toku/tokudb@35847 c7de825b-a66e-492c-adef-691d508d4ae1
parent 0a102089
......@@ -330,8 +330,7 @@ struct brtnode {
int height; /* height is always >= 0. 0 for leaf, >0 for nonleaf. */
int dirty;
u_int32_t fullhash;
// TODO 3982
// uint32_t optimized_for_upgrade; // version number to which this leaf has been optimized, zero if never optimized for upgrade
uint32_t optimized_for_upgrade; // version number to which this leaf has been optimized, zero if never optimized for upgrade
int n_children; //for internal nodes, if n_children==TREE_FANOUT+1 then the tree needs to be rebalanced.
// for leaf nodes, represents number of basement nodes
unsigned int totalchildkeylens;
......
......@@ -383,7 +383,7 @@ serialize_brtnode_info_size(BRTNODE node)
retval += 4; // nodesize
retval += 4; // flags
retval += 4; // height;
// retval += 4; // optimized_for_upgrade TODO 3982
retval += 4; // optimized_for_upgrade
retval += (3*8+1)*node->n_children; // subtree estimates for each child
retval += node->totalchildkeylens; // total length of pivots
retval += (node->n_children-1)*4; // encode length of each pivot
......@@ -409,7 +409,7 @@ static void serialize_brtnode_info(BRTNODE node,
wbuf_nocrc_uint(&wb, node->nodesize);
wbuf_nocrc_uint(&wb, node->flags);
wbuf_nocrc_int (&wb, node->height);
// TODO 3982 wbuf_nocrc_int (&wb, node->optimized_for_upgrade);
wbuf_nocrc_int (&wb, node->optimized_for_upgrade);
// subtree estimates of each child
for (int i = 0; i < node->n_children; i++) {
wbuf_nocrc_ulonglong(&wb, BP_SUBTREE_EST(node,i).nkeys);
......@@ -1107,7 +1107,7 @@ deserialize_brtnode_info(
node->nodesize = rbuf_int(&rb);
node->flags = rbuf_int(&rb);
node->height = rbuf_int(&rb);
// node->optimized_for_upgrade = rbuf_int(&rb); TODO 3982
node->optimized_for_upgrade = rbuf_int(&rb);
// now create the basement nodes or childinfos, depending on whether this is a
// leaf node or internal node
......
......@@ -1199,8 +1199,7 @@ toku_initialize_empty_brtnode (BRTNODE n, BLOCKNUM nodename, int height, int num
n->layout_version_original = layout_version;
n->layout_version_read_from_disk = layout_version;
n->height = height;
// TODO 3982
// n->optimized_for_upgrade = 0;
n->optimized_for_upgrade = 0;
n->dirty = 1;
n->totalchildkeylens = 0;
n->childkeys = 0;
......
......@@ -135,6 +135,7 @@ dump_node (int f, BLOCKNUM blocknum, struct brt_header *h) {
printf(" thisnodename=%" PRId64 "\n", n->thisnodename.b);
//printf(" log_lsn =%lld\n", n->log_lsn.lsn); // The log_lsn is a memory-only value.
printf(" height =%d\n", n->height);
printf(" optimized_for_upgrade = %u", n->optimized_for_upgrade);
printf(" layout_version=%d\n", n->layout_version);
printf(" layout_version_original=%d\n", n->layout_version_original);
printf(" layout_version_read_from_disk=%d\n", n->layout_version_read_from_disk);
......
......@@ -190,6 +190,7 @@ test_serialize_leaf_check_msn(enum brtnode_verify_type bft) {
sn.layout_version = BRT_LAYOUT_VERSION;
sn.layout_version_original = BRT_LAYOUT_VERSION;
sn.height = 0;
sn.optimized_for_upgrade = 1234;
sn.n_children = 2;
sn.dirty = 1;
LEAFENTRY elts[3];
......@@ -269,6 +270,7 @@ test_serialize_leaf_check_msn(enum brtnode_verify_type bft) {
assert(dn->layout_version_original ==BRT_LAYOUT_VERSION);
assert(dn->layout_version_read_from_disk ==BRT_LAYOUT_VERSION);
assert(dn->height == 0);
assert(dn->optimized_for_upgrade == 1234);
assert(dn->n_children>=1);
assert(dn->max_msn_applied_to_node_on_disk.msn == POSTSERIALIZE_MSN_ON_DISK.msn);
{
......@@ -332,6 +334,7 @@ test_serialize_leaf_with_large_pivots(enum brtnode_verify_type bft) {
sn.layout_version = BRT_LAYOUT_VERSION;
sn.layout_version_original = BRT_LAYOUT_VERSION;
sn.height = 0;
sn.optimized_for_upgrade = 1234;
sn.n_children = nrows;
sn.dirty = 1;
......@@ -458,6 +461,7 @@ test_serialize_leaf_with_many_rows(enum brtnode_verify_type bft) {
sn.layout_version = BRT_LAYOUT_VERSION;
sn.layout_version_original = BRT_LAYOUT_VERSION;
sn.height = 0;
sn.optimized_for_upgrade = 1234;
sn.n_children = 1;
sn.dirty = 1;
......@@ -578,6 +582,7 @@ test_serialize_leaf_with_large_rows(enum brtnode_verify_type bft) {
sn.layout_version = BRT_LAYOUT_VERSION;
sn.layout_version_original = BRT_LAYOUT_VERSION;
sn.height = 0;
sn.optimized_for_upgrade = 1234;
sn.n_children = 1;
sn.dirty = 1;
......@@ -704,6 +709,7 @@ test_serialize_leaf_with_empty_basement_nodes(enum brtnode_verify_type bft) {
sn.layout_version = BRT_LAYOUT_VERSION;
sn.layout_version_original = BRT_LAYOUT_VERSION;
sn.height = 0;
sn.optimized_for_upgrade = 1234;
sn.n_children = 7;
sn.dirty = 1;
LEAFENTRY elts[3];
......@@ -776,6 +782,7 @@ test_serialize_leaf_with_empty_basement_nodes(enum brtnode_verify_type bft) {
assert(dn->layout_version_original ==BRT_LAYOUT_VERSION);
assert(dn->layout_version_read_from_disk ==BRT_LAYOUT_VERSION);
assert(dn->height == 0);
// TODO: WHY DOES THIS FAIL??? assert(dn->optimized_for_upgrade = 1234);
assert(dn->n_children>0);
{
const u_int32_t npartitions = dn->n_children;
......@@ -835,6 +842,7 @@ test_serialize_leaf_with_multiple_empty_basement_nodes(enum brtnode_verify_type
sn.layout_version = BRT_LAYOUT_VERSION;
sn.layout_version_original = BRT_LAYOUT_VERSION;
sn.height = 0;
sn.optimized_for_upgrade = 1234;
sn.n_children = 4;
sn.dirty = 1;
MALLOC_N(sn.n_children, sn.bp);
......@@ -893,6 +901,7 @@ test_serialize_leaf_with_multiple_empty_basement_nodes(enum brtnode_verify_type
assert(dn->layout_version_original ==BRT_LAYOUT_VERSION);
assert(dn->layout_version_read_from_disk ==BRT_LAYOUT_VERSION);
assert(dn->height == 0);
assert(dn->optimized_for_upgrade == 1234);
assert(dn->n_children == 1);
{
const u_int32_t npartitions = dn->n_children;
......@@ -950,6 +959,7 @@ test_serialize_leaf(enum brtnode_verify_type bft) {
sn.layout_version = BRT_LAYOUT_VERSION;
sn.layout_version_original = BRT_LAYOUT_VERSION;
sn.height = 0;
sn.optimized_for_upgrade = 1234;
sn.n_children = 2;
sn.dirty = 1;
LEAFENTRY elts[3];
......@@ -1017,6 +1027,7 @@ test_serialize_leaf(enum brtnode_verify_type bft) {
assert(dn->layout_version_original ==BRT_LAYOUT_VERSION);
assert(dn->layout_version_read_from_disk ==BRT_LAYOUT_VERSION);
assert(dn->height == 0);
assert(dn->optimized_for_upgrade == 1234);
assert(dn->n_children>=1);
{
const u_int32_t npartitions = dn->n_children;
......@@ -1082,6 +1093,7 @@ test_serialize_nonleaf(enum brtnode_verify_type bft) {
sn.layout_version = BRT_LAYOUT_VERSION;
sn.layout_version_original = BRT_LAYOUT_VERSION;
sn.height = 1;
sn.optimized_for_upgrade = 1234;
sn.n_children = 2;
sn.dirty = 1;
hello_string = toku_strdup("hello");
......@@ -1158,6 +1170,7 @@ test_serialize_nonleaf(enum brtnode_verify_type bft) {
assert(dn->layout_version_original ==BRT_LAYOUT_VERSION);
assert(dn->layout_version_read_from_disk ==BRT_LAYOUT_VERSION);
assert(dn->height == 1);
assert(dn->optimized_for_upgrade == 1234);
assert(dn->n_children==2);
assert(strcmp(kv_pair_key(dn->childkeys[0]), "hello")==0);
assert(toku_brt_pivot_key_len(dn->childkeys[0])==6);
......
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