@@ -118,9 +118,7 @@ SHAMapStoreImp::SHAMapStoreImp(
118118
119119 get_if_exists (section, " online_delete" , deleteInterval_);
120120
121- bool const isMem = config.mem_backend ();
122-
123- if (deleteInterval_ || isMem)
121+ if (deleteInterval_)
124122 {
125123 if (app_.config ().reporting ())
126124 {
@@ -129,9 +127,6 @@ SHAMapStoreImp::SHAMapStoreImp(
129127 " online_delete info from config" );
130128 }
131129
132- if (isMem)
133- deleteInterval_ = config.LEDGER_HISTORY ;
134-
135130 // Configuration that affects the behavior of online delete
136131 get_if_exists (section, " delete_batch" , deleteBatch_);
137132 std::uint32_t temp;
@@ -167,7 +162,7 @@ SHAMapStoreImp::SHAMapStoreImp(
167162 }
168163
169164 state_db_.init (config, dbName_);
170- if (!isMem )
165+ if (!config. mem_backend () )
171166 dbPaths ();
172167 }
173168}
@@ -649,40 +644,40 @@ SHAMapStoreImp::clearPrior(LedgerIndex lastRotated)
649644 if (!db)
650645 Throw<std::runtime_error>(" Failed to get relational database" );
651646
647+ if (app_.config ().useTxTables ())
648+ {
649+ clearSql (
650+ lastRotated,
651+ " Transactions" ,
652+ [&db]() -> std::optional<LedgerIndex> {
653+ return db->getTransactionsMinLedgerSeq ();
654+ },
655+ [&db](LedgerIndex min) -> void {
656+ db->deleteTransactionsBeforeLedgerSeq (min);
657+ });
658+ if (healthWait () == stopping)
659+ return ;
660+
661+ clearSql (
662+ lastRotated,
663+ " AccountTransactions" ,
664+ [&db]() -> std::optional<LedgerIndex> {
665+ return db->getAccountTransactionsMinLedgerSeq ();
666+ },
667+ [&db](LedgerIndex min) -> void {
668+ db->deleteAccountTransactionsBeforeLedgerSeq (min);
669+ });
670+ if (healthWait () == stopping)
671+ return ;
672+ }
673+
652674 clearSql (
653675 lastRotated,
654676 " Ledgers" ,
655677 [db]() -> std::optional<LedgerIndex> { return db->getMinLedgerSeq (); },
656678 [db](LedgerIndex min) -> void { db->deleteBeforeLedgerSeq (min); });
657679 if (healthWait () == stopping)
658680 return ;
659-
660- if (!app_.config ().useTxTables ())
661- return ;
662-
663- clearSql (
664- lastRotated,
665- " Transactions" ,
666- [&db]() -> std::optional<LedgerIndex> {
667- return db->getTransactionsMinLedgerSeq ();
668- },
669- [&db](LedgerIndex min) -> void {
670- db->deleteTransactionsBeforeLedgerSeq (min);
671- });
672- if (healthWait () == stopping)
673- return ;
674-
675- clearSql (
676- lastRotated,
677- " AccountTransactions" ,
678- [&db]() -> std::optional<LedgerIndex> {
679- return db->getAccountTransactionsMinLedgerSeq ();
680- },
681- [&db](LedgerIndex min) -> void {
682- db->deleteAccountTransactionsBeforeLedgerSeq (min);
683- });
684- if (healthWait () == stopping)
685- return ;
686681}
687682
688683SHAMapStoreImp::HealthResult
0 commit comments