Merge pull request #9419 from sfc-gh-satherton/page-rebuild-fix
Optimize/fix node rebuild vs update trigger in Redwood
This commit is contained in:
commit
bb4fb3d81d
|
@ -976,6 +976,7 @@ void ServerKnobs::initialize(Randomize randomize, ClientKnobs* clientKnobs, IsSi
|
|||
init( REDWOOD_HISTOGRAM_INTERVAL, 30.0 );
|
||||
init( REDWOOD_EVICT_UPDATED_PAGES, true ); if( randomize && BUGGIFY ) { REDWOOD_EVICT_UPDATED_PAGES = false; }
|
||||
init( REDWOOD_DECODECACHE_REUSE_MIN_HEIGHT, 2 ); if( randomize && BUGGIFY ) { REDWOOD_DECODECACHE_REUSE_MIN_HEIGHT = deterministicRandom()->randomInt(1, 7); }
|
||||
init( REDWOOD_NODE_MAX_UNBALANCE, 2 );
|
||||
init( REDWOOD_IO_PRIORITIES, "32,32,32,32" );
|
||||
|
||||
// Server request latency measurement
|
||||
|
|
|
@ -949,6 +949,7 @@ public:
|
|||
double REDWOOD_HISTOGRAM_INTERVAL;
|
||||
bool REDWOOD_EVICT_UPDATED_PAGES; // Whether to prioritize eviction of updated pages from cache.
|
||||
int REDWOOD_DECODECACHE_REUSE_MIN_HEIGHT; // Minimum height for which to keep and reuse page decode caches
|
||||
int REDWOOD_NODE_MAX_UNBALANCE; // Maximum imbalance in a node before it should be rebuilt instead of updated
|
||||
|
||||
std::string REDWOOD_IO_PRIORITIES;
|
||||
|
||||
|
|
|
@ -6550,9 +6550,10 @@ private:
|
|||
bool updating,
|
||||
ParentInfo* parentInfo,
|
||||
Reference<IPageEncryptionKeyProvider> keyProvider,
|
||||
Optional<int64_t> pageDomainId)
|
||||
Optional<int64_t> pageDomainId,
|
||||
int maxHeightAllowed)
|
||||
: updating(updating), page(p), clonedPage(alreadyCloned), changesMade(false), parentInfo(parentInfo),
|
||||
keyProvider(keyProvider), pageDomainId(pageDomainId) {}
|
||||
keyProvider(keyProvider), pageDomainId(pageDomainId), maxHeightAllowed(maxHeightAllowed) {}
|
||||
|
||||
// Whether updating the existing page is allowed
|
||||
bool updating;
|
||||
|
@ -6570,6 +6571,8 @@ private:
|
|||
Reference<IPageEncryptionKeyProvider> keyProvider;
|
||||
Optional<int64_t> pageDomainId;
|
||||
|
||||
int maxHeightAllowed;
|
||||
|
||||
BTreePage* btPage() const { return (BTreePage*)page->mutateData(); }
|
||||
|
||||
bool empty() const {
|
||||
|
@ -6609,7 +6612,7 @@ private:
|
|||
canInsert = keyProvider->keyFitsInDomain(pageDomainId.get(), rec.key, true);
|
||||
}
|
||||
if (canInsert) {
|
||||
canInsert = end.insert(rec);
|
||||
canInsert = end.insert(rec, 0, maxHeightAllowed);
|
||||
}
|
||||
|
||||
if (!canInsert) {
|
||||
|
@ -6810,6 +6813,8 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
state int maxHeightAllowed = btPage->tree()->initialHeight + SERVER_KNOBS->REDWOOD_NODE_MAX_UNBALANCE;
|
||||
|
||||
// Leaf Page
|
||||
if (btPage->isLeaf()) {
|
||||
// When true, we are modifying the existing DeltaTree
|
||||
|
@ -6835,7 +6840,6 @@ private:
|
|||
|
||||
// Now, process each mutation range and merge changes with existing data.
|
||||
bool firstMutationBoundary = true;
|
||||
constexpr int maxHeightAllowed = 8;
|
||||
|
||||
while (mBegin != mEnd) {
|
||||
// Apply the change to the mutation buffer start boundary key only if
|
||||
|
@ -7316,7 +7320,7 @@ private:
|
|||
// If pageCopy is already set it was initialized to page above so the modifier doesn't need
|
||||
// to copy it
|
||||
state InternalPageModifier modifier(
|
||||
page, pageCopy.isValid(), tryToUpdate, parentInfo, self->m_keyProvider, pageDomainId);
|
||||
page, pageCopy.isValid(), tryToUpdate, parentInfo, self->m_keyProvider, pageDomainId, maxHeightAllowed);
|
||||
|
||||
// Apply the possible changes for each subtree range recursed to, except the last one.
|
||||
// For each range, the expected next record, if any, is checked against the first boundary
|
||||
|
|
Loading…
Reference in New Issue