Improve online_delete configuration and DB tuning:

* Document delete_batch, back_off_milliseconds, age_threshold_seconds.
* Convert those time values to chrono types.
* Fix bug that ignored age_threshold_seconds.
* Add a "recovery buffer" to the config that gives the node a chance to
  recover before aborting online delete.
* Add begin/end log messages around the SQL queries.
* Add a new configuration section: [sqlite] to allow tuning the sqlite
  database operations. Ignored on full/large history servers.
* Update documentation of [node_db] and [sqlite] in the
  rippled-example.cfg file.

Resolves #3321
This commit is contained in:
Edward Hennis
2020-05-11 16:48:34 -04:00
committed by Nik Bougalis
parent 00702f28c2
commit 4702c8b591
21 changed files with 1086 additions and 271 deletions

View File

@@ -31,6 +31,7 @@
#include <chrono>
#include <stdexcept>
#include <test/jtx.h>
#include <test/jtx/CaptureLogs.h>
#include <test/jtx/envconfig.h>
#include <test/unit_test/SuiteJournal.h>
#include <thread>
@@ -375,60 +376,6 @@ public:
pass();
}
/**
* @brief sink for writing all log messages to a stringstream
*/
class CaptureSink : public beast::Journal::Sink
{
std::stringstream& strm_;
public:
CaptureSink(
beast::severities::Severity threshold,
std::stringstream& strm)
: beast::Journal::Sink(threshold, false), strm_(strm)
{
}
void
write(beast::severities::Severity level, std::string const& text)
override
{
strm_ << text;
}
};
/**
* @brief Log manager for CaptureSinks. This class holds the stream
* instance that is written to by the sinks. Upon destruction, all
* contents of the stream are assigned to the string specified in the
* ctor
*/
class CaptureLogs : public Logs
{
std::stringstream strm_;
std::string& result_;
public:
explicit CaptureLogs(std::string& result)
: Logs(beast::severities::kInfo), result_(result)
{
}
~CaptureLogs() override
{
result_ = strm_.str();
}
std::unique_ptr<beast::Journal::Sink>
makeSink(
std::string const& partition,
beast::severities::Severity threshold) override
{
return std::make_unique<CaptureSink>(threshold, strm_);
}
};
void
testBadConfig()
{
@@ -444,7 +391,7 @@ public:
(*cfg).deprecatedClearSection("port_rpc");
return cfg;
}),
std::make_unique<CaptureLogs>(messages)};
std::make_unique<CaptureLogs>(&messages)};
});
BEAST_EXPECT(
messages.find("Missing 'ip' in [port_rpc]") != std::string::npos);
@@ -457,7 +404,7 @@ public:
(*cfg)["port_rpc"].set("ip", getEnvLocalhostAddr());
return cfg;
}),
std::make_unique<CaptureLogs>(messages)};
std::make_unique<CaptureLogs>(&messages)};
});
BEAST_EXPECT(
messages.find("Missing 'port' in [port_rpc]") != std::string::npos);
@@ -471,7 +418,7 @@ public:
(*cfg)["port_rpc"].set("port", "0");
return cfg;
}),
std::make_unique<CaptureLogs>(messages)};
std::make_unique<CaptureLogs>(&messages)};
});
BEAST_EXPECT(
messages.find("Invalid value '0' for key 'port' in [port_rpc]") !=
@@ -487,7 +434,7 @@ public:
(*cfg)["port_rpc"].set("protocol", "");
return cfg;
}),
std::make_unique<CaptureLogs>(messages)};
std::make_unique<CaptureLogs>(&messages)};
});
BEAST_EXPECT(
messages.find("Missing 'protocol' in [port_rpc]") !=
@@ -522,7 +469,7 @@ public:
(*cfg)["port_ws"].set("admin", getEnvLocalhostAddr());
return cfg;
}),
std::make_unique<CaptureLogs>(messages)};
std::make_unique<CaptureLogs>(&messages)};
});
BEAST_EXPECT(
messages.find("Required section [server] is missing") !=
@@ -548,7 +495,7 @@ public:
(*cfg)["server"].append("port_ws");
return cfg;
}),
std::make_unique<CaptureLogs>(messages)};
std::make_unique<CaptureLogs>(&messages)};
});
BEAST_EXPECT(
messages.find("Missing section: [port_peer]") != std::string::npos);