From d87e695fba3bcf6aa1cb9e2c4cacae7fe0cc32bd Mon Sep 17 00:00:00 2001 From: Fuheng Zhao Date: Fri, 16 Jul 2021 14:02:59 -0700 Subject: [PATCH] format files --- fdbserver/IPager.h | 7 +++-- fdbserver/VersionedBTree.actor.cpp | 50 ++++++++++++++++++------------ 2 files changed, 35 insertions(+), 22 deletions(-) diff --git a/fdbserver/IPager.h b/fdbserver/IPager.h index 810b30147e..afac4d7cc2 100644 --- a/fdbserver/IPager.h +++ b/fdbserver/IPager.h @@ -204,14 +204,17 @@ public: // Replace the contents of a page with new data across *all* versions. // Existing holders of a page reference for pageID, read from any version, // may see the effects of this write. - virtual void updatePage(PagerEventReasons reason, unsigned int level, LogicalPageID pageID, Reference data) = 0; + virtual void updatePage(PagerEventReasons reason, + unsigned int level, + LogicalPageID pageID, + Reference data) = 0; // Try to atomically update the contents of a page as of version v in the next commit. // If the pager is unable to do this at this time, it may choose to write the data to a new page ID // instead and return the new page ID to the caller. Otherwise the original pageID argument will be returned. // If a new page ID is returned, the old page ID will be freed as of version v virtual Future atomicUpdatePage(PagerEventReasons reason, - unsigned int level, + unsigned int level, LogicalPageID pageID, Reference data, Version v) = 0; diff --git a/fdbserver/VersionedBTree.actor.cpp b/fdbserver/VersionedBTree.actor.cpp index ef84aa5e91..98765eba1f 100644 --- a/fdbserver/VersionedBTree.actor.cpp +++ b/fdbserver/VersionedBTree.actor.cpp @@ -2382,7 +2382,10 @@ public: return writePhysicalPage(PagerEventReasons::metaData, nonBtreeLevel, pageID, page, true); } - void updatePage(PagerEventReasons reason, unsigned int level, LogicalPageID pageID, Reference data) override { + void updatePage(PagerEventReasons reason, + unsigned int level, + LogicalPageID pageID, + Reference data) override { // Get the cache entry for this page, without counting it as a cache hit as we're replacing its contents now // or as a cache miss because there is no benefit to the page already being in cache // this metaData reason will not be accounted since its not a cache hit or cache miss @@ -2426,7 +2429,7 @@ public: } Future atomicUpdatePage(PagerEventReasons reason, - unsigned int level, + unsigned int level, LogicalPageID pageID, Reference data, Version v) override { @@ -4981,7 +4984,7 @@ private: // Writes entries to 1 or more pages and return a vector of boundary keys with their ArenaPage(s) ACTOR static Future>> writePages(VersionedBTree* self, - PagerEventReasons reason, + PagerEventReasons reason, const RedwoodRecordRef* lowerBound, const RedwoodRecordRef* upperBound, VectorRef entries, @@ -5116,7 +5119,8 @@ private: // LogicalPageIDs in previousID and try to update them atomically. if (pagesToBuild.size() == 1 && previousID.size() == pages.size()) { for (k = 0; k < pages.size(); ++k) { - LogicalPageID id = wait(self->m_pager->atomicUpdatePage(reason, currLevel, previousID[k], pages[k], v)); + LogicalPageID id = + wait(self->m_pager->atomicUpdatePage(reason, currLevel, previousID[k], pages[k], v)); childPageID.push_back(records.arena(), id); } } else { @@ -5173,8 +5177,8 @@ private: // While there are multiple child pages for this version we must write new tree levels. while (records.size() > 1) { self->m_pHeader->height = ++height; - Standalone> newRecords = - wait(writePages(self, PagerEventReasons::metaData, &dbBegin, &dbEnd, records, height, version, BTreePageIDRef())); + Standalone> newRecords = wait(writePages( + self, PagerEventReasons::metaData, &dbBegin, &dbEnd, records, height, version, BTreePageIDRef())); debug_printf("Wrote a new root level at version %" PRId64 " height %d size %lu pages\n", version, height, @@ -5282,7 +5286,7 @@ private: // Write new version of pageID at version v using page as its data. // Attempts to reuse original id(s) in btPageID, returns BTreePageID. - // UpdateBtreePage is only called from commitSubTree funciton + // UpdateBtreePage is only called from commitSubTree funciton ACTOR static Future updateBTreePage(VersionedBTree* self, BTreePageIDRef oldID, Arena* arena, @@ -5305,7 +5309,8 @@ private: if (oldID.size() == 1) { BTreePage* btPage = (BTreePage*)page->begin(); - LogicalPageID id = wait(self->m_pager->atomicUpdatePage(PagerEventReasons::commit, btPage->height, oldID.front(), page, writeVersion)); + LogicalPageID id = wait(self->m_pager->atomicUpdatePage( + PagerEventReasons::commit, btPage->height, oldID.front(), page, writeVersion)); newID.front() = id; } else { state std::vector> pages; @@ -5325,8 +5330,8 @@ private: state int i = 0; for (; i < pages.size(); ++i) { BTreePage* btPage = (BTreePage*)page->begin(); - LogicalPageID id = - wait(self->m_pager->atomicUpdatePage(PagerEventReasons::commit, btPage->height, oldID[i], pages[i], writeVersion)); + LogicalPageID id = wait(self->m_pager->atomicUpdatePage( + PagerEventReasons::commit, btPage->height, oldID[i], pages[i], writeVersion)); newID[i] = id; } } @@ -5653,7 +5658,7 @@ private: MutationBuffer* mutationBuffer, BTreePageIDRef rootID, bool isLeaf, - unsigned int l, + unsigned int l, MutationBuffer::const_iterator mBegin, // greatest mutation boundary <= subtreeLowerBound->key MutationBuffer::const_iterator mEnd, // least boundary >= subtreeUpperBound->key InternalPageSliceUpdate* update) { @@ -5989,7 +5994,7 @@ private: // Rebuild new page(s). state Standalone> entries = wait(writePages(self, - PagerEventReasons::metaData, + PagerEventReasons::metaData, &update->subtreeLowerBound, &update->subtreeUpperBound, merged, @@ -6337,7 +6342,7 @@ private: Standalone> newChildEntries = wait(writePages(self, - PagerEventReasons::metaData, + PagerEventReasons::metaData, &update->subtreeLowerBound, &update->subtreeUpperBound, modifier.rebuild, @@ -6403,7 +6408,7 @@ private: mutations, rootPageID, self->m_pHeader->height == 1, - self->m_pHeader->height, + self->m_pHeader->height, mBegin, mEnd, &all)); @@ -6528,14 +6533,15 @@ public: Future pushPage(PagerEventReasons reason, const BTreePage::BinaryTree::Cursor& link) { debug_printf("pushPage(link=%s)\n", link.get().toString(false).c_str()); - return map(readPage(reason, path.back().btPage()->height - 1, pager, link.get().getChildPage()), [=](Reference p) { + return map(readPage(reason, path.back().btPage()->height - 1, pager, link.get().getChildPage()), + [=](Reference p) { #if REDWOOD_DEBUG - path.push_back({ p, getCursor(p, link), link.get().getChildPage() }); + path.push_back({ p, getCursor(p, link), link.get().getChildPage() }); #else path.push_back({ p, getCursor(p, link) }); #endif - return Void(); - }); + return Void(); + }); } Future pushPage(PagerEventReasons reason, BTreePageIDRef id) { @@ -6616,7 +6622,9 @@ public: return Void(); } - Future seekGTE(RedwoodRecordRef query, PagerEventReasons reason) { return seekGTE_impl(this, query, reason); } + Future seekGTE(RedwoodRecordRef query, PagerEventReasons reason) { + return seekGTE_impl(this, query, reason); + } // Start fetching sibling nodes in the forward or backward direction, stopping after recordLimit or byteLimit void prefetch(KeyRef rangeEnd, bool directionForward, int recordLimit, int byteLimit) { @@ -6681,7 +6689,9 @@ public: return Void(); } - Future seekLT(RedwoodRecordRef query, PagerEventReasons reason) { return seekLT_impl(this, query, reason); } + Future seekLT(RedwoodRecordRef query, PagerEventReasons reason) { + return seekLT_impl(this, query, reason); + } ACTOR Future move_impl(BTreeCursor* self, bool forward) { // Try to the move cursor at the end of the path in the correct direction