Add toolchain-v5 compatibility Revert to C++20 (#587)
* Upgrade cppitertools, spdlog, fmt, rapidcheck * Make compilation work on both v4 and v5 toolchains
This commit is contained in:
parent
7ec648b4ce
commit
61b9bb0f59
@ -189,7 +189,7 @@ add_custom_target(clean_all
|
|||||||
# is easier debugging of compilation and linker flags.
|
# is easier debugging of compilation and linker flags.
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 23)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
# c99-designator is disabled because of required mixture of designated and
|
# c99-designator is disabled because of required mixture of designated and
|
||||||
# non-designated initializers in Python Query Module code (`py_module.cpp`).
|
# non-designated initializers in Python Query Module code (`py_module.cpp`).
|
||||||
@ -211,8 +211,13 @@ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
|||||||
# ** Static linking is allowed only for executables! **
|
# ** Static linking is allowed only for executables! **
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
|
||||||
|
|
||||||
# Use lld linker to speedup build
|
# Use lld linker to speedup build and use less memory.
|
||||||
add_link_options(-fuse-ld=lld) # TODO: use mold linker
|
add_link_options(-fuse-ld=lld)
|
||||||
|
# NOTE: Moving to latest Clang (probably starting from 15), lld stopped to work
|
||||||
|
# without explicit link_directories call.
|
||||||
|
string(REPLACE ":" " " LD_LIBS $ENV{LD_LIBRARY_PATH})
|
||||||
|
separate_arguments(LD_LIBS)
|
||||||
|
link_directories(${LD_LIBS})
|
||||||
|
|
||||||
# release flags
|
# release flags
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
|
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2023 Memgraph Ltd.
|
// Copyright 2024 Memgraph Ltd.
|
||||||
//
|
//
|
||||||
// Use of this software is governed by the Business Source License
|
// Use of this software is governed by the Business Source License
|
||||||
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
@ -283,7 +283,7 @@ inline mgp_list *list_all_unique_constraints(mgp_graph *graph, mgp_memory *memor
|
|||||||
}
|
}
|
||||||
|
|
||||||
// mgp_graph
|
// mgp_graph
|
||||||
|
|
||||||
inline bool graph_is_transactional(mgp_graph *graph) { return MgInvoke<int>(mgp_graph_is_transactional, graph); }
|
inline bool graph_is_transactional(mgp_graph *graph) { return MgInvoke<int>(mgp_graph_is_transactional, graph); }
|
||||||
|
|
||||||
inline bool graph_is_mutable(mgp_graph *graph) { return MgInvoke<int>(mgp_graph_is_mutable, graph); }
|
inline bool graph_is_mutable(mgp_graph *graph) { return MgInvoke<int>(mgp_graph_is_mutable, graph); }
|
||||||
|
@ -16,7 +16,7 @@ set(GFLAGS_NOTHREADS OFF)
|
|||||||
|
|
||||||
# NOTE: config/generate.py depends on the gflags help XML format.
|
# NOTE: config/generate.py depends on the gflags help XML format.
|
||||||
find_package(gflags REQUIRED)
|
find_package(gflags REQUIRED)
|
||||||
find_package(fmt 8.0.1)
|
find_package(fmt 8.0.1 REQUIRED)
|
||||||
find_package(ZLIB 1.2.11 REQUIRED)
|
find_package(ZLIB 1.2.11 REQUIRED)
|
||||||
|
|
||||||
set(LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
set(LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
@ -5,7 +5,7 @@ index ee9b58c..31359a9 100644
|
|||||||
@@ -48,7 +48,7 @@ option(LIBRDTSC_USE_PMU "Enables PMU usage on ARM platforms" OFF)
|
@@ -48,7 +48,7 @@ option(LIBRDTSC_USE_PMU "Enables PMU usage on ARM platforms" OFF)
|
||||||
# | Library Build and Install Properties |
|
# | Library Build and Install Properties |
|
||||||
# +--------------------------------------------------------+
|
# +--------------------------------------------------------+
|
||||||
|
|
||||||
-add_library(rdtsc SHARED
|
-add_library(rdtsc SHARED
|
||||||
+add_library(rdtsc
|
+add_library(rdtsc
|
||||||
src/cycles.c
|
src/cycles.c
|
||||||
@ -14,7 +14,7 @@ index ee9b58c..31359a9 100644
|
|||||||
@@ -72,15 +72,6 @@ target_include_directories(rdtsc
|
@@ -72,15 +72,6 @@ target_include_directories(rdtsc
|
||||||
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
|
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||||
)
|
)
|
||||||
|
|
||||||
-# Install directory changes depending on build mode
|
-# Install directory changes depending on build mode
|
||||||
-if (CMAKE_BUILD_TYPE MATCHES "^[Dd]ebug")
|
-if (CMAKE_BUILD_TYPE MATCHES "^[Dd]ebug")
|
||||||
- # During debug, the library will be installed into a local directory
|
- # During debug, the library will be installed into a local directory
|
||||||
@ -27,3 +27,15 @@ index ee9b58c..31359a9 100644
|
|||||||
# Specifying what to export when installing (GNUInstallDirs required)
|
# Specifying what to export when installing (GNUInstallDirs required)
|
||||||
install(TARGETS rdtsc
|
install(TARGETS rdtsc
|
||||||
EXPORT librstsc-config
|
EXPORT librstsc-config
|
||||||
|
diff --git a/include/librdtsc/common_timer.h b/include/librdtsc/common_timer.h
|
||||||
|
index a6922d8..080dc77 100644
|
||||||
|
--- a/include/librdtsc/common_timer.h
|
||||||
|
+++ b/include/librdtsc/common_timer.h
|
||||||
|
@@ -2,6 +2,7 @@
|
||||||
|
#define LIBRDTSC_COMMON_TIMER_H
|
||||||
|
|
||||||
|
#include <librdtsc/common.h>
|
||||||
|
+#include <librdtsc/cycles.h>
|
||||||
|
|
||||||
|
extern uint64_t rdtsc_get_tsc_freq_arch();
|
||||||
|
extern uint64_t rdtsc_get_tsc_freq();
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
||||||
index 6761929..6a369af 100644
|
|
||||||
--- a/CMakeLists.txt
|
|
||||||
+++ b/CMakeLists.txt
|
|
||||||
@@ -220,6 +220,7 @@ else()
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -momit-leaf-frame-pointer")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-copy -Wno-unused-but-set-variable")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include(CheckCCompilerFlag)
|
|
||||||
@@ -997,7 +998,7 @@ if(NOT WIN32 OR ROCKSDB_INSTALL_ON_WINDOWS)
|
|
||||||
|
|
||||||
if(ROCKSDB_BUILD_SHARED)
|
|
||||||
install(
|
|
||||||
- TARGETS ${ROCKSDB_SHARED_LIB}
|
|
||||||
+ TARGETS ${ROCKSDB_SHARED_LIB} OPTIONAL
|
|
||||||
EXPORT RocksDBTargets
|
|
||||||
COMPONENT runtime
|
|
||||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
|
@ -168,12 +168,11 @@ pushd antlr4
|
|||||||
git apply ../antlr4.10.1.patch
|
git apply ../antlr4.10.1.patch
|
||||||
popd
|
popd
|
||||||
|
|
||||||
# cppitertools v2.0 2019-12-23
|
cppitertools_ref="v2.1" # 2021-01-15
|
||||||
cppitertools_ref="cb3635456bdb531121b82b4d2e3afc7ae1f56d47"
|
|
||||||
repo_clone_try_double "${primary_urls[cppitertools]}" "${secondary_urls[cppitertools]}" "cppitertools" "$cppitertools_ref"
|
repo_clone_try_double "${primary_urls[cppitertools]}" "${secondary_urls[cppitertools]}" "cppitertools" "$cppitertools_ref"
|
||||||
|
|
||||||
# rapidcheck
|
# rapidcheck
|
||||||
rapidcheck_tag="7bc7d302191a4f3d0bf005692677126136e02f60" # (2020-05-04)
|
rapidcheck_tag="1c91f40e64d87869250cfb610376c629307bf77d" # (2023-08-15)
|
||||||
repo_clone_try_double "${primary_urls[rapidcheck]}" "${secondary_urls[rapidcheck]}" "rapidcheck" "$rapidcheck_tag"
|
repo_clone_try_double "${primary_urls[rapidcheck]}" "${secondary_urls[rapidcheck]}" "rapidcheck" "$rapidcheck_tag"
|
||||||
|
|
||||||
# google benchmark
|
# google benchmark
|
||||||
@ -221,7 +220,7 @@ repo_clone_try_double "${primary_urls[pymgclient]}" "${secondary_urls[pymgclient
|
|||||||
mgconsole_tag="v1.4.0" # (2023-05-21)
|
mgconsole_tag="v1.4.0" # (2023-05-21)
|
||||||
repo_clone_try_double "${primary_urls[mgconsole]}" "${secondary_urls[mgconsole]}" "mgconsole" "$mgconsole_tag" true
|
repo_clone_try_double "${primary_urls[mgconsole]}" "${secondary_urls[mgconsole]}" "mgconsole" "$mgconsole_tag" true
|
||||||
|
|
||||||
spdlog_tag="v1.9.2" # (2021-08-12)
|
spdlog_tag="v1.12.0" # (2022-11-02)
|
||||||
repo_clone_try_double "${primary_urls[spdlog]}" "${secondary_urls[spdlog]}" "spdlog" "$spdlog_tag" true
|
repo_clone_try_double "${primary_urls[spdlog]}" "${secondary_urls[spdlog]}" "spdlog" "$spdlog_tag" true
|
||||||
|
|
||||||
# librdkafka
|
# librdkafka
|
||||||
|
@ -8,10 +8,12 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <json/json.hpp>
|
#include <cstdint>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include <json/json.hpp>
|
||||||
|
|
||||||
namespace memgraph::auth {
|
namespace memgraph::auth {
|
||||||
/// Need to be stable, auth durability depends on this
|
/// Need to be stable, auth durability depends on this
|
||||||
enum class PasswordHashAlgorithm : uint8_t { BCRYPT = 0, SHA256 = 1, SHA256_MULTIPLE = 2 };
|
enum class PasswordHashAlgorithm : uint8_t { BCRYPT = 0, SHA256 = 1, SHA256_MULTIPLE = 2 };
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2023 Memgraph Ltd.
|
// Copyright 2024 Memgraph Ltd.
|
||||||
//
|
//
|
||||||
// Use of this software is governed by the Business Source License
|
// Use of this software is governed by the Business Source License
|
||||||
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
@ -15,6 +15,9 @@
|
|||||||
#include "communication/bolt/v1/value.hpp"
|
#include "communication/bolt/v1/value.hpp"
|
||||||
#include "utils/logging.hpp"
|
#include "utils/logging.hpp"
|
||||||
|
|
||||||
|
#include "communication/bolt/v1/fmt.hpp"
|
||||||
|
#include "io/network/fmt.hpp"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
constexpr uint8_t kBoltV43Version[4] = {0x00, 0x00, 0x03, 0x04};
|
constexpr uint8_t kBoltV43Version[4] = {0x00, 0x00, 0x03, 0x04};
|
||||||
constexpr uint8_t kEmptyBoltVersion[4] = {0x00, 0x00, 0x00, 0x00};
|
constexpr uint8_t kEmptyBoltVersion[4] = {0x00, 0x00, 0x00, 0x00};
|
||||||
|
27
src/communication/bolt/v1/fmt.hpp
Normal file
27
src/communication/bolt/v1/fmt.hpp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// Copyright 2024 Memgraph Ltd.
|
||||||
|
//
|
||||||
|
// Use of this software is governed by the Business Source License
|
||||||
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
|
// License, and you may not use this file except in compliance with the Business Source License.
|
||||||
|
//
|
||||||
|
// As of the Change Date specified in that file, in accordance with
|
||||||
|
// the Business Source License, use of this software will be governed
|
||||||
|
// by the Apache License, Version 2.0, included in the file
|
||||||
|
// licenses/APL.txt.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if FMT_VERSION > 90000
|
||||||
|
#include <fmt/ostream.h>
|
||||||
|
|
||||||
|
#include "communication/bolt/v1/value.hpp"
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class fmt::formatter<memgraph::communication::bolt::Value> : public fmt::ostream_formatter {};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class fmt::formatter<std::vector<memgraph::communication::bolt::Value>> : public fmt::ostream_formatter {};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class fmt::formatter<std::map<std::string, memgraph::communication::bolt::Value>> : public fmt::ostream_formatter {};
|
||||||
|
#endif
|
20
src/communication/fmt.hpp
Normal file
20
src/communication/fmt.hpp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// Copyright 2024 Memgraph Ltd.
|
||||||
|
//
|
||||||
|
// Use of this software is governed by the Business Source License
|
||||||
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
|
// License, and you may not use this file except in compliance with the Business Source License.
|
||||||
|
//
|
||||||
|
// As of the Change Date specified in that file, in accordance with
|
||||||
|
// the Business Source License, use of this software will be governed
|
||||||
|
// by the Apache License, Version 2.0, included in the file
|
||||||
|
// licenses/APL.txt.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if FMT_VERSION > 90000
|
||||||
|
#include <fmt/ostream.h>
|
||||||
|
#include <boost/asio/ip/tcp.hpp>
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class fmt::formatter<boost::asio::ip::tcp::endpoint> : public fmt::ostream_formatter {};
|
||||||
|
#endif
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2023 Memgraph Ltd.
|
// Copyright 2024 Memgraph Ltd.
|
||||||
//
|
//
|
||||||
// Use of this software is governed by the Business Source License
|
// Use of this software is governed by the Business Source License
|
||||||
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
@ -21,6 +21,7 @@
|
|||||||
#include <boost/beast/core.hpp>
|
#include <boost/beast/core.hpp>
|
||||||
|
|
||||||
#include "communication/context.hpp"
|
#include "communication/context.hpp"
|
||||||
|
#include "communication/fmt.hpp"
|
||||||
#include "communication/http/session.hpp"
|
#include "communication/http/session.hpp"
|
||||||
#include "utils/spin_lock.hpp"
|
#include "utils/spin_lock.hpp"
|
||||||
#include "utils/synchronized.hpp"
|
#include "utils/synchronized.hpp"
|
||||||
@ -82,7 +83,7 @@ class Listener final : public std::enable_shared_from_this<Listener<TRequestHand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
spdlog::info("HTTP server is listening on {}:{}", endpoint.address(), endpoint.port());
|
spdlog::info("HTTP server is listening on {}", endpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoAccept() {
|
void DoAccept() {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2023 Memgraph Ltd.
|
// Copyright 2024 Memgraph Ltd.
|
||||||
//
|
//
|
||||||
// Use of this software is governed by the Business Source License
|
// Use of this software is governed by the Business Source License
|
||||||
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "communication/session.hpp"
|
#include "communication/session.hpp"
|
||||||
#include "io/network/epoll.hpp"
|
#include "io/network/epoll.hpp"
|
||||||
|
#include "io/network/fmt.hpp"
|
||||||
#include "io/network/socket.hpp"
|
#include "io/network/socket.hpp"
|
||||||
#include "utils/logging.hpp"
|
#include "utils/logging.hpp"
|
||||||
#include "utils/signals.hpp"
|
#include "utils/signals.hpp"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2023 Memgraph Ltd.
|
// Copyright 2024 Memgraph Ltd.
|
||||||
//
|
//
|
||||||
// Use of this software is governed by the Business Source License
|
// Use of this software is governed by the Business Source License
|
||||||
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "communication/init.hpp"
|
#include "communication/init.hpp"
|
||||||
#include "communication/listener.hpp"
|
#include "communication/listener.hpp"
|
||||||
|
#include "io/network/fmt.hpp"
|
||||||
#include "io/network/socket.hpp"
|
#include "io/network/socket.hpp"
|
||||||
#include "utils/logging.hpp"
|
#include "utils/logging.hpp"
|
||||||
#include "utils/message.hpp"
|
#include "utils/message.hpp"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2023 Memgraph Ltd.
|
// Copyright 2024 Memgraph Ltd.
|
||||||
//
|
//
|
||||||
// Use of this software is governed by the Business Source License
|
// Use of this software is governed by the Business Source License
|
||||||
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
@ -26,6 +26,7 @@
|
|||||||
#include <boost/asio/ip/tcp.hpp>
|
#include <boost/asio/ip/tcp.hpp>
|
||||||
|
|
||||||
#include "communication/context.hpp"
|
#include "communication/context.hpp"
|
||||||
|
#include "communication/fmt.hpp"
|
||||||
#include "communication/init.hpp"
|
#include "communication/init.hpp"
|
||||||
#include "communication/v2/listener.hpp"
|
#include "communication/v2/listener.hpp"
|
||||||
#include "communication/v2/pool.hpp"
|
#include "communication/v2/pool.hpp"
|
||||||
@ -129,7 +130,7 @@ bool Server<TSession, TSessionContext>::Start() {
|
|||||||
listener_->Start();
|
listener_->Start();
|
||||||
|
|
||||||
spdlog::info("{} server is fully armed and operational", service_name_);
|
spdlog::info("{} server is fully armed and operational", service_name_);
|
||||||
spdlog::info("{} listening on {}", service_name_, endpoint_.address());
|
spdlog::info("{} listening on {}", service_name_, endpoint_);
|
||||||
context_thread_pool_.Run();
|
context_thread_pool_.Run();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2023 Memgraph Ltd.
|
// Copyright 2024 Memgraph Ltd.
|
||||||
//
|
//
|
||||||
// Use of this software is governed by the Business Source License
|
// Use of this software is governed by the Business Source License
|
||||||
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
@ -47,6 +47,7 @@
|
|||||||
#include "communication/buffer.hpp"
|
#include "communication/buffer.hpp"
|
||||||
#include "communication/context.hpp"
|
#include "communication/context.hpp"
|
||||||
#include "communication/exceptions.hpp"
|
#include "communication/exceptions.hpp"
|
||||||
|
#include "communication/fmt.hpp"
|
||||||
#include "dbms/global.hpp"
|
#include "dbms/global.hpp"
|
||||||
#include "utils/event_counter.hpp"
|
#include "utils/event_counter.hpp"
|
||||||
#include "utils/logging.hpp"
|
#include "utils/logging.hpp"
|
||||||
@ -212,14 +213,11 @@ class WebsocketSession : public std::enable_shared_from_this<WebsocketSession<TS
|
|||||||
session_.Execute();
|
session_.Execute();
|
||||||
DoRead();
|
DoRead();
|
||||||
} catch (const SessionClosedException &e) {
|
} catch (const SessionClosedException &e) {
|
||||||
spdlog::info("{} client {}:{} closed the connection.", service_name_, remote_endpoint_.address(),
|
spdlog::info("{} client {} closed the connection.", service_name_, remote_endpoint_);
|
||||||
remote_endpoint_.port());
|
|
||||||
DoClose();
|
DoClose();
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
spdlog::error(
|
spdlog::error("Exception was thrown while processing event in {} session associated with {}", service_name_,
|
||||||
"Exception was thrown while processing event in {} session "
|
remote_endpoint_);
|
||||||
"associated with {}:{}",
|
|
||||||
service_name_, remote_endpoint_.address(), remote_endpoint_.port());
|
|
||||||
spdlog::debug("Exception message: {}", e.what());
|
spdlog::debug("Exception message: {}", e.what());
|
||||||
DoClose();
|
DoClose();
|
||||||
}
|
}
|
||||||
@ -376,8 +374,7 @@ class Session final : public std::enable_shared_from_this<Session<TSession, TSes
|
|||||||
socket.lowest_layer().non_blocking(false);
|
socket.lowest_layer().non_blocking(false);
|
||||||
});
|
});
|
||||||
timeout_timer_.expires_at(boost::asio::steady_timer::time_point::max());
|
timeout_timer_.expires_at(boost::asio::steady_timer::time_point::max());
|
||||||
spdlog::info("Accepted a connection from {}: {}:{}", service_name_, remote_endpoint_.address(),
|
spdlog::info("Accepted a connection from {}: {}", service_name_, remote_endpoint_);
|
||||||
remote_endpoint_.port());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoRead() {
|
void DoRead() {
|
||||||
@ -437,14 +434,11 @@ class Session final : public std::enable_shared_from_this<Session<TSession, TSes
|
|||||||
session_.Execute();
|
session_.Execute();
|
||||||
DoRead();
|
DoRead();
|
||||||
} catch (const SessionClosedException &e) {
|
} catch (const SessionClosedException &e) {
|
||||||
spdlog::info("{} client {}:{} closed the connection.", service_name_, remote_endpoint_.address(),
|
spdlog::info("{} client {} closed the connection.", service_name_, remote_endpoint_);
|
||||||
remote_endpoint_.port());
|
|
||||||
DoShutdown();
|
DoShutdown();
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
spdlog::error(
|
spdlog::error("Exception was thrown while processing event in {} session associated with {}", service_name_,
|
||||||
"Exception was thrown while processing event in {} session "
|
remote_endpoint_);
|
||||||
"associated with {}:{}",
|
|
||||||
service_name_, remote_endpoint_.address(), remote_endpoint_.port());
|
|
||||||
spdlog::debug("Exception message: {}", e.what());
|
spdlog::debug("Exception message: {}", e.what());
|
||||||
DoShutdown();
|
DoShutdown();
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2022 Memgraph Ltd.
|
// Copyright 2024 Memgraph Ltd.
|
||||||
//
|
//
|
||||||
// Use of this software is governed by the Business Source License
|
// Use of this software is governed by the Business Source License
|
||||||
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
@ -10,6 +10,7 @@
|
|||||||
// licenses/APL.txt.
|
// licenses/APL.txt.
|
||||||
|
|
||||||
#include "communication/websocket/listener.hpp"
|
#include "communication/websocket/listener.hpp"
|
||||||
|
#include "communication/fmt.hpp"
|
||||||
|
|
||||||
namespace memgraph::communication::websocket {
|
namespace memgraph::communication::websocket {
|
||||||
namespace {
|
namespace {
|
||||||
@ -61,7 +62,7 @@ Listener::Listener(boost::asio::io_context &ioc, ServerContext *context, tcp::en
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
spdlog::info("WebSocket server is listening on {}:{}", endpoint.address(), endpoint.port());
|
spdlog::info("WebSocket server is listening on {}", endpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Listener::DoAccept() {
|
void Listener::DoAccept() {
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include "coordination/coordinator_instance.hpp"
|
#include "coordination/coordinator_instance.hpp"
|
||||||
|
|
||||||
#include "coordination/coordinator_exceptions.hpp"
|
#include "coordination/coordinator_exceptions.hpp"
|
||||||
|
#include "coordination/fmt.hpp"
|
||||||
#include "nuraft/coordinator_state_machine.hpp"
|
#include "nuraft/coordinator_state_machine.hpp"
|
||||||
#include "nuraft/coordinator_state_manager.hpp"
|
#include "nuraft/coordinator_state_manager.hpp"
|
||||||
#include "utils/counter.hpp"
|
#include "utils/counter.hpp"
|
||||||
|
60
src/coordination/fmt.hpp
Normal file
60
src/coordination/fmt.hpp
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
// Copyright 2024 Memgraph Ltd.
|
||||||
|
//
|
||||||
|
// Use of this software is governed by the Business Source License
|
||||||
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
|
// License, and you may not use this file except in compliance with the Business Source License.
|
||||||
|
//
|
||||||
|
// As of the Change Date specified in that file, in accordance with
|
||||||
|
// the Business Source License, use of this software will be governed
|
||||||
|
// by the Apache License, Version 2.0, included in the file
|
||||||
|
// licenses/APL.txt.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if FMT_VERSION > 90000
|
||||||
|
#include <fmt/ostream.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <libnuraft/nuraft.hxx>
|
||||||
|
#include "utils/logging.hpp"
|
||||||
|
|
||||||
|
inline std::string ToString(const nuraft::cmd_result_code &code) {
|
||||||
|
switch (code) {
|
||||||
|
case nuraft::cmd_result_code::OK:
|
||||||
|
return "OK";
|
||||||
|
case nuraft::cmd_result_code::FAILED:
|
||||||
|
return "FAILED";
|
||||||
|
case nuraft::cmd_result_code::RESULT_NOT_EXIST_YET:
|
||||||
|
return "RESULT_NOT_EXIST_YET";
|
||||||
|
case nuraft::cmd_result_code::TERM_MISMATCH:
|
||||||
|
return "TERM_MISMATCH";
|
||||||
|
case nuraft::cmd_result_code::SERVER_IS_LEAVING:
|
||||||
|
return "SERVER_IS_LEAVING";
|
||||||
|
case nuraft::cmd_result_code::CANNOT_REMOVE_LEADER:
|
||||||
|
return "CANNOT_REMOVE_LEADER";
|
||||||
|
case nuraft::cmd_result_code::SERVER_NOT_FOUND:
|
||||||
|
return "SERVER_NOT_FOUND";
|
||||||
|
case nuraft::cmd_result_code::SERVER_IS_JOINING:
|
||||||
|
return "SERVER_IS_JOINING";
|
||||||
|
case nuraft::cmd_result_code::CONFIG_CHANGING:
|
||||||
|
return "CONFIG_CHANGING";
|
||||||
|
case nuraft::cmd_result_code::SERVER_ALREADY_EXISTS:
|
||||||
|
return "SERVER_ALREADY_EXISTS";
|
||||||
|
case nuraft::cmd_result_code::BAD_REQUEST:
|
||||||
|
return "BAD_REQUEST";
|
||||||
|
case nuraft::cmd_result_code::NOT_LEADER:
|
||||||
|
return "NOT_LEADER";
|
||||||
|
case nuraft::cmd_result_code::TIMEOUT:
|
||||||
|
return "TIMEOUT";
|
||||||
|
case nuraft::cmd_result_code::CANCELLED:
|
||||||
|
return "CANCELLED";
|
||||||
|
}
|
||||||
|
LOG_FATAL("ToString of a nuraft::cmd_result_code -> check missing switch case");
|
||||||
|
}
|
||||||
|
inline std::ostream &operator<<(std::ostream &os, const nuraft::cmd_result_code &code) {
|
||||||
|
os << ToString(code);
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
template <>
|
||||||
|
class fmt::formatter<nuraft::cmd_result_code> : public fmt::ostream_formatter {};
|
||||||
|
#endif
|
@ -19,6 +19,7 @@
|
|||||||
#include "storage/v2/durability/durability.hpp"
|
#include "storage/v2/durability/durability.hpp"
|
||||||
#include "storage/v2/durability/snapshot.hpp"
|
#include "storage/v2/durability/snapshot.hpp"
|
||||||
#include "storage/v2/durability/version.hpp"
|
#include "storage/v2/durability/version.hpp"
|
||||||
|
#include "storage/v2/fmt.hpp"
|
||||||
#include "storage/v2/indices/label_index_stats.hpp"
|
#include "storage/v2/indices/label_index_stats.hpp"
|
||||||
#include "storage/v2/inmemory/storage.hpp"
|
#include "storage/v2/inmemory/storage.hpp"
|
||||||
#include "storage/v2/inmemory/unique_constraints.hpp"
|
#include "storage/v2/inmemory/unique_constraints.hpp"
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
// licenses/APL.txt.
|
// licenses/APL.txt.
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <compare>
|
#include <compare>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2023 Memgraph Ltd.
|
// Copyright 2024 Memgraph Ltd.
|
||||||
//
|
//
|
||||||
// Use of this software is governed by the Business Source License
|
// Use of this software is governed by the Business Source License
|
||||||
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "integrations/constants.hpp"
|
#include "integrations/constants.hpp"
|
||||||
#include "integrations/kafka/exceptions.hpp"
|
#include "integrations/kafka/exceptions.hpp"
|
||||||
|
#include "integrations/kafka/fmt.hpp"
|
||||||
#include "utils/exceptions.hpp"
|
#include "utils/exceptions.hpp"
|
||||||
#include "utils/logging.hpp"
|
#include "utils/logging.hpp"
|
||||||
#include "utils/on_scope_exit.hpp"
|
#include "utils/on_scope_exit.hpp"
|
||||||
|
25
src/integrations/kafka/fmt.hpp
Normal file
25
src/integrations/kafka/fmt.hpp
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
// Copyright 2024 Memgraph Ltd.
|
||||||
|
//
|
||||||
|
// Use of this software is governed by the Business Source License
|
||||||
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
|
// License, and you may not use this file except in compliance with the Business Source License.
|
||||||
|
//
|
||||||
|
// As of the Change Date specified in that file, in accordance with
|
||||||
|
// the Business Source License, use of this software will be governed
|
||||||
|
// by the Apache License, Version 2.0, included in the file
|
||||||
|
// licenses/APL.txt.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if FMT_VERSION > 90000
|
||||||
|
#include <fmt/ostream.h>
|
||||||
|
|
||||||
|
#include <librdkafka/rdkafkacpp.h>
|
||||||
|
|
||||||
|
inline std::ostream &operator<<(std::ostream &os, const RdKafka::ErrorCode &code) {
|
||||||
|
os << RdKafka::err2str(code);
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
template <>
|
||||||
|
class fmt::formatter<RdKafka::ErrorCode> : public fmt::ostream_formatter {};
|
||||||
|
#endif
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2023 Memgraph Ltd.
|
// Copyright 2024 Memgraph Ltd.
|
||||||
//
|
//
|
||||||
// Use of this software is governed by the Business Source License
|
// Use of this software is governed by the Business Source License
|
||||||
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
@ -15,12 +15,12 @@
|
|||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#include <fmt/format.h>
|
|
||||||
#include <pulsar/Client.h>
|
#include <pulsar/Client.h>
|
||||||
#include <pulsar/InitialPosition.h>
|
#include <pulsar/InitialPosition.h>
|
||||||
|
|
||||||
#include "integrations/constants.hpp"
|
#include "integrations/constants.hpp"
|
||||||
#include "integrations/pulsar/exceptions.hpp"
|
#include "integrations/pulsar/exceptions.hpp"
|
||||||
|
#include "integrations/pulsar/fmt.hpp"
|
||||||
#include "utils/concepts.hpp"
|
#include "utils/concepts.hpp"
|
||||||
#include "utils/logging.hpp"
|
#include "utils/logging.hpp"
|
||||||
#include "utils/on_scope_exit.hpp"
|
#include "utils/on_scope_exit.hpp"
|
||||||
|
21
src/integrations/pulsar/fmt.hpp
Normal file
21
src/integrations/pulsar/fmt.hpp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// Copyright 2024 Memgraph Ltd.
|
||||||
|
//
|
||||||
|
// Use of this software is governed by the Business Source License
|
||||||
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
|
// License, and you may not use this file except in compliance with the Business Source License.
|
||||||
|
//
|
||||||
|
// As of the Change Date specified in that file, in accordance with
|
||||||
|
// the Business Source License, use of this software will be governed
|
||||||
|
// by the Apache License, Version 2.0, included in the file
|
||||||
|
// licenses/APL.txt.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if FMT_VERSION > 90000
|
||||||
|
#include <fmt/ostream.h>
|
||||||
|
|
||||||
|
#include "integrations/pulsar/consumer.hpp"
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class fmt::formatter<memgraph::integrations::pulsar::pulsar_client::Result> : public fmt::ostream_formatter {};
|
||||||
|
#endif
|
21
src/io/network/fmt.hpp
Normal file
21
src/io/network/fmt.hpp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// Copyright 2024 Memgraph Ltd.
|
||||||
|
//
|
||||||
|
// Use of this software is governed by the Business Source License
|
||||||
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
|
// License, and you may not use this file except in compliance with the Business Source License.
|
||||||
|
//
|
||||||
|
// As of the Change Date specified in that file, in accordance with
|
||||||
|
// the Business Source License, use of this software will be governed
|
||||||
|
// by the Apache License, Version 2.0, included in the file
|
||||||
|
// licenses/APL.txt.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if FMT_VERSION > 90000
|
||||||
|
#include <fmt/ostream.h>
|
||||||
|
|
||||||
|
#include "io/network/endpoint.hpp"
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class fmt::formatter<memgraph::io::network::Endpoint> : public fmt::ostream_formatter {};
|
||||||
|
#endif
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2022 Memgraph Ltd.
|
// Copyright 2023 Memgraph Ltd.
|
||||||
//
|
//
|
||||||
// Use of this software is governed by the Business Source License
|
// Use of this software is governed by the Business Source License
|
||||||
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace memgraph::io::network {
|
namespace memgraph::io::network {
|
||||||
|
@ -160,13 +160,14 @@ class KVStore final {
|
|||||||
* and behaves as if all of those pairs are stored in a single iterable
|
* and behaves as if all of those pairs are stored in a single iterable
|
||||||
* collection of std::pair<std::string, std::string>.
|
* collection of std::pair<std::string, std::string>.
|
||||||
*/
|
*/
|
||||||
class iterator final : public std::iterator<std::input_iterator_tag, // iterator_category
|
class iterator final {
|
||||||
std::pair<std::string, std::string>, // value_type
|
|
||||||
long, // difference_type
|
|
||||||
const std::pair<std::string, std::string> *, // pointer
|
|
||||||
const std::pair<std::string, std::string> & // reference
|
|
||||||
> {
|
|
||||||
public:
|
public:
|
||||||
|
using iterator_concept [[maybe_unused]] = std::input_iterator_tag;
|
||||||
|
using value_type = std::pair<std::string, std::string>;
|
||||||
|
using difference_type = long;
|
||||||
|
using pointer = const std::pair<std::string, std::string> *;
|
||||||
|
using reference = const std::pair<std::string, std::string> &;
|
||||||
|
|
||||||
explicit iterator(const KVStore *kvstore, const std::string &prefix = "", bool at_end = false);
|
explicit iterator(const KVStore *kvstore, const std::string &prefix = "", bool at_end = false);
|
||||||
|
|
||||||
iterator(const iterator &other) = delete;
|
iterator(const iterator &other) = delete;
|
||||||
|
@ -139,6 +139,11 @@ struct NodeId {
|
|||||||
std::string id_space;
|
std::string id_space;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if FMT_VERSION > 90000
|
||||||
|
template <>
|
||||||
|
class fmt::formatter<NodeId> : public fmt::ostream_formatter {};
|
||||||
|
#endif
|
||||||
|
|
||||||
bool operator==(const NodeId &a, const NodeId &b) { return a.id == b.id && a.id_space == b.id_space; }
|
bool operator==(const NodeId &a, const NodeId &b) { return a.id == b.id && a.id_space == b.id_space; }
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &stream, const NodeId &node_id) {
|
std::ostream &operator<<(std::ostream &stream, const NodeId &node_id) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2022 Memgraph Ltd.
|
// Copyright 2023 Memgraph Ltd.
|
||||||
//
|
//
|
||||||
// Use of this software is governed by the Business Source License
|
// Use of this software is governed by the Business Source License
|
||||||
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
@ -274,3 +274,8 @@ inline void RestoreError(ExceptionInfo exc_info) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace memgraph::py
|
} // namespace memgraph::py
|
||||||
|
|
||||||
|
#if FMT_VERSION > 90000
|
||||||
|
template <>
|
||||||
|
class fmt::formatter<memgraph::py::ExceptionInfo> : public fmt::ostream_formatter {};
|
||||||
|
#endif
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "query/db_accessor.hpp"
|
#include "query/db_accessor.hpp"
|
||||||
#include "query/exceptions.hpp"
|
#include "query/exceptions.hpp"
|
||||||
|
#include "query/fmt.hpp"
|
||||||
#include "query/frontend/ast/ast.hpp"
|
#include "query/frontend/ast/ast.hpp"
|
||||||
#include "query/frontend/semantic/symbol.hpp"
|
#include "query/frontend/semantic/symbol.hpp"
|
||||||
#include "query/typed_value.hpp"
|
#include "query/typed_value.hpp"
|
||||||
|
23
src/query/fmt.hpp
Normal file
23
src/query/fmt.hpp
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// Copyright 2024 Memgraph Ltd.
|
||||||
|
//
|
||||||
|
// Use of this software is governed by the Business Source License
|
||||||
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
|
// License, and you may not use this file except in compliance with the Business Source License.
|
||||||
|
//
|
||||||
|
// As of the Change Date specified in that file, in accordance with
|
||||||
|
// the Business Source License, use of this software will be governed
|
||||||
|
// by the Apache License, Version 2.0, included in the file
|
||||||
|
// licenses/APL.txt.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if FMT_VERSION > 90000
|
||||||
|
#include <fmt/ostream.h>
|
||||||
|
|
||||||
|
#include "query/typed_value.hpp"
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class fmt::formatter<memgraph::query::TypedValue> : public fmt::ostream_formatter {};
|
||||||
|
template <>
|
||||||
|
class fmt::formatter<memgraph::query::TypedValue::Type> : public fmt::ostream_formatter {};
|
||||||
|
#endif
|
@ -313,7 +313,7 @@ void Filters::CollectPatternFilters(Pattern &pattern, SymbolTable &symbol_table,
|
|||||||
auto *property_lookup = storage.Create<PropertyLookup>(atom->filter_lambda_.inner_edge, prop_pair.first);
|
auto *property_lookup = storage.Create<PropertyLookup>(atom->filter_lambda_.inner_edge, prop_pair.first);
|
||||||
auto *prop_equal = storage.Create<EqualOperator>(property_lookup, prop_pair.second);
|
auto *prop_equal = storage.Create<EqualOperator>(property_lookup, prop_pair.second);
|
||||||
// Currently, variable expand has no gains if we set PropertyFilter.
|
// Currently, variable expand has no gains if we set PropertyFilter.
|
||||||
all_filters_.emplace_back(FilterInfo{FilterInfo::Type::Generic, prop_equal, collector.symbols_});
|
all_filters_.emplace_back(FilterInfo::Type::Generic, prop_equal, collector.symbols_);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
collector.symbols_.clear();
|
collector.symbols_.clear();
|
||||||
@ -328,9 +328,9 @@ void Filters::CollectPatternFilters(Pattern &pattern, SymbolTable &symbol_table,
|
|||||||
auto *prop_equal = storage.Create<EqualOperator>(property_lookup, prop_pair.second);
|
auto *prop_equal = storage.Create<EqualOperator>(property_lookup, prop_pair.second);
|
||||||
// Currently, variable expand has no gains if we set PropertyFilter.
|
// Currently, variable expand has no gains if we set PropertyFilter.
|
||||||
all_filters_.emplace_back(
|
all_filters_.emplace_back(
|
||||||
FilterInfo{FilterInfo::Type::Generic,
|
FilterInfo::Type::Generic,
|
||||||
storage.Create<All>(identifier, atom->identifier_, storage.Create<Where>(prop_equal)),
|
storage.Create<All>(identifier, atom->identifier_, storage.Create<Where>(prop_equal)),
|
||||||
collector.symbols_});
|
collector.symbols_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -639,6 +639,12 @@ void AddMatching(const Match &match, SymbolTable &symbol_table, AstStorage &stor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PatternFilterVisitor::PatternFilterVisitor(SymbolTable &symbol_table, AstStorage &storage)
|
||||||
|
: symbol_table_(symbol_table), storage_(storage) {}
|
||||||
|
PatternFilterVisitor::PatternFilterVisitor(const PatternFilterVisitor &) = default;
|
||||||
|
PatternFilterVisitor::PatternFilterVisitor(PatternFilterVisitor &&) noexcept = default;
|
||||||
|
PatternFilterVisitor::~PatternFilterVisitor() = default;
|
||||||
|
|
||||||
void PatternFilterVisitor::Visit(Exists &op) {
|
void PatternFilterVisitor::Visit(Exists &op) {
|
||||||
std::vector<Pattern *> patterns;
|
std::vector<Pattern *> patterns;
|
||||||
patterns.push_back(op.pattern_);
|
patterns.push_back(op.pattern_);
|
||||||
@ -652,6 +658,8 @@ void PatternFilterVisitor::Visit(Exists &op) {
|
|||||||
matchings_.push_back(std::move(filter_matching));
|
matchings_.push_back(std::move(filter_matching));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<FilterMatching> PatternFilterVisitor::getMatchings() { return matchings_; }
|
||||||
|
|
||||||
static void ParseForeach(query::Foreach &foreach, SingleQueryPart &query_part, AstStorage &storage,
|
static void ParseForeach(query::Foreach &foreach, SingleQueryPart &query_part, AstStorage &storage,
|
||||||
SymbolTable &symbol_table) {
|
SymbolTable &symbol_table) {
|
||||||
for (auto *clause : foreach.clauses_) {
|
for (auto *clause : foreach.clauses_) {
|
||||||
@ -723,4 +731,18 @@ QueryParts CollectQueryParts(SymbolTable &symbol_table, AstStorage &storage, Cyp
|
|||||||
return QueryParts{query_parts, distinct};
|
return QueryParts{query_parts, distinct};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FilterInfo::FilterInfo(Type type, Expression *expression, std::unordered_set<Symbol> used_symbols,
|
||||||
|
std::optional<PropertyFilter> property_filter, std::optional<IdFilter> id_filter)
|
||||||
|
: type(type),
|
||||||
|
expression(expression),
|
||||||
|
used_symbols(std::move(used_symbols)),
|
||||||
|
property_filter(std::move(property_filter)),
|
||||||
|
id_filter(std::move(id_filter)),
|
||||||
|
matchings({}) {}
|
||||||
|
FilterInfo::FilterInfo(const FilterInfo &) = default;
|
||||||
|
FilterInfo &FilterInfo::operator=(const FilterInfo &) = default;
|
||||||
|
FilterInfo::FilterInfo(FilterInfo &&) noexcept = default;
|
||||||
|
FilterInfo &FilterInfo::operator=(FilterInfo &&) noexcept = default;
|
||||||
|
FilterInfo::~FilterInfo() = default;
|
||||||
|
|
||||||
} // namespace memgraph::query::plan
|
} // namespace memgraph::query::plan
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "query/frontend/ast/ast.hpp"
|
#include "query/frontend/ast/ast.hpp"
|
||||||
|
#include "query/frontend/ast/ast_visitor.hpp"
|
||||||
#include "query/frontend/semantic/symbol_table.hpp"
|
#include "query/frontend/semantic/symbol_table.hpp"
|
||||||
|
|
||||||
namespace memgraph::query::plan {
|
namespace memgraph::query::plan {
|
||||||
@ -159,8 +160,12 @@ enum class PatternFilterType { EXISTS };
|
|||||||
/// Collects matchings from filters that include patterns
|
/// Collects matchings from filters that include patterns
|
||||||
class PatternFilterVisitor : public ExpressionVisitor<void> {
|
class PatternFilterVisitor : public ExpressionVisitor<void> {
|
||||||
public:
|
public:
|
||||||
explicit PatternFilterVisitor(SymbolTable &symbol_table, AstStorage &storage)
|
explicit PatternFilterVisitor(SymbolTable &symbol_table, AstStorage &storage);
|
||||||
: symbol_table_(symbol_table), storage_(storage) {}
|
PatternFilterVisitor(const PatternFilterVisitor &);
|
||||||
|
PatternFilterVisitor &operator=(const PatternFilterVisitor &) = delete;
|
||||||
|
PatternFilterVisitor(PatternFilterVisitor &&) noexcept;
|
||||||
|
PatternFilterVisitor &operator=(PatternFilterVisitor &&) noexcept = delete;
|
||||||
|
~PatternFilterVisitor() override;
|
||||||
|
|
||||||
using ExpressionVisitor<void>::Visit;
|
using ExpressionVisitor<void>::Visit;
|
||||||
|
|
||||||
@ -232,7 +237,7 @@ class PatternFilterVisitor : public ExpressionVisitor<void> {
|
|||||||
void Visit(RegexMatch &op) override{};
|
void Visit(RegexMatch &op) override{};
|
||||||
void Visit(PatternComprehension &op) override{};
|
void Visit(PatternComprehension &op) override{};
|
||||||
|
|
||||||
std::vector<FilterMatching> getMatchings() { return matchings_; }
|
std::vector<FilterMatching> getMatchings();
|
||||||
|
|
||||||
SymbolTable &symbol_table_;
|
SymbolTable &symbol_table_;
|
||||||
AstStorage &storage_;
|
AstStorage &storage_;
|
||||||
@ -298,9 +303,23 @@ struct FilterInfo {
|
|||||||
/// elements.
|
/// elements.
|
||||||
enum class Type { Generic, Label, Property, Id, Pattern };
|
enum class Type { Generic, Label, Property, Id, Pattern };
|
||||||
|
|
||||||
Type type;
|
// FilterInfo is tricky because FilterMatching is not yet defined:
|
||||||
|
// * if no declared constructor -> FilterInfo is std::__is_complete_or_unbounded
|
||||||
|
// * if any user-declared constructor -> non-aggregate type -> no designated initializers are possible
|
||||||
|
// * IMPORTANT: Matchings will always be initialized to an empty container.
|
||||||
|
explicit FilterInfo(Type type = Type::Generic, Expression *expression = nullptr,
|
||||||
|
std::unordered_set<Symbol> used_symbols = {}, std::optional<PropertyFilter> property_filter = {},
|
||||||
|
std::optional<IdFilter> id_filter = {});
|
||||||
|
// All other constructors are also defined in the cpp file because this struct is incomplete here.
|
||||||
|
FilterInfo(const FilterInfo &);
|
||||||
|
FilterInfo &operator=(const FilterInfo &);
|
||||||
|
FilterInfo(FilterInfo &&) noexcept;
|
||||||
|
FilterInfo &operator=(FilterInfo &&) noexcept;
|
||||||
|
~FilterInfo();
|
||||||
|
|
||||||
|
Type type{Type::Generic};
|
||||||
/// The original filter expression which must be satisfied.
|
/// The original filter expression which must be satisfied.
|
||||||
Expression *expression;
|
Expression *expression{nullptr};
|
||||||
/// Set of used symbols by the filter @c expression.
|
/// Set of used symbols by the filter @c expression.
|
||||||
std::unordered_set<Symbol> used_symbols{};
|
std::unordered_set<Symbol> used_symbols{};
|
||||||
/// Labels for Type::Label filtering.
|
/// Labels for Type::Label filtering.
|
||||||
@ -310,7 +329,8 @@ struct FilterInfo {
|
|||||||
/// Information for Type::Id filtering.
|
/// Information for Type::Id filtering.
|
||||||
std::optional<IdFilter> id_filter{};
|
std::optional<IdFilter> id_filter{};
|
||||||
/// Matchings for filters that include patterns
|
/// Matchings for filters that include patterns
|
||||||
std::vector<FilterMatching> matchings{};
|
/// NOTE: The vector is not defined here because FilterMatching is forward declared above.
|
||||||
|
std::vector<FilterMatching> matchings;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Stores information on filters used inside the @c Matching of a @c QueryPart.
|
/// Stores information on filters used inside the @c Matching of a @c QueryPart.
|
||||||
@ -329,34 +349,15 @@ class Filters final {
|
|||||||
|
|
||||||
auto empty() const { return all_filters_.empty(); }
|
auto empty() const { return all_filters_.empty(); }
|
||||||
|
|
||||||
auto erase(iterator pos) { return all_filters_.erase(pos); }
|
auto erase(iterator pos) -> iterator;
|
||||||
auto erase(const_iterator pos) { return all_filters_.erase(pos); }
|
auto erase(const_iterator pos) -> iterator;
|
||||||
auto erase(iterator first, iterator last) { return all_filters_.erase(first, last); }
|
auto erase(iterator first, iterator last) -> iterator;
|
||||||
auto erase(const_iterator first, const_iterator last) { return all_filters_.erase(first, last); }
|
auto erase(const_iterator first, const_iterator last) -> iterator;
|
||||||
|
|
||||||
void SetFilters(std::vector<FilterInfo> &&all_filters) { all_filters_ = std::move(all_filters); }
|
void SetFilters(std::vector<FilterInfo> &&all_filters) { all_filters_ = std::move(all_filters); }
|
||||||
|
|
||||||
auto FilteredLabels(const Symbol &symbol) const {
|
auto FilteredLabels(const Symbol &symbol) const -> std::unordered_set<LabelIx>;
|
||||||
std::unordered_set<LabelIx> labels;
|
auto FilteredProperties(const Symbol &symbol) const -> std::unordered_set<PropertyIx>;
|
||||||
for (const auto &filter : all_filters_) {
|
|
||||||
if (filter.type == FilterInfo::Type::Label && utils::Contains(filter.used_symbols, symbol)) {
|
|
||||||
MG_ASSERT(filter.used_symbols.size() == 1U, "Expected a single used symbol for label filter");
|
|
||||||
labels.insert(filter.labels.begin(), filter.labels.end());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return labels;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto FilteredProperties(const Symbol &symbol) const -> std::unordered_set<PropertyIx> {
|
|
||||||
std::unordered_set<PropertyIx> properties;
|
|
||||||
|
|
||||||
for (const auto &filter : all_filters_) {
|
|
||||||
if (filter.type == FilterInfo::Type::Property && filter.property_filter->symbol_ == symbol) {
|
|
||||||
properties.insert(filter.property_filter->property_);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Remove a filter; may invalidate iterators.
|
/// Remove a filter; may invalidate iterators.
|
||||||
/// Removal is done by comparing only the expression, so that multiple
|
/// Removal is done by comparing only the expression, so that multiple
|
||||||
@ -370,26 +371,10 @@ class Filters final {
|
|||||||
std::vector<Expression *> *removed_filters = nullptr);
|
std::vector<Expression *> *removed_filters = nullptr);
|
||||||
|
|
||||||
/// Returns a vector of FilterInfo for properties.
|
/// Returns a vector of FilterInfo for properties.
|
||||||
auto PropertyFilters(const Symbol &symbol) const {
|
auto PropertyFilters(const Symbol &symbol) const -> std::vector<FilterInfo>;
|
||||||
std::vector<FilterInfo> filters;
|
|
||||||
for (const auto &filter : all_filters_) {
|
|
||||||
if (filter.type == FilterInfo::Type::Property && filter.property_filter->symbol_ == symbol) {
|
|
||||||
filters.push_back(filter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return filters;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Return a vector of FilterInfo for ID equality filtering.
|
/// Return a vector of FilterInfo for ID equality filtering.
|
||||||
auto IdFilters(const Symbol &symbol) const {
|
auto IdFilters(const Symbol &symbol) const -> std::vector<FilterInfo>;
|
||||||
std::vector<FilterInfo> filters;
|
|
||||||
for (const auto &filter : all_filters_) {
|
|
||||||
if (filter.type == FilterInfo::Type::Id && filter.id_filter->symbol_ == symbol) {
|
|
||||||
filters.push_back(filter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return filters;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Collects filtering information from a pattern.
|
/// Collects filtering information from a pattern.
|
||||||
///
|
///
|
||||||
@ -459,6 +444,57 @@ struct FilterMatching : Matching {
|
|||||||
std::optional<Symbol> symbol;
|
std::optional<Symbol> symbol;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline auto Filters::erase(Filters::iterator pos) -> iterator { return all_filters_.erase(pos); }
|
||||||
|
inline auto Filters::erase(Filters::const_iterator pos) -> iterator { return all_filters_.erase(pos); }
|
||||||
|
inline auto Filters::erase(Filters::iterator first, Filters::iterator last) -> iterator {
|
||||||
|
return all_filters_.erase(first, last);
|
||||||
|
}
|
||||||
|
inline auto Filters::erase(Filters::const_iterator first, Filters::const_iterator last) -> iterator {
|
||||||
|
return all_filters_.erase(first, last);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline auto Filters::FilteredLabels(const Symbol &symbol) const -> std::unordered_set<LabelIx> {
|
||||||
|
std::unordered_set<LabelIx> labels;
|
||||||
|
for (const auto &filter : all_filters_) {
|
||||||
|
if (filter.type == FilterInfo::Type::Label && utils::Contains(filter.used_symbols, symbol)) {
|
||||||
|
MG_ASSERT(filter.used_symbols.size() == 1U, "Expected a single used symbol for label filter");
|
||||||
|
labels.insert(filter.labels.begin(), filter.labels.end());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return labels;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline auto Filters::FilteredProperties(const Symbol &symbol) const -> std::unordered_set<PropertyIx> {
|
||||||
|
std::unordered_set<PropertyIx> properties;
|
||||||
|
|
||||||
|
for (const auto &filter : all_filters_) {
|
||||||
|
if (filter.type == FilterInfo::Type::Property && filter.property_filter->symbol_ == symbol) {
|
||||||
|
properties.insert(filter.property_filter->property_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline auto Filters::PropertyFilters(const Symbol &symbol) const -> std::vector<FilterInfo> {
|
||||||
|
std::vector<FilterInfo> filters;
|
||||||
|
for (const auto &filter : all_filters_) {
|
||||||
|
if (filter.type == FilterInfo::Type::Property && filter.property_filter->symbol_ == symbol) {
|
||||||
|
filters.push_back(filter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return filters;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline auto Filters::IdFilters(const Symbol &symbol) const -> std::vector<FilterInfo> {
|
||||||
|
std::vector<FilterInfo> filters;
|
||||||
|
for (const auto &filter : all_filters_) {
|
||||||
|
if (filter.type == FilterInfo::Type::Id && filter.id_filter->symbol_ == symbol) {
|
||||||
|
filters.push_back(filter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return filters;
|
||||||
|
}
|
||||||
|
|
||||||
/// @brief Represents a read (+ write) part of a query. Parts are split on
|
/// @brief Represents a read (+ write) part of a query. Parts are split on
|
||||||
/// `WITH` clauses.
|
/// `WITH` clauses.
|
||||||
///
|
///
|
||||||
|
82
src/query/procedure/fmt.hpp
Normal file
82
src/query/procedure/fmt.hpp
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
// Copyright 2024 Memgraph Ltd.
|
||||||
|
//
|
||||||
|
// Use of this software is governed by the Business Source License
|
||||||
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
|
// License, and you may not use this file except in compliance with the Business Source License.
|
||||||
|
//
|
||||||
|
// As of the Change Date specified in that file, in accordance with
|
||||||
|
// the Business Source License, use of this software will be governed
|
||||||
|
// by the Apache License, Version 2.0, included in the file
|
||||||
|
// licenses/APL.txt.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if FMT_VERSION > 90000
|
||||||
|
#include <fmt/ostream.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "mg_procedure.h"
|
||||||
|
#include "utils/logging.hpp"
|
||||||
|
|
||||||
|
inline std::string ToString(const mgp_log_level &log_level) {
|
||||||
|
switch (log_level) {
|
||||||
|
case mgp_log_level::MGP_LOG_LEVEL_CRITICAL:
|
||||||
|
return "CRITICAL";
|
||||||
|
case mgp_log_level::MGP_LOG_LEVEL_ERROR:
|
||||||
|
return "ERROR";
|
||||||
|
case mgp_log_level::MGP_LOG_LEVEL_WARN:
|
||||||
|
return "WARN";
|
||||||
|
case mgp_log_level::MGP_LOG_LEVEL_INFO:
|
||||||
|
return "INFO";
|
||||||
|
case mgp_log_level::MGP_LOG_LEVEL_DEBUG:
|
||||||
|
return "DEBUG";
|
||||||
|
case mgp_log_level::MGP_LOG_LEVEL_TRACE:
|
||||||
|
return "TRACE";
|
||||||
|
}
|
||||||
|
LOG_FATAL("ToString of a wrong mgp_log_level -> check missing switch case");
|
||||||
|
}
|
||||||
|
inline std::ostream &operator<<(std::ostream &os, const mgp_log_level &log_level) {
|
||||||
|
os << ToString(log_level);
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
template <>
|
||||||
|
class fmt::formatter<mgp_log_level> : public fmt::ostream_formatter {};
|
||||||
|
|
||||||
|
inline std::string ToString(const mgp_error &error) {
|
||||||
|
switch (error) {
|
||||||
|
case mgp_error::MGP_ERROR_NO_ERROR:
|
||||||
|
return "NO ERROR";
|
||||||
|
case mgp_error::MGP_ERROR_UNKNOWN_ERROR:
|
||||||
|
return "UNKNOWN ERROR";
|
||||||
|
case mgp_error::MGP_ERROR_UNABLE_TO_ALLOCATE:
|
||||||
|
return "UNABLE TO ALLOCATE ERROR";
|
||||||
|
case mgp_error::MGP_ERROR_INSUFFICIENT_BUFFER:
|
||||||
|
return "INSUFFICIENT BUFFER ERROR";
|
||||||
|
case mgp_error::MGP_ERROR_OUT_OF_RANGE:
|
||||||
|
return "OUT OF RANGE ERROR";
|
||||||
|
case mgp_error::MGP_ERROR_LOGIC_ERROR:
|
||||||
|
return "LOGIC ERROR";
|
||||||
|
case mgp_error::MGP_ERROR_DELETED_OBJECT:
|
||||||
|
return "DELETED OBJECT ERROR";
|
||||||
|
case mgp_error::MGP_ERROR_INVALID_ARGUMENT:
|
||||||
|
return "INVALID ARGUMENT ERROR";
|
||||||
|
case mgp_error::MGP_ERROR_KEY_ALREADY_EXISTS:
|
||||||
|
return "KEY ALREADY EXISTS ERROR";
|
||||||
|
case mgp_error::MGP_ERROR_IMMUTABLE_OBJECT:
|
||||||
|
return "IMMUTABLE OBJECT ERROR";
|
||||||
|
case mgp_error::MGP_ERROR_VALUE_CONVERSION:
|
||||||
|
return "VALUE CONVERSION ERROR";
|
||||||
|
case mgp_error::MGP_ERROR_SERIALIZATION_ERROR:
|
||||||
|
return "SERIALIZATION ERROR";
|
||||||
|
case mgp_error::MGP_ERROR_AUTHORIZATION_ERROR:
|
||||||
|
return "AUTHORIZATION ERROR";
|
||||||
|
}
|
||||||
|
LOG_FATAL("ToString of a wrong mgp_error -> check missing switch case");
|
||||||
|
}
|
||||||
|
inline std::ostream &operator<<(std::ostream &os, const mgp_error &error) {
|
||||||
|
os << ToString(error);
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
template <>
|
||||||
|
class fmt::formatter<mgp_error> : public fmt::ostream_formatter {};
|
||||||
|
#endif
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2022 Memgraph Ltd.
|
// Copyright 2023 Memgraph Ltd.
|
||||||
//
|
//
|
||||||
// Use of this software is governed by the Business Source License
|
// Use of this software is governed by the Business Source License
|
||||||
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
@ -10,6 +10,7 @@
|
|||||||
// licenses/APL.txt.
|
// licenses/APL.txt.
|
||||||
|
|
||||||
#include "query/procedure/mg_procedure_helpers.hpp"
|
#include "query/procedure/mg_procedure_helpers.hpp"
|
||||||
|
#include "query/procedure/fmt.hpp"
|
||||||
|
|
||||||
namespace memgraph::query::procedure {
|
namespace memgraph::query::procedure {
|
||||||
MgpUniquePtr<mgp_value> GetStringValueOrSetError(const char *string, mgp_memory *memory, mgp_result *result) {
|
MgpUniquePtr<mgp_value> GetStringValueOrSetError(const char *string, mgp_memory *memory, mgp_result *result) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2022 Memgraph Ltd.
|
// Copyright 2023 Memgraph Ltd.
|
||||||
//
|
//
|
||||||
// Use of this software is governed by the Business Source License
|
// Use of this software is governed by the Business Source License
|
||||||
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
@ -18,6 +18,7 @@
|
|||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
|
||||||
#include "mg_procedure.h"
|
#include "mg_procedure.h"
|
||||||
|
#include "query/procedure/fmt.hpp"
|
||||||
|
|
||||||
namespace memgraph::query::procedure {
|
namespace memgraph::query::procedure {
|
||||||
template <typename TResult, typename TFunc, typename... TArgs>
|
template <typename TResult, typename TFunc, typename... TArgs>
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "query/db_accessor.hpp"
|
#include "query/db_accessor.hpp"
|
||||||
#include "query/frontend/ast/ast.hpp"
|
#include "query/frontend/ast/ast.hpp"
|
||||||
#include "query/procedure/cypher_types.hpp"
|
#include "query/procedure/cypher_types.hpp"
|
||||||
|
#include "query/procedure/fmt.hpp"
|
||||||
#include "query/procedure/mg_procedure_helpers.hpp"
|
#include "query/procedure/mg_procedure_helpers.hpp"
|
||||||
#include "query/stream/common.hpp"
|
#include "query/stream/common.hpp"
|
||||||
#include "storage/v2/property_value.hpp"
|
#include "storage/v2/property_value.hpp"
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
#include "query/fmt.hpp"
|
||||||
#include "storage/v2/temporal.hpp"
|
#include "storage/v2/temporal.hpp"
|
||||||
#include "utils/exceptions.hpp"
|
#include "utils/exceptions.hpp"
|
||||||
#include "utils/fnv.hpp"
|
#include "utils/fnv.hpp"
|
||||||
@ -326,13 +327,11 @@ TypedValue::operator storage::PropertyValue() const {
|
|||||||
throw TypedValueException("TypedValue is of type '{}', not '{}'", type_, Type::type_enum); \
|
throw TypedValueException("TypedValue is of type '{}', not '{}'", type_, Type::type_enum); \
|
||||||
return field; \
|
return field; \
|
||||||
} \
|
} \
|
||||||
\
|
|
||||||
const type_param &TypedValue::Value##type_enum() const { \
|
const type_param &TypedValue::Value##type_enum() const { \
|
||||||
if (type_ != Type::type_enum) [[unlikely]] \
|
if (type_ != Type::type_enum) [[unlikely]] \
|
||||||
throw TypedValueException("TypedValue is of type '{}', not '{}'", type_, Type::type_enum); \
|
throw TypedValueException("TypedValue is of type '{}', not '{}'", type_, Type::type_enum); \
|
||||||
return field; \
|
return field; \
|
||||||
} \
|
} \
|
||||||
\
|
|
||||||
bool TypedValue::Is##type_enum() const { return type_ == Type::type_enum; }
|
bool TypedValue::Is##type_enum() const { return type_ == Type::type_enum; }
|
||||||
|
|
||||||
DEFINE_VALUE_AND_TYPE_GETTERS(bool, Bool, bool_v)
|
DEFINE_VALUE_AND_TYPE_GETTERS(bool, Bool, bool_v)
|
||||||
@ -783,10 +782,13 @@ TypedValue operator<(const TypedValue &a, const TypedValue &b) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (!is_legal(a.type()) || !is_legal(b.type()))
|
if (!is_legal(a.type()) || !is_legal(b.type())) {
|
||||||
throw TypedValueException("Invalid 'less' operand types({} + {})", a.type(), b.type());
|
throw TypedValueException("Invalid 'less' operand types({} + {})", a.type(), b.type());
|
||||||
|
}
|
||||||
|
|
||||||
if (a.IsNull() || b.IsNull()) return TypedValue(a.GetMemoryResource());
|
if (a.IsNull() || b.IsNull()) {
|
||||||
|
return TypedValue(a.GetMemoryResource());
|
||||||
|
}
|
||||||
|
|
||||||
if (a.IsString() || b.IsString()) {
|
if (a.IsString() || b.IsString()) {
|
||||||
if (a.type() != b.type()) {
|
if (a.type() != b.type()) {
|
||||||
@ -956,8 +958,9 @@ inline void EnsureArithmeticallyOk(const TypedValue &a, const TypedValue &b, boo
|
|||||||
// checked here because they are handled before this check is performed in
|
// checked here because they are handled before this check is performed in
|
||||||
// arithmetic op implementations.
|
// arithmetic op implementations.
|
||||||
|
|
||||||
if (!is_legal(a) || !is_legal(b))
|
if (!is_legal(a) || !is_legal(b)) {
|
||||||
throw TypedValueException("Invalid {} operand types {}, {}", op_name, a.type(), b.type());
|
throw TypedValueException("Invalid {} operand types {}, {}", op_name, a.type(), b.type());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -1107,8 +1110,9 @@ TypedValue operator%(const TypedValue &a, const TypedValue &b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void EnsureLogicallyOk(const TypedValue &a, const TypedValue &b, const std::string &op_name) {
|
inline void EnsureLogicallyOk(const TypedValue &a, const TypedValue &b, const std::string &op_name) {
|
||||||
if (!((a.IsBool() || a.IsNull()) && (b.IsBool() || b.IsNull())))
|
if (!((a.IsBool() || a.IsNull()) && (b.IsBool() || b.IsNull()))) {
|
||||||
throw TypedValueException("Invalid {} operand types({} && {})", op_name, a.type(), b.type());
|
throw TypedValueException("Invalid {} operand types({} && {})", op_name, a.type(), b.type());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TypedValue operator&&(const TypedValue &a, const TypedValue &b) {
|
TypedValue operator&&(const TypedValue &a, const TypedValue &b) {
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
// licenses/APL.txt.
|
// licenses/APL.txt.
|
||||||
|
|
||||||
#include "replication/replication_client.hpp"
|
#include "replication/replication_client.hpp"
|
||||||
|
#include "io/network/fmt.hpp"
|
||||||
|
|
||||||
namespace memgraph::replication {
|
namespace memgraph::replication {
|
||||||
|
|
||||||
@ -30,7 +31,7 @@ ReplicationClient::ReplicationClient(const memgraph::replication::ReplicationCli
|
|||||||
ReplicationClient::~ReplicationClient() {
|
ReplicationClient::~ReplicationClient() {
|
||||||
try {
|
try {
|
||||||
auto const &endpoint = rpc_client_.Endpoint();
|
auto const &endpoint = rpc_client_.Endpoint();
|
||||||
spdlog::trace("Closing replication client on {}:{}", endpoint.address, endpoint.port);
|
spdlog::trace("Closing replication client on {}", endpoint);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
// Logging can throw. Not a big deal, just ignore.
|
// Logging can throw. Not a big deal, just ignore.
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
#include "utils/on_scope_exit.hpp"
|
#include "utils/on_scope_exit.hpp"
|
||||||
#include "utils/typeinfo.hpp"
|
#include "utils/typeinfo.hpp"
|
||||||
|
|
||||||
|
#include "io/network/fmt.hpp"
|
||||||
|
|
||||||
namespace memgraph::rpc {
|
namespace memgraph::rpc {
|
||||||
|
|
||||||
/// Client is thread safe, but it is recommended to use thread_local clients.
|
/// Client is thread safe, but it is recommended to use thread_local clients.
|
||||||
|
@ -1278,7 +1278,7 @@ bool DiskStorage::DeleteEdgeFromConnectivityIndex(Transaction *transaction, cons
|
|||||||
/// std::map<dst_vertex_gid, ...>
|
/// std::map<dst_vertex_gid, ...>
|
||||||
/// Here we also do flushing of too many things, we don't need to serialize edges in read-only txn, check that...
|
/// Here we also do flushing of too many things, we don't need to serialize edges in read-only txn, check that...
|
||||||
[[nodiscard]] utils::BasicResult<StorageManipulationError, void> DiskStorage::FlushModifiedEdges(
|
[[nodiscard]] utils::BasicResult<StorageManipulationError, void> DiskStorage::FlushModifiedEdges(
|
||||||
Transaction *transaction, const auto &edge_acc) {
|
Transaction *transaction, const auto &edges_acc) {
|
||||||
for (const auto &modified_edge : transaction->modified_edges_) {
|
for (const auto &modified_edge : transaction->modified_edges_) {
|
||||||
const std::string edge_gid = modified_edge.first.ToString();
|
const std::string edge_gid = modified_edge.first.ToString();
|
||||||
const Delta::Action root_action = modified_edge.second.delta_action;
|
const Delta::Action root_action = modified_edge.second.delta_action;
|
||||||
@ -1304,8 +1304,8 @@ bool DiskStorage::DeleteEdgeFromConnectivityIndex(Transaction *transaction, cons
|
|||||||
return StorageManipulationError{SerializationError{}};
|
return StorageManipulationError{SerializationError{}};
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto &edge = edge_acc.find(modified_edge.first);
|
const auto &edge = edges_acc.find(modified_edge.first);
|
||||||
MG_ASSERT(edge != edge_acc.end(),
|
MG_ASSERT(edge != edges_acc.end(),
|
||||||
"Database in invalid state, commit not possible! Please restart your DB and start the import again.");
|
"Database in invalid state, commit not possible! Please restart your DB and start the import again.");
|
||||||
|
|
||||||
/// TODO: (andi) I think this is not wrong but it would be better to use AtomicWrites across column families.
|
/// TODO: (andi) I think this is not wrong but it would be better to use AtomicWrites across column families.
|
||||||
@ -1693,9 +1693,8 @@ utils::BasicResult<StorageManipulationError, void> DiskStorage::DiskAccessor::Co
|
|||||||
transaction_.commit_timestamp->store(*commit_timestamp_, std::memory_order_release);
|
transaction_.commit_timestamp->store(*commit_timestamp_, std::memory_order_release);
|
||||||
|
|
||||||
if (edge_import_mode_active) {
|
if (edge_import_mode_active) {
|
||||||
if (auto res =
|
auto edges_acc = disk_storage->edge_import_mode_cache_->AccessToEdges();
|
||||||
disk_storage->FlushModifiedEdges(&transaction_, disk_storage->edge_import_mode_cache_->AccessToEdges());
|
if (auto res = disk_storage->FlushModifiedEdges(&transaction_, edges_acc); res.HasError()) {
|
||||||
res.HasError()) {
|
|
||||||
Abort();
|
Abort();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -1717,7 +1716,8 @@ utils::BasicResult<StorageManipulationError, void> DiskStorage::DiskAccessor::Co
|
|||||||
return del_vertices_res.GetError();
|
return del_vertices_res.GetError();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto modified_edges_res = disk_storage->FlushModifiedEdges(&transaction_, transaction_.edges_->access());
|
auto tx_edges_acc = transaction_.edges_->access();
|
||||||
|
if (auto modified_edges_res = disk_storage->FlushModifiedEdges(&transaction_, tx_edges_acc);
|
||||||
modified_edges_res.HasError()) {
|
modified_edges_res.HasError()) {
|
||||||
Abort();
|
Abort();
|
||||||
return modified_edges_res.GetError();
|
return modified_edges_res.GetError();
|
||||||
|
@ -195,7 +195,7 @@ class DiskStorage final : public Storage {
|
|||||||
[[nodiscard]] utils::BasicResult<StorageManipulationError, void> FlushDeletedVertices(Transaction *transaction);
|
[[nodiscard]] utils::BasicResult<StorageManipulationError, void> FlushDeletedVertices(Transaction *transaction);
|
||||||
[[nodiscard]] utils::BasicResult<StorageManipulationError, void> FlushDeletedEdges(Transaction *transaction);
|
[[nodiscard]] utils::BasicResult<StorageManipulationError, void> FlushDeletedEdges(Transaction *transaction);
|
||||||
[[nodiscard]] utils::BasicResult<StorageManipulationError, void> FlushModifiedEdges(Transaction *transaction,
|
[[nodiscard]] utils::BasicResult<StorageManipulationError, void> FlushModifiedEdges(Transaction *transaction,
|
||||||
const auto &edge_acc);
|
const auto &edges_acc);
|
||||||
[[nodiscard]] utils::BasicResult<StorageManipulationError, void> ClearDanglingVertices(Transaction *transaction);
|
[[nodiscard]] utils::BasicResult<StorageManipulationError, void> ClearDanglingVertices(Transaction *transaction);
|
||||||
|
|
||||||
/// Writing methods
|
/// Writing methods
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "storage/v2/edge.hpp"
|
#include "storage/v2/edge.hpp"
|
||||||
#include "storage/v2/edge_accessor.hpp"
|
#include "storage/v2/edge_accessor.hpp"
|
||||||
#include "storage/v2/edge_ref.hpp"
|
#include "storage/v2/edge_ref.hpp"
|
||||||
|
#include "storage/v2/fmt.hpp"
|
||||||
#include "storage/v2/id_types.hpp"
|
#include "storage/v2/id_types.hpp"
|
||||||
#include "storage/v2/indices/label_index_stats.hpp"
|
#include "storage/v2/indices/label_index_stats.hpp"
|
||||||
#include "storage/v2/indices/label_property_index_stats.hpp"
|
#include "storage/v2/indices/label_property_index_stats.hpp"
|
||||||
|
23
src/storage/v2/fmt.hpp
Normal file
23
src/storage/v2/fmt.hpp
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// Copyright 2024 Memgraph Ltd.
|
||||||
|
//
|
||||||
|
// Use of this software is governed by the Business Source License
|
||||||
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
|
// License, and you may not use this file except in compliance with the Business Source License.
|
||||||
|
//
|
||||||
|
// As of the Change Date specified in that file, in accordance with
|
||||||
|
// the Business Source License, use of this software will be governed
|
||||||
|
// by the Apache License, Version 2.0, included in the file
|
||||||
|
// licenses/APL.txt.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if FMT_VERSION > 90000
|
||||||
|
#include <fmt/ostream.h>
|
||||||
|
|
||||||
|
#include "storage/v2/property_value.hpp"
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class fmt::formatter<memgraph::storage::PropertyValue> : public fmt::ostream_formatter {};
|
||||||
|
template <>
|
||||||
|
class fmt::formatter<memgraph::storage::PropertyValue::Type> : public fmt::ostream_formatter {};
|
||||||
|
#endif
|
@ -9,6 +9,8 @@
|
|||||||
// by the Apache License, Version 2.0, included in the file
|
// by the Apache License, Version 2.0, included in the file
|
||||||
// licenses/APL.txt.
|
// licenses/APL.txt.
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "replication/replication_client.hpp"
|
#include "replication/replication_client.hpp"
|
||||||
#include "storage/v2/inmemory/storage.hpp"
|
#include "storage/v2/inmemory/storage.hpp"
|
||||||
#include "storage/v2/storage.hpp"
|
#include "storage/v2/storage.hpp"
|
||||||
@ -17,7 +19,7 @@
|
|||||||
#include "utils/uuid.hpp"
|
#include "utils/uuid.hpp"
|
||||||
#include "utils/variant_helpers.hpp"
|
#include "utils/variant_helpers.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include "io/network/fmt.hpp"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
template <typename>
|
template <typename>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2022 Memgraph Ltd.
|
// Copyright 2023 Memgraph Ltd.
|
||||||
//
|
//
|
||||||
// Use of this software is governed by the Business Source License
|
// Use of this software is governed by the Business Source License
|
||||||
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2022 Memgraph Ltd.
|
// Copyright 2024 Memgraph Ltd.
|
||||||
//
|
//
|
||||||
// Use of this software is governed by the Business Source License
|
// Use of this software is governed by the Business Source License
|
||||||
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
@ -56,12 +56,11 @@ void EraseFlag(uint64_t flag_id) { expiration_flags.access().remove(flag_id); }
|
|||||||
|
|
||||||
std::weak_ptr<std::atomic<bool>> GetFlag(uint64_t flag_id) {
|
std::weak_ptr<std::atomic<bool>> GetFlag(uint64_t flag_id) {
|
||||||
const auto flag_accessor = expiration_flags.access();
|
const auto flag_accessor = expiration_flags.access();
|
||||||
const auto it = flag_accessor.find(flag_id);
|
const auto iter = flag_accessor.find(flag_id);
|
||||||
if (it == flag_accessor.end()) {
|
if (iter == flag_accessor.end()) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
return iter->flag;
|
||||||
return it->flag;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarkDone(const uint64_t flag_id) {
|
void MarkDone(const uint64_t flag_id) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2023 Memgraph Ltd.
|
// Copyright 2024 Memgraph Ltd.
|
||||||
//
|
//
|
||||||
// Use of this software is governed by the Business Source License
|
// Use of this software is governed by the Business Source License
|
||||||
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
@ -23,6 +23,11 @@
|
|||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
// NOTE: fmt 9+ introduced fmt/std.h, it's important because of, e.g., std::path formatting. toolchain-v4 has fmt 8,
|
||||||
|
// the guard is here because of fmt 8 compatibility.
|
||||||
|
#if FMT_VERSION > 90000
|
||||||
|
#include <fmt/std.h>
|
||||||
|
#endif
|
||||||
#include <spdlog/fmt/ostr.h>
|
#include <spdlog/fmt/ostr.h>
|
||||||
#include <spdlog/sinks/stdout_color_sinks.h>
|
#include <spdlog/sinks/stdout_color_sinks.h>
|
||||||
#include <spdlog/spdlog.h>
|
#include <spdlog/spdlog.h>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2022 Memgraph Ltd.
|
// Copyright 2023 Memgraph Ltd.
|
||||||
//
|
//
|
||||||
// Use of this software is governed by the Business Source License
|
// Use of this software is governed by the Business Source License
|
||||||
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
@ -17,8 +17,13 @@ namespace memgraph::utils {
|
|||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
std::string MessageWithLink(fmt::format_string<Args...> fmt, Args &&...args) {
|
std::string MessageWithLink(fmt::format_string<Args...> fmt, Args &&...args) {
|
||||||
|
#if FMT_VERSION > 90000
|
||||||
|
return fmt::format(fmt::runtime(fmt::format(fmt::runtime("{} For more details, visit {{}}."), fmt.get())),
|
||||||
|
std::forward<Args>(args)...);
|
||||||
|
#else
|
||||||
return fmt::format(fmt::runtime(fmt::format(fmt::runtime("{} For more details, visit {{}}."), fmt)),
|
return fmt::format(fmt::runtime(fmt::format(fmt::runtime("{} For more details, visit {{}}."), fmt)),
|
||||||
std::forward<Args>(args)...);
|
std::forward<Args>(args)...);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace memgraph::utils
|
} // namespace memgraph::utils
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2023 Memgraph Ltd.
|
// Copyright 2024 Memgraph Ltd.
|
||||||
//
|
//
|
||||||
// Use of this software is governed by the Business Source License
|
// Use of this software is governed by the Business Source License
|
||||||
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
@ -18,6 +18,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "utils/file.hpp"
|
#include "utils/file.hpp"
|
||||||
|
#include "utils/logging.hpp"
|
||||||
#include "utils/string.hpp"
|
#include "utils/string.hpp"
|
||||||
|
|
||||||
namespace memgraph::utils {
|
namespace memgraph::utils {
|
||||||
@ -39,19 +40,19 @@ inline uint64_t GetDirDiskUsage(const std::filesystem::path &path) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
uint64_t size = 0;
|
uint64_t size = 0;
|
||||||
for (const auto &p : std::filesystem::directory_iterator(path)) {
|
for (const auto &dir_entry : std::filesystem::directory_iterator(path)) {
|
||||||
if (IgnoreSymlink && std::filesystem::is_symlink(p)) continue;
|
if (IgnoreSymlink && std::filesystem::is_symlink(dir_entry)) continue;
|
||||||
if (std::filesystem::is_directory(p)) {
|
if (std::filesystem::is_directory(dir_entry)) {
|
||||||
size += GetDirDiskUsage(p);
|
size += GetDirDiskUsage(dir_entry);
|
||||||
} else if (std::filesystem::is_regular_file(p)) {
|
} else if (std::filesystem::is_regular_file(dir_entry)) {
|
||||||
if (!utils::HasReadAccess(p)) {
|
if (!utils::HasReadAccess(dir_entry)) {
|
||||||
spdlog::warn(
|
spdlog::warn(
|
||||||
"Skipping file path on collecting directory disk usage '{}' because it is not readable, check file "
|
"Skipping file path on collecting directory disk usage '{}' because it is not readable, check file "
|
||||||
"ownership and read permissions!",
|
"ownership and read permissions!",
|
||||||
p);
|
dir_entry.path());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
size += std::filesystem::file_size(p);
|
size += std::filesystem::file_size(dir_entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2023 Memgraph Ltd.
|
// Copyright 2024 Memgraph Ltd.
|
||||||
//
|
//
|
||||||
// Use of this software is governed by the Business Source License
|
// Use of this software is governed by the Business Source License
|
||||||
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
@ -18,6 +18,7 @@
|
|||||||
#include <gflags/gflags.h>
|
#include <gflags/gflags.h>
|
||||||
|
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
|
#include "io/network/fmt.hpp"
|
||||||
#include "utils/logging.hpp"
|
#include "utils/logging.hpp"
|
||||||
#include "utils/thread.hpp"
|
#include "utils/thread.hpp"
|
||||||
#include "utils/timer.hpp"
|
#include "utils/timer.hpp"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2023 Memgraph Ltd.
|
// Copyright 2024 Memgraph Ltd.
|
||||||
//
|
//
|
||||||
// Use of this software is governed by the Business Source License
|
// Use of this software is governed by the Business Source License
|
||||||
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
@ -18,6 +18,7 @@
|
|||||||
#include <gflags/gflags.h>
|
#include <gflags/gflags.h>
|
||||||
|
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
|
#include "io/network/fmt.hpp"
|
||||||
#include "utils/logging.hpp"
|
#include "utils/logging.hpp"
|
||||||
#include "utils/thread.hpp"
|
#include "utils/thread.hpp"
|
||||||
#include "utils/timer.hpp"
|
#include "utils/timer.hpp"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2023 Memgraph Ltd.
|
// Copyright 2024 Memgraph Ltd.
|
||||||
//
|
//
|
||||||
// Use of this software is governed by the Business Source License
|
// Use of this software is governed by the Business Source License
|
||||||
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
@ -19,6 +19,7 @@
|
|||||||
#include <json/json.hpp>
|
#include <json/json.hpp>
|
||||||
|
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
|
#include "io/network/fmt.hpp"
|
||||||
#include "utils/logging.hpp"
|
#include "utils/logging.hpp"
|
||||||
#include "utils/thread.hpp"
|
#include "utils/thread.hpp"
|
||||||
#include "utils/timer.hpp"
|
#include "utils/timer.hpp"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2022 Memgraph Ltd.
|
// Copyright 2023 Memgraph Ltd.
|
||||||
//
|
//
|
||||||
// Use of this software is governed by the Business Source License
|
// Use of this software is governed by the Business Source License
|
||||||
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
@ -13,7 +13,6 @@
|
|||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
|
||||||
#include <gflags/gflags.h>
|
#include <gflags/gflags.h>
|
||||||
#include <spdlog/fmt/bundled/core.h>
|
|
||||||
#include <mgclient.hpp>
|
#include <mgclient.hpp>
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
#include "utils/logging.hpp"
|
#include "utils/logging.hpp"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2022 Memgraph Ltd.
|
// Copyright 2024 Memgraph Ltd.
|
||||||
//
|
//
|
||||||
// Use of this software is governed by the Business Source License
|
// Use of this software is governed by the Business Source License
|
||||||
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
@ -24,11 +24,13 @@
|
|||||||
#include <gflags/gflags.h>
|
#include <gflags/gflags.h>
|
||||||
#include <json/json.hpp>
|
#include <json/json.hpp>
|
||||||
|
|
||||||
|
#include "communication/bolt/v1/value.hpp"
|
||||||
#include "io/network/utils.hpp"
|
#include "io/network/utils.hpp"
|
||||||
|
#include "long_running_common.hpp"
|
||||||
#include "utils/algorithm.hpp"
|
#include "utils/algorithm.hpp"
|
||||||
#include "utils/timer.hpp"
|
#include "utils/timer.hpp"
|
||||||
|
|
||||||
#include "long_running_common.hpp"
|
#include "communication/bolt/v1/fmt.hpp"
|
||||||
|
|
||||||
using memgraph::communication::bolt::Edge;
|
using memgraph::communication::bolt::Edge;
|
||||||
using memgraph::communication::bolt::Value;
|
using memgraph::communication::bolt::Value;
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "query/plan/planner.hpp"
|
#include "query/plan/planner.hpp"
|
||||||
#include "query/plan/pretty_print.hpp"
|
#include "query/plan/pretty_print.hpp"
|
||||||
#include "query/typed_value.hpp"
|
#include "query/typed_value.hpp"
|
||||||
|
#include "storage/v2/fmt.hpp"
|
||||||
#include "storage/v2/property_value.hpp"
|
#include "storage/v2/property_value.hpp"
|
||||||
#include "utils/string.hpp"
|
#include "utils/string.hpp"
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2022 Memgraph Ltd.
|
// Copyright 2024 Memgraph Ltd.
|
||||||
//
|
//
|
||||||
// Use of this software is governed by the Business Source License
|
// Use of this software is governed by the Business Source License
|
||||||
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
@ -15,6 +15,7 @@
|
|||||||
#include <gflags/gflags.h>
|
#include <gflags/gflags.h>
|
||||||
|
|
||||||
#include "query/frontend/stripped.hpp"
|
#include "query/frontend/stripped.hpp"
|
||||||
|
#include "storage/v2/fmt.hpp"
|
||||||
|
|
||||||
DEFINE_string(q, "CREATE (n) RETURN n", "Query");
|
DEFINE_string(q, "CREATE (n) RETURN n", "Query");
|
||||||
|
|
||||||
|
@ -214,23 +214,22 @@ TYPED_TEST(OperatorToStringTest, Filter) {
|
|||||||
auto node_ident = IDENT("person");
|
auto node_ident = IDENT("person");
|
||||||
auto property = this->dba.NameToProperty("name");
|
auto property = this->dba.NameToProperty("name");
|
||||||
auto property_ix = this->storage.GetPropertyIx("name");
|
auto property_ix = this->storage.GetPropertyIx("name");
|
||||||
|
auto generic_filter_info = FilterInfo{FilterInfo::Type::Generic, nullptr, {node}};
|
||||||
FilterInfo generic_filter_info = {.type = FilterInfo::Type::Generic, .used_symbols = {node}};
|
|
||||||
|
|
||||||
auto id_filter = IdFilter(this->symbol_table, node, LITERAL(42));
|
auto id_filter = IdFilter(this->symbol_table, node, LITERAL(42));
|
||||||
FilterInfo id_filter_info = {.type = FilterInfo::Type::Id, .id_filter = id_filter};
|
auto id_filter_info = FilterInfo{FilterInfo::Type::Id, nullptr, {}, {}, id_filter};
|
||||||
|
|
||||||
std::vector<LabelIx> labels{this->storage.GetLabelIx("Customer"), this->storage.GetLabelIx("Visitor")};
|
std::vector<LabelIx> labels{this->storage.GetLabelIx("Customer"), this->storage.GetLabelIx("Visitor")};
|
||||||
auto labels_test = LABELS_TEST(node_ident, labels);
|
auto labels_test = LABELS_TEST(node_ident, labels);
|
||||||
FilterInfo label_filter_info = {.type = FilterInfo::Type::Label, .expression = labels_test};
|
auto label_filter_info = FilterInfo{FilterInfo::Type::Label, labels_test};
|
||||||
|
|
||||||
auto labels_test_2 = LABELS_TEST(PROPERTY_LOOKUP(this->dba, "person", property), labels);
|
auto labels_test_2 = LABELS_TEST(PROPERTY_LOOKUP(this->dba, "person", property), labels);
|
||||||
FilterInfo label_filter_2_info = {.type = FilterInfo::Type::Label, .expression = labels_test_2};
|
auto label_filter_2_info = FilterInfo{FilterInfo::Type::Label, labels_test_2};
|
||||||
|
|
||||||
auto property_filter = PropertyFilter(node, property_ix, PropertyFilter::Type::EQUAL);
|
auto property_filter = PropertyFilter(node, property_ix, PropertyFilter::Type::EQUAL);
|
||||||
FilterInfo property_filter_info = {.type = FilterInfo::Type::Property, .property_filter = property_filter};
|
auto property_filter_info = FilterInfo{FilterInfo::Type::Property, nullptr, {}, property_filter};
|
||||||
|
|
||||||
FilterInfo pattern_filter_info = {.type = FilterInfo::Type::Pattern};
|
auto pattern_filter_info = FilterInfo{FilterInfo::Type::Pattern};
|
||||||
|
|
||||||
Filters filters;
|
Filters filters;
|
||||||
filters.SetFilters({generic_filter_info, id_filter_info, label_filter_info, label_filter_2_info, property_filter_info,
|
filters.SetFilters({generic_filter_info, id_filter_info, label_filter_info, label_filter_2_info, property_filter_info,
|
||||||
|
Loading…
Reference in New Issue
Block a user