Skip to content

Commit

Permalink
Merge pull request #2460 from kuzudb/storage-version
Browse files Browse the repository at this point in the history
Use newest storage version if not found in storage_version map
  • Loading branch information
acquamarin committed Nov 20, 2023
2 parents 7730acf + f96f9b6 commit 1e48e8a
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 1e48e8a

Please sign in to comment.