| 196 | } |
| 197 | |
| 198 | void Checkpointer::beginCheckpoint(common::transaction_t snapshotTimestamp) { |
| 199 | if (isInMemory) { |
| 200 | return; |
| 201 | } |
| 202 | |
| 203 | snapshotTS = snapshotTimestamp; |
| 204 | checkpointTargets = collectCheckpointTargets(); |
| 205 | |
| 206 | for (const auto& target : checkpointTargets) { |
| 207 | auto rotated = target.storageManager->getWAL().rotateForCheckpoint(&clientContext); |
| 208 | walRotatedByManager[target.storageManager] = rotated; |
| 209 | walRotated = walRotated || rotated; |
| 210 | } |
| 211 | |
| 212 | checkpointHeader = *mainStorageManager->getOrInitDatabaseHeader(clientContext); |
| 213 | const auto oldStorageVersion = checkpointHeader.storageVersion; |
| 214 | checkpointHeader.storageVersion = StorageVersionInfo::getStorageVersion(); |
| 215 | hasStorageVersionUpgrade = oldStorageVersion != checkpointHeader.storageVersion; |
| 216 | |
| 217 | // Capture versions while the write gate is still held. |
| 218 | for (const auto& target : checkpointTargets) { |
| 219 | catalogVersionAtCheckpointByCatalog[target.catalog] = target.catalog->getVersion(); |
| 220 | pageManagerVersionAtCheckpointByManager[target.storageManager] = |
| 221 | target.storageManager->getDataFH()->getPageManager()->getVersion(); |
| 222 | tableEpochWatermarksByManager[target.storageManager] = |
| 223 | target.storageManager->captureChangeEpochs(); |
| 224 | } |
| 225 | catalogVersionAtCheckpoint = |
| 226 | catalogVersionAtCheckpointByCatalog[clientContext.getDatabase()->getCatalog()]; |
| 227 | pageManagerVersionAtCheckpoint = pageManagerVersionAtCheckpointByManager[mainStorageManager]; |
| 228 | tableEpochWatermarks = tableEpochWatermarksByManager[mainStorageManager]; |
| 229 | } |
| 230 | |
| 231 | void Checkpointer::checkpointStoragePhase() { |
| 232 | if (isInMemory) { |
no test coverage detected