mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-21 03:26:01 +00:00
Improve reporting of missing node exceptions
This commit is contained in:
@@ -638,7 +638,6 @@ target_sources (rippled PRIVATE
|
|||||||
src/ripple/shamap/impl/SHAMap.cpp
|
src/ripple/shamap/impl/SHAMap.cpp
|
||||||
src/ripple/shamap/impl/SHAMapDelta.cpp
|
src/ripple/shamap/impl/SHAMapDelta.cpp
|
||||||
src/ripple/shamap/impl/SHAMapItem.cpp
|
src/ripple/shamap/impl/SHAMapItem.cpp
|
||||||
src/ripple/shamap/impl/SHAMapMissingNode.cpp
|
|
||||||
src/ripple/shamap/impl/SHAMapNodeID.cpp
|
src/ripple/shamap/impl/SHAMapNodeID.cpp
|
||||||
src/ripple/shamap/impl/SHAMapSync.cpp
|
src/ripple/shamap/impl/SHAMapSync.cpp
|
||||||
src/ripple/shamap/impl/SHAMapTreeNode.cpp
|
src/ripple/shamap/impl/SHAMapTreeNode.cpp
|
||||||
|
|||||||
@@ -827,7 +827,7 @@ RCLConsensus::timerEntry(NetClock::time_point const& now)
|
|||||||
catch (SHAMapMissingNode const& mn)
|
catch (SHAMapMissingNode const& mn)
|
||||||
{
|
{
|
||||||
// This should never happen
|
// This should never happen
|
||||||
JLOG(j_.error()) << "Missing node during consensus process " << mn;
|
JLOG(j_.error()) << "During consensus timerEntry: " << mn.what();
|
||||||
Rethrow();
|
Rethrow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -843,7 +843,7 @@ RCLConsensus::gotTxSet(NetClock::time_point const& now, RCLTxSet const& txSet)
|
|||||||
catch (SHAMapMissingNode const& mn)
|
catch (SHAMapMissingNode const& mn)
|
||||||
{
|
{
|
||||||
// This should never happen
|
// This should never happen
|
||||||
JLOG(j_.error()) << "Missing node during consensus process " << mn;
|
JLOG(j_.error()) << "During consensus gotTxSet: " << mn.what();
|
||||||
Rethrow();
|
Rethrow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -596,7 +596,7 @@ Ledger::setup (Config const& config)
|
|||||||
fees_.increment = sle->getFieldU32 (sfReserveIncrement);
|
fees_.increment = sle->getFieldU32 (sfReserveIncrement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SHAMapMissingNode &)
|
catch (SHAMapMissingNode const&)
|
||||||
{
|
{
|
||||||
ret = false;
|
ret = false;
|
||||||
}
|
}
|
||||||
@@ -609,7 +609,7 @@ Ledger::setup (Config const& config)
|
|||||||
{
|
{
|
||||||
rules_ = Rules(*this, config.features);
|
rules_ = Rules(*this, config.features);
|
||||||
}
|
}
|
||||||
catch (SHAMapMissingNode &)
|
catch (SHAMapMissingNode const&)
|
||||||
{
|
{
|
||||||
ret = false;
|
ret = false;
|
||||||
}
|
}
|
||||||
@@ -657,7 +657,7 @@ bool Ledger::walkLedger (beast::Journal j) const
|
|||||||
if (auto stream = j.info())
|
if (auto stream = j.info())
|
||||||
{
|
{
|
||||||
stream << missingNodes1.size () << " missing account node(s)";
|
stream << missingNodes1.size () << " missing account node(s)";
|
||||||
stream << "First: " << missingNodes1[0];
|
stream << "First: " << missingNodes1[0].what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -677,7 +677,7 @@ bool Ledger::walkLedger (beast::Journal j) const
|
|||||||
if (auto stream = j.info())
|
if (auto stream = j.info())
|
||||||
{
|
{
|
||||||
stream << missingNodes2.size () << " missing transaction node(s)";
|
stream << missingNodes2.size () << " missing transaction node(s)";
|
||||||
stream << "First: " << missingNodes2[0];
|
stream << "First: " << missingNodes2[0].what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return missingNodes1.empty () && missingNodes2.empty ();
|
return missingNodes1.empty () && missingNodes2.empty ();
|
||||||
|
|||||||
@@ -132,10 +132,10 @@ void OrderBookDB::update(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (const SHAMapMissingNode&)
|
catch (SHAMapMissingNode const& mn)
|
||||||
{
|
{
|
||||||
JLOG (j_.info())
|
JLOG (j_.info())
|
||||||
<< "OrderBookDB::update encountered a missing node";
|
<< "OrderBookDB::update: " << mn.what();
|
||||||
std::lock_guard sl (mLock);
|
std::lock_guard sl (mLock);
|
||||||
mSeq = 0;
|
mSeq = 0;
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -277,10 +277,10 @@ private:
|
|||||||
{
|
{
|
||||||
hash = hashOfSeq(*ledger, index, j_);
|
hash = hashOfSeq(*ledger, index, j_);
|
||||||
}
|
}
|
||||||
catch (SHAMapMissingNode &)
|
catch (SHAMapMissingNode const& mn)
|
||||||
{
|
{
|
||||||
JLOG (j_.warn()) <<
|
JLOG (j_.warn()) <<
|
||||||
"Node missing from ledger " << ledger->info().seq;
|
"Ledger #" << ledger->info().seq << ": " << mn.what();
|
||||||
app_.getInboundLedgers().acquire (
|
app_.getInboundLedgers().acquire (
|
||||||
ledger->info().hash, ledger->info().seq,
|
ledger->info().hash, ledger->info().seq,
|
||||||
InboundLedger::Reason::GENERIC);
|
InboundLedger::Reason::GENERIC);
|
||||||
|
|||||||
@@ -1421,10 +1421,10 @@ LedgerMaster::updatePaths (Job& job)
|
|||||||
app_.getPathRequests().updateAll(
|
app_.getPathRequests().updateAll(
|
||||||
lastLedger, job.getCancelCallback());
|
lastLedger, job.getCancelCallback());
|
||||||
}
|
}
|
||||||
catch (SHAMapMissingNode&)
|
catch (SHAMapMissingNode const& mn)
|
||||||
{
|
{
|
||||||
JLOG (m_journal.info())
|
JLOG (m_journal.info())
|
||||||
<< "Missing node detected during pathfinding";
|
<< "During pathfinding: " << mn.what();
|
||||||
if (lastLedger->open())
|
if (lastLedger->open())
|
||||||
{
|
{
|
||||||
// our parent is the problem
|
// our parent is the problem
|
||||||
@@ -1617,7 +1617,7 @@ LedgerMaster::walkHashBySeq (
|
|||||||
{
|
{
|
||||||
ledgerHash = hashOfSeq(*ledger, index, m_journal);
|
ledgerHash = hashOfSeq(*ledger, index, m_journal);
|
||||||
}
|
}
|
||||||
catch(SHAMapMissingNode&)
|
catch(SHAMapMissingNode const&)
|
||||||
{
|
{
|
||||||
ledger.reset();
|
ledger.reset();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1806,10 +1806,10 @@ ApplicationImp::getLastFullLedger()
|
|||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
catch (SHAMapMissingNode& sn)
|
catch (SHAMapMissingNode const& mn)
|
||||||
{
|
{
|
||||||
JLOG (j.warn()) <<
|
JLOG (j.warn()) <<
|
||||||
"Ledger with missing nodes in database: " << sn;
|
"Ledger in database: " << mn.what();
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2117,10 +2117,10 @@ bool ApplicationImp::loadOldLedger (
|
|||||||
m_ledgerMaster->takeReplay (std::move (replayData));
|
m_ledgerMaster->takeReplay (std::move (replayData));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SHAMapMissingNode&)
|
catch (SHAMapMissingNode const& mn)
|
||||||
{
|
{
|
||||||
JLOG(m_journal.fatal()) <<
|
JLOG(m_journal.fatal()) <<
|
||||||
"Data is missing for selected ledger";
|
"While loading specified ledger: " << mn.what();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
catch (boost::bad_lexical_cast&)
|
catch (boost::bad_lexical_cast&)
|
||||||
|
|||||||
@@ -448,11 +448,10 @@ isValidated(LedgerMaster& ledgerMaster, ReadView const& ledger,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SHAMapMissingNode const&)
|
catch (SHAMapMissingNode const& mn)
|
||||||
{
|
{
|
||||||
auto stream = app.journal ("RPCHandler").warn();
|
auto stream = app.journal ("RPCHandler").warn();
|
||||||
JLOG (stream)
|
JLOG (stream) << "Ledger #" << seq << ": " << mn.what();
|
||||||
<< "Missing SHANode " << std::to_string (seq);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
#include <ripple/shamap/SHAMapTreeNode.h>
|
#include <ripple/shamap/SHAMapTreeNode.h>
|
||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
@@ -34,31 +36,38 @@ enum class SHAMapType
|
|||||||
FREE = 3, // A tree not part of a ledger
|
FREE = 3, // A tree not part of a ledger
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline
|
||||||
|
std::string
|
||||||
|
to_string(SHAMapType t)
|
||||||
|
{
|
||||||
|
switch (t)
|
||||||
|
{
|
||||||
|
case SHAMapType::TRANSACTION:
|
||||||
|
return "Transaction Tree";
|
||||||
|
case SHAMapType::STATE:
|
||||||
|
return "State Tree";
|
||||||
|
case SHAMapType::FREE:
|
||||||
|
return "Free Tree";
|
||||||
|
default:
|
||||||
|
return std::to_string(safe_cast<std::underlying_type_t<SHAMapType>>(t));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class SHAMapMissingNode
|
class SHAMapMissingNode
|
||||||
: public std::runtime_error
|
: public std::runtime_error
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
SHAMapType mType;
|
|
||||||
SHAMapHash mNodeHash;
|
|
||||||
uint256 mNodeID;
|
|
||||||
public:
|
public:
|
||||||
SHAMapMissingNode (SHAMapType t,
|
SHAMapMissingNode (SHAMapType t, SHAMapHash const& hash)
|
||||||
SHAMapHash const& nodeHash)
|
: std::runtime_error("Missing Node: " +
|
||||||
: std::runtime_error ("SHAMapMissingNode")
|
to_string(t) + ": hash " + to_string(hash))
|
||||||
, mType (t)
|
|
||||||
, mNodeHash (nodeHash)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
SHAMapMissingNode (SHAMapType t,
|
SHAMapMissingNode (SHAMapType t, uint256 const& id)
|
||||||
uint256 const& nodeID)
|
: std::runtime_error ("Missing Node: " +
|
||||||
: std::runtime_error ("SHAMapMissingNode")
|
to_string(t) + ": id " + to_string(id))
|
||||||
, mType (t)
|
|
||||||
, mNodeID (nodeID)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
friend std::ostream& operator<< (std::ostream&, SHAMapMissingNode const&);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // ripple
|
} // ripple
|
||||||
|
|||||||
@@ -1,53 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of rippled: https://github.com/ripple/rippled
|
|
||||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#include <ripple/shamap/SHAMapMissingNode.h>
|
|
||||||
#include <ripple/beast/utility/Zero.h>
|
|
||||||
#include <ostream>
|
|
||||||
|
|
||||||
namespace ripple {
|
|
||||||
|
|
||||||
std::ostream&
|
|
||||||
operator<< (std::ostream& out, const SHAMapMissingNode& mn)
|
|
||||||
{
|
|
||||||
switch (mn.mType)
|
|
||||||
{
|
|
||||||
case SHAMapType::TRANSACTION:
|
|
||||||
out << "Missing/TXN(";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SHAMapType::STATE:
|
|
||||||
out << "Missing/STA(";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SHAMapType::FREE:
|
|
||||||
default:
|
|
||||||
out << "Missing/(";
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (mn.mNodeHash == beast::zero)
|
|
||||||
out << "id : " << mn.mNodeID;
|
|
||||||
else
|
|
||||||
out << "hash : " << mn.mNodeHash;
|
|
||||||
out << ")";
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // ripple
|
|
||||||
Reference in New Issue
Block a user