From 40d53e23f5cdb1650b82eac1232f88df5e6b82dc Mon Sep 17 00:00:00 2001 From: Stephen Atherton Date: Mon, 28 Oct 2019 16:05:11 -0700 Subject: [PATCH] Optimization, only the first btree mutation boundary for a subtree needs to be compared to the subtree's lower bound. Also removed a check for a condition which is no longer possible due to other changes. --- fdbserver/VersionedBTree.actor.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/fdbserver/VersionedBTree.actor.cpp b/fdbserver/VersionedBTree.actor.cpp index b0d7e40c0e..c890bca3fb 100644 --- a/fdbserver/VersionedBTree.actor.cpp +++ b/fdbserver/VersionedBTree.actor.cpp @@ -3495,24 +3495,22 @@ private: int changes = 0; // Now, process each mutation range and merge changes with existing data. + bool firstMutationBoundary = true; while(iMutationBoundary != iMutationBoundaryEnd) { debug_printf("%s New mutation boundary: '%s': %s\n", context.c_str(), printable(iMutationBoundary->first).c_str(), iMutationBoundary->second.toString().c_str()); SingleKeyMutationsByVersion::const_iterator iMutations; - // If the mutation boundary key is less than the lower bound key then skip startKeyMutations for - // this bounary, we're only processing this mutation range here to apply any clears to existing data. - if(iMutationBoundary->first < lowerBound->key) { + // For the first mutation boundary only, if the boundary key is less than the lower bound for the page + // then skip startKeyMutations for this boundary, we're only processing this mutation range here to apply + // a possible clear to existing data. + if(firstMutationBoundary && iMutationBoundary->first < lowerBound->key) { iMutations = iMutationBoundary->second.startKeyMutations.end(); } - // If the mutation boundary key is the same as the page lowerBound key then start reading single - // key mutations at the first version greater than the lowerBound key's version. - else if(!self->singleVersion && iMutationBoundary->first == lowerBound->key) { - iMutations = iMutationBoundary->second.startKeyMutations.upper_bound(lowerBound->version); - } else { iMutations = iMutationBoundary->second.startKeyMutations.begin(); } + firstMutationBoundary = false; SingleKeyMutationsByVersion::const_iterator iMutationsEnd = iMutationBoundary->second.startKeyMutations.end();