From dc9353fc7ce5415cf3180bcb1af2cfdad964d7ca Mon Sep 17 00:00:00 2001 From: yiwu-arbug Date: Tue, 15 Oct 2019 20:04:42 -0700 Subject: [PATCH] Make WaitForFlushMemTable public (#126) Move `WaitForFlushMemTable` API to public. It is needed for hotfix of https://github.com/pingcap/titan/issues/93 Signed-off-by: Yi Wu Signed-off-by: tabokie --- db/db_impl/db_impl.h | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/db/db_impl/db_impl.h b/db/db_impl/db_impl.h index 036b9ba72d2..39839a1880b 100644 --- a/db/db_impl/db_impl.h +++ b/db/db_impl/db_impl.h @@ -954,6 +954,24 @@ class DBImpl : public DB { VersionSet* GetVersionSet() const { return versions_.get(); } + // Wait for memtable flushed. + // If flush_memtable_id is non-null, wait until the memtable with the ID + // gets flush. Otherwise, wait until the column family don't have any + // memtable pending flush. + // resuming_from_bg_err indicates whether the caller is attempting to resume + // from background error. + Status WaitForFlushMemTable(ColumnFamilyData* cfd, + const uint64_t* flush_memtable_id = nullptr, + bool resuming_from_bg_err = false) { + return WaitForFlushMemTables({cfd}, {flush_memtable_id}, + resuming_from_bg_err); + } + // Wait for memtables to be flushed for multiple column families. + Status WaitForFlushMemTables( + const autovector& cfds, + const autovector& flush_memtable_ids, + bool resuming_from_bg_err); + #ifndef NDEBUG // Compact any files in the named level that overlap [*begin, *end] Status TEST_CompactRange(int level, const Slice* begin, const Slice* end, @@ -1678,24 +1696,6 @@ class DBImpl : public DB { Status WaitUntilFlushWouldNotStallWrites(ColumnFamilyData* cfd, bool* flush_needed); - // Wait for memtable flushed. - // If flush_memtable_id is non-null, wait until the memtable with the ID - // gets flush. Otherwise, wait until the column family don't have any - // memtable pending flush. - // resuming_from_bg_err indicates whether the caller is attempting to resume - // from background error. - Status WaitForFlushMemTable(ColumnFamilyData* cfd, - const uint64_t* flush_memtable_id = nullptr, - bool resuming_from_bg_err = false) { - return WaitForFlushMemTables({cfd}, {flush_memtable_id}, - resuming_from_bg_err); - } - // Wait for memtables to be flushed for multiple column families. - Status WaitForFlushMemTables( - const autovector& cfds, - const autovector& flush_memtable_ids, - bool resuming_from_bg_err); - inline void WaitForPendingWrites() { mutex_.AssertHeld(); TEST_SYNC_POINT("DBImpl::WaitForPendingWrites:BeforeBlock");