forked from Mirrors/privacore-open-source-search-engine
Added RdbTree::collExists() just like RdbBuckets
This commit is contained in:
8
Rdb.cpp
8
Rdb.cpp
@ -913,13 +913,7 @@ bool Rdb::dumpCollLoop ( ) {
|
||||
|
||||
// before we create the file, see if tree has anything for this coll
|
||||
if(m_useTree) {
|
||||
ScopedLock sl(m_tree.getLock());
|
||||
|
||||
const char *k = KEYMIN();
|
||||
int32_t nn = m_tree.getNextNode_unlocked(m_dumpCollnum, k);
|
||||
if ( nn < 0 )
|
||||
continue;
|
||||
if (m_tree.getCollnum_unlocked(nn) != m_dumpCollnum )
|
||||
if(!m_tree.collExists(m_dumpCollnum))
|
||||
continue;
|
||||
} else {
|
||||
if(!m_buckets.collExists(m_dumpCollnum))
|
||||
|
11
RdbTree.cpp
11
RdbTree.cpp
@ -1641,6 +1641,17 @@ int32_t RdbTree::estimateListSize(collnum_t collnum, const char *startKey, const
|
||||
}
|
||||
|
||||
|
||||
bool RdbTree::collExists(collnum_t coll) const {
|
||||
ScopedLock sl(m_mtx);
|
||||
int32_t nn = getNextNode_unlocked(coll, KEYMIN());
|
||||
if(nn < 0)
|
||||
return false;
|
||||
if(getCollnum_unlocked(nn) != coll)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// . returns a number from 0 to m_numUsedNodes-1
|
||||
// . represents the ordering of this key in that range
|
||||
// . *retKey is the key that has the returned order
|
||||
|
@ -124,6 +124,8 @@ public:
|
||||
// estimate the size of the list defined by these keys
|
||||
int32_t estimateListSize(collnum_t collnum, const char *startKey, const char *endKey, char *minKey, char *maxKey) const;
|
||||
|
||||
bool collExists(collnum_t coll) const;
|
||||
|
||||
/// @todo ALC verify saving/writable logic is okay with multithread
|
||||
bool isSaving() const { return m_isSaving; }
|
||||
bool needsSave() const { return m_needsSave; }
|
||||
|
Reference in New Issue
Block a user