Remove throttling, add err log (#934)

This commit is contained in:
Alex Kremer
2023-10-17 14:43:09 +01:00
committed by GitHub
parent 97c969f192
commit 5666bbd88e
3 changed files with 5 additions and 10 deletions

View File

@@ -486,6 +486,7 @@ struct ReadCallbackData
std::atomic_int& numOutstanding;
handler_type handler;
std::function<void(CassandraResult&)> onSuccess;
clio::Logger log_{"Backend"};
std::atomic_bool errored = false;
ReadCallbackData(
@@ -502,6 +503,7 @@ struct ReadCallbackData
CassError rc = cass_future_error_code(fut);
if (rc != CASS_OK)
{
log_.error() << "Got error response: " << cass_error_desc(rc);
errored = true;
}
else
@@ -540,7 +542,6 @@ CassandraBackend::fetchTransactions(
{
if (hashes.size() == 0)
return {};
numReadRequestsOutstanding_ += hashes.size();
handler_type handler(std::forward<decltype(yield)>(yield));
result_type result(handler);
@@ -572,7 +573,6 @@ CassandraBackend::fetchTransactions(
// suspend the coroutine until completion handler is called.
result.get();
numReadRequestsOutstanding_ -= hashes.size();
});
for (auto const& cb : cbs)
{
@@ -877,8 +877,6 @@ CassandraBackend::doFetchLedgerObjects(
if (keys.size() == 0)
return {};
numReadRequestsOutstanding_ += keys.size();
handler_type handler(std::forward<decltype(yield)>(yield));
result_type result(handler);
@@ -904,7 +902,6 @@ CassandraBackend::doFetchLedgerObjects(
// suspend the coroutine until completion handler is called.
result.get();
numReadRequestsOutstanding_ -= keys.size();
for (auto const& cb : cbs)
{
@@ -1033,7 +1030,7 @@ CassandraBackend::doOnlineDelete(
bool
CassandraBackend::isTooBusy() const
{
return numReadRequestsOutstanding_ >= maxReadRequestsOutstanding;
return false;
}
void

View File

@@ -681,7 +681,6 @@ private:
// maximum number of concurrent in flight read requests. isTooBusy() will
// return true if the number of in flight read requests exceeds this limit
std::uint32_t maxReadRequestsOutstanding = 100000;
mutable std::atomic_uint32_t numReadRequestsOutstanding_ = 0;
// mutex and condition_variable to limit the number of concurrent in flight
// write requests
@@ -1239,12 +1238,10 @@ public:
CassError rc;
do
{
++numReadRequestsOutstanding_;
fut = cass_session_execute(session_.get(), statement.get());
boost::system::error_code ec;
rc = cass_future_error_code(fut, yield[ec]);
--numReadRequestsOutstanding_;
if (ec)
{

View File

@@ -124,7 +124,8 @@ maybeWriteTransaction(
throw std::runtime_error("Could not repair transaction");
auto package = tx.value();
if (!package.contains("result") || !package.at("result").is_object())
if (!package.contains("result") || !package.at("result").is_object() ||
package.at("result").as_object().contains("error"))
throw std::runtime_error("Received non-success response from rippled");
auto data = package.at("result").as_object();