mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-02 17:45:57 +00:00
support for read replicas with postgres
This commit is contained in:
@@ -132,7 +132,7 @@ public:
|
|||||||
// Open the database. Set up all of the necessary objects and
|
// Open the database. Set up all of the necessary objects and
|
||||||
// datastructures. After this call completes, the database is ready for use.
|
// datastructures. After this call completes, the database is ready for use.
|
||||||
virtual void
|
virtual void
|
||||||
open() = 0;
|
open(bool readOnly) = 0;
|
||||||
|
|
||||||
// Close the database, releasing any resources
|
// Close the database, releasing any resources
|
||||||
virtual void
|
virtual void
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ CassandraBackend::doOnlineDelete(uint32_t minLedgerToKeep) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CassandraBackend::open()
|
CassandraBackend::open(bool readOnly)
|
||||||
{
|
{
|
||||||
std::cout << config_ << std::endl;
|
std::cout << config_ << std::endl;
|
||||||
auto getString = [this](std::string const& field) -> std::string {
|
auto getString = [this](std::string const& field) -> std::string {
|
||||||
|
|||||||
@@ -665,7 +665,7 @@ public:
|
|||||||
// Create the table if it doesn't exist already
|
// Create the table if it doesn't exist already
|
||||||
// @param createIfMissing ignored
|
// @param createIfMissing ignored
|
||||||
void
|
void
|
||||||
open() override;
|
open(bool readOnly) override;
|
||||||
|
|
||||||
// Close the connection to the database
|
// Close the connection to the database
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -625,8 +625,9 @@ PostgresBackend::fetchAccountTransactions(
|
|||||||
} // namespace Backend
|
} // namespace Backend
|
||||||
|
|
||||||
void
|
void
|
||||||
PostgresBackend::open()
|
PostgresBackend::open(bool readOnly)
|
||||||
{
|
{
|
||||||
|
if (!readOnly)
|
||||||
initSchema(pgPool_);
|
initSchema(pgPool_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ public:
|
|||||||
std::vector<AccountTransactionsData>&& data) const override;
|
std::vector<AccountTransactionsData>&& data) const override;
|
||||||
|
|
||||||
void
|
void
|
||||||
open() override;
|
open(bool readOnly) override;
|
||||||
|
|
||||||
void
|
void
|
||||||
close() override;
|
close() override;
|
||||||
|
|||||||
@@ -711,7 +711,6 @@ ReportingETL::ReportingETL(
|
|||||||
networkValidatedLedgers_,
|
networkValidatedLedgers_,
|
||||||
ioc)
|
ioc)
|
||||||
{
|
{
|
||||||
flatMapBackend_->open();
|
|
||||||
if (config.contains("start_sequence"))
|
if (config.contains("start_sequence"))
|
||||||
startSequence_ = config.at("start_sequence").as_int64();
|
startSequence_ = config.at("start_sequence").as_int64();
|
||||||
if (config.contains("finish_sequence"))
|
if (config.contains("finish_sequence"))
|
||||||
@@ -724,5 +723,6 @@ ReportingETL::ReportingETL(
|
|||||||
extractorThreads_ = config.at("extractor_threads").as_int64();
|
extractorThreads_ = config.at("extractor_threads").as_int64();
|
||||||
if (config.contains("txn_threshold"))
|
if (config.contains("txn_threshold"))
|
||||||
txnThreshold_ = config.at("txn_threshold").as_int64();
|
txnThreshold_ = config.at("txn_threshold").as_int64();
|
||||||
|
flatMapBackend_->open(readOnly_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user