Compare commits
2 Commits
fix-pre-co
...
compile-wi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76690bf904 | ||
|
|
ec03fb0456 |
@@ -184,7 +184,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall \
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall \
|
||||||
-Werror=switch -Werror=switch-bool -Werror=return-type \
|
-Werror=switch -Werror=switch-bool -Werror=return-type \
|
||||||
-Werror=return-stack-address \
|
-Werror=return-stack-address \
|
||||||
-Wno-c99-designator \
|
-Wno-c99-designator -stdlib=libc++ \
|
||||||
-DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT")
|
-DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT")
|
||||||
|
|
||||||
# Don't omit frame pointer in RelWithDebInfo, for additional callchain debug.
|
# Don't omit frame pointer in RelWithDebInfo, for additional callchain debug.
|
||||||
@@ -197,7 +197,10 @@ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
|||||||
# Last checked for gcc-10.2 which we are using on the build machines.
|
# Last checked for gcc-10.2 which we are using on the build machines.
|
||||||
# ** If we change versions, recheck this! **
|
# ** If we change versions, recheck this! **
|
||||||
# ** 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++")
|
||||||
|
|
||||||
|
# message(STATUS "${CMAKE_CXX_STANDARD_LIBRARIES}")
|
||||||
|
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lc++experimental")
|
||||||
|
|
||||||
# Use gold linker to speedup build
|
# Use gold linker to speedup build
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ import_external_library(antlr4 STATIC
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/antlr4/runtime/Cpp/include/antlr4-runtime
|
${CMAKE_CURRENT_SOURCE_DIR}/antlr4/runtime/Cpp/include/antlr4-runtime
|
||||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/antlr4/runtime/Cpp
|
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/antlr4/runtime/Cpp
|
||||||
CMAKE_ARGS # http://stackoverflow.com/questions/37096062/get-a-basic-c-program-to-compile-using-clang-on-ubuntu-16/38385967#38385967
|
CMAKE_ARGS # http://stackoverflow.com/questions/37096062/get-a-basic-c-program-to-compile-using-clang-on-ubuntu-16/38385967#38385967
|
||||||
-DWITH_LIBCXX=OFF # because of debian bug
|
-DWITH_LIBCXX=ON # because of debian bug
|
||||||
-DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=true
|
-DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=true
|
||||||
-DCMAKE_CXX_STANDARD=20
|
-DCMAKE_CXX_STANDARD=20
|
||||||
-DANTLR_BUILD_CPP_TESTS=OFF
|
-DANTLR_BUILD_CPP_TESTS=OFF
|
||||||
@@ -127,7 +127,9 @@ mark_as_advanced(RC_ENABLE_GTEST RC_ENABLE_GMOCK)
|
|||||||
add_subdirectory(rapidcheck EXCLUDE_FROM_ALL)
|
add_subdirectory(rapidcheck EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
# setup google test
|
# setup google test
|
||||||
add_external_project(gtest SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/googletest)
|
add_external_project(gtest
|
||||||
|
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/googletest
|
||||||
|
CMAKE_ARGS -DCMAKE_CXX_FLAGS="-stdlib=libc++")
|
||||||
set(GTEST_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/googletest/include
|
set(GTEST_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/googletest/include
|
||||||
CACHE PATH "Path to gtest and gmock include directory" FORCE)
|
CACHE PATH "Path to gtest and gmock include directory" FORCE)
|
||||||
set(GMOCK_LIBRARY ${CMAKE_CURRENT_SOURCE_DIR}/googletest/lib/libgmock.a
|
set(GMOCK_LIBRARY ${CMAKE_CURRENT_SOURCE_DIR}/googletest/lib/libgmock.a
|
||||||
@@ -155,6 +157,7 @@ import_external_library(rocksdb STATIC
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/rocksdb/lib/librocksdb.a
|
${CMAKE_CURRENT_SOURCE_DIR}/rocksdb/lib/librocksdb.a
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/rocksdb/include
|
${CMAKE_CURRENT_SOURCE_DIR}/rocksdb/include
|
||||||
CMAKE_ARGS -DUSE_RTTI=ON
|
CMAKE_ARGS -DUSE_RTTI=ON
|
||||||
|
-DCMAKE_CXX_FLAGS="-stdlib=libc++"
|
||||||
-DWITH_TESTS=OFF
|
-DWITH_TESTS=OFF
|
||||||
-DGFLAGS_NOTHREADS=OFF
|
-DGFLAGS_NOTHREADS=OFF
|
||||||
-DCMAKE_INSTALL_LIBDIR=lib
|
-DCMAKE_INSTALL_LIBDIR=lib
|
||||||
@@ -207,6 +210,7 @@ import_external_library(librdkafka STATIC
|
|||||||
-DWITH_ZSTD=OFF
|
-DWITH_ZSTD=OFF
|
||||||
-DENABLE_LZ4_EXT=OFF
|
-DENABLE_LZ4_EXT=OFF
|
||||||
-DCMAKE_INSTALL_LIBDIR=lib
|
-DCMAKE_INSTALL_LIBDIR=lib
|
||||||
|
-DCMAKE_CXX_FLAGS="-stdlib=libc++"
|
||||||
-DWITH_SSL=ON
|
-DWITH_SSL=ON
|
||||||
# If we want SASL, we need to install it on build machines
|
# If we want SASL, we need to install it on build machines
|
||||||
-DWITH_SASL=OFF)
|
-DWITH_SASL=OFF)
|
||||||
@@ -223,7 +227,8 @@ import_external_library(protobuf STATIC
|
|||||||
${PROTOBUF_ROOT}/lib/libprotobuf.a
|
${PROTOBUF_ROOT}/lib/libprotobuf.a
|
||||||
${PROTOBUF_ROOT}/include
|
${PROTOBUF_ROOT}/include
|
||||||
BUILD_IN_SOURCE 1
|
BUILD_IN_SOURCE 1
|
||||||
CONFIGURE_COMMAND true)
|
CONFIGURE_COMMAND true
|
||||||
|
BUILD_COMMAND $(MAKE))
|
||||||
|
|
||||||
import_external_library(pulsar STATIC
|
import_external_library(pulsar STATIC
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/pulsar/pulsar-client-cpp/lib/libpulsarwithdeps.a
|
${CMAKE_CURRENT_SOURCE_DIR}/pulsar/pulsar-client-cpp/lib/libpulsarwithdeps.a
|
||||||
@@ -233,6 +238,7 @@ import_external_library(pulsar STATIC
|
|||||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_SOURCE_DIR}/pulsar/install
|
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_SOURCE_DIR}/pulsar/install
|
||||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||||
|
-DCMAKE_CXX_FLAGS=-stdlib=libc++\ -I/opt/toolchain-v4/include
|
||||||
-DBUILD_DYNAMIC_LIB=OFF
|
-DBUILD_DYNAMIC_LIB=OFF
|
||||||
-DBUILD_STATIC_LIB=ON
|
-DBUILD_STATIC_LIB=ON
|
||||||
-DBUILD_TESTS=OFF
|
-DBUILD_TESTS=OFF
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ repo_clone_try_double "${primary_urls[librdkafka]}" "${secondary_urls[librdkafka
|
|||||||
protobuf_tag="v3.12.4"
|
protobuf_tag="v3.12.4"
|
||||||
repo_clone_try_double "${primary_urls[protobuf]}" "${secondary_urls[protobuf]}" "protobuf" "$protobuf_tag" true
|
repo_clone_try_double "${primary_urls[protobuf]}" "${secondary_urls[protobuf]}" "protobuf" "$protobuf_tag" true
|
||||||
pushd protobuf
|
pushd protobuf
|
||||||
./autogen.sh && ./configure CC=clang CXX=clang++ --prefix=$(pwd)/lib
|
./autogen.sh && CXXFLAGS="-stdlib=libc++ -isystem /opt/toolchain-v4/include" ./configure CC=clang CXX=clang++ --prefix=$(pwd)/lib
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#pulsar
|
#pulsar
|
||||||
|
|||||||
@@ -51,7 +51,14 @@ class IOContextThreadPool final {
|
|||||||
running_ = false;
|
running_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AwaitShutdown() { background_threads_.clear(); }
|
void AwaitShutdown() {
|
||||||
|
for (auto &thread : background_threads_) {
|
||||||
|
if (thread.joinable()) {
|
||||||
|
thread.join();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
background_threads_.clear();
|
||||||
|
}
|
||||||
|
|
||||||
bool IsRunning() const noexcept { return running_; }
|
bool IsRunning() const noexcept { return running_; }
|
||||||
|
|
||||||
@@ -62,7 +69,7 @@ class IOContextThreadPool final {
|
|||||||
IOContext io_context_;
|
IOContext io_context_;
|
||||||
IOContextGuard guard_;
|
IOContextGuard guard_;
|
||||||
size_t pool_size_;
|
size_t pool_size_;
|
||||||
std::vector<std::jthread> background_threads_;
|
std::vector<std::thread> background_threads_;
|
||||||
bool running_{false};
|
bool running_{false};
|
||||||
};
|
};
|
||||||
} // namespace memgraph::communication::v2
|
} // namespace memgraph::communication::v2
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ void TryToConsumeBatch(TConsumer &consumer, const ConsumerInfo &info, const Cons
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (std::ranges::any_of(batch, has_message_failed)) {
|
if (std::any_of(batch.begin(), batch.end(), has_message_failed)) {
|
||||||
throw ConsumerAcknowledgeMessagesFailedException(info.consumer_name);
|
throw ConsumerAcknowledgeMessagesFailedException(info.consumer_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <netinet/tcp.h>
|
#include <netinet/tcp.h>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "io/network/addrinfo.hpp"
|
#include "io/network/addrinfo.hpp"
|
||||||
#include "io/network/socket.hpp"
|
#include "io/network/socket.hpp"
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
#include <sstream>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
|
||||||
// Define to use Py_ssize_t for API returning length of something. Some future
|
// Define to use Py_ssize_t for API returning length of something. Some future
|
||||||
|
|||||||
@@ -599,7 +599,8 @@ void SymbolGenerator::VisitWithIdentifiers(Expression *expr, const std::vector<I
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SymbolGenerator::HasSymbol(const std::string &name) const {
|
bool SymbolGenerator::HasSymbol(const std::string &name) const {
|
||||||
return std::ranges::any_of(scopes_, [&name](const auto &scope) { return scope.symbols.contains(name); });
|
return std::any_of(scopes_.begin(), scopes_.end(),
|
||||||
|
[&name](const auto &scope) { return scope.symbols.contains(name); });
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SymbolGenerator::HasSymbolLocalScope(const std::string &name) const {
|
bool SymbolGenerator::HasSymbolLocalScope(const std::string &name) const {
|
||||||
|
|||||||
@@ -793,18 +793,14 @@ Callback HandleStreamQuery(StreamQuery *stream_query, const Parameters ¶mete
|
|||||||
auto streams_status = interpreter_context->streams.GetStreamInfo();
|
auto streams_status = interpreter_context->streams.GetStreamInfo();
|
||||||
std::vector<std::vector<TypedValue>> results;
|
std::vector<std::vector<TypedValue>> results;
|
||||||
results.reserve(streams_status.size());
|
results.reserve(streams_status.size());
|
||||||
auto stream_info_as_typed_stream_info_emplace_in = [](auto &typed_status, const auto &stream_info) {
|
|
||||||
typed_status.emplace_back(stream_info.batch_interval.count());
|
|
||||||
typed_status.emplace_back(stream_info.batch_size);
|
|
||||||
typed_status.emplace_back(stream_info.transformation_name);
|
|
||||||
};
|
|
||||||
|
|
||||||
for (const auto &status : streams_status) {
|
for (const auto &status : streams_status) {
|
||||||
std::vector<TypedValue> typed_status;
|
std::vector<TypedValue> typed_status;
|
||||||
typed_status.reserve(7);
|
typed_status.reserve(7);
|
||||||
typed_status.emplace_back(status.name);
|
typed_status.emplace_back(status.name);
|
||||||
typed_status.emplace_back(StreamSourceTypeToString(status.type));
|
typed_status.emplace_back(StreamSourceTypeToString(status.type));
|
||||||
stream_info_as_typed_stream_info_emplace_in(typed_status, status.info);
|
typed_status.emplace_back(status.info.batch_interval.count());
|
||||||
|
typed_status.emplace_back(status.info.batch_size);
|
||||||
|
typed_status.emplace_back(status.info.transformation_name);
|
||||||
if (status.owner.has_value()) {
|
if (status.owner.has_value()) {
|
||||||
typed_status.emplace_back(*status.owner);
|
typed_status.emplace_back(*status.owner);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -469,7 +469,7 @@ class ScanAllCursor : public Cursor {
|
|||||||
const Symbol output_symbol_;
|
const Symbol output_symbol_;
|
||||||
const UniqueCursorPtr input_cursor_;
|
const UniqueCursorPtr input_cursor_;
|
||||||
TVerticesFun get_vertices_;
|
TVerticesFun get_vertices_;
|
||||||
std::optional<typename std::result_of<TVerticesFun(Frame &, ExecutionContext &)>::type::value_type> vertices_;
|
std::optional<typename std::invoke_result<TVerticesFun, Frame &, ExecutionContext &>::type::value_type> vertices_;
|
||||||
std::optional<decltype(vertices_.value().begin())> vertices_it_;
|
std::optional<decltype(vertices_.value().begin())> vertices_it_;
|
||||||
const char *op_name_;
|
const char *op_name_;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -326,11 +326,6 @@ class VariableStartPlanner {
|
|||||||
},
|
},
|
||||||
VaryQueryMatching(query_parts, *context_->symbol_table));
|
VaryQueryMatching(query_parts, *context_->symbol_table));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief The result of plan generation is an iterable of roots to multiple
|
|
||||||
/// generated operator trees.
|
|
||||||
using PlanResult = typename std::result_of<decltype (&VariableStartPlanner<TPlanningContext>::Plan)(
|
|
||||||
VariableStartPlanner<TPlanningContext>, std::vector<SingleQueryPart> &)>::type;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace memgraph::query::plan
|
} // namespace memgraph::query::plan
|
||||||
|
|||||||
@@ -342,13 +342,13 @@ struct mgp_list {
|
|||||||
explicit mgp_list(memgraph::utils::MemoryResource *memory) : elems(memory) {}
|
explicit mgp_list(memgraph::utils::MemoryResource *memory) : elems(memory) {}
|
||||||
|
|
||||||
mgp_list(memgraph::utils::pmr::vector<mgp_value> &&elems, memgraph::utils::MemoryResource *memory)
|
mgp_list(memgraph::utils::pmr::vector<mgp_value> &&elems, memgraph::utils::MemoryResource *memory)
|
||||||
: elems(std::move(elems), memory) {}
|
: elems(elems, memory) {}
|
||||||
|
|
||||||
mgp_list(const mgp_list &other, memgraph::utils::MemoryResource *memory) : elems(other.elems, memory) {}
|
mgp_list(const mgp_list &other, memgraph::utils::MemoryResource *memory) : elems(other.elems, memory) {}
|
||||||
|
|
||||||
mgp_list(mgp_list &&other, memgraph::utils::MemoryResource *memory) : elems(std::move(other.elems), memory) {}
|
mgp_list(mgp_list &&other, memgraph::utils::MemoryResource *memory) : elems(other.elems, memory) {}
|
||||||
|
|
||||||
mgp_list(mgp_list &&other) noexcept : elems(std::move(other.elems)) {}
|
mgp_list(mgp_list &&other) noexcept : elems(other.elems) {}
|
||||||
|
|
||||||
/// Copy construction without memgraph::utils::MemoryResource is not allowed.
|
/// Copy construction without memgraph::utils::MemoryResource is not allowed.
|
||||||
mgp_list(const mgp_list &) = delete;
|
mgp_list(const mgp_list &) = delete;
|
||||||
@@ -544,9 +544,9 @@ struct mgp_path {
|
|||||||
: vertices(other.vertices, memory), edges(other.edges, memory) {}
|
: vertices(other.vertices, memory), edges(other.edges, memory) {}
|
||||||
|
|
||||||
mgp_path(mgp_path &&other, memgraph::utils::MemoryResource *memory)
|
mgp_path(mgp_path &&other, memgraph::utils::MemoryResource *memory)
|
||||||
: vertices(std::move(other.vertices), memory), edges(std::move(other.edges), memory) {}
|
: vertices(other.vertices, memory), edges(other.edges, memory) {}
|
||||||
|
|
||||||
mgp_path(mgp_path &&other) noexcept : vertices(std::move(other.vertices)), edges(std::move(other.edges)) {}
|
mgp_path(mgp_path &&other) noexcept : vertices(other.vertices), edges(other.edges) {}
|
||||||
|
|
||||||
/// Copy construction without memgraph::utils::MemoryResource is not allowed.
|
/// Copy construction without memgraph::utils::MemoryResource is not allowed.
|
||||||
mgp_path(const mgp_path &) = delete;
|
mgp_path(const mgp_path &) = delete;
|
||||||
|
|||||||
@@ -148,6 +148,11 @@ class TypedValue {
|
|||||||
int_v = value;
|
int_v = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
explicit TypedValue(long long value, utils::MemoryResource *memory = utils::NewDeleteResource())
|
||||||
|
: memory_(memory), type_(Type::Int) {
|
||||||
|
int_v = value;
|
||||||
|
}
|
||||||
|
|
||||||
explicit TypedValue(double value, utils::MemoryResource *memory = utils::NewDeleteResource())
|
explicit TypedValue(double value, utils::MemoryResource *memory = utils::NewDeleteResource())
|
||||||
: memory_(memory), type_(Type::Double) {
|
: memory_(memory), type_(Type::Double) {
|
||||||
double_v = value;
|
double_v = value;
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ std::optional<std::vector<WalDurabilityInfo>> GetWalFiles(const std::filesystem:
|
|||||||
}
|
}
|
||||||
MG_ASSERT(!error_code, "Couldn't recover data because an error occurred: {}!", error_code.message());
|
MG_ASSERT(!error_code, "Couldn't recover data because an error occurred: {}!", error_code.message());
|
||||||
|
|
||||||
std::sort(wal_files.begin(), wal_files.end());
|
// std::sort(wal_files.begin(), wal_files.end());
|
||||||
return std::move(wal_files);
|
return std::move(wal_files);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@ std::optional<RecoveryInfo> RecoverData(const std::filesystem::path &snapshot_di
|
|||||||
if (!snapshot_files.empty()) {
|
if (!snapshot_files.empty()) {
|
||||||
spdlog::info("Try recovering from snapshot directory {}.", snapshot_directory);
|
spdlog::info("Try recovering from snapshot directory {}.", snapshot_directory);
|
||||||
// Order the files by name
|
// Order the files by name
|
||||||
std::sort(snapshot_files.begin(), snapshot_files.end());
|
// std::sort(snapshot_files.begin(), snapshot_files.end());
|
||||||
|
|
||||||
// UUID used for durability is the UUID of the last snapshot file.
|
// UUID used for durability is the UUID of the last snapshot file.
|
||||||
*uuid = snapshot_files.back().uuid;
|
*uuid = snapshot_files.back().uuid;
|
||||||
@@ -230,7 +230,7 @@ std::optional<RecoveryInfo> RecoverData(const std::filesystem::path &snapshot_di
|
|||||||
std::string uuid;
|
std::string uuid;
|
||||||
std::string epoch_id;
|
std::string epoch_id;
|
||||||
|
|
||||||
auto operator<=>(const WalFileInfo &) const = default;
|
// auto operator<=>(const WalFileInfo &) const = default;
|
||||||
};
|
};
|
||||||
std::vector<WalFileInfo> wal_files;
|
std::vector<WalFileInfo> wal_files;
|
||||||
for (const auto &item : std::filesystem::directory_iterator(wal_directory, error_code)) {
|
for (const auto &item : std::filesystem::directory_iterator(wal_directory, error_code)) {
|
||||||
@@ -247,7 +247,7 @@ std::optional<RecoveryInfo> RecoverData(const std::filesystem::path &snapshot_di
|
|||||||
spdlog::warn(utils::MessageWithLink("No snapshot or WAL file found.", "https://memgr.ph/durability"));
|
spdlog::warn(utils::MessageWithLink("No snapshot or WAL file found.", "https://memgr.ph/durability"));
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
std::sort(wal_files.begin(), wal_files.end());
|
// std::sort(wal_files.begin(), wal_files.end());
|
||||||
// UUID used for durability is the UUID of the last WAL file.
|
// UUID used for durability is the UUID of the last WAL file.
|
||||||
// Same for the epoch id.
|
// Same for the epoch id.
|
||||||
*uuid = std::move(wal_files.back().uuid);
|
*uuid = std::move(wal_files.back().uuid);
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ struct SnapshotDurabilityInfo {
|
|||||||
std::string uuid;
|
std::string uuid;
|
||||||
uint64_t start_timestamp;
|
uint64_t start_timestamp;
|
||||||
|
|
||||||
auto operator<=>(const SnapshotDurabilityInfo &) const = default;
|
// auto operator<=>(const SnapshotDurabilityInfo &) const = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Get list of snapshot files with their UUID.
|
/// Get list of snapshot files with their UUID.
|
||||||
@@ -74,7 +74,7 @@ struct WalDurabilityInfo {
|
|||||||
std::string epoch_id;
|
std::string epoch_id;
|
||||||
std::filesystem::path path;
|
std::filesystem::path path;
|
||||||
|
|
||||||
auto operator<=>(const WalDurabilityInfo &) const = default;
|
// auto operator<=>(const WalDurabilityInfo &) const = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Get list of WAL files ordered by the sequence number
|
/// Get list of WAL files ordered by the sequence number
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <bit>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "storage/v2/id_types.hpp"
|
#include "storage/v2/id_types.hpp"
|
||||||
|
|||||||
@@ -378,7 +378,7 @@ std::vector<Storage::ReplicationClient::RecoveryStep> Storage::ReplicationClient
|
|||||||
auto snapshot_files = durability::GetSnapshotFiles(storage_->snapshot_directory_, storage_->uuid_);
|
auto snapshot_files = durability::GetSnapshotFiles(storage_->snapshot_directory_, storage_->uuid_);
|
||||||
std::optional<durability::SnapshotDurabilityInfo> latest_snapshot;
|
std::optional<durability::SnapshotDurabilityInfo> latest_snapshot;
|
||||||
if (!snapshot_files.empty()) {
|
if (!snapshot_files.empty()) {
|
||||||
std::sort(snapshot_files.begin(), snapshot_files.end());
|
// std::sort(snapshot_files.begin(), snapshot_files.end());
|
||||||
latest_snapshot.emplace(std::move(snapshot_files.back()));
|
latest_snapshot.emplace(std::move(snapshot_files.back()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "storage/v2/replication/replication_server.hpp"
|
#include "storage/v2/replication/replication_server.hpp"
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
#include "storage/v2/durability/durability.hpp"
|
#include "storage/v2/durability/durability.hpp"
|
||||||
#include "storage/v2/durability/paths.hpp"
|
#include "storage/v2/durability/paths.hpp"
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ find_package(gflags REQUIRED)
|
|||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
add_library(mg-utils STATIC ${utils_src_files})
|
add_library(mg-utils STATIC ${utils_src_files})
|
||||||
target_link_libraries(mg-utils PUBLIC Boost::headers fmt::fmt spdlog::spdlog)
|
target_link_libraries(mg-utils PUBLIC Boost::headers fmt::fmt spdlog::spdlog c++experimental)
|
||||||
target_link_libraries(mg-utils PRIVATE librdtsc stdc++fs Threads::Threads gflags uuid rt)
|
target_link_libraries(mg-utils PRIVATE librdtsc stdc++fs Threads::Threads gflags uuid rt)
|
||||||
|
|
||||||
set(settings_src_files
|
set(settings_src_files
|
||||||
@@ -35,4 +35,3 @@ set(license_src_files
|
|||||||
license.cpp)
|
license.cpp)
|
||||||
add_library(mg-license STATIC ${license_src_files})
|
add_library(mg-license STATIC ${license_src_files})
|
||||||
target_link_libraries(mg-license mg-settings mg-utils)
|
target_link_libraries(mg-license mg-settings mg-utils)
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
#include "utils/async_timer.hpp"
|
#include "utils/async_timer.hpp"
|
||||||
|
|
||||||
|
#include <sys/syscall.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <csignal>
|
#include <csignal>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|||||||
@@ -277,7 +277,8 @@ std::optional<License> Decode(std::string_view license_key) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
slk::Reader reader(std::bit_cast<uint8_t *>(decoded->c_str()), decoded->size());
|
// TODO(gitbuda): Bitcast comes in clang 14
|
||||||
|
slk::Reader reader((uint8_t *)(decoded->c_str()), decoded->size());
|
||||||
std::string organization_name;
|
std::string organization_name;
|
||||||
slk::Load(&organization_name, &reader);
|
slk::Load(&organization_name, &reader);
|
||||||
int64_t valid_until{0};
|
int64_t valid_until{0};
|
||||||
|
|||||||
@@ -23,13 +23,12 @@
|
|||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
// Although <memory_resource> is in C++17, gcc libstdc++ still needs to
|
#if __clang__
|
||||||
// implement it fully. It should be available in the next major release
|
|
||||||
// version, i.e. gcc 9.x.
|
|
||||||
#if _GLIBCXX_RELEASE < 9
|
|
||||||
#include <experimental/memory_resource>
|
#include <experimental/memory_resource>
|
||||||
|
namespace std_pmr = std::experimental::fundamentals_v1::pmr;
|
||||||
#else
|
#else
|
||||||
#include <memory_resource>
|
#include <memory_resource>
|
||||||
|
namespace std_pmr = std::pmr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "utils/logging.hpp"
|
#include "utils/logging.hpp"
|
||||||
@@ -251,12 +250,8 @@ bool operator!=(const Allocator<T> &a, const Allocator<U> &b) {
|
|||||||
/// Wraps std::pmr::memory_resource for use with out MemoryResource
|
/// Wraps std::pmr::memory_resource for use with out MemoryResource
|
||||||
class StdMemoryResource final : public MemoryResource {
|
class StdMemoryResource final : public MemoryResource {
|
||||||
public:
|
public:
|
||||||
#if _GLIBCXX_RELEASE < 9
|
|
||||||
StdMemoryResource(std::experimental::pmr::memory_resource *memory) : memory_(memory) {}
|
|
||||||
#else
|
|
||||||
/// Implicitly convert std::pmr::memory_resource to StdMemoryResource
|
/// Implicitly convert std::pmr::memory_resource to StdMemoryResource
|
||||||
StdMemoryResource(std::pmr::memory_resource *memory) : memory_(memory) {}
|
StdMemoryResource(std_pmr::memory_resource *memory) : memory_(memory) {}
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void *DoAllocate(size_t bytes, size_t alignment) override {
|
void *DoAllocate(size_t bytes, size_t alignment) override {
|
||||||
@@ -282,19 +277,11 @@ class StdMemoryResource final : public MemoryResource {
|
|||||||
return *memory_ == *other_std->memory_;
|
return *memory_ == *other_std->memory_;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if _GLIBCXX_RELEASE < 9
|
std_pmr::memory_resource *memory_;
|
||||||
std::experimental::pmr::memory_resource *memory_;
|
|
||||||
#else
|
|
||||||
std::pmr::memory_resource *memory_;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline MemoryResource *NewDeleteResource() noexcept {
|
inline MemoryResource *NewDeleteResource() noexcept {
|
||||||
#if _GLIBCXX_RELEASE < 9
|
static StdMemoryResource memory(std_pmr::new_delete_resource());
|
||||||
static StdMemoryResource memory(std::experimental::pmr::new_delete_resource());
|
|
||||||
#else
|
|
||||||
static StdMemoryResource memory(std::pmr::new_delete_resource());
|
|
||||||
#endif
|
|
||||||
return &memory;
|
return &memory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include <execinfo.h>
|
#include <execinfo.h>
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "utils/on_scope_exit.hpp"
|
#include "utils/on_scope_exit.hpp"
|
||||||
|
|
||||||
|
|||||||
@@ -37,10 +37,10 @@ std::optional<T> ParseNumber(const std::string_view string, const size_t size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
T value{};
|
T value{};
|
||||||
if (const auto [p, ec] = std::from_chars(string.data(), string.data() + size, value);
|
// if (const auto [p, ec] = std::from_chars(string.data(), string.data() + size, value);
|
||||||
ec != std::errc() || p != string.data() + size) {
|
// ec != std::errc() || p != string.data() + size) {
|
||||||
return std::nullopt;
|
// return std::nullopt;
|
||||||
}
|
// }
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user