Don't flush if not necessary
This commit is contained in:
parent
4b04226162
commit
628f4edec0
@ -115,7 +115,6 @@ void DataTree::traverseLeaves(uint32_t beginIndex, uint32_t endIndex, function<v
|
|||||||
const_cast<const DataTree*>(this)->traverseLeaves(beginIndex, endIndex, [func](const DataLeafNode* leaf, uint32_t leafIndex) {
|
const_cast<const DataTree*>(this)->traverseLeaves(beginIndex, endIndex, [func](const DataLeafNode* leaf, uint32_t leafIndex) {
|
||||||
func(const_cast<DataLeafNode*>(leaf), leafIndex);
|
func(const_cast<DataLeafNode*>(leaf), leafIndex);
|
||||||
});
|
});
|
||||||
flush();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataTree::traverseLeaves(uint32_t beginIndex, uint32_t endIndex, function<void (const DataLeafNode*, uint32_t)> func) const {
|
void DataTree::traverseLeaves(uint32_t beginIndex, uint32_t endIndex, function<void (const DataLeafNode*, uint32_t)> func) const {
|
||||||
@ -196,7 +195,6 @@ void DataTree::resizeNumBytes(uint64_t newNumBytes) {
|
|||||||
}
|
}
|
||||||
uint32_t newLastLeafSize = newNumBytes - (newNumLeaves-1)*_nodeStore->layout().maxBytesPerLeaf();
|
uint32_t newLastLeafSize = newNumBytes - (newNumLeaves-1)*_nodeStore->layout().maxBytesPerLeaf();
|
||||||
LastLeaf(_rootNode.get())->resize(newLastLeafSize);
|
LastLeaf(_rootNode.get())->resize(newLastLeafSize);
|
||||||
flush();
|
|
||||||
}
|
}
|
||||||
assert(newNumBytes == numStoredBytes());
|
assert(newNumBytes == numStoredBytes());
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,8 @@ public:
|
|||||||
|
|
||||||
uint64_t numStoredBytes() const;
|
uint64_t numStoredBytes() const;
|
||||||
|
|
||||||
|
void flush() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mutable boost::shared_mutex _mutex;
|
mutable boost::shared_mutex _mutex;
|
||||||
datanodestore::DataNodeStore *_nodeStore;
|
datanodestore::DataNodeStore *_nodeStore;
|
||||||
@ -61,8 +63,6 @@ private:
|
|||||||
cpputils::optional_ownership_ptr<datanodestore::DataLeafNode> LastLeaf(datanodestore::DataNode *root);
|
cpputils::optional_ownership_ptr<datanodestore::DataLeafNode> LastLeaf(datanodestore::DataNode *root);
|
||||||
std::unique_ptr<datanodestore::DataLeafNode> LastLeaf(std::unique_ptr<datanodestore::DataNode> root);
|
std::unique_ptr<datanodestore::DataLeafNode> LastLeaf(std::unique_ptr<datanodestore::DataNode> root);
|
||||||
|
|
||||||
void flush() const;
|
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(DataTree);
|
DISALLOW_COPY_AND_ASSIGN(DataTree);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user