Commit cc10b7c7 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel
Browse files

[t:4775], remove NONLEAF_CHILDINFO->n_bytes_in_buffer

git-svn-id: file:///svn/toku/tokudb@42751 c7de825b-a66e-492c-adef-691d508d4ae1
parent 50f371cc
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -127,7 +127,6 @@ struct brtnode_nonleaf_childinfo {
    OMT broadcast_list;
    OMT fresh_message_tree;
    OMT stale_message_tree;
    unsigned int n_bytes_in_buffer; /* How many bytes are in each buffer (including overheads for the disk-representation) */
};

unsigned int toku_bnc_nbytesinbuf(NONLEAF_CHILDINFO bnc);
+0 −9
Original line number Diff line number Diff line
@@ -932,7 +932,6 @@ static void
deserialize_child_buffer(NONLEAF_CHILDINFO bnc, struct rbuf *rbuf,
                         DESCRIPTOR desc, brt_compare_func cmp) {
    int r;
    int n_bytes_in_buffer = 0;
    int n_in_this_buffer = rbuf_int(rbuf);
    void **fresh_offsets, **stale_offsets;
    void **broadcast_offsets;
@@ -977,7 +976,6 @@ deserialize_child_buffer(NONLEAF_CHILDINFO bnc, struct rbuf *rbuf,
        }
        r = toku_fifo_enq(bnc->buffer, key, keylen, val, vallen, type, msn, xids, is_fresh, dest); /* Copies the data into the fifo */
        lazy_assert_zero(r);
        n_bytes_in_buffer += keylen + vallen + KEY_VALUE_OVERHEAD + BRT_CMD_OVERHEAD + xids_get_serialize_size(xids);
        //printf("Inserted\n");
        xids_destroy(&xids);
    }
@@ -999,7 +997,6 @@ deserialize_child_buffer(NONLEAF_CHILDINFO bnc, struct rbuf *rbuf,
        r = toku_omt_create_steal_sorted_array(&bnc->broadcast_list, &broadcast_offsets, nbroadcast_offsets, n_in_this_buffer);
        assert_zero(r);
    }
    bnc->n_bytes_in_buffer = n_bytes_in_buffer;
}

// dump a buffer to stderr
@@ -1095,7 +1092,6 @@ BASEMENTNODE toku_create_empty_bn_no_buffer(void) {

NONLEAF_CHILDINFO toku_create_empty_nl(void) {
    NONLEAF_CHILDINFO XMALLOC(cn);
    cn->n_bytes_in_buffer = 0;
    int r = toku_fifo_create(&cn->buffer); assert_zero(r);
    r = toku_omt_create(&cn->fresh_message_tree); assert_zero(r);
    r = toku_omt_create(&cn->stale_message_tree); assert_zero(r);
@@ -1106,7 +1102,6 @@ NONLEAF_CHILDINFO toku_create_empty_nl(void) {
// does NOT create OMTs, just the FIFO
NONLEAF_CHILDINFO toku_clone_nl(NONLEAF_CHILDINFO orig_childinfo) {
    NONLEAF_CHILDINFO XMALLOC(cn);
    cn->n_bytes_in_buffer = orig_childinfo->n_bytes_in_buffer;    
    cn->fresh_message_tree = NULL;
    cn->stale_message_tree = NULL;
    cn->broadcast_list = NULL;
@@ -1779,7 +1774,6 @@ deserialize_and_upgrade_internal_node(BRTNODE node,
    // Deserialize de-compressed buffers.
    for (int i = 0; i < node->n_children; ++i) {
        NONLEAF_CHILDINFO bnc = BNC(node, i);
        int n_bytes_in_buffer = 0;
        int n_in_this_buffer = rbuf_int(rb);

        void **fresh_offsets;
@@ -1843,7 +1837,6 @@ deserialize_and_upgrade_internal_node(BRTNODE node,
                              true,
                              dest);
            lazy_assert_zero(r);
            n_bytes_in_buffer += keylen + vallen + BRT_CMD_OVERHEAD + KEY_VALUE_OVERHEAD + xids_get_serialize_size(xids);
            xids_destroy(&xids);
        }

@@ -1870,8 +1863,6 @@ deserialize_and_upgrade_internal_node(BRTNODE node,
                                                   n_in_this_buffer);
            assert_zero(r);
        }

        bnc->n_bytes_in_buffer = n_bytes_in_buffer;
    }

    // Assign the highest msn from our upgrade message FIFO queues.
+2 −4
Original line number Diff line number Diff line
@@ -288,7 +288,7 @@ get_node_reactivity (BRTNODE node) {
unsigned int
toku_bnc_nbytesinbuf(NONLEAF_CHILDINFO bnc)
{
    return bnc->n_bytes_in_buffer;
    return toku_fifo_buffer_size_in_use(bnc->buffer);
}

// return TRUE if the size of the buffers plus the amount of work done is large enough.   (But return false if there is nothing to be flushed (the buffers empty)).
@@ -2024,7 +2024,6 @@ toku_bnc_insert_msg(NONLEAF_CHILDINFO bnc, const void *key, ITEMLEN keylen, cons
//
// This is only exported for tests.
{
    int diff = keylen + datalen + KEY_VALUE_OVERHEAD + BRT_CMD_OVERHEAD + xids_get_serialize_size(xids);
    long offset;
    int r = toku_fifo_enq(bnc->buffer, key, keylen, data, datalen, type, msn, xids, is_fresh, &offset);
    assert_zero(r);
@@ -2044,7 +2043,6 @@ toku_bnc_insert_msg(NONLEAF_CHILDINFO bnc, const void *key, ITEMLEN keylen, cons
    } else {
        assert(FALSE);
    }
    bnc->n_bytes_in_buffer += diff;
    return r;
}

@@ -2456,7 +2454,7 @@ toku_bnc_flush_to_child(
                                     logger->live_root_txns);
            assert_zero(r);
            // take advantage of surrounding mutex, update stats.
            size_t buffsize = bnc->n_bytes_in_buffer;
            size_t buffsize = toku_fifo_buffer_size_in_use(bnc->buffer);
            STATUS_VALUE(BRT_MSG_BYTES_OUT) += buffsize;
            // may be misleading if there's a broadcast message in there
            STATUS_VALUE(BRT_MSG_BYTES_CURR) -= buffsize;
+5 −0
Original line number Diff line number Diff line
@@ -148,6 +148,11 @@ void toku_fifo_size_is_stabilized(FIFO fifo) {
    }
}


unsigned int toku_fifo_buffer_size_in_use (FIFO fifo) {
    return fifo->memory_used;
}

unsigned long toku_fifo_memory_size_in_use(FIFO fifo) {
    return sizeof(*fifo)+fifo->memory_used;
}
+3 −0
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ int toku_fifo_enq (FIFO, const void *key, ITEMLEN keylen, const void *data, ITEM

// int toku_fifo_peek_cmdstruct (FIFO, BRT_MSG, DBT*, DBT*); // fill in the BRT_MSG, using the two DBTs for the DBT part.
                          // THIS ONLY REMAINS FOR TESTING, DO NOT USE IT IN CODE
unsigned int toku_fifo_buffer_size_in_use (FIFO fifo);
unsigned long toku_fifo_memory_size_in_use(FIFO fifo);  // return how much memory in the fifo holds useful data

unsigned long toku_fifo_memory_footprint(FIFO fifo);  // return how much memory the fifo occupies
@@ -105,6 +106,8 @@ void toku_fifo_clone(FIFO orig_fifo, FIFO* cloned_fifo);

BOOL toku_are_fifos_same(FIFO fifo1, FIFO fifo2);



#if defined(__cplusplus) || defined(__cilkplusplus)
};
#endif
Loading