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

Method serializeMetadataSnapshot

src/storage/checkpointer.cpp:106–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104}
105
106PageRange Checkpointer::serializeMetadataSnapshot(const catalog::Catalog& catalog,
107 StorageManager& storageManager) {
108 auto metadataWriter =
109 std::make_shared<common::InMemFileWriter>(*MemoryManager::Get(clientContext));
110 common::Serializer metadataSerializer(metadataWriter);
111 const transaction::Transaction snapshotTxn(transaction::TransactionType::CHECKPOINT,
112 transaction::Transaction::DUMMY_TRANSACTION_ID, snapshotTS);
113 storageManager.serialize(catalog, snapshotTxn, metadataSerializer);
114
115 auto& pageManager = *storageManager.getDataFH()->getPageManager();
116 const auto pagesForPageManager = pageManager.estimatePagesNeededForSerialize();
117 auto pageAllocator = storageManager.getDataFH()->getPageManager();
118 const auto allocatedPages = pageAllocator->allocatePageRange(
119 metadataWriter->getNumPagesToFlush() + pagesForPageManager);
120 pageManager.serialize(metadataSerializer);
121
122 metadataWriter->flush(allocatedPages, pageAllocator->getDataFH(),
123 storageManager.getShadowFile());
124 return allocatedPages;
125}
126
127PageRange Checkpointer::serializeMetadata(const catalog::Catalog& catalog,
128 StorageManager& storageManager) {

Callers

nothing calls this directly

Calls 7

getPageManagerMethod · 0.80
getNumPagesToFlushMethod · 0.80
serializeMethod · 0.45
getDataFHMethod · 0.45
allocatePageRangeMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected