fix online delete

This commit is contained in:
Denis Angell
2025-07-10 12:50:16 +02:00
parent 849d447a20
commit a84d72a7f7
2 changed files with 13 additions and 1 deletions

View File

@@ -65,9 +65,17 @@ public:
return {};
std::shared_lock<std::shared_mutex> lock(mutex_);
LedgerIndex minSeq = std::numeric_limits<LedgerIndex>::max();
if (transactionMap_.empty())
return std::nullopt;
return transactionMap_.begin()->second.second->getLgrSeq();
for (const auto& [_, txMeta] : transactionMap_)
{
if (txMeta.second && txMeta.second->getLgrSeq() < minSeq)
minSeq = txMeta.second->getLgrSeq();
}
return minSeq == std::numeric_limits<LedgerIndex>::max()
? std::nullopt
: std::optional<LedgerIndex>(minSeq);
}
std::optional<LedgerIndex>

View File

@@ -216,6 +216,10 @@ public:
}
BEAST_EXPECT(store.getLastRotated() == lastRotated);
SQLiteDatabase* const db =
dynamic_cast<SQLiteDatabase*>(&env.app().getRelationalDatabase());
BEAST_EXPECT(*db->getTransactionsMinLedgerSeq() == 3);
for (auto i = 3; i < deleteInterval + lastRotated; ++i)
{
ledgers.emplace(