@@ -42,7 +42,7 @@ void CDBEnv::EnvShutdown()
42
42
fDbEnvInit = false ;
43
43
int ret = dbenv.close (0 );
44
44
if (ret != 0 )
45
- LogPrintf (" EnvShutdown exception: %s (%d) \n " , DbEnv::strerror (ret), ret );
45
+ LogPrintf (" CDBEnv:: EnvShutdown : Error %d shutting down database environment: %s \n " , ret, DbEnv::strerror (ret));
46
46
if (!fMockDb )
47
47
DbEnv (0 ).remove (path.string ().c_str (), 0 );
48
48
}
@@ -74,7 +74,7 @@ bool CDBEnv::Open(const boost::filesystem::path& pathIn)
74
74
filesystem::path pathLogDir = path / " database" ;
75
75
TryCreateDirectory (pathLogDir);
76
76
filesystem::path pathErrorFile = path / " db.log" ;
77
- LogPrintf (" dbenv.open LogDir=%s ErrorFile=%s\n " , pathLogDir.string (), pathErrorFile.string ());
77
+ LogPrintf (" CDBEnv::Open : LogDir=%s ErrorFile=%s\n " , pathLogDir.string (), pathErrorFile.string ());
78
78
79
79
unsigned int nEnvFlags = 0 ;
80
80
if (GetBoolArg (" -privdb" , true ))
@@ -101,7 +101,7 @@ bool CDBEnv::Open(const boost::filesystem::path& pathIn)
101
101
nEnvFlags,
102
102
S_IRUSR | S_IWUSR);
103
103
if (ret != 0 )
104
- return error (" CDB() : error %s (%d) opening database environment" , DbEnv::strerror (ret), ret );
104
+ return error (" CDBEnv::Open : Error %d opening database environment: %s \n " , ret, DbEnv::strerror (ret));
105
105
106
106
fDbEnvInit = true ;
107
107
fMockDb = false ;
@@ -111,11 +111,11 @@ bool CDBEnv::Open(const boost::filesystem::path& pathIn)
111
111
void CDBEnv::MakeMock ()
112
112
{
113
113
if (fDbEnvInit )
114
- throw runtime_error (" CDBEnv::MakeMock(): already initialized" );
114
+ throw runtime_error (" CDBEnv::MakeMock : Already initialized" );
115
115
116
116
boost::this_thread::interruption_point ();
117
117
118
- LogPrint (" db" , " CDBEnv::MakeMock() \n " );
118
+ LogPrint (" db" , " CDBEnv::MakeMock\n " );
119
119
120
120
dbenv.set_cachesize (1 , 0 , 1 );
121
121
dbenv.set_lg_bsize (10485760 *4 );
@@ -134,7 +134,7 @@ void CDBEnv::MakeMock()
134
134
DB_PRIVATE,
135
135
S_IRUSR | S_IWUSR);
136
136
if (ret > 0 )
137
- throw runtime_error (strprintf (" CDBEnv::MakeMock(): error %d opening database environment" , ret));
137
+ throw runtime_error (strprintf (" CDBEnv::MakeMock : Error %d opening database environment. " , ret));
138
138
139
139
fDbEnvInit = true ;
140
140
fMockDb = true ;
@@ -172,16 +172,16 @@ bool CDBEnv::Salvage(std::string strFile, bool fAggressive,
172
172
int result = db.verify (strFile.c_str (), NULL , &strDump, flags);
173
173
if (result == DB_VERIFY_BAD)
174
174
{
175
- LogPrintf (" Error: Salvage found errors, all data may not be recoverable.\n " );
175
+ LogPrintf (" CDBEnv:: Salvage : Database salvage found errors, all data may not be recoverable.\n " );
176
176
if (!fAggressive )
177
177
{
178
- LogPrintf (" Error : Rerun with aggressive mode to ignore errors and continue.\n " );
178
+ LogPrintf (" CDBEnv::Salvage : Rerun with aggressive mode to ignore errors and continue.\n " );
179
179
return false ;
180
180
}
181
181
}
182
182
if (result != 0 && result != DB_VERIFY_BAD)
183
183
{
184
- LogPrintf (" ERROR: db salvage failed: %d \n " ,result);
184
+ LogPrintf (" CDBEnv::Salvage : Database salvage failed with result %d. \n " , result);
185
185
return false ;
186
186
}
187
187
@@ -237,7 +237,7 @@ CDB::CDB(const char *pszFile, const char* pszMode) :
237
237
{
238
238
LOCK (bitdb.cs_db );
239
239
if (!bitdb.Open (GetDataDir ()))
240
- throw runtime_error (" env open failed " );
240
+ throw runtime_error (" CDB : Failed to open database environment. " );
241
241
242
242
strFile = pszFile;
243
243
++bitdb.mapFileUseCount [strFile];
@@ -252,7 +252,7 @@ CDB::CDB(const char *pszFile, const char* pszMode) :
252
252
DbMpoolFile*mpf = pdb->get_mpf ();
253
253
ret = mpf->set_flags (DB_MPOOL_NOFILE, 1 );
254
254
if (ret != 0 )
255
- throw runtime_error (strprintf (" CDB() : failed to configure for no temp file backing for database %s" , pszFile));
255
+ throw runtime_error (strprintf (" CDB : Failed to configure for no temp file backing for database %s" , pszFile));
256
256
}
257
257
258
258
ret = pdb->open (NULL , // Txn pointer
@@ -268,7 +268,7 @@ CDB::CDB(const char *pszFile, const char* pszMode) :
268
268
pdb = NULL ;
269
269
--bitdb.mapFileUseCount [strFile];
270
270
strFile = " " ;
271
- throw runtime_error (strprintf (" CDB() : can't open database file %s, error %d " , pszFile, ret ));
271
+ throw runtime_error (strprintf (" CDB : Error %d, can't open database %s " , ret, pszFile ));
272
272
}
273
273
274
274
if (fCreate && !Exists (string (" version" )))
@@ -352,7 +352,7 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip)
352
352
bitdb.mapFileUseCount .erase (strFile);
353
353
354
354
bool fSuccess = true ;
355
- LogPrintf (" Rewriting %s...\n " , strFile);
355
+ LogPrintf (" CDB::Rewrite : Rewriting %s...\n " , strFile);
356
356
string strFileRes = strFile + " .rewrite" ;
357
357
{ // surround usage of db with extra {}
358
358
CDB db (strFile.c_str (), " r" );
@@ -366,7 +366,7 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip)
366
366
0 );
367
367
if (ret > 0 )
368
368
{
369
- LogPrintf (" Cannot create database file %s\n " , strFileRes);
369
+ LogPrintf (" CDB::Rewrite : Can't create database file %s\n " , strFileRes);
370
370
fSuccess = false ;
371
371
}
372
372
@@ -422,7 +422,7 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip)
422
422
fSuccess = false ;
423
423
}
424
424
if (!fSuccess )
425
- LogPrintf (" Rewriting of %s FAILED! \n " , strFileRes);
425
+ LogPrintf (" CDB::Rewrite : Failed to rewrite database file %s \n " , strFileRes);
426
426
return fSuccess ;
427
427
}
428
428
}
@@ -435,9 +435,8 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip)
435
435
void CDBEnv::Flush (bool fShutdown )
436
436
{
437
437
int64_t nStart = GetTimeMillis ();
438
- // Flush log data to the actual data file
439
- // on all files that are not in use
440
- LogPrint (" db" , " Flush(%s)%s\n " , fShutdown ? " true" : " false" , fDbEnvInit ? " " : " db not started" );
438
+ // Flush log data to the actual data file on all files that are not in use
439
+ LogPrint (" db" , " CDBEnv::Flush : Flush(%s)%s\n " , fShutdown ? " true" : " false" , fDbEnvInit ? " " : " database not started" );
441
440
if (!fDbEnvInit )
442
441
return ;
443
442
{
@@ -447,23 +446,23 @@ void CDBEnv::Flush(bool fShutdown)
447
446
{
448
447
string strFile = (*mi).first ;
449
448
int nRefCount = (*mi).second ;
450
- LogPrint (" db" , " %s refcount=%d \n " , strFile, nRefCount);
449
+ LogPrint (" db" , " CDBEnv::Flush : Flushing %s ( refcount = %d)... \n " , strFile, nRefCount);
451
450
if (nRefCount == 0 )
452
451
{
453
452
// Move log data to the dat file
454
453
CloseDb (strFile);
455
- LogPrint (" db" , " %s checkpoint\n " , strFile);
454
+ LogPrint (" db" , " CDBEnv::Flush : %s checkpoint\n " , strFile);
456
455
dbenv.txn_checkpoint (0 , 0 , 0 );
457
- LogPrint (" db" , " %s detach\n " , strFile);
456
+ LogPrint (" db" , " CDBEnv::Flush : %s detach\n " , strFile);
458
457
if (!fMockDb )
459
458
dbenv.lsn_reset (strFile.c_str (), 0 );
460
- LogPrint (" db" , " %s closed\n " , strFile);
459
+ LogPrint (" db" , " CDBEnv::Flush : %s closed\n " , strFile);
461
460
mapFileUseCount.erase (mi++);
462
461
}
463
462
else
464
463
mi++;
465
464
}
466
- LogPrint (" db" , " DBFlush (%s)%s ended %15dms\n " , fShutdown ? " true" : " false" , fDbEnvInit ? " " : " db not started" , GetTimeMillis () - nStart);
465
+ LogPrint (" db" , " CDBEnv::Flush : Flush (%s)%s took %15dms\n " , fShutdown ? " true" : " false" , fDbEnvInit ? " " : " database not started" , GetTimeMillis () - nStart);
467
466
if (fShutdown )
468
467
{
469
468
char ** listp;
0 commit comments