mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Don't delete from tx table if it's not in use
This commit is contained in:
@@ -2344,8 +2344,14 @@ LedgerMaster::getFetchPackCacheSize() const
|
||||
boost::optional<LedgerIndex>
|
||||
LedgerMaster::minSqlSeq()
|
||||
{
|
||||
if (!app_.config().reporting())
|
||||
{
|
||||
boost::optional<LedgerIndex> seq;
|
||||
auto db = app_.getLedgerDB().checkoutDb();
|
||||
*db << "SELECT MIN(LedgerSeq) FROM Ledgers", soci::into(seq);
|
||||
return seq;
|
||||
}
|
||||
#ifdef RIPPLED_REPORTING
|
||||
if (app_.config().reporting())
|
||||
{
|
||||
auto seq = PgQuery(app_.getPgPool())("SELECT min_ledger()");
|
||||
if (!seq)
|
||||
@@ -2359,10 +2365,7 @@ LedgerMaster::minSqlSeq()
|
||||
return seq.asInt();
|
||||
}
|
||||
#endif
|
||||
boost::optional<LedgerIndex> seq;
|
||||
auto db = app_.getLedgerDB().checkoutDb();
|
||||
*db << "SELECT MIN(LedgerSeq) FROM Ledgers", soci::into(seq);
|
||||
return seq;
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace ripple
|
||||
|
||||
@@ -343,7 +343,8 @@ SHAMapStoreImp::run()
|
||||
ledgerMaster_ = &app_.getLedgerMaster();
|
||||
fullBelowCache_ = &(*app_.getNodeFamily().getFullBelowCache(0));
|
||||
treeNodeCache_ = &(*app_.getNodeFamily().getTreeNodeCache(0));
|
||||
transactionDb_ = &app_.getTxnDB();
|
||||
if (app_.config().useTxTables())
|
||||
transactionDb_ = &app_.getTxnDB();
|
||||
ledgerDb_ = &app_.getLedgerDB();
|
||||
if (advisoryDelete_)
|
||||
canDelete_ = state_db_.getCanDelete();
|
||||
@@ -695,6 +696,9 @@ SHAMapStoreImp::clearPrior(LedgerIndex lastRotated)
|
||||
if (health())
|
||||
return;
|
||||
|
||||
if (!app_.config().useTxTables())
|
||||
return;
|
||||
|
||||
clearSql(
|
||||
*transactionDb_,
|
||||
lastRotated,
|
||||
|
||||
@@ -835,6 +835,16 @@ ReportingETL::ReportingETL(Application& app, Stoppable& parent)
|
||||
// if present, get endpoint from config
|
||||
if (app_.config().exists("reporting"))
|
||||
{
|
||||
#ifndef RIPPLED_REPORTING
|
||||
Throw<std::runtime_error>(
|
||||
"Config file specifies reporting, but software was not built with "
|
||||
"-Dreporting=1. To use reporting, configure CMake with "
|
||||
"-Dreporting=1");
|
||||
#endif
|
||||
if (!app_.config().useTxTables())
|
||||
Throw<std::runtime_error>(
|
||||
"Reporting requires tx tables. Set use_tx_tables=1 in config "
|
||||
"file, under [ledger_tx_tables] section");
|
||||
Section section = app_.config().section("reporting");
|
||||
|
||||
JLOG(journal_.debug()) << "Parsing config info";
|
||||
|
||||
Reference in New Issue
Block a user