forked from Mirrors/privacore-open-source-search-engine
Renamed KEYADD to KEYINC and KEYSUB to KEYDEC
Because that is what they actually do
This commit is contained in:
10
Msg3.cpp
10
Msg3.cpp
@ -426,7 +426,7 @@ bool Msg3::readList ( char rdbId ,
|
||||
// m_constrainKey -= (uint32_t)1;
|
||||
KEYSET(m_constrainKey,m_endKey,m_ks);
|
||||
if ( KEYNEG(m_constrainKey) )
|
||||
KEYSUB(m_constrainKey,m_ks);
|
||||
KEYDEC(m_constrainKey,m_ks);
|
||||
|
||||
// Msg5 likes to get the endkey for getting the list from the tree
|
||||
if ( justGetEndKey ) return true;
|
||||
@ -522,7 +522,7 @@ bool Msg3::readList ( char rdbId ,
|
||||
// . maps[fn]->getKey(lastPage) will return the LAST KEY
|
||||
// and maps[fn]->getOffset(lastPage) the length of the file
|
||||
//if ( maps[fn]->getNumPages()!=p2) endKey -=(uint32_t)1;
|
||||
if ( maps[fn]->getNumPages() != p2 ) KEYSUB(endKey2,m_ks);
|
||||
if ( maps[fn]->getNumPages() != p2 ) KEYDEC(endKey2,m_ks);
|
||||
// otherwise, if we're reading all pages, then force the
|
||||
// endKey to virtual inifinite
|
||||
else KEYMAX(endKey2,m_ks);
|
||||
@ -1147,7 +1147,7 @@ void Msg3::setPageRanges ( RdbBase *base ,
|
||||
if ( KEYCMP(minKey,maps[fn]->getKeyPtr(m_endpg[i]),m_ks)!=0)
|
||||
continue;
|
||||
//minKey += (uint32_t) 1;
|
||||
KEYADD(minKey,m_ks);
|
||||
KEYINC(minKey,m_ks);
|
||||
}
|
||||
// . we're done if we hit the end of all maps in the race
|
||||
// . return the max end key
|
||||
@ -1177,12 +1177,12 @@ void Msg3::setPageRanges ( RdbBase *base ,
|
||||
if ( KEYCMP(minKey,endKey,m_ks)>0 ) {
|
||||
//lastMinKey = endKey;
|
||||
KEYSET(minKey,endKey,m_ks);
|
||||
KEYADD(minKey,m_ks);
|
||||
KEYINC(minKey,m_ks);
|
||||
KEYSET(lastMinKey,endKey,m_ks);
|
||||
}
|
||||
else {
|
||||
KEYSET(lastMinKey,minKey,m_ks);
|
||||
KEYSUB(lastMinKey,m_ks);
|
||||
KEYDEC(lastMinKey,m_ks);
|
||||
}
|
||||
// it is now valid
|
||||
lastMinKeyIsValid = 1;
|
||||
|
4
Msg5.cpp
4
Msg5.cpp
@ -431,7 +431,7 @@ bool Msg5::readList ( ) {
|
||||
// but it really wasn't and we get stuck with it
|
||||
char kk[MAX_KEY_BYTES];
|
||||
KEYSET(kk,m_startKey,m_ks);
|
||||
KEYADD(kk,m_ks);
|
||||
KEYINC(kk,m_ks);
|
||||
if ( KEYCMP(m_endKey,kk,m_ks)==0 && ! m_treeList.isEmpty() ) {
|
||||
return gotList();
|
||||
}
|
||||
@ -1312,7 +1312,7 @@ bool Msg5::doneMerging ( ) {
|
||||
//m_fileStartKey = m_list->getEndKey() ;
|
||||
//m_fileStartKey += (uint32_t)1;
|
||||
KEYSET(m_fileStartKey,m_list->getEndKey(),m_ks);
|
||||
KEYADD(m_fileStartKey,m_ks);
|
||||
KEYINC(m_fileStartKey,m_ks);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1476,7 +1476,7 @@ bool RdbBucket::getList(RdbList* list,
|
||||
// tree, then it's ok because we'd annihilate him anyway,
|
||||
// so we might as well ignore him
|
||||
// we are little endian
|
||||
if ( KEYNEG(newEndKey,0,ks) ) KEYADD(newEndKey,ks);
|
||||
if ( KEYNEG(newEndKey,0,ks) ) KEYINC(newEndKey,ks);
|
||||
// if we're using half keys set his half key bit
|
||||
if ( useHalfKeys ) KEYOR(newEndKey,0x02);
|
||||
if ( m_parent->m_rdbId == RDB_POSDB ||
|
||||
|
@ -439,7 +439,7 @@ bool RdbDump::dumpTree ( bool recall ) {
|
||||
//m_nextKey += (uint32_t)1;
|
||||
//if ( m_nextKey < lastKey ) m_rolledOver = true;
|
||||
KEYSET(m_nextKey,lastKey,m_ks);
|
||||
KEYADD(m_nextKey,m_ks);
|
||||
KEYINC(m_nextKey,m_ks);
|
||||
if (KEYCMP(m_nextKey,lastKey,m_ks)<0) m_rolledOver = true;
|
||||
// debug msg
|
||||
//log(0,"RdbDump:lastKey.n1=%" PRIu32",n0=%" PRIu64,lastKey.n1,lastKey.n0);
|
||||
|
@ -699,7 +699,7 @@ bool RdbList::checkList_r ( bool removeNegRecs , bool sleepOnProblem ,
|
||||
//acceptable += (uint32_t) 1;
|
||||
char acceptable[MAX_KEY_BYTES];
|
||||
KEYSET ( acceptable , m_endKey , m_ks );
|
||||
KEYADD ( acceptable , m_ks );
|
||||
KEYINC ( acceptable , m_ks );
|
||||
// watch out for wrap around...
|
||||
//if ( acceptable.n0 == 0 && acceptable.n1 == 0 ) {
|
||||
// acceptable.n1 = m_endKey.n1 ;
|
||||
@ -1884,7 +1884,7 @@ abort();
|
||||
// log(LOG_LOGIC,"db: rdblist: merge_r: Illegal endKey for "
|
||||
// "merging rdb=%s. fixing.",getDbnameFromId(rdbId));
|
||||
// make it legal so it will be read first NEXT time
|
||||
KEYSUB(m_endKey,m_ks);
|
||||
KEYDEC(m_endKey,m_ks);
|
||||
}
|
||||
|
||||
// do nothing if no lists passed in
|
||||
@ -2263,7 +2263,7 @@ skip:
|
||||
//if ( (*(char *)&endKey & 0x01) == 0x00 )
|
||||
if ( KEYNEG(endKey) )
|
||||
//endKey += (uint32_t)1;
|
||||
KEYADD(endKey,m_ks);
|
||||
KEYINC(endKey,m_ks);
|
||||
// be careful not to increase original endkey, though
|
||||
//if ( endKey < m_endKey ) m_endKey = endKey;
|
||||
if ( KEYCMP(endKey,m_endKey,m_ks)<0 )
|
||||
@ -2642,7 +2642,7 @@ bool RdbList::posdbMerge_r ( RdbList **lists ,
|
||||
// if endkey is now negative we must have a dangling negative
|
||||
// so make it positive (dangling = unmatched)
|
||||
if ( KEYNEG(m_endKey) )
|
||||
KEYADD(m_endKey, sizeof(key144_t));
|
||||
KEYINC(m_endKey, sizeof(key144_t));
|
||||
// be careful not to increase original endkey, though
|
||||
if ( KEYCMP(orig,m_endKey,sizeof(key144_t))<0 )
|
||||
KEYSET(m_endKey, orig, sizeof(key144_t));
|
||||
|
@ -475,7 +475,7 @@ bool RdbMap::verifyMap2 ( ) {
|
||||
KEYSET(f,lastKey,m_ks);
|
||||
//if ( lastKey != getKey(i+1) ) f += (uint32_t)1;
|
||||
if (KEYCMP(lastKey,getKeyPtr(i+1),m_ks)!=0)
|
||||
KEYADD(f,m_ks);
|
||||
KEYINC(f,m_ks);
|
||||
setKey(i,f);
|
||||
log("db: Key in map was too small. Fixed.");
|
||||
goto top;
|
||||
@ -486,7 +486,7 @@ bool RdbMap::verifyMap2 ( ) {
|
||||
//key_t f = getKey(i-2);
|
||||
char *f = getKeyPtr(i-2);
|
||||
//if ( f != k ) f += (uint32_t)1;
|
||||
if ( KEYCMP(f,k,m_ks)!=0) KEYADD(f,m_ks);
|
||||
if ( KEYCMP(f,k,m_ks)!=0) KEYINC(f,m_ks);
|
||||
setKey(i-1,f);
|
||||
log("db: LastKey in map was too big. Fixed.");
|
||||
goto top;
|
||||
|
@ -87,7 +87,7 @@ bool RdbMerge::merge ( char rdbId ,
|
||||
//m_startKey = m_targetMap->getLastKey();
|
||||
m_targetMap->getLastKey(m_startKey);
|
||||
//m_startKey += (uint32_t) 1;
|
||||
KEYADD(m_startKey,m_ks);
|
||||
KEYINC(m_startKey,m_ks);
|
||||
// if power goes out and we are not doing synchronous writes
|
||||
// then we could have completely lost some data and unlinked
|
||||
// a part file from the file being merged, so that the data is
|
||||
@ -519,7 +519,7 @@ bool RdbMerge::dumpList ( ) {
|
||||
// doing the merge.
|
||||
m_list.getEndKey(m_startKey) ;
|
||||
//m_startKey += (uint32_t)1;
|
||||
KEYADD(m_startKey,m_ks);
|
||||
KEYINC(m_startKey,m_ks);
|
||||
|
||||
/////
|
||||
//
|
||||
|
@ -1950,7 +1950,7 @@ bool RdbTree::getList ( collnum_t collnum ,
|
||||
//if (((newEndKey.n0) & 0x01) == 0x00 )
|
||||
// newEndKey += (uint32_t)1;
|
||||
// we are little endian
|
||||
if ( KEYNEG(newEndKey,0,m_ks) ) KEYADD(newEndKey,m_ks);
|
||||
if ( KEYNEG(newEndKey,0,m_ks) ) KEYINC(newEndKey,m_ks);
|
||||
// if we're using half keys set his half key bit
|
||||
//if ( useHalfKeys ) newEndKey.n0 |= 0x02;
|
||||
if ( useHalfKeys ) KEYOR(newEndKey,0x02);
|
||||
|
@ -530,7 +530,7 @@ bool Rebalance::gotList ( ) {
|
||||
// if it is not maxxed out, then incremenet it for the
|
||||
// next scan round
|
||||
if ( KEYCMP ( m_nextKey , KEYMAX() , ks ) != 0 )
|
||||
KEYADD ( m_nextKey , ks );
|
||||
KEYINC ( m_nextKey , ks );
|
||||
}
|
||||
|
||||
if ( ! m_msg4a.addMetaList( &m_posMetaList, m_collnum, this, doneAddingMetaWrapper, MAX_NICENESS, rdb->m_rdbId, -1 ) ) { // shard override, not!
|
||||
|
4
types.h
4
types.h
@ -659,7 +659,7 @@ static inline bool KEYNEG ( key_t k ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline void KEYADD ( char *k , char keySize ) {
|
||||
static inline void KEYINC(char *k, char keySize) {
|
||||
// posdb
|
||||
if ( keySize == 18 ) { *((key144_t *)k) += (int32_t)1; return; }
|
||||
if ( keySize == 12 ) { *((key96_t *)k) += (int32_t)1; return; }
|
||||
@ -670,7 +670,7 @@ static inline void KEYADD ( char *k , char keySize ) {
|
||||
gbshutdownAbort(true);
|
||||
}
|
||||
|
||||
static inline void KEYSUB ( char *k , char keySize ) {
|
||||
static inline void KEYDEC(char *k, char keySize) {
|
||||
if ( keySize == 18 ) { *((key144_t *)k) -= (int32_t)1; return; }
|
||||
if ( keySize == 12 ) { *((key96_t *)k) -= (int32_t)1; return; }
|
||||
if ( keySize == 16 ) { *((key128_t *)k) -= (int32_t)1; return; }
|
||||
|
Reference in New Issue
Block a user