mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-19 20:04:24 -04:00
removed some debug info in rsdataservice
This commit is contained in:
parent
09ad53981d
commit
218ca45ac8
2 changed files with 65 additions and 60 deletions
|
@ -1309,46 +1309,46 @@ int RsDataService::retrieveGxsGrpMetaData(std::map<RsGxsGroupId, RsGxsGrpMetaDat
|
||||||
if(mGrpMetaDataCache_ContainsAllDatabase) // grab all the stash from the cache, so as to avoid decryption costs.
|
if(mGrpMetaDataCache_ContainsAllDatabase) // grab all the stash from the cache, so as to avoid decryption costs.
|
||||||
{
|
{
|
||||||
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
||||||
std::cerr << (void*)this << ": RsDataService::retrieveGxsGrpMetaData() retrieving all from cache!" << std::endl;
|
std::cerr << (void*)this << ": RsDataService::retrieveGxsGrpMetaData() retrieving all from cache!" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for(std::map<RsGxsGroupId,RsGxsGrpMetaData>::const_iterator it(mGrpMetaDataCache.begin());it!=mGrpMetaDataCache.end();++it)
|
for(std::map<RsGxsGroupId,RsGxsGrpMetaData>::const_iterator it(mGrpMetaDataCache.begin());it!=mGrpMetaDataCache.end();++it)
|
||||||
grp[it->first] = new RsGxsGrpMetaData(it->second);
|
grp[it->first] = new RsGxsGrpMetaData(it->second);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef RS_DATA_SERVICE_DEBUG
|
#ifdef RS_DATA_SERVICE_DEBUG
|
||||||
std::cerr << "RsDataService::retrieveGxsGrpMetaData() retrieving all" << std::endl;
|
std::cerr << "RsDataService::retrieveGxsGrpMetaData() retrieving all" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RetroCursor* c = mDb->sqlQuery(GRP_TABLE_NAME, mGrpMetaColumns, "", "");
|
RetroCursor* c = mDb->sqlQuery(GRP_TABLE_NAME, mGrpMetaColumns, "", "");
|
||||||
|
|
||||||
if(c)
|
if(c)
|
||||||
{
|
{
|
||||||
bool valid = c->moveToFirst();
|
bool valid = c->moveToFirst();
|
||||||
|
|
||||||
while(valid)
|
while(valid)
|
||||||
{
|
{
|
||||||
RsGxsGrpMetaData* g = locked_getGrpMeta(*c, 0);
|
RsGxsGrpMetaData* g = locked_getGrpMeta(*c, 0);
|
||||||
if(g)
|
if(g)
|
||||||
{
|
{
|
||||||
grp[g->mGroupId] = g;
|
grp[g->mGroupId] = g;
|
||||||
mGrpMetaDataCache[g->mGroupId] = *g ;
|
mGrpMetaDataCache[g->mGroupId] = *g ;
|
||||||
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
||||||
std::cerr << (void *)this << ": Retrieving (all) Grp metadata grpId=" << g->mGroupId << std::endl;
|
std::cerr << (void *)this << ": Retrieving (all) Grp metadata grpId=" << g->mGroupId << std::endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
valid = c->moveToNext();
|
valid = c->moveToNext();
|
||||||
|
|
||||||
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
||||||
++resultCount;
|
++resultCount;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
delete c;
|
delete c;
|
||||||
}
|
}
|
||||||
|
|
||||||
mGrpMetaDataCache_ContainsAllDatabase = true ;
|
mGrpMetaDataCache_ContainsAllDatabase = true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
|
@ -1360,52 +1360,52 @@ int RsDataService::retrieveGxsGrpMetaData(std::map<RsGxsGroupId, RsGxsGrpMetaDat
|
||||||
if(itt != mGrpMetaDataCache.end())
|
if(itt != mGrpMetaDataCache.end())
|
||||||
{
|
{
|
||||||
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
||||||
std::cerr << "Retrieving Grp metadata grpId=" << mit->first << " from cache!" << std::endl;
|
std::cerr << "Retrieving Grp metadata grpId=" << mit->first << " from cache!" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
grp[mit->first] = new RsGxsGrpMetaData(itt->second) ;
|
grp[mit->first] = new RsGxsGrpMetaData(itt->second) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
||||||
std::cerr << "Retrieving Grp metadata grpId=" << mit->first ;
|
std::cerr << "Retrieving Grp metadata grpId=" << mit->first ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const RsGxsGroupId& grpId = mit->first;
|
const RsGxsGroupId& grpId = mit->first;
|
||||||
RetroCursor* c = mDb->sqlQuery(GRP_TABLE_NAME, mGrpMetaColumns, "grpId='" + grpId.toStdString() + "'", "");
|
RetroCursor* c = mDb->sqlQuery(GRP_TABLE_NAME, mGrpMetaColumns, "grpId='" + grpId.toStdString() + "'", "");
|
||||||
|
|
||||||
if(c)
|
if(c)
|
||||||
{
|
{
|
||||||
bool valid = c->moveToFirst();
|
bool valid = c->moveToFirst();
|
||||||
|
|
||||||
//#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
//#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
||||||
if(!valid)
|
if(!valid)
|
||||||
std::cerr << " Empty query! GrpId " << grpId << " is not in database" << std::endl;
|
std::cerr << " Empty query! GrpId " << grpId << " is not in database" << std::endl;
|
||||||
//#endif
|
//#endif
|
||||||
while(valid)
|
while(valid)
|
||||||
{
|
{
|
||||||
RsGxsGrpMetaData* g = locked_getGrpMeta(*c, 0);
|
RsGxsGrpMetaData* g = locked_getGrpMeta(*c, 0);
|
||||||
|
|
||||||
if(g)
|
if(g)
|
||||||
{
|
{
|
||||||
grp[g->mGroupId] = g;
|
grp[g->mGroupId] = g;
|
||||||
mGrpMetaDataCache[g->mGroupId] = *g ;
|
mGrpMetaDataCache[g->mGroupId] = *g ;
|
||||||
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
||||||
std::cerr << ". Got it. Updating cache." << std::endl;
|
std::cerr << ". Got it. Updating cache." << std::endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
valid = c->moveToNext();
|
valid = c->moveToNext();
|
||||||
|
|
||||||
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
||||||
++resultCount;
|
++resultCount;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
delete c;
|
delete c;
|
||||||
}
|
}
|
||||||
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
||||||
else
|
else
|
||||||
std::cerr << ". not found!" << std::endl;
|
std::cerr << ". not found!" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1442,23 +1442,29 @@ int RsDataService::resetDataStore()
|
||||||
|
|
||||||
int RsDataService::updateGroupMetaData(GrpLocMetaData &meta)
|
int RsDataService::updateGroupMetaData(GrpLocMetaData &meta)
|
||||||
{
|
{
|
||||||
|
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
||||||
std::cerr << (void*)this << ": Updating Grp Meta data: grpId = " << meta.grpId << std::endl;
|
std::cerr << (void*)this << ": Updating Grp Meta data: grpId = " << meta.grpId << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
RsStackMutex stack(mDbMutex);
|
RsStackMutex stack(mDbMutex);
|
||||||
RsGxsGroupId& grpId = meta.grpId;
|
RsGxsGroupId& grpId = meta.grpId;
|
||||||
|
|
||||||
|
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
||||||
std::cerr << (void*)this << ": erasing old entry from cache." << std::endl;
|
std::cerr << (void*)this << ": erasing old entry from cache." << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
mGrpMetaDataCache_ContainsAllDatabase = false ;
|
mGrpMetaDataCache_ContainsAllDatabase = false ;
|
||||||
mGrpMetaDataCache.erase(meta.grpId) ;
|
mGrpMetaDataCache.erase(meta.grpId) ;
|
||||||
|
|
||||||
return mDb->sqlUpdate(GRP_TABLE_NAME, KEY_GRP_ID+ "='" + grpId.toStdString() + "'", meta.val) ? 1 : 0;
|
return mDb->sqlUpdate(GRP_TABLE_NAME, KEY_GRP_ID+ "='" + grpId.toStdString() + "'", meta.val) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RsDataService::updateMessageMetaData(MsgLocMetaData &metaData)
|
int RsDataService::updateMessageMetaData(MsgLocMetaData &metaData)
|
||||||
{
|
{
|
||||||
|
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
|
||||||
std::cerr << (void*)this << ": Updating Msg Meta data: grpId = " << metaData.msgId.first << " msgId = " << metaData.msgId.second << std::endl;
|
std::cerr << (void*)this << ": Updating Msg Meta data: grpId = " << metaData.msgId.first << " msgId = " << metaData.msgId.second << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
RsStackMutex stack(mDbMutex);
|
RsStackMutex stack(mDbMutex);
|
||||||
RsGxsGroupId& grpId = metaData.msgId.first;
|
RsGxsGroupId& grpId = metaData.msgId.first;
|
||||||
RsGxsMessageId& msgId = metaData.msgId.second;
|
RsGxsMessageId& msgId = metaData.msgId.second;
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
/****
|
/****
|
||||||
* #define DEBUG_REPUTATION 1
|
* #define DEBUG_REPUTATION 1
|
||||||
****/
|
****/
|
||||||
#define DEBUG_REPUTATION 1
|
|
||||||
|
|
||||||
/************ IMPLEMENTATION NOTES *********************************
|
/************ IMPLEMENTATION NOTES *********************************
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue