I decoupled updateCardinalities() from the Scavenger and moved it on to
its own thread. Now, each scavenge simply signals it and moves on, no
waiting on syncSysDDL.
BUT...
Database::scavengeRecords() commits pending system transactions, which
of course requires a lock syncSysDDL. In the old code, this was done
only inside of syncScavenge AND if the scavenge was not 'forced'.
Load-based scavenges are the current equivalent of forced scavenges, and
also should not commit pending system transactions.
// NEW CODE
void Database::scavengeRecords(void)
{
// Commit pending system transactions before proceeding
if (systemConnection->transaction)
commitSystemTransaction();
Sync syncScavenger(&syncScavenge,
"Database::scavengeRecords(Scavenge)");
syncScavenger.lock(Exclusive)
[...]
// OLD CODE
void Database::retireRecords(bool forced)
{
int cycle = scavengeCycle;
Sync syncScavenger(&syncScavenge, "Database::retireRecords(1)");
syncScavenger.lock(Exclusive);
if (forced && scavengeCycle > cycle)
return;
// Commit pending system transactions before proceeding
if (!forced && systemConnection->transaction)
commitSystemTransaction();