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

Function validateEmptyWAL

src/main/attached_database.cpp:35–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33}
34
35static void validateEmptyWAL(const std::string& path, ClientContext* context) {
36 auto vfs = common::VirtualFileSystem::GetUnsafe(*context);
37 auto walFilePath = storage::StorageUtils::getWALFilePath(path);
38 if (vfs->fileOrPathExists(walFilePath, context)) {
39 auto walFile = vfs->openFile(walFilePath,
40 common::FileOpenFlags(common::FileFlags::READ_ONLY), context);
41 if (walFile->getFileSize() > 0) {
42 throw common::RuntimeException(std::format(
43 "Cannot attach an external Lbug database with non-empty wal file. Try manually "
44 "checkpointing the external database (i.e., run \"CHECKPOINT;\")."));
45 }
46 }
47}
48
49AttachedLbugDatabase::AttachedLbugDatabase(std::string dbPath, std::string dbName,
50 std::string dbType, ClientContext* clientContext)

Callers 1

AttachedLbugDatabaseMethod · 0.85

Calls 4

FileOpenFlagsClass · 0.85
fileOrPathExistsMethod · 0.45
openFileMethod · 0.45
getFileSizeMethod · 0.45

Tested by

no test coverage detected