Put newly-created nodes in the treeNodeCache

This commit is contained in:
JoelKatz
2014-05-11 21:45:51 -07:00
committed by Vinnie Falco
parent eed66894db
commit 294a13d653

View File

@@ -1133,15 +1133,17 @@ int SHAMap::flushDirty (DirtySet& set, int maxNodes, NodeObjectType t, std::uint
#endif
getApp().getNodeStore ().store (t, seq, std::move (s.modData ()), nodeHash);
if (getApp().running ())
if (node->getSeq () != 0)
{
// Put the canonical version into the SHAMap and the treeNodeCache
mTNByID.erase (*node);
fetchNodeExternal (*node, nodeHash);
// Node is not shareable
// Make and share a shareable copy
node = boost::make_shared <SHAMapTreeNode> (*node, 0);
canonicalize (node->getNodeHash(), node);
mTNByID.replace (*node, node);
}
getApp().getNodeStore ().store (t, seq, std::move (s.modData ()), nodeHash);
if (flushed++ >= maxNodes)
return flushed;
}