mirror of
https://github.com/privacore/open-source-search-engine.git
synced 2025-05-20 18:59:33 -04:00
Moved Rdb initialization from main to Rdb.cpp in new function initialiseAllPrimaryRdbs()
This commit is contained in:
parent
d03334fd1b
commit
4d12dcc85d
34
Rdb.cpp
34
Rdb.cpp
@ -1993,6 +1993,40 @@ const char *getDbnameFromId(rdbid_t rdbId) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool initialiseAllPrimaryRdbs() {
|
||||||
|
if(!g_posdb.init()) {
|
||||||
|
log( LOG_ERROR, "db: Posdb init failed." );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!g_titledb.init()) {
|
||||||
|
log( LOG_ERROR, "db: Titledb init failed." );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!g_tagdb.init()) {
|
||||||
|
log( LOG_ERROR, "db: Tagdb init failed." );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!g_spiderdb.init()) {
|
||||||
|
log( LOG_ERROR, "db: Spiderdb init failed." );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!g_doledb.init()) {
|
||||||
|
log( LOG_ERROR, "db: Doledb init failed." );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!g_clusterdb.init() ) {
|
||||||
|
log( LOG_ERROR, "db: Clusterdb init failed." );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!g_linkdb.init()) {
|
||||||
|
log( LOG_ERROR, "db: Linkdb init failed." );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// get the RdbBase class for an rdbId and collection name
|
// get the RdbBase class for an rdbId and collection name
|
||||||
RdbBase *getRdbBase(rdbid_t rdbId, collnum_t collnum) {
|
RdbBase *getRdbBase(rdbid_t rdbId, collnum_t collnum) {
|
||||||
Rdb *rdb = getRdbFromId ( rdbId );
|
Rdb *rdb = getRdbFromId ( rdbId );
|
||||||
|
3
Rdb.h
3
Rdb.h
@ -30,6 +30,9 @@ bool isSecondaryRdb ( rdbid_t rdbId ) ;
|
|||||||
// get the dbname
|
// get the dbname
|
||||||
const char *getDbnameFromId(rdbid_t rdbId);
|
const char *getDbnameFromId(rdbid_t rdbId);
|
||||||
|
|
||||||
|
//initialize all primary Rdbs
|
||||||
|
bool initialiseAllPrimaryRdbs();
|
||||||
|
|
||||||
// size of keys
|
// size of keys
|
||||||
char getKeySizeFromRdbId(rdbid_t rdbId);
|
char getKeySizeFromRdbId(rdbid_t rdbId);
|
||||||
|
|
||||||
|
40
main.cpp
40
main.cpp
@ -1575,34 +1575,8 @@ int main2 ( int argc , char *argv[] ) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! g_posdb.init() ) {
|
if(!initialiseAllPrimaryRdbs())
|
||||||
log( LOG_ERROR, "db: Posdb init failed." );
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
|
|
||||||
// then titledb
|
|
||||||
if ( ! g_titledb.init() ) {
|
|
||||||
log( LOG_ERROR, "db: Titledb init failed." );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// then tagdb
|
|
||||||
if ( ! g_tagdb.init() ) {
|
|
||||||
log( LOG_ERROR, "db: Tagdb init failed." );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// then spiderdb
|
|
||||||
if ( ! g_spiderdb.init() ) {
|
|
||||||
log( LOG_ERROR, "db: Spiderdb init failed." );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// then doledb
|
|
||||||
if ( ! g_doledb.init() ) {
|
|
||||||
log( LOG_ERROR, "db: Doledb init failed." );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// the spider cache used by SpiderLoop
|
// the spider cache used by SpiderLoop
|
||||||
if ( ! g_spiderCache.init() ) {
|
if ( ! g_spiderCache.init() ) {
|
||||||
@ -1610,18 +1584,6 @@ int main2 ( int argc , char *argv[] ) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// site clusterdb
|
|
||||||
if ( ! g_clusterdb.init() ) {
|
|
||||||
log( LOG_ERROR, "db: Clusterdb init failed." );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// linkdb
|
|
||||||
if ( ! g_linkdb.init() ) {
|
|
||||||
log( LOG_ERROR, "db: Linkdb init failed." );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// now clean the trees since all rdbs have loaded their rdb trees
|
// now clean the trees since all rdbs have loaded their rdb trees
|
||||||
// from disk, we need to remove bogus collection data from teh trees
|
// from disk, we need to remove bogus collection data from teh trees
|
||||||
// like if a collection was delete but tree never saved right it'll
|
// like if a collection was delete but tree never saved right it'll
|
||||||
|
Loading…
x
Reference in New Issue
Block a user