Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DB version call #2466

Merged
merged 6 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ function(add_kuzu_api_test TEST_NAME)
endfunction()

add_definitions(-DKUZU_ROOT_DIRECTORY="${PROJECT_SOURCE_DIR}")
add_definitions(-DKUZU_STORAGE_VERSION="${CMAKE_PROJECT_VERSION}")
add_definitions(-DKUZU_CMAKE_VERSION="${CMAKE_PROJECT_VERSION}")

include_directories(src/include)
include_directories(third_party/antlr4_cypher/include)
Expand Down
1 change: 0 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_compile_definitions(KUZU_CMAKE_VERSION=v${CMAKE_PROJECT_VERSION})
# Avoid the import annotation when building on windows
# Really this should be set per target,
# but the targets are split among many files and only the object files are linked against here
Expand Down
1 change: 1 addition & 0 deletions src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ add_subdirectory(vector)

add_library(kuzu_common
OBJECT
constants.cpp
expression_type.cpp
file_utils.cpp
in_mem_overflow_buffer.cpp
Expand Down
6 changes: 6 additions & 0 deletions src/common/constants.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace kuzu {
namespace common {

const char* KUZU_VERSION = KUZU_CMAKE_VERSION;
}
} // namespace kuzu
4 changes: 1 addition & 3 deletions src/include/common/constants.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
#pragma once

#define TO_STRING(ARG) #ARG

#include <cstdint>

namespace kuzu {
namespace common {

constexpr char KUZU_VERSION[] = TO_STRING(KUZU_CMAKE_VERSION);
extern const char* KUZU_VERSION;

constexpr uint64_t DEFAULT_VECTOR_CAPACITY_LOG_2 = 11;
constexpr uint64_t DEFAULT_VECTOR_CAPACITY = (uint64_t)1 << DEFAULT_VECTOR_CAPACITY_LOG_2;
Expand Down
6 changes: 3 additions & 3 deletions src/storage/storage_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ 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,
if (!storageVersionInfo.contains(KUZU_CMAKE_VERSION)) {
// If the current KUZU_CMAKE_VERSION is not in the map,
// then we must run the newest version of kuzu
// LCOV_EXCL_START
storage_version_t maxVersion = 0;
Expand All @@ -16,7 +16,7 @@ storage_version_t StorageVersionInfo::getStorageVersion() {
return maxVersion;
// LCOV_EXCL_STOP
}
return storageVersionInfo.at(KUZU_STORAGE_VERSION);
return storageVersionInfo.at(KUZU_CMAKE_VERSION);
}

} // namespace storage
Expand Down