Added RdbTree::collExists() just like RdbBuckets

This commit is contained in:
Ivan Skytte Jørgensen
2017-04-20 15:14:33 +02:00
parent 12bb0e2acf
commit cf5452c030
3 changed files with 14 additions and 7 deletions

@ -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))

@ -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; }