From 30522ccaf176afff1b9572ee94b091353d4ba512 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ante=20Pu=C5=A1i=C4=87?= Date: Sun, 18 Feb 2024 19:35:10 +0100 Subject: [PATCH] Switch to experimental flags --- src/flags/experimental.cpp | 9 +++++---- src/flags/experimental.hpp | 1 + src/flags/run_time_configurable.cpp | 13 ------------- src/flags/run_time_configurable.hpp | 7 ------- src/query/exceptions.hpp | 4 +++- src/query/interpreter.cpp | 5 +++-- src/query/plan/operator.cpp | 15 ++++++++------- src/query/procedure/mg_procedure_impl.cpp | 11 ++++++----- src/storage/v2/disk/storage.cpp | 5 +++-- src/storage/v2/durability/durability.cpp | 2 +- src/storage/v2/durability/snapshot.cpp | 5 +++-- src/storage/v2/indices/text_index.cpp | 19 ++++++++++--------- src/storage/v2/inmemory/storage.cpp | 5 +++-- src/storage/v2/storage.cpp | 3 ++- tests/e2e/configuration/default_config.py | 2 +- tests/e2e/text_search/workloads.yaml | 2 +- 16 files changed, 50 insertions(+), 58 deletions(-) diff --git a/src/flags/experimental.cpp b/src/flags/experimental.cpp index 7bd26a837..0bc38ac02 100644 --- a/src/flags/experimental.cpp +++ b/src/flags/experimental.cpp @@ -19,13 +19,14 @@ // Bolt server flags. // NOLINTNEXTLINE (cppcoreguidelines-avoid-non-const-global-variables) DEFINE_string(experimental_enabled, "", - "Experimental features to be used, comma seperated. Options [system-replication]"); + "Experimental features to be used, comma-separated. Options [system-replication, text-search]"); using namespace std::string_view_literals; namespace memgraph::flags { -auto const mapping = std::map{std::pair{"system-replication"sv, Experiments::SYSTEM_REPLICATION}}; +auto const mapping = std::map{std::pair{"system-replication"sv, Experiments::SYSTEM_REPLICATION}, + std::pair{"text-search"sv, Experiments::TEXT_SEARCH}}; auto ExperimentsInstance() -> Experiments & { static auto instance = Experiments{}; @@ -44,7 +45,7 @@ bool AreExperimentsEnabled(Experiments experiments) { void InitializeExperimental() { namespace rv = ranges::views; - auto const connonicalize_string = [](auto &&rng) { + auto const canonicalize_string = [](auto &&rng) { auto const is_space = [](auto c) { return c == ' '; }; auto const to_lower = [](unsigned char c) { return std::tolower(c); }; @@ -55,7 +56,7 @@ void InitializeExperimental() { auto const mapping_end = mapping.cend(); using underlying_type = std::underlying_type_t; auto to_set = underlying_type{}; - for (auto &&experiment : FLAGS_experimental_enabled | rv::split(',') | rv::transform(connonicalize_string)) { + for (auto &&experiment : FLAGS_experimental_enabled | rv::split(',') | rv::transform(canonicalize_string)) { if (auto it = mapping.find(experiment); it != mapping_end) { to_set |= static_cast(it->second); } diff --git a/src/flags/experimental.hpp b/src/flags/experimental.hpp index ec4db2037..169990282 100644 --- a/src/flags/experimental.hpp +++ b/src/flags/experimental.hpp @@ -23,6 +23,7 @@ namespace memgraph::flags { // old experiments can be reused once code cleanup has happened enum class Experiments : uint8_t { SYSTEM_REPLICATION = 1 << 0, + TEXT_SEARCH = 1 << 1, }; bool AreExperimentsEnabled(Experiments experiments); diff --git a/src/flags/run_time_configurable.cpp b/src/flags/run_time_configurable.cpp index 1bf4ec2e9..6c0fc54ac 100644 --- a/src/flags/run_time_configurable.cpp +++ b/src/flags/run_time_configurable.cpp @@ -54,9 +54,6 @@ DEFINE_double(query_execution_timeout_sec, 600, // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) DEFINE_bool(cartesian_product_enabled, true, "Enable cartesian product expansion."); -// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) -DEFINE_bool(experimental_text_search_enabled, false, "Enable experimental text search."); - namespace { // Bolt server name constexpr auto kServerNameSettingKey = "server.name"; @@ -76,14 +73,10 @@ constexpr auto kLogToStderrGFlagsKey = "also_log_to_stderr"; constexpr auto kCartesianProductEnabledSettingKey = "cartesian-product-enabled"; constexpr auto kCartesianProductEnabledGFlagsKey = "cartesian-product-enabled"; -constexpr auto kExperimentalTextSearchEnabledSettingKey = "experimental-text-search-enabled"; -constexpr auto kExperimentalTextSearchEnabledGFlagsKey = "experimental-text-search-enabled"; - // NOLINTBEGIN(cppcoreguidelines-avoid-non-const-global-variables) // Local cache-like thing std::atomic execution_timeout_sec_; std::atomic cartesian_product_enabled_{true}; -std::atomic experimental_text_search_enabled_{true}; // NOLINTEND(cppcoreguidelines-avoid-non-const-global-variables) auto ToLLEnum(std::string_view val) { @@ -193,10 +186,6 @@ void Initialize() { register_flag( kCartesianProductEnabledGFlagsKey, kCartesianProductEnabledSettingKey, !kRestore, [](const std::string &val) { cartesian_product_enabled_ = val == "true"; }, ValidBoolStr); - - register_flag( - kExperimentalTextSearchEnabledGFlagsKey, kExperimentalTextSearchEnabledSettingKey, !kRestore, - [](const std::string &val) { experimental_text_search_enabled_ = val == "true"; }, ValidBoolStr); } std::string GetServerName() { @@ -210,6 +199,4 @@ double GetExecutionTimeout() { return execution_timeout_sec_; } bool GetCartesianProductEnabled() { return cartesian_product_enabled_; } -bool GetExperimentalTextSearchEnabled() { return experimental_text_search_enabled_; } - } // namespace memgraph::flags::run_time diff --git a/src/flags/run_time_configurable.hpp b/src/flags/run_time_configurable.hpp index 8f0cdbf0d..b215d6540 100644 --- a/src/flags/run_time_configurable.hpp +++ b/src/flags/run_time_configurable.hpp @@ -42,11 +42,4 @@ double GetExecutionTimeout(); */ bool GetCartesianProductEnabled(); -/** - * @brief Get whether text search is enabled - * - * @return bool - */ -bool GetExperimentalTextSearchEnabled(); - } // namespace memgraph::flags::run_time diff --git a/src/query/exceptions.hpp b/src/query/exceptions.hpp index aeb0432b7..a4c25fbae 100644 --- a/src/query/exceptions.hpp +++ b/src/query/exceptions.hpp @@ -440,7 +440,9 @@ class TextSearchException : public QueryException { class TextSearchDisabledException : public TextSearchException { public: - TextSearchDisabledException() : TextSearchException("To use text indices, enable the text search feature.") {} + TextSearchDisabledException() + : TextSearchException( + "To use text indices and text search, start Memgraph with the experimental text search feature enabled.") {} SPECIALIZE_GET_EXCEPTION_NAME(TextSearchDisabledException) }; diff --git a/src/query/interpreter.cpp b/src/query/interpreter.cpp index 289e4ca29..8b991554c 100644 --- a/src/query/interpreter.cpp +++ b/src/query/interpreter.cpp @@ -39,6 +39,7 @@ #include "dbms/dbms_handler.hpp" #include "dbms/global.hpp" #include "dbms/inmemory/storage_helper.hpp" +#include "flags/experimental.hpp" #include "flags/replication.hpp" #include "flags/run_time_configurable.hpp" #include "glue/communication.hpp" @@ -2716,7 +2717,7 @@ PreparedQuery PrepareTextIndexQuery(ParsedQuery parsed_query, bool in_explicit_t // TODO: not just storage + invalidate_plan_cache. Need a DB transaction (for replication) handler = [dba, label, index_name, invalidate_plan_cache = std::move(invalidate_plan_cache)](Notification &index_notification) { - if (!flags::run_time::GetExperimentalTextSearchEnabled()) { + if (!flags::AreExperimentsEnabled(flags::Experiments::TEXT_SEARCH)) { throw TextSearchDisabledException(); } dba->CreateTextIndex(index_name, label); @@ -2730,7 +2731,7 @@ PreparedQuery PrepareTextIndexQuery(ParsedQuery parsed_query, bool in_explicit_t // TODO: not just storage + invalidate_plan_cache. Need a DB transaction (for replication) handler = [dba, index_name, invalidate_plan_cache = std::move(invalidate_plan_cache)](Notification &index_notification) { - if (!flags::run_time::GetExperimentalTextSearchEnabled()) { + if (!flags::AreExperimentsEnabled(flags::Experiments::TEXT_SEARCH)) { throw TextSearchDisabledException(); } dba->DropTextIndex(index_name); diff --git a/src/query/plan/operator.cpp b/src/query/plan/operator.cpp index 28c64dee6..7519b5d10 100644 --- a/src/query/plan/operator.cpp +++ b/src/query/plan/operator.cpp @@ -32,6 +32,7 @@ #include "spdlog/spdlog.h" #include "csv/parsing.hpp" +#include "flags/experimental.hpp" #include "license/license.hpp" #include "query/auth_checker.hpp" #include "query/context.hpp" @@ -251,7 +252,7 @@ VertexAccessor &CreateLocalVertex(const NodeCreationInfo &node_info, Frame *fram } MultiPropsInitChecked(&new_node, properties); - if (flags::run_time::GetExperimentalTextSearchEnabled()) { + if (flags::AreExperimentsEnabled(flags::Experiments::TEXT_SEARCH)) { context.db_accessor->TextIndexAddVertex(&new_node); } @@ -2885,7 +2886,7 @@ bool SetProperty::SetPropertyCursor::Pull(Frame &frame, ExecutionContext &contex context.trigger_context_collector->RegisterSetObjectProperty(lhs.ValueVertex(), self_.property_, TypedValue{std::move(old_value)}, TypedValue{rhs}); } - if (flags::run_time::GetExperimentalTextSearchEnabled()) { + if (flags::AreExperimentsEnabled(flags::Experiments::TEXT_SEARCH)) { auto new_node = lhs.ValueVertex(); context.db_accessor->TextIndexUpdateVertex(&new_node); } @@ -3045,7 +3046,7 @@ void SetPropertiesOnRecord(TRecordAccessor *record, const TypedValue &rhs, SetPr case TypedValue::Type::Vertex: { PropertiesMap new_properties = get_props(rhs.ValueVertex()); update_props(new_properties); - if (flags::run_time::GetExperimentalTextSearchEnabled()) { + if (flags::AreExperimentsEnabled(flags::Experiments::TEXT_SEARCH)) { auto new_node = rhs.ValueVertex(); context->db_accessor->TextIndexUpdateVertex(&new_node); } @@ -3106,7 +3107,7 @@ bool SetProperties::SetPropertiesCursor::Pull(Frame &frame, ExecutionContext &co } #endif SetPropertiesOnRecord(&lhs.ValueVertex(), rhs, self_.op_, &context, cached_name_id_); - if (flags::run_time::GetExperimentalTextSearchEnabled()) { + if (flags::AreExperimentsEnabled(flags::Experiments::TEXT_SEARCH)) { context.db_accessor->TextIndexUpdateVertex(&lhs.ValueVertex()); } break; @@ -3198,7 +3199,7 @@ bool SetLabels::SetLabelsCursor::Pull(Frame &frame, ExecutionContext &context) { } } - if (flags::run_time::GetExperimentalTextSearchEnabled()) { + if (flags::AreExperimentsEnabled(flags::Experiments::TEXT_SEARCH)) { context.db_accessor->TextIndexUpdateVertex(&vertex); } @@ -3273,7 +3274,7 @@ bool RemoveProperty::RemovePropertyCursor::Pull(Frame &frame, ExecutionContext & } #endif remove_prop(&lhs.ValueVertex()); - if (flags::run_time::GetExperimentalTextSearchEnabled()) { + if (flags::AreExperimentsEnabled(flags::Experiments::TEXT_SEARCH)) { auto &updated_vertex = lhs.ValueVertex(); context.db_accessor->TextIndexUpdateVertex(&updated_vertex); } @@ -3367,7 +3368,7 @@ bool RemoveLabels::RemoveLabelsCursor::Pull(Frame &frame, ExecutionContext &cont } } - if (flags::run_time::GetExperimentalTextSearchEnabled()) { + if (flags::AreExperimentsEnabled(flags::Experiments::TEXT_SEARCH)) { context.db_accessor->TextIndexUpdateVertex(&vertex, self_.labels_); } diff --git a/src/query/procedure/mg_procedure_impl.cpp b/src/query/procedure/mg_procedure_impl.cpp index a7d099123..3c31e3642 100644 --- a/src/query/procedure/mg_procedure_impl.cpp +++ b/src/query/procedure/mg_procedure_impl.cpp @@ -23,6 +23,7 @@ #include #include +#include "flags/experimental.hpp" #include "flags/run_time_configurable.hpp" #include "license/license.hpp" #include "mg_procedure.h" @@ -1843,7 +1844,7 @@ mgp_error mgp_vertex_set_property(struct mgp_vertex *v, const char *property_nam const auto result = std::visit( [prop_key, property_value](auto &impl) { return impl.SetProperty(prop_key, ToPropertyValue(*property_value)); }, v->impl); - if (memgraph::flags::run_time::GetExperimentalTextSearchEnabled() && !result.HasError()) { + if (memgraph::flags::AreExperimentsEnabled(memgraph::flags::Experiments::TEXT_SEARCH) && !result.HasError()) { auto v_impl = v->getImpl(); v->graph->getImpl()->TextIndexUpdateVertex(&v_impl); } @@ -1904,7 +1905,7 @@ mgp_error mgp_vertex_set_properties(struct mgp_vertex *v, struct mgp_map *proper } const auto result = v->getImpl().UpdateProperties(props); - if (memgraph::flags::run_time::GetExperimentalTextSearchEnabled() && !result.HasError()) { + if (memgraph::flags::AreExperimentsEnabled(memgraph::flags::Experiments::TEXT_SEARCH) && !result.HasError()) { auto v_impl = v->getImpl(); v->graph->getImpl()->TextIndexUpdateVertex(&v_impl); } @@ -1966,7 +1967,7 @@ mgp_error mgp_vertex_add_label(struct mgp_vertex *v, mgp_label label) { } const auto result = std::visit([label_id](auto &impl) { return impl.AddLabel(label_id); }, v->impl); - if (memgraph::flags::run_time::GetExperimentalTextSearchEnabled() && !result.HasError()) { + if (memgraph::flags::AreExperimentsEnabled(memgraph::flags::Experiments::TEXT_SEARCH) && !result.HasError()) { auto v_impl = v->getImpl(); v->graph->getImpl()->TextIndexUpdateVertex(&v_impl); } @@ -2012,7 +2013,7 @@ mgp_error mgp_vertex_remove_label(struct mgp_vertex *v, mgp_label label) { throw ImmutableObjectException{"Cannot remove a label from an immutable vertex!"}; } const auto result = std::visit([label_id](auto &impl) { return impl.RemoveLabel(label_id); }, v->impl); - if (memgraph::flags::run_time::GetExperimentalTextSearchEnabled() && !result.HasError()) { + if (memgraph::flags::AreExperimentsEnabled(memgraph::flags::Experiments::TEXT_SEARCH) && !result.HasError()) { auto v_impl = v->getImpl(); v->graph->getImpl()->TextIndexUpdateVertex(&v_impl, {label_id}); } @@ -2986,7 +2987,7 @@ mgp_error mgp_graph_create_vertex(struct mgp_graph *graph, mgp_memory *memory, m auto *vertex = std::visit( [=](auto *impl) { return NewRawMgpObject(memory, impl->InsertVertex(), graph); }, graph->impl); // TODO antepusic update text index - if (memgraph::flags::run_time::GetExperimentalTextSearchEnabled()) { + if (memgraph::flags::AreExperimentsEnabled(memgraph::flags::Experiments::TEXT_SEARCH)) { auto v_impl = vertex->getImpl(); vertex->graph->getImpl()->TextIndexAddVertex(&v_impl); } diff --git a/src/storage/v2/disk/storage.cpp b/src/storage/v2/disk/storage.cpp index b880815c1..aefded8c4 100644 --- a/src/storage/v2/disk/storage.cpp +++ b/src/storage/v2/disk/storage.cpp @@ -29,6 +29,7 @@ #include #include +#include "flags/experimental.hpp" #include "flags/run_time_configurable.hpp" #include "kvstore/kvstore.hpp" #include "spdlog/spdlog.h" @@ -1766,7 +1767,7 @@ utils::BasicResult DiskStorage::DiskAccessor::Co return StorageManipulationError{SerializationError{}}; } spdlog::trace("rocksdb: Commit successful"); - if (flags::run_time::GetExperimentalTextSearchEnabled()) { + if (flags::AreExperimentsEnabled(flags::Experiments::TEXT_SEARCH)) { disk_storage->indices_.text_index_.Commit(); } @@ -1887,7 +1888,7 @@ void DiskStorage::DiskAccessor::Abort() { // query_plan_accumulate_aggregate.cpp transaction_.disk_transaction_->Rollback(); transaction_.disk_transaction_->ClearSnapshot(); - if (flags::run_time::GetExperimentalTextSearchEnabled()) { + if (flags::AreExperimentsEnabled(flags::Experiments::TEXT_SEARCH)) { storage_->indices_.text_index_.Rollback(); } delete transaction_.disk_transaction_; diff --git a/src/storage/v2/durability/durability.cpp b/src/storage/v2/durability/durability.cpp index 893a353d8..46797e177 100644 --- a/src/storage/v2/durability/durability.cpp +++ b/src/storage/v2/durability/durability.cpp @@ -197,7 +197,7 @@ void RecoverIndicesAndStats(const RecoveredIndicesAndConstraints::IndicesMetadat } spdlog::info("Label+property indices statistics are recreated."); - if (flags::run_time::GetExperimentalTextSearchEnabled()) { + if (flags::AreExperimentsEnabled(flags::Experiments::TEXT_SEARCH)) { // Recover text indices. spdlog::info("Recreating {} text indices from metadata.", indices_metadata.text_indices.size()); auto &mem_text_index = indices->text_index_; diff --git a/src/storage/v2/durability/snapshot.cpp b/src/storage/v2/durability/snapshot.cpp index fbb2a0b2c..0507193db 100644 --- a/src/storage/v2/durability/snapshot.cpp +++ b/src/storage/v2/durability/snapshot.cpp @@ -13,6 +13,7 @@ #include +#include "flags/experimental.hpp" #include "flags/run_time_configurable.hpp" #include "spdlog/spdlog.h" #include "storage/v2/durability/exceptions.hpp" @@ -1631,7 +1632,7 @@ RecoveredSnapshot LoadSnapshot(const std::filesystem::path &path, utils::SkipLis } // Recover text indices. - if (flags::run_time::GetExperimentalTextSearchEnabled()) { + if (flags::AreExperimentsEnabled(flags::Experiments::TEXT_SEARCH)) { auto size = snapshot.ReadUint(); if (!size) throw RecoveryFailure("Couldn't recover the number of text indices!"); spdlog::info("Recovering metadata of {} text indices.", *size); @@ -2126,7 +2127,7 @@ void CreateSnapshot(Storage *storage, Transaction *transaction, const std::files } // Write text indices. - if (flags::run_time::GetExperimentalTextSearchEnabled()) { + if (flags::AreExperimentsEnabled(flags::Experiments::TEXT_SEARCH)) { auto text_indices = storage->indices_.text_index_.ListIndices(); snapshot.WriteUint(text_indices.size()); for (const auto &item : text_indices) { diff --git a/src/storage/v2/indices/text_index.cpp b/src/storage/v2/indices/text_index.cpp index 5a5c29ecb..dc144214a 100644 --- a/src/storage/v2/indices/text_index.cpp +++ b/src/storage/v2/indices/text_index.cpp @@ -10,6 +10,7 @@ // licenses/APL.txt. #include "storage/v2/indices/text_index.hpp" +#include "flags/experimental.hpp" #include "flags/run_time_configurable.hpp" #include "query/db_accessor.hpp" #include "storage/v2/view.hpp" @@ -24,7 +25,7 @@ std::string GetPropertyName(PropertyId prop_id, NameIdMapper *name_id_mapper) { } void TextIndex::CreateEmptyIndex(const std::string &index_name, LabelId label) { - if (!flags::run_time::GetExperimentalTextSearchEnabled()) { + if (!flags::AreExperimentsEnabled(flags::Experiments::TEXT_SEARCH)) { throw query::TextSearchDisabledException(); } @@ -78,7 +79,7 @@ nlohmann::json TextIndex::SerializeProperties(const std::map TextIndex::GetApplicableTextIndices(const std::vector &labels) { - if (!flags::run_time::GetExperimentalTextSearchEnabled()) { + if (!flags::AreExperimentsEnabled(flags::Experiments::TEXT_SEARCH)) { throw query::TextSearchDisabledException(); } @@ -132,7 +133,7 @@ void TextIndex::CommitLoadedNodes(mgcxx::text_search::Context &index_context) { void TextIndex::AddNode(Vertex *vertex_after_update, NameIdMapper *name_id_mapper, const std::vector &applicable_text_indices) { - if (!flags::run_time::GetExperimentalTextSearchEnabled()) { + if (!flags::AreExperimentsEnabled(flags::Experiments::TEXT_SEARCH)) { throw query::TextSearchDisabledException(); } @@ -142,7 +143,7 @@ void TextIndex::AddNode(Vertex *vertex_after_update, NameIdMapper *name_id_mappe } void TextIndex::AddNode(Vertex *vertex_after_update, NameIdMapper *name_id_mapper) { - if (!flags::run_time::GetExperimentalTextSearchEnabled()) { + if (!flags::AreExperimentsEnabled(flags::Experiments::TEXT_SEARCH)) { throw query::TextSearchDisabledException(); } @@ -153,7 +154,7 @@ void TextIndex::AddNode(Vertex *vertex_after_update, NameIdMapper *name_id_mappe void TextIndex::UpdateNode(Vertex *vertex_after_update, NameIdMapper *name_id_mapper, const std::vector &removed_labels) { - if (!flags::run_time::GetExperimentalTextSearchEnabled()) { + if (!flags::AreExperimentsEnabled(flags::Experiments::TEXT_SEARCH)) { throw query::TextSearchDisabledException(); } @@ -170,7 +171,7 @@ void TextIndex::UpdateNode(Vertex *vertex_after_update, NameIdMapper *name_id_ma void TextIndex::RemoveNode(Vertex *vertex_after_update, const std::vector &applicable_text_indices) { - if (!flags::run_time::GetExperimentalTextSearchEnabled()) { + if (!flags::AreExperimentsEnabled(flags::Experiments::TEXT_SEARCH)) { throw query::TextSearchDisabledException(); } @@ -187,7 +188,7 @@ void TextIndex::RemoveNode(Vertex *vertex_after_update, } void TextIndex::RemoveNode(Vertex *vertex_after_update) { - if (!flags::run_time::GetExperimentalTextSearchEnabled()) { + if (!flags::AreExperimentsEnabled(flags::Experiments::TEXT_SEARCH)) { throw query::TextSearchDisabledException(); } @@ -231,7 +232,7 @@ void TextIndex::RecoverIndex(const std::string &index_name, LabelId label, } LabelId TextIndex::DropIndex(const std::string &index_name) { - if (!flags::run_time::GetExperimentalTextSearchEnabled()) { + if (!flags::AreExperimentsEnabled(flags::Experiments::TEXT_SEARCH)) { throw query::TextSearchDisabledException(); } @@ -255,7 +256,7 @@ LabelId TextIndex::DropIndex(const std::string &index_name) { bool TextIndex::IndexExists(const std::string &index_name) const { return index_.contains(index_name); } std::vector TextIndex::Search(const std::string &index_name, const std::string &search_query) { - if (!flags::run_time::GetExperimentalTextSearchEnabled()) { + if (!flags::AreExperimentsEnabled(flags::Experiments::TEXT_SEARCH)) { throw query::TextSearchDisabledException(); } diff --git a/src/storage/v2/inmemory/storage.cpp b/src/storage/v2/inmemory/storage.cpp index 5729386f2..b723f2657 100644 --- a/src/storage/v2/inmemory/storage.cpp +++ b/src/storage/v2/inmemory/storage.cpp @@ -14,6 +14,7 @@ #include #include #include "dbms/constants.hpp" +#include "flags/experimental.hpp" #include "flags/run_time_configurable.hpp" #include "memory/global_memory_control.hpp" #include "storage/v2/durability/durability.hpp" @@ -876,7 +877,7 @@ utils::BasicResult InMemoryStorage::InMemoryAcce return StorageManipulationError{*unique_constraint_violation}; } - if (flags::run_time::GetExperimentalTextSearchEnabled()) { + if (flags::AreExperimentsEnabled(flags::Experiments::TEXT_SEARCH)) { mem_storage->indices_.text_index_.Commit(); } } @@ -1201,7 +1202,7 @@ void InMemoryStorage::InMemoryAccessor::Abort() { for (auto const &[property, prop_vertices] : property_cleanup) { storage_->indices_.AbortEntries(property, prop_vertices, transaction_.start_timestamp); } - if (flags::run_time::GetExperimentalTextSearchEnabled()) { + if (flags::AreExperimentsEnabled(flags::Experiments::TEXT_SEARCH)) { storage_->indices_.text_index_.Rollback(); } diff --git a/src/storage/v2/storage.cpp b/src/storage/v2/storage.cpp index 29e37f5d8..e5498a435 100644 --- a/src/storage/v2/storage.cpp +++ b/src/storage/v2/storage.cpp @@ -13,6 +13,7 @@ #include "absl/container/flat_hash_set.h" #include "spdlog/spdlog.h" +#include "flags/experimental.hpp" #include "flags/run_time_configurable.hpp" #include "storage/v2/disk/name_id_mapper.hpp" #include "storage/v2/storage.hpp" @@ -274,7 +275,7 @@ Storage::Accessor::DetachDelete(std::vector nodes, std::vector return maybe_deleted_vertices.GetError(); } - if (flags::run_time::GetExperimentalTextSearchEnabled()) { + if (flags::AreExperimentsEnabled(flags::Experiments::TEXT_SEARCH)) { for (auto *node : nodes_to_delete) { storage_->indices_.text_index_.RemoveNode(node); } diff --git a/tests/e2e/configuration/default_config.py b/tests/e2e/configuration/default_config.py index de05a5617..29c66eb6f 100644 --- a/tests/e2e/configuration/default_config.py +++ b/tests/e2e/configuration/default_config.py @@ -228,6 +228,6 @@ startup_config_dict = { "experimental_enabled": ( "", "", - "Experimental features to be used, comma seperated. Options [system-replication]", + "Experimental features to be used, comma-separated. Options [system-replication, text-search]", ), } diff --git a/tests/e2e/text_search/workloads.yaml b/tests/e2e/text_search/workloads.yaml index 8029627da..bd0e511bc 100644 --- a/tests/e2e/text_search/workloads.yaml +++ b/tests/e2e/text_search/workloads.yaml @@ -1,7 +1,7 @@ text_search_cluster: &text_search_cluster cluster: main: - args: ["--bolt-port", "7687", "--log-level=TRACE", "--experimental-text-search-enabled=true"] + args: ["--bolt-port", "7687", "--log-level=TRACE", "--experimental-enabled=text-search"] log_file: "text_search.log" setup_queries: [] validation_queries: []