From 6a08bc7e736cbd310053284cd35806d8dd463b85 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Fri, 16 Aug 2013 10:43:31 -0700 Subject: [PATCH 01/13] Fix missing return value --- .../modules/beast_asio/protocol/beast_HandshakeDetectorType.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Subtrees/beast/modules/beast_asio/protocol/beast_HandshakeDetectorType.h b/Subtrees/beast/modules/beast_asio/protocol/beast_HandshakeDetectorType.h index 037a720a7..5d5a3f429 100644 --- a/Subtrees/beast/modules/beast_asio/protocol/beast_HandshakeDetectorType.h +++ b/Subtrees/beast/modules/beast_asio/protocol/beast_HandshakeDetectorType.h @@ -145,7 +145,7 @@ protected: //static_bassert (std::is_integral ::value); IntegerType networkValue; if (! read (&networkValue)) - return; + return false; *value = fromNetworkByteOrder (networkValue); return true; } From 69ae39d0a3bfee468bcbfe56b844e12b07913c14 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Fri, 16 Aug 2013 16:23:12 -0700 Subject: [PATCH 02/13] Set version to 0.12.0-rc3 --- modules/ripple_app/basics/ripple_BuildInfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ripple_app/basics/ripple_BuildInfo.cpp b/modules/ripple_app/basics/ripple_BuildInfo.cpp index b73442219..89014216d 100644 --- a/modules/ripple_app/basics/ripple_BuildInfo.cpp +++ b/modules/ripple_app/basics/ripple_BuildInfo.cpp @@ -12,7 +12,7 @@ char const* BuildInfo::getRawVersionString () // // The build version number (edit this for each release) // - "0.12.0-rc2" + "0.12.0-rc3" // // Must follow the format described here: // From 8faef903ad3be7b3af1fa96bb56db4432c698bf7 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Fri, 16 Aug 2013 18:12:33 -0700 Subject: [PATCH 03/13] A better fix for countAccountTxs. --- modules/ripple_app/misc/NetworkOPs.cpp | 27 +++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/modules/ripple_app/misc/NetworkOPs.cpp b/modules/ripple_app/misc/NetworkOPs.cpp index ef0134798..449bd512c 100644 --- a/modules/ripple_app/misc/NetworkOPs.cpp +++ b/modules/ripple_app/misc/NetworkOPs.cpp @@ -1215,12 +1215,25 @@ NetworkOPs::transactionsSQL (std::string selection, const RippleAddress& account if (minLedger != -1) minClause = boost::str (boost::format ("AND AccountTransactions.LedgerSeq >= '%u'") % minLedger); - std::string sql = - boost::str (boost::format ("SELECT %s FROM " - "AccountTransactions INNER JOIN Transactions ON Transactions.TransID = AccountTransactions.TransID " - "WHERE Account = '%s' %s %s " - "ORDER BY AccountTransactions.LedgerSeq %s, AccountTransactions.TxnSeq %s, AccountTransactions.TransID %s " - "LIMIT %u, %u;") + std::string sql; + + if (count) + sql = + boost::str (boost::format ("SELECT %s FROM AccountTransactions WHERE Account = '%s' %s %s LIMIT %u %u;") + % selection + % account.humanAccountID () + % maxClause + % minClause + % lexicalCastThrow (offset) + % lexicalCastThrow (numberOfResults) + ); + else + sql = + boost::str (boost::format ("SELECT %s FROM " + "AccountTransactions INNER JOIN Transactions ON Transactions.TransID = AccountTransactions.TransID " + "WHERE Account = '%s' %s %s " + "ORDER BY AccountTransactions.LedgerSeq %s, AccountTransactions.TxnSeq %s, AccountTransactions.TransID %s " + "LIMIT %u, %u;") % selection % account.humanAccountID () % maxClause @@ -1335,7 +1348,7 @@ NetworkOPs::countAccountTxs (const RippleAddress& account, int32 minLedger, int3 { // can be called with no locks uint32 ret = 0; - std::string sql = NetworkOPs::transactionsSQL ("COUNT(*) AS 'TransactionCount'", account, + std::string sql = NetworkOPs::transactionsSQL ("COUNT(DISCTINCT TransID) AS 'TransactionCount'", account, minLedger, maxLedger, false, 0, -1, true, true, true); Database* db = getApp().getTxnDB ()->getDB (); From 0ba864f28a0edeff0e170a00e65f079819d99652 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Fri, 16 Aug 2013 18:41:47 -0700 Subject: [PATCH 04/13] Missing comma. --- modules/ripple_app/misc/NetworkOPs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ripple_app/misc/NetworkOPs.cpp b/modules/ripple_app/misc/NetworkOPs.cpp index 449bd512c..5f8f1c5cb 100644 --- a/modules/ripple_app/misc/NetworkOPs.cpp +++ b/modules/ripple_app/misc/NetworkOPs.cpp @@ -1219,7 +1219,7 @@ NetworkOPs::transactionsSQL (std::string selection, const RippleAddress& account if (count) sql = - boost::str (boost::format ("SELECT %s FROM AccountTransactions WHERE Account = '%s' %s %s LIMIT %u %u;") + boost::str (boost::format ("SELECT %s FROM AccountTransactions WHERE Account = '%s' %s %s LIMIT %u, %u;") % selection % account.humanAccountID () % maxClause From 88f38fae714ae474719f489764bc09e2c6de572b Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Fri, 16 Aug 2013 18:50:33 -0700 Subject: [PATCH 05/13] Typo. --- modules/ripple_app/misc/NetworkOPs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ripple_app/misc/NetworkOPs.cpp b/modules/ripple_app/misc/NetworkOPs.cpp index 5f8f1c5cb..007ca1e86 100644 --- a/modules/ripple_app/misc/NetworkOPs.cpp +++ b/modules/ripple_app/misc/NetworkOPs.cpp @@ -1348,7 +1348,7 @@ NetworkOPs::countAccountTxs (const RippleAddress& account, int32 minLedger, int3 { // can be called with no locks uint32 ret = 0; - std::string sql = NetworkOPs::transactionsSQL ("COUNT(DISCTINCT TransID) AS 'TransactionCount'", account, + std::string sql = NetworkOPs::transactionsSQL ("COUNT(DISTINCT TransID) AS 'TransactionCount'", account, minLedger, maxLedger, false, 0, -1, true, true, true); Database* db = getApp().getTxnDB ()->getDB (); From faf4c58a519f1db3b3707f6ae000f8364188b30a Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Fri, 16 Aug 2013 23:22:33 -0700 Subject: [PATCH 06/13] Don't tolerate failed ledger acquires in the publication stream. --- modules/ripple_app/ledger/LedgerMaster.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/ripple_app/ledger/LedgerMaster.cpp b/modules/ripple_app/ledger/LedgerMaster.cpp index d43b2fd47..a784e113c 100644 --- a/modules/ripple_app/ledger/LedgerMaster.cpp +++ b/modules/ripple_app/ledger/LedgerMaster.cpp @@ -745,8 +745,13 @@ std::list LedgerMaster::findNewLedgersToPublish(boost::recursiv WriteLog (lsWARNING, LedgerMaster) << "Failed to acquire a published ledger"; getApp().getInboundLedgers().dropLedger(hash); acq = getApp().getInboundLedgers().findCreate(hash, seq); - if (acq->isComplete() && !acq->isFailed()) - ledger = acq->getLedger(); + if (acq->isComplete()) + { + if (acq->isFailed()) + getApp().getInboundLedgers().dropLedger(hash); + else + ledger = acq->getLedger(); + } } } From 1081dda5cdff6e93315498ca9488a112f12aa6ef Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Sun, 18 Aug 2013 20:10:32 -0700 Subject: [PATCH 07/13] Fix a bug that could cause us not to acquire the current ledger. --- modules/ripple_app/consensus/ripple_LedgerConsensus.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/ripple_app/consensus/ripple_LedgerConsensus.cpp b/modules/ripple_app/consensus/ripple_LedgerConsensus.cpp index e2845c508..277677d26 100644 --- a/modules/ripple_app/consensus/ripple_LedgerConsensus.cpp +++ b/modules/ripple_app/consensus/ripple_LedgerConsensus.cpp @@ -213,6 +213,8 @@ void LedgerConsensus::handleLCL (uint256 const& lclHash) mHaveCorrectLCL = false; return; } + else + return; WriteLog (lsINFO, LedgerConsensus) << "Have the consensus ledger " << mPrevLedgerHash; mHaveCorrectLCL = true; From 3cf54bb3cdb078c7f2f400014d9b57532f5ba0f5 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Sun, 18 Aug 2013 20:42:09 -0700 Subject: [PATCH 08/13] Slow down fetching to avoid Sorceror's Apprentice syndrome. --- modules/ripple_app/ledger/ripple_InboundLedger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ripple_app/ledger/ripple_InboundLedger.cpp b/modules/ripple_app/ledger/ripple_InboundLedger.cpp index cb7909e09..0c5e2d68f 100644 --- a/modules/ripple_app/ledger/ripple_InboundLedger.cpp +++ b/modules/ripple_app/ledger/ripple_InboundLedger.cpp @@ -8,7 +8,7 @@ SETUP_LOG (InboundLedger) // VFALCO TODO replace macros #define LA_DEBUG -#define LEDGER_ACQUIRE_TIMEOUT 2000 // millisecond for each ledger timeout +#define LEDGER_ACQUIRE_TIMEOUT 6000 // millisecond for each ledger timeout #define LEDGER_TIMEOUT_COUNT 10 // how many timeouts before we giveup #define LEDGER_TIMEOUT_AGGRESSIVE 6 // how many timeouts before we get aggressive From b00c33988c962ee0634e54d46ab1de32fcec5a00 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Sun, 18 Aug 2013 21:31:09 -0700 Subject: [PATCH 09/13] Make the progress logic that triggers timeouts smarter. --- modules/ripple_app/peers/ripple_PeerSet.cpp | 8 ++------ modules/ripple_app/peers/ripple_PeerSet.h | 6 +++--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/modules/ripple_app/peers/ripple_PeerSet.cpp b/modules/ripple_app/peers/ripple_PeerSet.cpp index 3a278f814..15e9ef6ae 100644 --- a/modules/ripple_app/peers/ripple_PeerSet.cpp +++ b/modules/ripple_app/peers/ripple_PeerSet.cpp @@ -12,12 +12,11 @@ PeerSet::PeerSet (uint256 const& hash, int interval, bool txnData) , mTimeouts (0) , mComplete (false) , mFailed (false) - , mProgress (true) , mAggressive (false) , mTxnData (txnData) , mTimer (getApp().getIOService ()) { - mLastAction = UptimeTimer::getInstance ().getElapsedSeconds (); + mLastAction = mLastProgress = UptimeTimer::getInstance ().getElapsedSeconds (); assert ((mTimerInterval > 10) && (mTimerInterval < 30000)); } @@ -51,17 +50,14 @@ void PeerSet::invokeOnTimer () if (isDone ()) return; - if (!mProgress) + if (!isProgress()) { ++mTimeouts; WriteLog (lsWARNING, InboundLedger) << "Timeout(" << mTimeouts << ") pc=" << mPeers.size () << " acquiring " << mHash; onTimer (false, sl); } else - { - mProgress = false; onTimer (true, sl); - } if (!isDone ()) setTimer (); diff --git a/modules/ripple_app/peers/ripple_PeerSet.h b/modules/ripple_app/peers/ripple_PeerSet.h index 73e55e6a0..a7155d380 100644 --- a/modules/ripple_app/peers/ripple_PeerSet.h +++ b/modules/ripple_app/peers/ripple_PeerSet.h @@ -34,12 +34,12 @@ public: bool isActive (); void progress () { - mProgress = true; + mLastProgress = UptimeTimer::getInstance().getElapsedSeconds(); mAggressive = false; } bool isProgress () { - return mProgress; + return (mLastProgress + (mTimerInterval / 1000)) > UptimeTimer::getInstance().getElapsedSeconds(); } void touch () { @@ -93,10 +93,10 @@ protected: int mTimeouts; bool mComplete; bool mFailed; - bool mProgress; bool mAggressive; bool mTxnData; int mLastAction; + int mLastProgress; boost::recursive_mutex mLock; From 57f21593b52247cec68b9449cae2de6d22074249 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Sun, 18 Aug 2013 23:27:54 -0700 Subject: [PATCH 10/13] Don't call both a function and a parameter "progress". --- modules/ripple_app/ledger/ripple_InboundLedger.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ripple_app/ledger/ripple_InboundLedger.cpp b/modules/ripple_app/ledger/ripple_InboundLedger.cpp index 0c5e2d68f..40a345251 100644 --- a/modules/ripple_app/ledger/ripple_InboundLedger.cpp +++ b/modules/ripple_app/ledger/ripple_InboundLedger.cpp @@ -137,7 +137,7 @@ bool InboundLedger::tryLocal () return mComplete; } -void InboundLedger::onTimer (bool progress, boost::recursive_mutex::scoped_lock&) +void InboundLedger::onTimer (bool wasProgress, boost::recursive_mutex::scoped_lock&) { mRecentTXNodes.clear (); mRecentASNodes.clear (); @@ -150,7 +150,7 @@ void InboundLedger::onTimer (bool progress, boost::recursive_mutex::scoped_lock& return; } - if (!progress) + if (!wasProgress) { if (isDone()) { From f596ef4b832f0e1bb49483367f26e6cd88575cc8 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Sun, 18 Aug 2013 23:37:29 -0700 Subject: [PATCH 11/13] 0.12.0-rc3b --- modules/ripple_app/basics/ripple_BuildInfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ripple_app/basics/ripple_BuildInfo.cpp b/modules/ripple_app/basics/ripple_BuildInfo.cpp index 89014216d..00432a8bb 100644 --- a/modules/ripple_app/basics/ripple_BuildInfo.cpp +++ b/modules/ripple_app/basics/ripple_BuildInfo.cpp @@ -12,7 +12,7 @@ char const* BuildInfo::getRawVersionString () // // The build version number (edit this for each release) // - "0.12.0-rc3" + "0.12.0-rc3b" // // Must follow the format described here: // From a742b1097a4848225b959b2b5fb234e0d9221b8d Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Mon, 19 Aug 2013 01:56:09 -0700 Subject: [PATCH 12/13] Don't touch a possibly-failed inbound ledger. --- modules/ripple_app/ledger/ripple_InboundLedgers.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/ripple_app/ledger/ripple_InboundLedgers.cpp b/modules/ripple_app/ledger/ripple_InboundLedgers.cpp index a5f4c5305..b47a1bed4 100644 --- a/modules/ripple_app/ledger/ripple_InboundLedgers.cpp +++ b/modules/ripple_app/ledger/ripple_InboundLedgers.cpp @@ -18,7 +18,6 @@ InboundLedger::pointer InboundLedgers::findCreate (uint256 const& hash, uint32 s if (it != mLedgers.end ()) { ret = it->second; - ret->touch (); // FIXME: Should set the sequence if it's not set } else @@ -58,7 +57,6 @@ InboundLedger::pointer InboundLedgers::find (uint256 const& hash) boost::unordered_map::iterator it = mLedgers.find (hash); if (it != mLedgers.end ()) { - it->second->touch (); ret = it->second; } } From ff21bfa07b13d53a03ed422c6f54611ac78d68a5 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Mon, 19 Aug 2013 14:20:18 -0700 Subject: [PATCH 13/13] Set version to 0.12.0-rc4 --- modules/ripple_app/basics/ripple_BuildInfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ripple_app/basics/ripple_BuildInfo.cpp b/modules/ripple_app/basics/ripple_BuildInfo.cpp index 00432a8bb..22b3fcedc 100644 --- a/modules/ripple_app/basics/ripple_BuildInfo.cpp +++ b/modules/ripple_app/basics/ripple_BuildInfo.cpp @@ -12,7 +12,7 @@ char const* BuildInfo::getRawVersionString () // // The build version number (edit this for each release) // - "0.12.0-rc3b" + "0.12.0-rc4" // // Must follow the format described here: //