Skip to content

Commit

Permalink
Issue #2066 Enhanced debug logging to simplify potential bug hunting.
Browse files Browse the repository at this point in the history
  • Loading branch information
vogel76 authored and mvandeberg committed Mar 20, 2018
1 parent 4af0073 commit 235a0ac
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions libraries/plugins/rocksdb/rocksdb_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ namespace bpo = boost::program_options;

#define STEEM_NAMESPACE_PREFIX "steem::protocol::"

#define DIAGNOSTIC(s)
//#define DIAGNOSTIC(s) s

namespace steem { namespace plugins { namespace rocksdb {

Expand Down Expand Up @@ -466,7 +468,8 @@ class rocksdb_plugin::impl final
size_t _totalOps = 0;
/// Total number of ops being skipped by filtering options.
size_t _excludedOps = 0;

/// Total number of accounts (impacted by ops) excluded from processing because of filtering.
mutable size_t _excludedAccountCount = 0;
/// IDs to be assigned to object.id field.
size_t _operationSeqId = 0;
size_t _accountHistorySeqId = 0;
Expand Down Expand Up @@ -569,6 +572,16 @@ inline bool rocksdb_plugin::impl::isTrackedAccount(const account_name_type& name
}

bool inRange = itr != _tracked_accounts.end() && itr->first <= name && name <= itr->second;

_excludedAccountCount += inRange;

DIAGNOSTIC(
if(inRange)
ilog("Account: ${a} matched to defined account range: [${b},${e}]", ("a", name)("b", itr->first)("e", itr->second) );
else
ilog("Account: ${a} ignored due to defined tracking filters.", ("a", name));
);

return inRange;
}

Expand Down Expand Up @@ -810,12 +823,14 @@ void rocksdb_plugin::impl::importOperation(uint32_t blockNum, const fc::time_poi

if(blockNum % 10000 == 0 && txInBlock == 0 && opInTx == 0)
{
ilog("RocksDb data import processed blocks: ${n}, containing: ${tx} transactions and ${op} operations."
" ${ep} operations have been filtered out due to configured options.",
ilog("RocksDb data import processed blocks: ${n}, containing: ${tx} transactions and ${op} operations.\n"
" ${ep} operations have been filtered out due to configured options.\n"
" ${ea} accounts have been filtered out due to configured options.",
("n", blockNum)
("tx", _txNo)
("op", _totalOps)
("ep", _excludedOps)
("ea", _excludedAccountCount)
);
}

Expand Down Expand Up @@ -928,11 +943,14 @@ void rocksdb_plugin::impl::importData(unsigned int blockLimit)
("cm", measure.current_mem)
("pm", measure.peak_mem) );

ilog( "RocksDb data import finished. Processed blocks: ${n}, containing: ${tx} transactions and ${op} operations. ${ep} operations have been filtered out due to configured options.",
ilog("RocksDb data import finished. Processed blocks: ${n}, containing: ${tx} transactions and ${op} operations.\n"
"${ep} operations have been filtered out due to configured options.\n"
"${ea} accounts have been filtered out due to configured options.",
("n", blockNo)
("tx", _txNo)
("op", _totalOps)
("ep", _excludedOps)
("ea", _excludedAccountCount)
);
}

Expand Down

0 comments on commit 235a0ac

Please sign in to comment.