mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Merge #17410: Rename db
log category to walletdb
(like coindb
)
e2c03c1156a1a8cb2c04c180f2ddbd3535126a46 doc: Add relase note for db→walletdb rename (Wladimir J. van der Laan) 4c1d263d93988ceed53e8f6b5decaf034b68137e scripted-diff: Change `BCLog::DB` to `BCLog::WALLETDB` (Wladimir J. van der Laan) 6b42b3ba9087225fddb91dd764c42c28d0c42d0f Rename `db` log category to `walletdb` (like `coindb`) (Wladimir J. van der Laan) Pull request description: Rename the `db` log category to `walletdb` (in the style of, and to distinguish from `coindb`). Deprecate (but still accept) '-debug=db'. Second commit is a scripted commit that changes the enum item name. ACKs for top commit: hebasto: ACK e2c03c1156a1a8cb2c04c180f2ddbd3535126a46, tested on Linux Mint 19.2: Tree-SHA512: a044de6f9a70e735cbb1caa4ed6bf75bc2269b2d5bc3241a25b6a6d69c1fc1d83456e252b431388ae61f4821e4fc06ecc1b634816ceadbe9a3c0e494bee6c11e
This commit is contained in:
parent
8fcc517f52
commit
9ca2c0a8a6
5
doc/release-notes-17410.md
Normal file
5
doc/release-notes-17410.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
Command-line options
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
- The `-debug=db` logging category has been renamed to `-debug=walletdb`, to distinguish it from `coindb`.
|
||||||
|
`-debug=db` has been deprecated and will be removed in the next major release.
|
@ -78,7 +78,15 @@ void BCLog::Logger::EnableCategory(BCLog::LogFlags flag)
|
|||||||
bool BCLog::Logger::EnableCategory(const std::string& str)
|
bool BCLog::Logger::EnableCategory(const std::string& str)
|
||||||
{
|
{
|
||||||
BCLog::LogFlags flag;
|
BCLog::LogFlags flag;
|
||||||
if (!GetLogCategory(flag, str)) return false;
|
if (!GetLogCategory(flag, str)) {
|
||||||
|
if (str == "db") {
|
||||||
|
// DEPRECATION: Added in 0.20, should start returning an error in 0.21
|
||||||
|
LogPrintf("Warning: logging category 'db' is deprecated, use 'walletdb' instead\n");
|
||||||
|
EnableCategory(BCLog::WALLETDB);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
EnableCategory(flag);
|
EnableCategory(flag);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -122,7 +130,7 @@ const CLogCategoryDesc LogCategories[] =
|
|||||||
{BCLog::HTTP, "http"},
|
{BCLog::HTTP, "http"},
|
||||||
{BCLog::BENCHMARK, "bench"},
|
{BCLog::BENCHMARK, "bench"},
|
||||||
{BCLog::ZMQ, "zmq"},
|
{BCLog::ZMQ, "zmq"},
|
||||||
{BCLog::DB, "db"},
|
{BCLog::WALLETDB, "walletdb"},
|
||||||
{BCLog::RPC, "rpc"},
|
{BCLog::RPC, "rpc"},
|
||||||
{BCLog::ESTIMATEFEE, "estimatefee"},
|
{BCLog::ESTIMATEFEE, "estimatefee"},
|
||||||
{BCLog::ADDRMAN, "addrman"},
|
{BCLog::ADDRMAN, "addrman"},
|
||||||
|
@ -41,7 +41,7 @@ namespace BCLog {
|
|||||||
HTTP = (1 << 3),
|
HTTP = (1 << 3),
|
||||||
BENCHMARK = (1 << 4),
|
BENCHMARK = (1 << 4),
|
||||||
ZMQ = (1 << 5),
|
ZMQ = (1 << 5),
|
||||||
DB = (1 << 6),
|
WALLETDB = (1 << 6),
|
||||||
RPC = (1 << 7),
|
RPC = (1 << 7),
|
||||||
ESTIMATEFEE = (1 << 8),
|
ESTIMATEFEE = (1 << 8),
|
||||||
ADDRMAN = (1 << 9),
|
ADDRMAN = (1 << 9),
|
||||||
|
@ -243,7 +243,7 @@ BerkeleyEnvironment::BerkeleyEnvironment()
|
|||||||
{
|
{
|
||||||
Reset();
|
Reset();
|
||||||
|
|
||||||
LogPrint(BCLog::DB, "BerkeleyEnvironment::MakeMock\n");
|
LogPrint(BCLog::WALLETDB, "BerkeleyEnvironment::MakeMock\n");
|
||||||
|
|
||||||
dbenv->set_cachesize(1, 0, 1);
|
dbenv->set_cachesize(1, 0, 1);
|
||||||
dbenv->set_lg_bsize(10485760 * 4);
|
dbenv->set_lg_bsize(10485760 * 4);
|
||||||
@ -725,7 +725,7 @@ void BerkeleyEnvironment::Flush(bool fShutdown)
|
|||||||
{
|
{
|
||||||
int64_t nStart = GetTimeMillis();
|
int64_t nStart = GetTimeMillis();
|
||||||
// Flush log data to the actual data file on all files that are not in use
|
// Flush log data to the actual data file on all files that are not in use
|
||||||
LogPrint(BCLog::DB, "BerkeleyEnvironment::Flush: [%s] Flush(%s)%s\n", strPath, fShutdown ? "true" : "false", fDbEnvInit ? "" : " database not started");
|
LogPrint(BCLog::WALLETDB, "BerkeleyEnvironment::Flush: [%s] Flush(%s)%s\n", strPath, fShutdown ? "true" : "false", fDbEnvInit ? "" : " database not started");
|
||||||
if (!fDbEnvInit)
|
if (!fDbEnvInit)
|
||||||
return;
|
return;
|
||||||
{
|
{
|
||||||
@ -734,21 +734,21 @@ void BerkeleyEnvironment::Flush(bool fShutdown)
|
|||||||
while (mi != mapFileUseCount.end()) {
|
while (mi != mapFileUseCount.end()) {
|
||||||
std::string strFile = (*mi).first;
|
std::string strFile = (*mi).first;
|
||||||
int nRefCount = (*mi).second;
|
int nRefCount = (*mi).second;
|
||||||
LogPrint(BCLog::DB, "BerkeleyEnvironment::Flush: Flushing %s (refcount = %d)...\n", strFile, nRefCount);
|
LogPrint(BCLog::WALLETDB, "BerkeleyEnvironment::Flush: Flushing %s (refcount = %d)...\n", strFile, nRefCount);
|
||||||
if (nRefCount == 0) {
|
if (nRefCount == 0) {
|
||||||
// Move log data to the dat file
|
// Move log data to the dat file
|
||||||
CloseDb(strFile);
|
CloseDb(strFile);
|
||||||
LogPrint(BCLog::DB, "BerkeleyEnvironment::Flush: %s checkpoint\n", strFile);
|
LogPrint(BCLog::WALLETDB, "BerkeleyEnvironment::Flush: %s checkpoint\n", strFile);
|
||||||
dbenv->txn_checkpoint(0, 0, 0);
|
dbenv->txn_checkpoint(0, 0, 0);
|
||||||
LogPrint(BCLog::DB, "BerkeleyEnvironment::Flush: %s detach\n", strFile);
|
LogPrint(BCLog::WALLETDB, "BerkeleyEnvironment::Flush: %s detach\n", strFile);
|
||||||
if (!fMockDb)
|
if (!fMockDb)
|
||||||
dbenv->lsn_reset(strFile.c_str(), 0);
|
dbenv->lsn_reset(strFile.c_str(), 0);
|
||||||
LogPrint(BCLog::DB, "BerkeleyEnvironment::Flush: %s closed\n", strFile);
|
LogPrint(BCLog::WALLETDB, "BerkeleyEnvironment::Flush: %s closed\n", strFile);
|
||||||
mapFileUseCount.erase(mi++);
|
mapFileUseCount.erase(mi++);
|
||||||
} else
|
} else
|
||||||
mi++;
|
mi++;
|
||||||
}
|
}
|
||||||
LogPrint(BCLog::DB, "BerkeleyEnvironment::Flush: Flush(%s)%s took %15dms\n", fShutdown ? "true" : "false", fDbEnvInit ? "" : " database not started", GetTimeMillis() - nStart);
|
LogPrint(BCLog::WALLETDB, "BerkeleyEnvironment::Flush: Flush(%s)%s took %15dms\n", fShutdown ? "true" : "false", fDbEnvInit ? "" : " database not started", GetTimeMillis() - nStart);
|
||||||
if (fShutdown) {
|
if (fShutdown) {
|
||||||
char** listp;
|
char** listp;
|
||||||
if (mapFileUseCount.empty()) {
|
if (mapFileUseCount.empty()) {
|
||||||
@ -787,7 +787,7 @@ bool BerkeleyBatch::PeriodicFlush(BerkeleyDatabase& database)
|
|||||||
std::map<std::string, int>::iterator mi = env->mapFileUseCount.find(strFile);
|
std::map<std::string, int>::iterator mi = env->mapFileUseCount.find(strFile);
|
||||||
if (mi != env->mapFileUseCount.end())
|
if (mi != env->mapFileUseCount.end())
|
||||||
{
|
{
|
||||||
LogPrint(BCLog::DB, "Flushing %s\n", strFile);
|
LogPrint(BCLog::WALLETDB, "Flushing %s\n", strFile);
|
||||||
int64_t nStart = GetTimeMillis();
|
int64_t nStart = GetTimeMillis();
|
||||||
|
|
||||||
// Flush wallet file so it's self contained
|
// Flush wallet file so it's self contained
|
||||||
@ -795,7 +795,7 @@ bool BerkeleyBatch::PeriodicFlush(BerkeleyDatabase& database)
|
|||||||
env->CheckpointLSN(strFile);
|
env->CheckpointLSN(strFile);
|
||||||
|
|
||||||
env->mapFileUseCount.erase(mi++);
|
env->mapFileUseCount.erase(mi++);
|
||||||
LogPrint(BCLog::DB, "Flushed %s %dms\n", strFile, GetTimeMillis() - nStart);
|
LogPrint(BCLog::WALLETDB, "Flushed %s %dms\n", strFile, GetTimeMillis() - nStart);
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -791,7 +791,7 @@ DBErrors WalletBatch::ZapSelectTx(std::vector<uint256>& vTxHashIn, std::vector<u
|
|||||||
}
|
}
|
||||||
else if ((*it) == hash) {
|
else if ((*it) == hash) {
|
||||||
if(!EraseTx(hash)) {
|
if(!EraseTx(hash)) {
|
||||||
LogPrint(BCLog::DB, "Transaction was found for deletion but returned database error: %s\n", hash.GetHex());
|
LogPrint(BCLog::WALLETDB, "Transaction was found for deletion but returned database error: %s\n", hash.GetHex());
|
||||||
delerror = true;
|
delerror = true;
|
||||||
}
|
}
|
||||||
vTxHashOut.push_back(hash);
|
vTxHashOut.push_back(hash);
|
||||||
|
Loading…
Reference in New Issue
Block a user