Optimize version handling in mergeWithChild
This commit is contained in:
@@ -1623,7 +1623,7 @@ void mergeWithChild(Node *&self, WriteContext *tls, ConflictSet::Impl *impl,
|
|||||||
getSearchPathPrintable(child).c_str());
|
getSearchPathPrintable(child).c_str());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
InternalVersionT childMaxVersion = maxVersion(child, impl);
|
InternalVersionT childMaxVersion = self3->childMaxVersion[0];
|
||||||
|
|
||||||
// Construct new partial key for child
|
// Construct new partial key for child
|
||||||
memmove(child->partialKey() + self3->partialKeyLen + 1, child->partialKey(),
|
memmove(child->partialKey() + self3->partialKeyLen + 1, child->partialKey(),
|
||||||
@@ -1637,10 +1637,7 @@ void mergeWithChild(Node *&self, WriteContext *tls, ConflictSet::Impl *impl,
|
|||||||
|
|
||||||
// Max versions are stored in the parent, so we need to update it now
|
// Max versions are stored in the parent, so we need to update it now
|
||||||
// that we have a new parent.
|
// that we have a new parent.
|
||||||
setMaxVersion(child, impl, childMaxVersion);
|
setMaxVersion(child, impl, std::max(childMaxVersion, tls->zero));
|
||||||
if (child->parent) {
|
|
||||||
rezero(child->parent, tls->zero);
|
|
||||||
}
|
|
||||||
|
|
||||||
getInTree(self, impl) = child;
|
getInTree(self, impl) = child;
|
||||||
tls->release(self3);
|
tls->release(self3);
|
||||||
@@ -3728,6 +3725,7 @@ InternalVersionT exchangeMaxVersion(Node *n, InternalVersionT newMax) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setMaxVersion(Node *n, ConflictSet::Impl *impl, InternalVersionT newMax) {
|
void setMaxVersion(Node *n, ConflictSet::Impl *impl, InternalVersionT newMax) {
|
||||||
|
assert(newMax >= InternalVersionT::zero);
|
||||||
int index = n->parentsIndex;
|
int index = n->parentsIndex;
|
||||||
n = n->parent;
|
n = n->parent;
|
||||||
if (n == nullptr) {
|
if (n == nullptr) {
|
||||||
|
Reference in New Issue
Block a user