MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / canAutoCheckpoint

Method canAutoCheckpoint

src/storage/checkpointer.cpp:394–409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

392}
393
394bool Checkpointer::canAutoCheckpoint(const main::ClientContext& clientContext,
395 const transaction::Transaction& transaction) {
396 if (clientContext.isInMemory()) {
397 return false;
398 }
399 if (!clientContext.getDBConfig()->autoCheckpoint) {
400 return false;
401 }
402 if (transaction.isRecovery()) {
403 // Recovery transactions are not allowed to trigger auto checkpoint.
404 return false;
405 }
406 auto wal = &clientContext.getDatabase()->getStorageManager()->getWAL();
407 const auto expectedSize = transaction.getLocalWAL().getSize() + wal->getFileSize();
408 return expectedSize > clientContext.getDBConfig()->checkpointThreshold;
409}
410
411void Checkpointer::readCheckpoint() {
412 // IMPORTANT: Use the main database's storage manager, NOT StorageManager::Get() which

Callers

nothing calls this directly

Calls 6

isInMemoryMethod · 0.80
getDBConfigMethod · 0.80
getStorageManagerMethod · 0.45
getDatabaseMethod · 0.45
getSizeMethod · 0.45
getFileSizeMethod · 0.45

Tested by

no test coverage detected