mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Stability bugfixes for online delete SHAMapStore:
The correct ledger age is necessary for checking health status, and the previous behavior caused the online deletion process to abort if the process took too long. The tuning parameter added and the parameter whose default was modified both minimize impact of SQL DELETE operations by decreasing the default batch size for deletes and for increasing the backoff period between deletion batches. These parameters decrease contention for the SQLite and I/O with the trade-off of longer processing time for online delete. Online-delete is not a time-critical function, so a little slowness in wall-clock time is not harmful.
This commit is contained in:
committed by
Nik Bougalis
parent
a48120e675
commit
d5c3f0c9cf
@@ -563,7 +563,7 @@ SHAMapStoreImp::clearSql (DatabaseCon& database,
|
||||
return;
|
||||
if (min < lastRotated)
|
||||
std::this_thread::sleep_for (
|
||||
std::chrono::microseconds (pause_));
|
||||
std::chrono::milliseconds (setup_.backOff));
|
||||
}
|
||||
journal_.debug << "finished: " << deleteQuery;
|
||||
}
|
||||
@@ -634,15 +634,12 @@ SHAMapStoreImp::health()
|
||||
return Health::ok;
|
||||
|
||||
NetworkOPs::OperatingMode mode = netOPs_->getOperatingMode();
|
||||
std::uint32_t age = netOPs_->getNetworkTimeNC() - (
|
||||
validatedLedger_->getCloseTimeNC() -
|
||||
validatedLedger_->getCloseResolution());
|
||||
|
||||
if (mode != NetworkOPs::omFULL || age >= ageTooHigh_)
|
||||
std::int32_t age = ledgerMaster_->getValidatedLedgerAge();
|
||||
if (mode != NetworkOPs::omFULL || age >= setup_.ageThreshold)
|
||||
{
|
||||
journal_.warning << "server not healthy, not deleting. state: "
|
||||
<< mode << " age " << age << " age threshold "
|
||||
<< ageTooHigh_;
|
||||
journal_.warning << "Not deleting. state: " << mode << " age " << age
|
||||
<< " age threshold " << setup_.ageThreshold;
|
||||
healthy_ = false;
|
||||
}
|
||||
|
||||
@@ -702,6 +699,10 @@ setup_SHAMapStore (Config const& c)
|
||||
setup.databasePath = c.DATABASE_PATH;
|
||||
if (c.nodeDatabase["delete_batch"].isNotEmpty())
|
||||
setup.deleteBatch = c.nodeDatabase["delete_batch"].getIntValue();
|
||||
if (c.nodeDatabase["backOff"].isNotEmpty())
|
||||
setup.backOff = c.nodeDatabase["backOff"].getIntValue();
|
||||
if (c.nodeDatabase["age_threshold"].isNotEmpty())
|
||||
setup.ageThreshold = c.nodeDatabase["age_threshold"].getIntValue();
|
||||
|
||||
return setup;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user