forked from Mirrors/privacore-open-source-search-engine
Don't check for space for each record when msg4 already did it wholesale
This commit is contained in:
2
Msg4.cpp
2
Msg4.cpp
@ -973,7 +973,7 @@ static bool addMetaList(const char *p, UdpSlot *slot) {
|
||||
rdb->readRequestAdd(recSize);
|
||||
|
||||
// this returns false and sets g_errno on error
|
||||
bool status = rdb->addList(collnum, &list);
|
||||
bool status = rdb->addListNoSpaceCheck(collnum, &list);
|
||||
|
||||
// bad coll #? ignore it. common when deleting and resetting
|
||||
// collections using crawlbot. but there are other recs in this
|
||||
|
5
Rdb.cpp
5
Rdb.cpp
@ -1474,9 +1474,10 @@ void attemptMergeAll() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// . return false and set g_errno on error
|
||||
// . TODO: speedup with m_tree.addSortedKeys() already partially written
|
||||
bool Rdb::addList(collnum_t collnum , RdbList *list) {
|
||||
bool Rdb::addList(collnum_t collnum, RdbList *list, bool checkForRoom) {
|
||||
// pick it
|
||||
if ( collnum < 0 || collnum > getNumBases() || ! getBase(collnum) ) {
|
||||
g_errno = ENOCOLLREC;
|
||||
@ -1524,7 +1525,7 @@ bool Rdb::addList(collnum_t collnum , RdbList *list) {
|
||||
// . if we don't have enough room to store list, initiate a dump and
|
||||
// return g_errno of ETRYAGAIN
|
||||
// . otherwise, we're guaranteed to have room for this list
|
||||
if ( ! hasRoom(list) ) {
|
||||
if( checkForRoom && ! hasRoom(list) ) {
|
||||
// if tree is empty, list will never fit!!!
|
||||
if ( m_useTree && m_tree.getNumUsedNodes() <= 0 ) {
|
||||
g_errno = ELISTTOOBIG;
|
||||
|
8
Rdb.h
8
Rdb.h
@ -125,7 +125,12 @@ public:
|
||||
// . if we can't handle all records in list we don't add any and
|
||||
// set errno to ETRYAGAIN or ENOMEM
|
||||
// . we copy all data so you can free your list when we're done
|
||||
bool addList ( collnum_t collnum , RdbList *list);
|
||||
bool addList(collnum_t collnum, RdbList *list) {
|
||||
return addList(collnum,list,true);
|
||||
}
|
||||
bool addListNoSpaceCheck(collnum_t collnum, RdbList *list) {
|
||||
return addList(collnum,list,false);
|
||||
}
|
||||
|
||||
bool isSecondaryRdb() const {
|
||||
return ::isSecondaryRdb((unsigned char)m_rdbId);
|
||||
@ -293,6 +298,7 @@ public:
|
||||
static void doneDumpingCollWrapper(void *state);
|
||||
|
||||
private:
|
||||
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; }
|
||||
|
||||
|
Reference in New Issue
Block a user