forked from Mirrors/privacore-open-source-search-engine
Remove unused Posdb methods
This commit is contained in:
109
Posdb.cpp
109
Posdb.cpp
@ -164,115 +164,6 @@ bool Posdb::init2 ( int32_t treeMem ) {
|
||||
g_conf.m_noInMemoryPosdbMerge);
|
||||
}
|
||||
|
||||
|
||||
bool Posdb::addColl ( const char *coll, bool doVerify ) {
|
||||
if ( ! m_rdb.addRdbBase1 ( coll ) ) return false;
|
||||
if ( ! doVerify ) return true;
|
||||
// verify
|
||||
if ( verify(coll) ) return true;
|
||||
// do a deep verify to figure out which files are corrupt
|
||||
//deepVerify ( coll );
|
||||
// if not allowing scale, return false
|
||||
if ( ! g_conf.m_allowScale ) return false;
|
||||
// otherwise let it go
|
||||
log ( "db: Verify failed, but scaling is allowed, passing." );
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Posdb::verify ( const char *coll ) {
|
||||
return true;
|
||||
#if 0
|
||||
log ( LOG_DEBUG, "db: Verifying Posdb for coll %s...", coll );
|
||||
g_threads.disableThreads();
|
||||
|
||||
Msg5 msg5;
|
||||
RdbList list;
|
||||
key144_t startKey;
|
||||
key144_t endKey;
|
||||
startKey.setMin();
|
||||
endKey.setMax();
|
||||
//int32_t minRecSizes = 64000;
|
||||
CollectionRec *cr = g_collectiondb.getRec(coll);
|
||||
|
||||
if ( ! msg5.getList ( RDB_POSDB ,
|
||||
cr->m_collnum ,
|
||||
&list ,
|
||||
&startKey ,
|
||||
&endKey ,
|
||||
64000 , // minRecSizes ,
|
||||
true , // includeTree ,
|
||||
false , // add to cache?
|
||||
0 , // max cache age
|
||||
0 , // startFileNum ,
|
||||
-1 , // numFiles ,
|
||||
NULL , // state
|
||||
NULL , // callback
|
||||
0 , // niceness
|
||||
false , // err correction?
|
||||
NULL ,
|
||||
0 ,
|
||||
-1 ,
|
||||
true ,
|
||||
-1LL ,
|
||||
true )) {
|
||||
g_threads.enableThreads();
|
||||
return log("db: HEY! it did not block");
|
||||
}
|
||||
|
||||
int32_t count = 0;
|
||||
int32_t got = 0;
|
||||
bool printedKey = false;
|
||||
bool printedZeroKey = false;
|
||||
for ( list.resetListPtr() ; ! list.isExhausted() ;
|
||||
list.skipCurrentRecord() ) {
|
||||
key144_t k;
|
||||
list.getCurrentKey(&k);
|
||||
// skip negative keys
|
||||
if ( (k.n0 & 0x01) == 0x00 ) continue;
|
||||
count++;
|
||||
//uint32_t groupId = k.n1 & g_hostdb.m_groupMask;
|
||||
//uint32_t groupId = getGroupId ( RDB_POSDB , &k );
|
||||
//if ( groupId == g_hostdb.m_groupId ) got++;
|
||||
uint32_t shardNum = getShardNum( RDB_POSDB , &k );
|
||||
if ( shardNum == getMyShardNum() ) got++;
|
||||
else if ( !printedKey ) {
|
||||
log ( "db: Found bad key in list (only printing once): "
|
||||
"%" PRIx64" %" PRIx64" %" PRIx32, k.n2, k.n1 ,(int32_t)k.n0);
|
||||
printedKey = true;
|
||||
}
|
||||
if ( k.n1 == 0 && k.n0 == 0 ) {
|
||||
if ( !printedZeroKey ) {
|
||||
log ( "db: Found Zero key in list, passing. "
|
||||
"(only printing once)." );
|
||||
printedZeroKey = true;
|
||||
}
|
||||
if ( shardNum != getMyShardNum() )
|
||||
got++;
|
||||
}
|
||||
}
|
||||
if ( got != count ) {
|
||||
// tally it up
|
||||
g_rebalance.m_numForeignRecs += count - got;
|
||||
log ("db: Out of first %" PRId32" records in posdb, only %" PRId32" belong "
|
||||
"to our group.",count,got);
|
||||
// exit if NONE, we probably got the wrong data
|
||||
if ( got == 0 ) log("db: Are you sure you have the "
|
||||
"right "
|
||||
"data in the right directory? "
|
||||
"Exiting.");
|
||||
log ( "db: Exiting due to Posdb inconsistency." );
|
||||
g_threads.enableThreads();
|
||||
return g_conf.m_bypassValidation;
|
||||
}
|
||||
log ( LOG_DEBUG, "db: Posdb passed verification successfully for %" PRId32" "
|
||||
"recs.", count );
|
||||
// DONE
|
||||
g_threads.enableThreads();
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// . see Posdb.h for format of the 12 byte key
|
||||
// . TODO: substitute var ptrs if you want extra speed
|
||||
void Posdb::makeKey ( void *vkp ,
|
||||
|
4
Posdb.h
4
Posdb.h
@ -108,10 +108,6 @@ class Posdb {
|
||||
// init the rebuild/secondary rdb, used by PageRepair.cpp
|
||||
bool init2 ( int32_t treeMem );
|
||||
|
||||
bool verify ( const char *coll );
|
||||
|
||||
bool addColl ( const char *coll, bool doVerify = true );
|
||||
|
||||
// . make a 16-byte key from all these components
|
||||
// . since it is 16 bytes, the big bit will be set
|
||||
static void makeKey ( void *kp ,
|
||||
|
Reference in New Issue
Block a user