From f96f9b6938a2fc7e13819a93273c7eeda5c18f30 Mon Sep 17 00:00:00 2001 From: ziyi chen Date: Sun, 19 Nov 2023 14:22:31 -0500 Subject: [PATCH] Use storage version if not present --- src/storage/storage_info.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/storage/storage_info.cpp b/src/storage/storage_info.cpp index fe7559862d..3aa00f2945 100644 --- a/src/storage/storage_info.cpp +++ b/src/storage/storage_info.cpp @@ -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);