mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Log partition support.
This commit is contained in:
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
|
|
||||||
|
SETUP_LOG();
|
||||||
|
|
||||||
// #define META_DEBUG
|
// #define META_DEBUG
|
||||||
|
|
||||||
// Small for testing, should likely be 32 or 64.
|
// Small for testing, should likely be 32 or 64.
|
||||||
@@ -297,7 +299,7 @@ bool LedgerEntrySet::threadTx(const NewcoinAddress& threadTo, Ledger::ref ledger
|
|||||||
boost::unordered_map<uint256, SLE::pointer>& newMods)
|
boost::unordered_map<uint256, SLE::pointer>& newMods)
|
||||||
{
|
{
|
||||||
#ifdef META_DEBUG
|
#ifdef META_DEBUG
|
||||||
Log(lsTRACE) << "Thread to " << threadTo.getAccountID();
|
cLog(lsTRACE) << "Thread to " << threadTo.getAccountID();
|
||||||
#endif
|
#endif
|
||||||
SLE::pointer sle = getForMod(Ledger::getAccountRootIndex(threadTo.getAccountID()), ledger, newMods);
|
SLE::pointer sle = getForMod(Ledger::getAccountRootIndex(threadTo.getAccountID()), ledger, newMods);
|
||||||
if (!sle)
|
if (!sle)
|
||||||
@@ -326,14 +328,14 @@ bool LedgerEntrySet::threadOwners(SLE::ref node, Ledger::ref ledger, boost::unor
|
|||||||
if (node->hasOneOwner()) // thread to owner's account
|
if (node->hasOneOwner()) // thread to owner's account
|
||||||
{
|
{
|
||||||
#ifdef META_DEBUG
|
#ifdef META_DEBUG
|
||||||
Log(lsTRACE) << "Thread to single owner";
|
cLog(lsTRACE) << "Thread to single owner";
|
||||||
#endif
|
#endif
|
||||||
return threadTx(node->getOwner(), ledger, newMods);
|
return threadTx(node->getOwner(), ledger, newMods);
|
||||||
}
|
}
|
||||||
else if (node->hasTwoOwners()) // thread to owner's accounts]
|
else if (node->hasTwoOwners()) // thread to owner's accounts]
|
||||||
{
|
{
|
||||||
#ifdef META_DEBUG
|
#ifdef META_DEBUG
|
||||||
Log(lsTRACE) << "Thread to two owners";
|
cLog(lsTRACE) << "Thread to two owners";
|
||||||
#endif
|
#endif
|
||||||
return
|
return
|
||||||
threadTx(node->getFirstOwner(), ledger, newMods) &&
|
threadTx(node->getFirstOwner(), ledger, newMods) &&
|
||||||
@@ -358,21 +360,21 @@ void LedgerEntrySet::calcRawMeta(Serializer& s)
|
|||||||
{
|
{
|
||||||
case taaMODIFY:
|
case taaMODIFY:
|
||||||
#ifdef META_DEBUG
|
#ifdef META_DEBUG
|
||||||
Log(lsTRACE) << "Modified Node " << it->first;
|
cLog(lsTRACE) << "Modified Node " << it->first;
|
||||||
#endif
|
#endif
|
||||||
nType = TMNModifiedNode;
|
nType = TMNModifiedNode;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case taaDELETE:
|
case taaDELETE:
|
||||||
#ifdef META_DEBUG
|
#ifdef META_DEBUG
|
||||||
Log(lsTRACE) << "Deleted Node " << it->first;
|
cLog(lsTRACE) << "Deleted Node " << it->first;
|
||||||
#endif
|
#endif
|
||||||
nType = TMNDeletedNode;
|
nType = TMNDeletedNode;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case taaCREATE:
|
case taaCREATE:
|
||||||
#ifdef META_DEBUG
|
#ifdef META_DEBUG
|
||||||
Log(lsTRACE) << "Created Node " << it->first;
|
cLog(lsTRACE) << "Created Node " << it->first;
|
||||||
#endif
|
#endif
|
||||||
nType = TMNCreatedNode;
|
nType = TMNCreatedNode;
|
||||||
break;
|
break;
|
||||||
@@ -466,7 +468,7 @@ void LedgerEntrySet::calcRawMeta(Serializer& s)
|
|||||||
entryModify(it->second);
|
entryModify(it->second);
|
||||||
|
|
||||||
#ifdef META_DEBUG
|
#ifdef META_DEBUG
|
||||||
Log(lsINFO) << "Metadata:" << mSet.getJson(0);
|
cLog(lsINFO) << "Metadata:" << mSet.getJson(0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mSet.addRaw(s);
|
mSet.addRaw(s);
|
||||||
@@ -557,10 +559,10 @@ TER LedgerEntrySet::dirAdd(
|
|||||||
svIndexes.peekValue().push_back(uLedgerIndex); // Append entry.
|
svIndexes.peekValue().push_back(uLedgerIndex); // Append entry.
|
||||||
sleNode->setFieldV256(sfIndexes, svIndexes); // Save entry.
|
sleNode->setFieldV256(sfIndexes, svIndexes); // Save entry.
|
||||||
|
|
||||||
Log(lsINFO) << "dirAdd: creating: root: " << uRootIndex.ToString();
|
cLog(lsINFO) << "dirAdd: creating: root: " << uRootIndex.ToString();
|
||||||
Log(lsINFO) << "dirAdd: appending: Entry: " << uLedgerIndex.ToString();
|
cLog(lsINFO) << "dirAdd: appending: Entry: " << uLedgerIndex.ToString();
|
||||||
Log(lsINFO) << "dirAdd: appending: Node: " << strHex(uNodeDir);
|
cLog(lsINFO) << "dirAdd: appending: Node: " << strHex(uNodeDir);
|
||||||
// Log(lsINFO) << "dirAdd: appending: PREV: " << svIndexes.peekValue()[0].ToString();
|
// cLog(lsINFO) << "dirAdd: appending: PREV: " << svIndexes.peekValue()[0].ToString();
|
||||||
|
|
||||||
return tesSUCCESS;
|
return tesSUCCESS;
|
||||||
}
|
}
|
||||||
@@ -580,7 +582,7 @@ TER LedgerEntrySet::dirDelete(
|
|||||||
|
|
||||||
if (!sleNode)
|
if (!sleNode)
|
||||||
{
|
{
|
||||||
Log(lsWARNING) << "dirDelete: no such node";
|
cLog(lsWARNING) << "dirDelete: no such node";
|
||||||
|
|
||||||
return tefBAD_LEDGER;
|
return tefBAD_LEDGER;
|
||||||
}
|
}
|
||||||
@@ -596,7 +598,7 @@ TER LedgerEntrySet::dirDelete(
|
|||||||
{
|
{
|
||||||
assert(false);
|
assert(false);
|
||||||
|
|
||||||
Log(lsWARNING) << "dirDelete: no such entry";
|
cLog(lsWARNING) << "dirDelete: no such entry";
|
||||||
|
|
||||||
return tefBAD_LEDGER;
|
return tefBAD_LEDGER;
|
||||||
}
|
}
|
||||||
@@ -688,14 +690,14 @@ TER LedgerEntrySet::dirDelete(
|
|||||||
|
|
||||||
if (!slePrevious)
|
if (!slePrevious)
|
||||||
{
|
{
|
||||||
Log(lsWARNING) << "dirDelete: previous node is missing";
|
cLog(lsWARNING) << "dirDelete: previous node is missing";
|
||||||
|
|
||||||
return tefBAD_LEDGER;
|
return tefBAD_LEDGER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sleNext)
|
if (!sleNext)
|
||||||
{
|
{
|
||||||
Log(lsWARNING) << "dirDelete: next node is missing";
|
cLog(lsWARNING) << "dirDelete: next node is missing";
|
||||||
|
|
||||||
return tefBAD_LEDGER;
|
return tefBAD_LEDGER;
|
||||||
}
|
}
|
||||||
@@ -789,7 +791,7 @@ bool LedgerEntrySet::dirNext(
|
|||||||
}
|
}
|
||||||
|
|
||||||
uEntryIndex = vuiIndexes[uDirEntry++];
|
uEntryIndex = vuiIndexes[uDirEntry++];
|
||||||
Log(lsINFO) << boost::str(boost::format("dirNext: uDirEntry=%d uEntryIndex=%s") % uDirEntry % uEntryIndex);
|
cLog(lsINFO) << boost::str(boost::format("dirNext: uDirEntry=%d uEntryIndex=%s") % uDirEntry % uEntryIndex);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -836,7 +838,7 @@ STAmount LedgerEntrySet::rippleOwed(const uint160& uToAccountID, const uint160&
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log(lsINFO) << "rippleOwed: No credit line between "
|
cLog(lsINFO) << "rippleOwed: No credit line between "
|
||||||
<< NewcoinAddress::createHumanAccountID(uFromAccountID)
|
<< NewcoinAddress::createHumanAccountID(uFromAccountID)
|
||||||
<< " and "
|
<< " and "
|
||||||
<< NewcoinAddress::createHumanAccountID(uToAccountID)
|
<< NewcoinAddress::createHumanAccountID(uToAccountID)
|
||||||
@@ -876,7 +878,7 @@ uint32 LedgerEntrySet::rippleTransferRate(const uint160& uIssuerID)
|
|||||||
? sleAccount->getFieldU32(sfTransferRate)
|
? sleAccount->getFieldU32(sfTransferRate)
|
||||||
: QUALITY_ONE;
|
: QUALITY_ONE;
|
||||||
|
|
||||||
Log(lsINFO) << boost::str(boost::format("rippleTransferRate: uIssuerID=%s account_exists=%d transfer_rate=%f")
|
cLog(lsINFO) << boost::str(boost::format("rippleTransferRate: uIssuerID=%s account_exists=%d transfer_rate=%f")
|
||||||
% NewcoinAddress::createHumanAccountID(uIssuerID)
|
% NewcoinAddress::createHumanAccountID(uIssuerID)
|
||||||
% !!sleAccount
|
% !!sleAccount
|
||||||
% (uQuality/1000000000.0));
|
% (uQuality/1000000000.0));
|
||||||
@@ -920,7 +922,7 @@ uint32 LedgerEntrySet::rippleQualityIn(const uint160& uToAccountID, const uint16
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log(lsINFO) << boost::str(boost::format("rippleQuality: %s uToAccountID=%s uFromAccountID=%s uCurrencyID=%s bLine=%d uQuality=%f")
|
cLog(lsINFO) << boost::str(boost::format("rippleQuality: %s uToAccountID=%s uFromAccountID=%s uCurrencyID=%s bLine=%d uQuality=%f")
|
||||||
% (sfLow == sfLowQualityIn ? "in" : "out")
|
% (sfLow == sfLowQualityIn ? "in" : "out")
|
||||||
% NewcoinAddress::createHumanAccountID(uToAccountID)
|
% NewcoinAddress::createHumanAccountID(uToAccountID)
|
||||||
% NewcoinAddress::createHumanAccountID(uFromAccountID)
|
% NewcoinAddress::createHumanAccountID(uFromAccountID)
|
||||||
@@ -967,7 +969,7 @@ STAmount LedgerEntrySet::accountHolds(const uint160& uAccountID, const uint160&
|
|||||||
saAmount = rippleHolds(uAccountID, uCurrencyID, uIssuerID);
|
saAmount = rippleHolds(uAccountID, uCurrencyID, uIssuerID);
|
||||||
}
|
}
|
||||||
|
|
||||||
Log(lsINFO) << boost::str(boost::format("accountHolds: uAccountID=%s saAmount=%s")
|
cLog(lsINFO) << boost::str(boost::format("accountHolds: uAccountID=%s saAmount=%s")
|
||||||
% NewcoinAddress::createHumanAccountID(uAccountID)
|
% NewcoinAddress::createHumanAccountID(uAccountID)
|
||||||
% saAmount.getFullText());
|
% saAmount.getFullText());
|
||||||
|
|
||||||
@@ -987,7 +989,7 @@ STAmount LedgerEntrySet::accountFunds(const uint160& uAccountID, const STAmount&
|
|||||||
{
|
{
|
||||||
saFunds = saDefault;
|
saFunds = saDefault;
|
||||||
|
|
||||||
Log(lsINFO) << boost::str(boost::format("accountFunds: uAccountID=%s saDefault=%s SELF-FUNDED")
|
cLog(lsINFO) << boost::str(boost::format("accountFunds: uAccountID=%s saDefault=%s SELF-FUNDED")
|
||||||
% NewcoinAddress::createHumanAccountID(uAccountID)
|
% NewcoinAddress::createHumanAccountID(uAccountID)
|
||||||
% saDefault.getFullText());
|
% saDefault.getFullText());
|
||||||
}
|
}
|
||||||
@@ -995,7 +997,7 @@ STAmount LedgerEntrySet::accountFunds(const uint160& uAccountID, const STAmount&
|
|||||||
{
|
{
|
||||||
saFunds = accountHolds(uAccountID, saDefault.getCurrency(), saDefault.getIssuer());
|
saFunds = accountHolds(uAccountID, saDefault.getCurrency(), saDefault.getIssuer());
|
||||||
|
|
||||||
Log(lsINFO) << boost::str(boost::format("accountFunds: uAccountID=%s saDefault=%s saFunds=%s")
|
cLog(lsINFO) << boost::str(boost::format("accountFunds: uAccountID=%s saDefault=%s saFunds=%s")
|
||||||
% NewcoinAddress::createHumanAccountID(uAccountID)
|
% NewcoinAddress::createHumanAccountID(uAccountID)
|
||||||
% saDefault.getFullText()
|
% saDefault.getFullText()
|
||||||
% saFunds.getFullText());
|
% saFunds.getFullText());
|
||||||
@@ -1038,7 +1040,7 @@ void LedgerEntrySet::rippleCredit(const uint160& uSenderID, const uint160& uRece
|
|||||||
|
|
||||||
if (!sleRippleState)
|
if (!sleRippleState)
|
||||||
{
|
{
|
||||||
Log(lsINFO) << "rippleCredit: Creating ripple line: " << uIndex.ToString();
|
cLog(lsINFO) << "rippleCredit: Creating ripple line: " << uIndex.ToString();
|
||||||
|
|
||||||
STAmount saBalance = saAmount;
|
STAmount saBalance = saAmount;
|
||||||
|
|
||||||
@@ -1122,7 +1124,7 @@ void LedgerEntrySet::accountSend(const uint160& uSenderID, const uint160& uRecei
|
|||||||
? entryCache(ltACCOUNT_ROOT, Ledger::getAccountRootIndex(uReceiverID))
|
? entryCache(ltACCOUNT_ROOT, Ledger::getAccountRootIndex(uReceiverID))
|
||||||
: SLE::pointer();
|
: SLE::pointer();
|
||||||
|
|
||||||
Log(lsINFO) << boost::str(boost::format("accountSend> %s (%s) -> %s (%s) : %s")
|
cLog(lsINFO) << boost::str(boost::format("accountSend> %s (%s) -> %s (%s) : %s")
|
||||||
% NewcoinAddress::createHumanAccountID(uSenderID)
|
% NewcoinAddress::createHumanAccountID(uSenderID)
|
||||||
% (sleSender ? (sleSender->getFieldAmount(sfBalance)).getFullText() : "-")
|
% (sleSender ? (sleSender->getFieldAmount(sfBalance)).getFullText() : "-")
|
||||||
% NewcoinAddress::createHumanAccountID(uReceiverID)
|
% NewcoinAddress::createHumanAccountID(uReceiverID)
|
||||||
@@ -1141,7 +1143,7 @@ void LedgerEntrySet::accountSend(const uint160& uSenderID, const uint160& uRecei
|
|||||||
entryModify(sleReceiver);
|
entryModify(sleReceiver);
|
||||||
}
|
}
|
||||||
|
|
||||||
Log(lsINFO) << boost::str(boost::format("accountSend< %s (%s) -> %s (%s) : %s")
|
cLog(lsINFO) << boost::str(boost::format("accountSend< %s (%s) -> %s (%s) : %s")
|
||||||
% NewcoinAddress::createHumanAccountID(uSenderID)
|
% NewcoinAddress::createHumanAccountID(uSenderID)
|
||||||
% (sleSender ? (sleSender->getFieldAmount(sfBalance)).getFullText() : "-")
|
% (sleSender ? (sleSender->getFieldAmount(sfBalance)).getFullText() : "-")
|
||||||
% NewcoinAddress::createHumanAccountID(uReceiverID)
|
% NewcoinAddress::createHumanAccountID(uReceiverID)
|
||||||
|
|||||||
Reference in New Issue
Block a user