From 362ba87f0fef450d2579f736ddb3f4d57ced0775 Mon Sep 17 00:00:00 2001 From: Lloyd-Pottiger <60744015+Lloyd-Pottiger@users.noreply.github.com> Date: Thu, 31 Mar 2022 15:30:29 +0800 Subject: [PATCH] Remove default arguments of virtual function in DB::PageStorage and its derived class (#4507) close pingcap/tiflash#4482 --- dbms/src/Storages/Page/PageStorage.h | 64 ++++++++++++++++--- dbms/src/Storages/Page/V2/PageStorage.cpp | 20 +++--- dbms/src/Storages/Page/V2/PageStorage.h | 40 ++++++------ .../Page/V2/tests/page_storage_ctl.cpp | 2 +- dbms/src/Storages/Page/V3/PageStorageImpl.cpp | 18 +++--- dbms/src/Storages/Page/V3/PageStorageImpl.h | 31 ++++----- 6 files changed, 109 insertions(+), 66 deletions(-) diff --git a/dbms/src/Storages/Page/PageStorage.h b/dbms/src/Storages/Page/PageStorage.h index 6d97e21acd9..f863795ca1d 100644 --- a/dbms/src/Storages/Page/PageStorage.h +++ b/dbms/src/Storages/Page/PageStorage.h @@ -179,26 +179,54 @@ class PageStorage : private boost::noncopyable // Get some statistics of all living snapshots and the oldest living snapshot. virtual SnapshotsStatistics getSnapshotsStat() const = 0; - virtual void write(WriteBatch && write_batch, const WriteLimiterPtr & write_limiter = nullptr) = 0; + void write(WriteBatch && write_batch, const WriteLimiterPtr & write_limiter = nullptr) + { + writeImpl(std::move(write_batch), write_limiter); + } - virtual PageEntry getEntry(NamespaceId ns_id, PageId page_id, SnapshotPtr snapshot = {}) = 0; + PageEntry getEntry(NamespaceId ns_id, PageId page_id, SnapshotPtr snapshot = {}) + { + return getEntryImpl(ns_id, page_id, snapshot); + } - virtual Page read(NamespaceId ns_id, PageId page_id, const ReadLimiterPtr & read_limiter = nullptr, SnapshotPtr snapshot = {}) = 0; + Page read(NamespaceId ns_id, PageId page_id, const ReadLimiterPtr & read_limiter = nullptr, SnapshotPtr snapshot = {}) + { + return readImpl(ns_id, page_id, read_limiter, snapshot); + } - virtual PageMap read(NamespaceId ns_id, const std::vector & page_ids, const ReadLimiterPtr & read_limiter = nullptr, SnapshotPtr snapshot = {}) = 0; + PageMap read(NamespaceId ns_id, const std::vector & page_ids, const ReadLimiterPtr & read_limiter = nullptr, SnapshotPtr snapshot = {}) + { + return readImpl(ns_id, page_ids, read_limiter, snapshot); + } - virtual void read(NamespaceId ns_id, const std::vector & page_ids, const PageHandler & handler, const ReadLimiterPtr & read_limiter = nullptr, SnapshotPtr snapshot = {}) = 0; + void read(NamespaceId ns_id, const std::vector & page_ids, const PageHandler & handler, const ReadLimiterPtr & read_limiter = nullptr, SnapshotPtr snapshot = {}) + { + readImpl(ns_id, page_ids, handler, read_limiter, snapshot); + } using FieldIndices = std::vector; using PageReadFields = std::pair; - virtual PageMap read(NamespaceId ns_id, const std::vector & page_fields, const ReadLimiterPtr & read_limiter = nullptr, SnapshotPtr snapshot = {}) = 0; - virtual void traverse(const std::function & acceptor, SnapshotPtr snapshot = {}) = 0; + PageMap read(NamespaceId ns_id, const std::vector & page_fields, const ReadLimiterPtr & read_limiter = nullptr, SnapshotPtr snapshot = {}) + { + return readImpl(ns_id, page_fields, read_limiter, snapshot); + } + + void traverse(const std::function & acceptor, SnapshotPtr snapshot = {}) + { + traverseImpl(acceptor, snapshot); + } - virtual PageId getNormalPageId(NamespaceId ns_id, PageId page_id, SnapshotPtr snapshot = {}) = 0; + PageId getNormalPageId(NamespaceId ns_id, PageId page_id, SnapshotPtr snapshot = {}) + { + return getNormalPageIdImpl(ns_id, page_id, snapshot); + } // We may skip the GC to reduce useless reading by default. - virtual bool gc(bool not_skip = false, const WriteLimiterPtr & write_limiter = nullptr, const ReadLimiterPtr & read_limiter = nullptr) = 0; + bool gc(bool not_skip = false, const WriteLimiterPtr & write_limiter = nullptr, const ReadLimiterPtr & read_limiter = nullptr) + { + return gcImpl(not_skip, write_limiter, read_limiter); + } // Register and unregister external pages GC callbacks virtual void registerExternalPagesCallbacks(const ExternalPageCallbacks & callbacks) = 0; @@ -207,6 +235,24 @@ class PageStorage : private boost::noncopyable #ifndef DBMS_PUBLIC_GTEST protected: #endif + virtual void writeImpl(WriteBatch && write_batch, const WriteLimiterPtr & write_limiter) = 0; + + virtual PageEntry getEntryImpl(NamespaceId ns_id, PageId page_id, SnapshotPtr snapshot) = 0; + + virtual Page readImpl(NamespaceId ns_id, PageId page_id, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) = 0; + + virtual PageMap readImpl(NamespaceId ns_id, const std::vector & page_ids, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) = 0; + + virtual void readImpl(NamespaceId ns_id, const std::vector & page_ids, const PageHandler & handler, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) = 0; + + virtual PageMap readImpl(NamespaceId ns_id, const std::vector & page_fields, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) = 0; + + virtual void traverseImpl(const std::function & acceptor, SnapshotPtr snapshot) = 0; + + virtual PageId getNormalPageIdImpl(NamespaceId ns_id, PageId page_id, SnapshotPtr snapshot) = 0; + + virtual bool gcImpl(bool not_skip, const WriteLimiterPtr & write_limiter, const ReadLimiterPtr & read_limiter) = 0; + String storage_name; // Identify between different Storage PSDiskDelegatorPtr delegator; // Get paths for storing data Config config; diff --git a/dbms/src/Storages/Page/V2/PageStorage.cpp b/dbms/src/Storages/Page/V2/PageStorage.cpp index fb40482048f..922c8dc2f1a 100644 --- a/dbms/src/Storages/Page/V2/PageStorage.cpp +++ b/dbms/src/Storages/Page/V2/PageStorage.cpp @@ -361,7 +361,7 @@ PageId PageStorage::getMaxId(NamespaceId /*ns_id*/) return versioned_page_entries.getSnapshot("")->version()->maxId(); } -PageId PageStorage::getNormalPageId(NamespaceId /*ns_id*/, PageId page_id, SnapshotPtr snapshot) +PageId PageStorage::getNormalPageIdImpl(NamespaceId /*ns_id*/, PageId page_id, SnapshotPtr snapshot) { if (!snapshot) { @@ -372,7 +372,7 @@ PageId PageStorage::getNormalPageId(NamespaceId /*ns_id*/, PageId page_id, Snaps return is_ref_id ? normal_page_id : page_id; } -DB::PageEntry PageStorage::getEntry(NamespaceId /*ns_id*/, PageId page_id, SnapshotPtr snapshot) +DB::PageEntry PageStorage::getEntryImpl(NamespaceId /*ns_id*/, PageId page_id, SnapshotPtr snapshot) { if (!snapshot) { @@ -484,7 +484,7 @@ PageStorage::ReaderPtr PageStorage::getReader(const PageFileIdAndLevel & file_id return pages_reader; } -void PageStorage::write(DB::WriteBatch && wb, const WriteLimiterPtr & write_limiter) +void PageStorage::writeImpl(DB::WriteBatch && wb, const WriteLimiterPtr & write_limiter) { if (unlikely(wb.empty())) return; @@ -592,7 +592,7 @@ SnapshotsStatistics PageStorage::getSnapshotsStat() const return versioned_page_entries.getSnapshotsStat(); } -DB::Page PageStorage::read(NamespaceId /*ns_id*/, PageId page_id, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) +DB::Page PageStorage::readImpl(NamespaceId /*ns_id*/, PageId page_id, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) { if (!snapshot) { @@ -608,7 +608,7 @@ DB::Page PageStorage::read(NamespaceId /*ns_id*/, PageId page_id, const ReadLimi return file_reader->read(to_read, read_limiter)[page_id]; } -PageMap PageStorage::read(NamespaceId /*ns_id*/, const std::vector & page_ids, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) +PageMap PageStorage::readImpl(NamespaceId /*ns_id*/, const std::vector & page_ids, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) { if (!snapshot) { @@ -651,7 +651,7 @@ PageMap PageStorage::read(NamespaceId /*ns_id*/, const std::vector & pag return page_map; } -void PageStorage::read(NamespaceId /*ns_id*/, const std::vector & page_ids, const PageHandler & handler, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) +void PageStorage::readImpl(NamespaceId /*ns_id*/, const std::vector & page_ids, const PageHandler & handler, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) { if (!snapshot) { @@ -691,7 +691,7 @@ void PageStorage::read(NamespaceId /*ns_id*/, const std::vector & page_i } } -PageMap PageStorage::read(NamespaceId /*ns_id*/, const std::vector & page_fields, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) +PageMap PageStorage::readImpl(NamespaceId /*ns_id*/, const std::vector & page_fields, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) { if (!snapshot) { @@ -734,7 +734,7 @@ PageMap PageStorage::read(NamespaceId /*ns_id*/, const std::vector & acceptor, SnapshotPtr snapshot) +void PageStorage::traverseImpl(const std::function & acceptor, SnapshotPtr snapshot) { if (!snapshot) { @@ -757,7 +757,7 @@ void PageStorage::traverse(const std::function & ac for (const auto & p : file_and_pages) { // namespace id is not used in V2, so it's value is not important here - auto pages = read(MAX_NAMESPACE_ID, p.second, nullptr, snapshot); + auto pages = readImpl(MAX_NAMESPACE_ID, p.second, nullptr, snapshot); for (const auto & id_page : pages) { acceptor(id_page.second); @@ -897,7 +897,7 @@ WriteBatch::SequenceID PageStorage::WritingFilesSnapshot::minPersistedSequence() return seq; } -bool PageStorage::gc(bool not_skip, const WriteLimiterPtr & write_limiter, const ReadLimiterPtr & read_limiter) +bool PageStorage::gcImpl(bool not_skip, const WriteLimiterPtr & write_limiter, const ReadLimiterPtr & read_limiter) { // If another thread is running gc, just return; bool v = false; diff --git a/dbms/src/Storages/Page/V2/PageStorage.h b/dbms/src/Storages/Page/V2/PageStorage.h index beec8783463..f1752545815 100644 --- a/dbms/src/Storages/Page/V2/PageStorage.h +++ b/dbms/src/Storages/Page/V2/PageStorage.h @@ -97,7 +97,7 @@ class PageStorage : public DB::PageStorage PageId getMaxId(NamespaceId ns_id) override; - PageId getNormalPageId(NamespaceId ns_id, PageId page_id, SnapshotPtr snapshot) override; + PageId getNormalPageIdImpl(NamespaceId ns_id, PageId page_id, SnapshotPtr snapshot) override; DB::PageStorage::SnapshotPtr getSnapshot(const String & tracing_id) override; @@ -107,21 +107,21 @@ class PageStorage : public DB::PageStorage SnapshotsStatistics getSnapshotsStat() const override; - void write(DB::WriteBatch && wb, const WriteLimiterPtr & write_limiter) override; + void writeImpl(DB::WriteBatch && wb, const WriteLimiterPtr & write_limiter) override; - DB::PageEntry getEntry(NamespaceId ns_id, PageId page_id, SnapshotPtr snapshot) override; + DB::PageEntry getEntryImpl(NamespaceId ns_id, PageId page_id, SnapshotPtr snapshot) override; - DB::Page read(NamespaceId ns_id, PageId page_id, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) override; + DB::Page readImpl(NamespaceId ns_id, PageId page_id, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) override; - PageMap read(NamespaceId ns_id, const std::vector & page_ids, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) override; + PageMap readImpl(NamespaceId ns_id, const std::vector & page_ids, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) override; - void read(NamespaceId ns_id, const std::vector & page_ids, const PageHandler & handler, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) override; + void readImpl(NamespaceId ns_id, const std::vector & page_ids, const PageHandler & handler, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) override; - PageMap read(NamespaceId ns_id, const std::vector & page_fields, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) override; + PageMap readImpl(NamespaceId ns_id, const std::vector & page_fields, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) override; - void traverse(const std::function & acceptor, SnapshotPtr snapshot) override; + void traverseImpl(const std::function & acceptor, SnapshotPtr snapshot) override; - bool gc(bool not_skip, const WriteLimiterPtr & write_limiter, const ReadLimiterPtr & read_limiter) override; + bool gcImpl(bool not_skip, const WriteLimiterPtr & write_limiter, const ReadLimiterPtr & read_limiter) override; void registerExternalPagesCallbacks(const ExternalPageCallbacks & callbacks) override; @@ -194,17 +194,17 @@ class PageStorage : public DB::PageStorage #ifndef NDEBUG // Just for tests, refactor them out later DB::PageStorage::SnapshotPtr getSnapshot() { return getSnapshot(""); } - void write(DB::WriteBatch && wb) { return write(std::move(wb), nullptr); } - DB::PageEntry getEntry(PageId page_id) { return getEntry(TEST_NAMESPACE_ID, page_id, nullptr); } - DB::PageEntry getEntry(PageId page_id, SnapshotPtr snapshot) { return getEntry(TEST_NAMESPACE_ID, page_id, snapshot); }; - DB::Page read(PageId page_id) { return read(TEST_NAMESPACE_ID, page_id, nullptr, nullptr); } - DB::Page read(PageId page_id, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) { return read(TEST_NAMESPACE_ID, page_id, read_limiter, snapshot); } - PageMap read(const std::vector & page_ids) { return read(TEST_NAMESPACE_ID, page_ids, nullptr, nullptr); } - PageMap read(const std::vector & page_ids, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) { return read(TEST_NAMESPACE_ID, page_ids, read_limiter, snapshot); }; - void read(const std::vector & page_ids, const PageHandler & handler) { return read(TEST_NAMESPACE_ID, page_ids, handler, nullptr, nullptr); } - PageMap read(const std::vector & page_fields) { return read(TEST_NAMESPACE_ID, page_fields, nullptr, nullptr); } - void traverse(const std::function & acceptor) { return traverse(acceptor, nullptr); } - bool gc() { return gc(false, nullptr, nullptr); } + void write(DB::WriteBatch && wb) { return writeImpl(std::move(wb), nullptr); } + DB::PageEntry getEntry(PageId page_id) { return getEntryImpl(TEST_NAMESPACE_ID, page_id, nullptr); } + DB::PageEntry getEntry(PageId page_id, SnapshotPtr snapshot) { return getEntryImpl(TEST_NAMESPACE_ID, page_id, snapshot); }; + DB::Page read(PageId page_id) { return readImpl(TEST_NAMESPACE_ID, page_id, nullptr, nullptr); } + DB::Page read(PageId page_id, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) { return readImpl(TEST_NAMESPACE_ID, page_id, read_limiter, snapshot); } + PageMap read(const std::vector & page_ids) { return readImpl(TEST_NAMESPACE_ID, page_ids, nullptr, nullptr); } + PageMap read(const std::vector & page_ids, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) { return readImpl(TEST_NAMESPACE_ID, page_ids, read_limiter, snapshot); }; + void read(const std::vector & page_ids, const PageHandler & handler) { return readImpl(TEST_NAMESPACE_ID, page_ids, handler, nullptr, nullptr); } + PageMap read(const std::vector & page_fields) { return readImpl(TEST_NAMESPACE_ID, page_fields, nullptr, nullptr); } + void traverse(const std::function & acceptor) { return traverseImpl(acceptor, nullptr); } + bool gc() { return gcImpl(false, nullptr, nullptr); } #endif #ifndef DBMS_PUBLIC_GTEST diff --git a/dbms/src/Storages/Page/V2/tests/page_storage_ctl.cpp b/dbms/src/Storages/Page/V2/tests/page_storage_ctl.cpp index 3655d1e83d5..2fb7e31d70e 100644 --- a/dbms/src/Storages/Page/V2/tests/page_storage_ctl.cpp +++ b/dbms/src/Storages/Page/V2/tests/page_storage_ctl.cpp @@ -217,7 +217,7 @@ try for (Int64 idx = 0; num_gc == -1 || idx < num_gc; ++idx) { LOG_FMT_INFO(logger, "Running GC, [round={}] [num_gc={}]", (idx + 1), num_gc); - storage.gc(/*not_skip=*/true, nullptr, nullptr); + storage.gcImpl(/*not_skip=*/true, nullptr, nullptr); LOG_FMT_INFO(logger, "Run GC done, [round={}] [num_gc={}]", (idx + 1), num_gc); } break; diff --git a/dbms/src/Storages/Page/V3/PageStorageImpl.cpp b/dbms/src/Storages/Page/V3/PageStorageImpl.cpp index 478accf48a4..e771f74a41d 100644 --- a/dbms/src/Storages/Page/V3/PageStorageImpl.cpp +++ b/dbms/src/Storages/Page/V3/PageStorageImpl.cpp @@ -64,7 +64,7 @@ PageId PageStorageImpl::getMaxId(NamespaceId ns_id) return page_directory->getMaxId(ns_id); } -PageId PageStorageImpl::getNormalPageId(NamespaceId ns_id, PageId page_id, SnapshotPtr snapshot) +PageId PageStorageImpl::getNormalPageIdImpl(NamespaceId ns_id, PageId page_id, SnapshotPtr snapshot) { if (!snapshot) { @@ -84,7 +84,7 @@ SnapshotsStatistics PageStorageImpl::getSnapshotsStat() const return page_directory->getSnapshotsStat(); } -void PageStorageImpl::write(DB::WriteBatch && write_batch, const WriteLimiterPtr & write_limiter) +void PageStorageImpl::writeImpl(DB::WriteBatch && write_batch, const WriteLimiterPtr & write_limiter) { if (unlikely(write_batch.empty())) return; @@ -94,7 +94,7 @@ void PageStorageImpl::write(DB::WriteBatch && write_batch, const WriteLimiterPtr page_directory->apply(std::move(edit), write_limiter); } -DB::PageEntry PageStorageImpl::getEntry(NamespaceId ns_id, PageId page_id, SnapshotPtr snapshot) +DB::PageEntry PageStorageImpl::getEntryImpl(NamespaceId ns_id, PageId page_id, SnapshotPtr snapshot) { if (!snapshot) { @@ -124,7 +124,7 @@ DB::PageEntry PageStorageImpl::getEntry(NamespaceId ns_id, PageId page_id, Snaps } } -DB::Page PageStorageImpl::read(NamespaceId ns_id, PageId page_id, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) +DB::Page PageStorageImpl::readImpl(NamespaceId ns_id, PageId page_id, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) { if (!snapshot) { @@ -135,7 +135,7 @@ DB::Page PageStorageImpl::read(NamespaceId ns_id, PageId page_id, const ReadLimi return blob_store.read(page_entry, read_limiter); } -PageMap PageStorageImpl::read(NamespaceId ns_id, const std::vector & page_ids, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) +PageMap PageStorageImpl::readImpl(NamespaceId ns_id, const std::vector & page_ids, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) { if (!snapshot) { @@ -149,7 +149,7 @@ PageMap PageStorageImpl::read(NamespaceId ns_id, const std::vector & pag return blob_store.read(page_entries, read_limiter); } -void PageStorageImpl::read(NamespaceId ns_id, const std::vector & page_ids, const PageHandler & handler, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) +void PageStorageImpl::readImpl(NamespaceId ns_id, const std::vector & page_ids, const PageHandler & handler, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) { if (!snapshot) { @@ -163,7 +163,7 @@ void PageStorageImpl::read(NamespaceId ns_id, const std::vector & page_i blob_store.read(page_entries, handler, read_limiter); } -PageMap PageStorageImpl::read(NamespaceId ns_id, const std::vector & page_fields, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) +PageMap PageStorageImpl::readImpl(NamespaceId ns_id, const std::vector & page_fields, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) { if (!snapshot) { @@ -182,7 +182,7 @@ PageMap PageStorageImpl::read(NamespaceId ns_id, const std::vector & acceptor, SnapshotPtr snapshot) +void PageStorageImpl::traverseImpl(const std::function & acceptor, SnapshotPtr snapshot) { if (!snapshot) { @@ -198,7 +198,7 @@ void PageStorageImpl::traverse(const std::function } } -bool PageStorageImpl::gc(bool /*not_skip*/, const WriteLimiterPtr & write_limiter, const ReadLimiterPtr & read_limiter) +bool PageStorageImpl::gcImpl(bool /*not_skip*/, const WriteLimiterPtr & write_limiter, const ReadLimiterPtr & read_limiter) { // If another thread is running gc, just return; bool v = false; diff --git a/dbms/src/Storages/Page/V3/PageStorageImpl.h b/dbms/src/Storages/Page/V3/PageStorageImpl.h index c7e2ad8f5ce..2db4ea9d8e9 100644 --- a/dbms/src/Storages/Page/V3/PageStorageImpl.h +++ b/dbms/src/Storages/Page/V3/PageStorageImpl.h @@ -41,27 +41,27 @@ class PageStorageImpl : public DB::PageStorage PageId getMaxId(NamespaceId ns_id) override; - PageId getNormalPageId(NamespaceId ns_id, PageId page_id, SnapshotPtr snapshot) override; + PageId getNormalPageIdImpl(NamespaceId ns_id, PageId page_id, SnapshotPtr snapshot) override; DB::PageStorage::SnapshotPtr getSnapshot(const String & tracing_id) override; SnapshotsStatistics getSnapshotsStat() const override; - void write(DB::WriteBatch && write_batch, const WriteLimiterPtr & write_limiter) override; + void writeImpl(DB::WriteBatch && write_batch, const WriteLimiterPtr & write_limiter) override; - DB::PageEntry getEntry(NamespaceId ns_id, PageId page_id, SnapshotPtr snapshot) override; + DB::PageEntry getEntryImpl(NamespaceId ns_id, PageId page_id, SnapshotPtr snapshot) override; - DB::Page read(NamespaceId ns_id, PageId page_id, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) override; + DB::Page readImpl(NamespaceId ns_id, PageId page_id, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) override; - PageMap read(NamespaceId ns_id, const std::vector & page_ids, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) override; + PageMap readImpl(NamespaceId ns_id, const std::vector & page_ids, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) override; - void read(NamespaceId ns_id, const std::vector & page_ids, const PageHandler & handler, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) override; + void readImpl(NamespaceId ns_id, const std::vector & page_ids, const PageHandler & handler, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) override; - PageMap read(NamespaceId ns_id, const std::vector & page_fields, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) override; + PageMap readImpl(NamespaceId ns_id, const std::vector & page_fields, const ReadLimiterPtr & read_limiter, SnapshotPtr snapshot) override; - void traverse(const std::function & acceptor, SnapshotPtr snapshot) override; + void traverseImpl(const std::function & acceptor, SnapshotPtr snapshot) override; - bool gc(bool not_skip, const WriteLimiterPtr & write_limiter, const ReadLimiterPtr & read_limiter) override; + bool gcImpl(bool not_skip, const WriteLimiterPtr & write_limiter, const ReadLimiterPtr & read_limiter) override; void registerExternalPagesCallbacks(const ExternalPageCallbacks & callbacks) override; @@ -74,14 +74,11 @@ class PageStorageImpl : public DB::PageStorage #ifndef NDEBUG // Just for tests, refactor them out later DB::PageStorage::SnapshotPtr getSnapshot() { return getSnapshot(""); } - void write(DB::WriteBatch && wb) { return write(std::move(wb), nullptr); } - DB::PageEntry getEntry(PageId page_id) { return getEntry(TEST_NAMESPACE_ID, page_id, nullptr); } - DB::Page read(PageId page_id) { return read(TEST_NAMESPACE_ID, page_id, nullptr, nullptr); } - PageMap read(const std::vector & page_ids) { return read(TEST_NAMESPACE_ID, page_ids, nullptr, nullptr); } - void read(const std::vector & page_ids, const PageHandler & handler) { return read(TEST_NAMESPACE_ID, page_ids, handler, nullptr, nullptr); } - PageMap read(const std::vector & page_fields) { return read(TEST_NAMESPACE_ID, page_fields, nullptr, nullptr); } - void traverse(const std::function & acceptor) { return traverse(acceptor, nullptr); } - bool gc() { return gc(false, nullptr, nullptr); } + DB::PageEntry getEntry(PageId page_id) { return getEntryImpl(TEST_NAMESPACE_ID, page_id, nullptr); } + DB::Page read(PageId page_id) { return readImpl(TEST_NAMESPACE_ID, page_id, nullptr, nullptr); } + PageMap read(const std::vector & page_ids) { return readImpl(TEST_NAMESPACE_ID, page_ids, nullptr, nullptr); } + void read(const std::vector & page_ids, const PageHandler & handler) { return readImpl(TEST_NAMESPACE_ID, page_ids, handler, nullptr, nullptr); } + PageMap read(const std::vector & page_fields) { return readImpl(TEST_NAMESPACE_ID, page_fields, nullptr, nullptr); } #endif friend class PageDirectoryFactory;