mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-21 19:45:53 +00:00
Merge branch 'develop' into feature-keyvadb
Conflicts: src/cpp/ripple/ripple_TransactionAcquire.cpp
This commit is contained in:
@@ -1272,15 +1272,6 @@ NetworkOPs::getAccountTxs (const RippleAddress& account, int32 minLedger, int32
|
||||
ledger->pendSave(false);
|
||||
}
|
||||
|
||||
if (rawMeta.getLength() == 0)
|
||||
{ // Work around a bug that could leave the metadata missing
|
||||
uint32 seq = static_cast<uint32>(db->getBigInt("AccountTransactions.LedgerSeq"));
|
||||
WriteLog(lsWARNING, NetworkOPs) << "Recovering ledger " << seq << ", txn " << txn->getID();
|
||||
Ledger::pointer ledger = getLedgerBySeq(seq);
|
||||
if (ledger)
|
||||
ledger->pendSave(false);
|
||||
}
|
||||
|
||||
TransactionMetaSet::pointer meta = boost::make_shared<TransactionMetaSet> (txn->getID (), txn->getLedger (), rawMeta.getData ());
|
||||
ret.push_back (std::pair<Transaction::pointer, TransactionMetaSet::pointer> (txn, meta));
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ int rippleMain (int argc, char** argv)
|
||||
if (HaveSustain () &&
|
||||
!iResult && !vm.count ("parameters") && !vm.count ("fg") && !vm.count ("standalone") && !vm.count ("unittest"))
|
||||
{
|
||||
std::string logMe = DoSustain ();
|
||||
std::string logMe = DoSustain (theConfig.DEBUG_LOGFILE.c_str());
|
||||
|
||||
if (!logMe.empty ())
|
||||
Log (lsWARNING) << logMe;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
class InboundLedger;
|
||||
|
||||
PeerSet::PeerSet (uint256 const& hash, int interval)
|
||||
PeerSet::PeerSet (uint256 const& hash, int interval, bool txnData)
|
||||
: mHash (hash)
|
||||
, mTimerInterval (interval)
|
||||
, mTimeouts (0)
|
||||
@@ -14,6 +14,7 @@ PeerSet::PeerSet (uint256 const& hash, int interval)
|
||||
, mFailed (false)
|
||||
, mProgress (true)
|
||||
, mAggressive (false)
|
||||
, mTxnData (txnData)
|
||||
, mTimer (getApp().getIOService ())
|
||||
{
|
||||
mLastAction = UptimeTimer::getInstance ().getElapsedSeconds ();
|
||||
@@ -53,12 +54,12 @@ void PeerSet::invokeOnTimer ()
|
||||
{
|
||||
++mTimeouts;
|
||||
WriteLog (lsWARNING, InboundLedger) << "Timeout(" << mTimeouts << ") pc=" << mPeers.size () << " acquiring " << mHash;
|
||||
onTimer (false);
|
||||
onTimer (false, sl);
|
||||
}
|
||||
else
|
||||
{
|
||||
mProgress = false;
|
||||
onTimer (true);
|
||||
onTimer (true, sl);
|
||||
}
|
||||
|
||||
if (!isDone ())
|
||||
@@ -74,16 +75,24 @@ void PeerSet::TimerEntry (boost::weak_ptr<PeerSet> wptr, const boost::system::er
|
||||
|
||||
if (ptr)
|
||||
{
|
||||
int jc = getApp().getJobQueue ().getJobCountTotal (jtLEDGER_DATA);
|
||||
|
||||
if (jc > 4)
|
||||
if (ptr->mTxnData)
|
||||
{
|
||||
WriteLog (lsDEBUG, InboundLedger) << "Deferring PeerSet timer due to load";
|
||||
ptr->setTimer ();
|
||||
getApp().getJobQueue ().addLimitJob (jtTXN_DATA, "timerEntry", 2,
|
||||
BIND_TYPE (&PeerSet::TimerJobEntry, P_1, ptr));
|
||||
}
|
||||
else
|
||||
getApp().getJobQueue ().addLimitJob (jtLEDGER_DATA, "timerEntry", 2,
|
||||
BIND_TYPE (&PeerSet::TimerJobEntry, P_1, ptr));
|
||||
{
|
||||
int jc = getApp().getJobQueue ().getJobCountTotal (jtLEDGER_DATA);
|
||||
|
||||
if (jc > 4)
|
||||
{
|
||||
WriteLog (lsDEBUG, InboundLedger) << "Deferring PeerSet timer due to load";
|
||||
ptr->setTimer ();
|
||||
}
|
||||
else
|
||||
getApp().getJobQueue ().addLimitJob (jtLEDGER_DATA, "timerEntry", 2,
|
||||
BIND_TYPE (&PeerSet::TimerJobEntry, P_1, ptr));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,11 +67,11 @@ private:
|
||||
|
||||
// VFALCO TODO try to make some of these private
|
||||
protected:
|
||||
PeerSet (uint256 const& hash, int interval);
|
||||
PeerSet (uint256 const& hash, int interval, bool txnData);
|
||||
virtual ~PeerSet () { }
|
||||
|
||||
virtual void newPeer (Peer::ref) = 0;
|
||||
virtual void onTimer (bool progress) = 0;
|
||||
virtual void onTimer (bool progress, boost::recursive_mutex::scoped_lock&) = 0;
|
||||
virtual boost::weak_ptr<PeerSet> pmDowncast () = 0;
|
||||
|
||||
void setComplete ()
|
||||
@@ -95,6 +95,7 @@ protected:
|
||||
bool mFailed;
|
||||
bool mProgress;
|
||||
bool mAggressive;
|
||||
bool mTxnData;
|
||||
int mLastAction;
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,9 @@ SETUP_LOG (TransactionAcquire)
|
||||
typedef std::map<uint160, LedgerProposal::pointer>::value_type u160_prop_pair;
|
||||
typedef std::map<uint256, DisputedTx::pointer>::value_type u256_lct_pair;
|
||||
|
||||
TransactionAcquire::TransactionAcquire (uint256 const& hash) : PeerSet (hash, TX_ACQUIRE_TIMEOUT), mHaveRoot (false)
|
||||
TransactionAcquire::TransactionAcquire (uint256 const& hash)
|
||||
: PeerSet (hash, TX_ACQUIRE_TIMEOUT, true)
|
||||
, mHaveRoot (false)
|
||||
{
|
||||
mMap = boost::make_shared<SHAMap> (smtTRANSACTION, hash);
|
||||
}
|
||||
@@ -46,23 +48,30 @@ void TransactionAcquire::done ()
|
||||
getApp().getIOService ().post (BIND_TYPE (&TACompletionHandler, mHash, map));
|
||||
}
|
||||
|
||||
void TransactionAcquire::onTimer (bool progress)
|
||||
void TransactionAcquire::onTimer (bool progress, boost::recursive_mutex::scoped_lock& psl)
|
||||
{
|
||||
bool aggressive = false;
|
||||
|
||||
if (getTimeouts () > 10)
|
||||
{
|
||||
WriteLog (lsWARNING, TransactionAcquire) << "Ten timeouts on TX set " << getHash ();
|
||||
psl.unlock();
|
||||
{
|
||||
Application::ScopedLockType lock (getApp().getMasterLock (), __FILE__, __LINE__);
|
||||
|
||||
if (getApp().getOPs ().stillNeedTXSet (mHash))
|
||||
{
|
||||
WriteLog (lsWARNING, TransactionAcquire) << "Still need it";
|
||||
mTimeouts = 0;
|
||||
aggressive = true;
|
||||
}
|
||||
boost::recursive_mutex::scoped_lock sl (getApp().getMasterLock ());
|
||||
|
||||
if (getApp().getOPs ().stillNeedTXSet (mHash))
|
||||
{
|
||||
WriteLog (lsWARNING, TransactionAcquire) << "Still need it";
|
||||
mTimeouts = 0;
|
||||
aggressive = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
psl.lock();
|
||||
|
||||
if (!aggressive)
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@ private:
|
||||
SHAMap::pointer mMap;
|
||||
bool mHaveRoot;
|
||||
|
||||
void onTimer (bool progress);
|
||||
void onTimer (bool progress, boost::recursive_mutex::scoped_lock& peerSetLock);
|
||||
void newPeer (Peer::ref peer)
|
||||
{
|
||||
trigger (peer);
|
||||
|
||||
Reference in New Issue
Block a user