diff --git a/src/ripple/shamap/SHAMapMissingNode.h b/src/ripple/shamap/SHAMapMissingNode.h index 07a521cd049..811fe5f9615 100644 --- a/src/ripple/shamap/SHAMapMissingNode.h +++ b/src/ripple/shamap/SHAMapMissingNode.h @@ -33,7 +33,6 @@ enum class SHAMapType { TRANSACTION = 1, // A tree of transactions STATE = 2, // A tree of state nodes FREE = 3, // A tree not part of a ledger - UNKNOWN = 4 // Could be any type, but it's not there nonetheless }; inline std::string @@ -47,8 +46,6 @@ to_string(SHAMapType t) return "State Tree"; case SHAMapType::FREE: return "Free Tree"; - case SHAMapType::UNKNOWN: - return "Unknown Tree"; default: return std::to_string( safe_cast>(t)); @@ -69,13 +66,6 @@ class SHAMapMissingNode : public std::runtime_error "Missing Node: " + to_string(t) + ": id " + to_string(id)) { } - - SHAMapMissingNode(uint256 const& id) - : std::runtime_error( - "Missing Node: " + to_string(SHAMapType::UNKNOWN) + ": hash " + - to_string(id)) - { - } }; } // namespace ripple diff --git a/src/ripple/shamap/impl/NodeFamily.cpp b/src/ripple/shamap/impl/NodeFamily.cpp index 651bc8079df..1752db06a8e 100644 --- a/src/ripple/shamap/impl/NodeFamily.cpp +++ b/src/ripple/shamap/impl/NodeFamily.cpp @@ -20,9 +20,8 @@ #include #include #include -#include #include -#include +#include namespace ripple { @@ -71,7 +70,12 @@ NodeFamily::missingNodeAcquireBySeq(std::uint32_t seq, uint256 const& nodeHash) { JLOG(j_.error()) << "Missing node in " << seq; if (app_.config().reporting()) - Throw(nodeHash); + { + std::stringstream ss; + ss << "Node not read, likely a Cassandra error in ledger seq " << seq + << " object hash " << nodeHash; + Throw(ss.str()); + } std::unique_lock lock(maxSeqMutex_); if (maxSeq_ == 0) diff --git a/src/ripple/shamap/impl/SHAMap.cpp b/src/ripple/shamap/impl/SHAMap.cpp index 68ba2af624e..fa42c8e8f82 100644 --- a/src/ripple/shamap/impl/SHAMap.cpp +++ b/src/ripple/shamap/impl/SHAMap.cpp @@ -173,30 +173,40 @@ SHAMap::finishFetch( std::shared_ptr const& object) const { assert(backed_); - if (!object) - { - if (full_) - { - full_ = false; - f_.missingNodeAcquireBySeq(ledgerSeq_, hash.as_uint256()); - } - return {}; - } std::shared_ptr node; try { + if (!object) + { + if (full_) + { + full_ = false; + f_.missingNodeAcquireBySeq(ledgerSeq_, hash.as_uint256()); + } + return {}; + } + node = SHAMapTreeNode::makeFromPrefix(makeSlice(object->getData()), hash); if (node) canonicalize(hash, node); return node; } - catch (std::exception const&) + catch (SHAMapMissingNode const& e) + { + JLOG(journal_.warn()) << "Missing node: " << hash << " : " << e.what(); + } + catch (std::runtime_error const& e) + { + JLOG(journal_.warn()) << e.what(); + } + catch (...) { JLOG(journal_.warn()) << "Invalid DB node " << hash; - return std::shared_ptr(); } + + return std::shared_ptr(); } // See if a sync filter has a node