Skip to content

Commit

Permalink
Use storage version if not present
Browse files Browse the repository at this point in the history
  • Loading branch information
acquamarin committed Nov 19, 2023
1 parent 8f9f38e commit f96f9b6
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/storage/storage_info.cpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#include "storage/storage_info.h"

#include "common/exception/runtime.h"
#include "common/string_format.h"

using namespace kuzu::common;

namespace kuzu {
namespace storage {

storage_version_t StorageVersionInfo::getStorageVersion() {
auto storageVersionInfo = getStorageVersionInfo();
if (!storageVersionInfo.contains(KUZU_STORAGE_VERSION)) {
// If the current KUZU_STORAGE_VERSION is not in the map,
// then we must run the newest version of kuzu
// LCOV_EXCL_START
throw RuntimeException(
stringFormat("Invalid storage version name: {}", KUZU_STORAGE_VERSION));
storage_version_t maxVersion = 0;
for (auto& [_, versionNumber] : storageVersionInfo) {
maxVersion = std::max(maxVersion, versionNumber);
}
return maxVersion;
// LCOV_EXCL_STOP
}
return storageVersionInfo.at(KUZU_STORAGE_VERSION);
Expand Down

0 comments on commit f96f9b6

Please sign in to comment.