Commit 09ae64c1 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

refs #5768, fix maintenence of stats numbytes during garbage collection

git-svn-id: file:///svn/toku/tokudb@50867 c7de825b-a66e-492c-adef-691d508d4ae1
parent b2c3b99c
...@@ -2182,6 +2182,10 @@ ft_basement_node_gc_once(BASEMENTNODE bn, ...@@ -2182,6 +2182,10 @@ ft_basement_node_gc_once(BASEMENTNODE bn,
// Cache the size of the leaf entry. // Cache the size of the leaf entry.
oldsize = leafentry_memsize(leaf_entry); oldsize = leafentry_memsize(leaf_entry);
// These will represent the number of bytes and rows changed as
// part of the garbage collection.
int64_t numbytes_delta;
int64_t numrows_delta;
toku_le_garbage_collect(leaf_entry, toku_le_garbage_collect(leaf_entry,
&new_leaf_entry, &new_leaf_entry,
&newsize, &newsize,
...@@ -2191,13 +2195,9 @@ ft_basement_node_gc_once(BASEMENTNODE bn, ...@@ -2191,13 +2195,9 @@ ft_basement_node_gc_once(BASEMENTNODE bn,
snapshot_xids, snapshot_xids,
referenced_xids, referenced_xids,
live_root_txns, live_root_txns,
oldest_known_referenced_xid); oldest_known_referenced_xid,
&numbytes_delta);
// These will represent the number of bytes and rows changed as
// part of the garbage collection.
int64_t numbytes_delta;
numbytes_delta = newsize - oldsize;
int64_t numrows_delta;
numrows_delta = 0; numrows_delta = 0;
if (new_leaf_entry) { if (new_leaf_entry) {
// If we have a new leaf entry, we must update the size of the // If we have a new leaf entry, we must update the size of the
......
...@@ -188,7 +188,8 @@ void toku_le_garbage_collect(LEAFENTRY old_leaf_entry, ...@@ -188,7 +188,8 @@ void toku_le_garbage_collect(LEAFENTRY old_leaf_entry,
const xid_omt_t &snapshot_xids, const xid_omt_t &snapshot_xids,
const rx_omt_t &referenced_xids, const rx_omt_t &referenced_xids,
const xid_omt_t &live_root_txns, const xid_omt_t &live_root_txns,
TXNID oldest_known_referenced_xid); TXNID oldest_known_referenced_xid,
int64_t * numbytes_delta_p);
#endif /* TOKU_LEAFENTRY_H */ #endif /* TOKU_LEAFENTRY_H */
...@@ -432,10 +432,15 @@ toku_le_garbage_collect(LEAFENTRY old_leaf_entry, ...@@ -432,10 +432,15 @@ toku_le_garbage_collect(LEAFENTRY old_leaf_entry,
const xid_omt_t &snapshot_xids, const xid_omt_t &snapshot_xids,
const rx_omt_t &referenced_xids, const rx_omt_t &referenced_xids,
const xid_omt_t &live_root_txns, const xid_omt_t &live_root_txns,
TXNID oldest_known_referenced_xid) { TXNID oldest_known_referenced_xid,
int64_t * numbytes_delta_p) {
ULE_S ule; ULE_S ule;
int64_t oldnumbytes = 0;
int64_t newnumbytes = 0;
le_unpack(&ule, old_leaf_entry); le_unpack(&ule, old_leaf_entry);
oldnumbytes = ule_get_innermost_numbytes(&ule);
// Before running garbage collection, try to promote the outermost provisional // Before running garbage collection, try to promote the outermost provisional
// entries to committed if its xid is older than the oldest possible live xid. // entries to committed if its xid is older than the oldest possible live xid.
// //
...@@ -453,6 +458,10 @@ toku_le_garbage_collect(LEAFENTRY old_leaf_entry, ...@@ -453,6 +458,10 @@ toku_le_garbage_collect(LEAFENTRY old_leaf_entry,
mp, mp,
maybe_free); maybe_free);
assert(r == 0); assert(r == 0);
if (new_leaf_entry) {
newnumbytes = ule_get_innermost_numbytes(&ule);
}
*numbytes_delta_p = newnumbytes - oldnumbytes;
ule_cleanup(&ule); ule_cleanup(&ule);
} }
......
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