Move collExist logic out to a function

This commit is contained in:
Ai Lin Chia
2017-04-26 15:56:44 +02:00
parent b98f313415
commit a90049221b
2 changed files with 8 additions and 6 deletions

12
Rdb.cpp

@ -864,12 +864,8 @@ bool Rdb::dumpCollLoop ( ) {
}
// before we create the file, see if tree has anything for this coll
if(m_useTree) {
if(!m_tree.collExists(m_dumpCollnum))
continue;
} else {
if(!m_buckets.collExists(m_dumpCollnum))
continue;
if (!getTreeCollExist(m_dumpCollnum)) {
continue;
}
// . MDW ADDING A NEW FILE SHOULD BE IN RDBDUMP.CPP NOW... NO!
@ -2100,6 +2096,10 @@ void Rdb::cleanTree() {
else return m_buckets.cleanBuckets();
}
bool Rdb::getTreeCollExist(collnum_t collnum) const {
return (m_useTree ? m_tree.collExists(collnum) : m_buckets.collExists(collnum));
}
// if we are doledb, we are a tree-only rdb, so try to reclaim
// memory from deleted nodes. works by condensing the used memory.
// returns how much we reclaimed.

2
Rdb.h

@ -235,6 +235,8 @@ private:
// returns false if no room in tree or m_mem for a list to add
bool hasRoom(RdbList *list);
bool getTreeCollExist(collnum_t collnum) const;
bool addList(collnum_t collnum, RdbList *list, bool checkForRoom);
// get the directory name where this rdb stores its files
const char *getDir() const { return g_hostdb.m_dir; }