Remove extraneous comments and #includes

This commit is contained in:
Ante Pušić 2024-01-19 00:30:15 +01:00
parent 0571da7116
commit e4e3044fce
10 changed files with 11 additions and 82 deletions

View File

@ -251,7 +251,6 @@ VertexAccessor &CreateLocalVertex(const NodeCreationInfo &node_info, Frame *fram
} }
MultiPropsInitChecked(&new_node, properties); MultiPropsInitChecked(&new_node, properties);
// TODO antepusic check if text search is turned on
if (flags::run_time::GetTextSearchEnabled()) { if (flags::run_time::GetTextSearchEnabled()) {
new_node.impl_.storage_->indices_.text_index_->AddNode(new_node.impl_.vertex_, new_node.impl_.storage_); new_node.impl_.storage_->indices_.text_index_->AddNode(new_node.impl_.vertex_, new_node.impl_.storage_);
} }
@ -2824,7 +2823,6 @@ bool SetProperty::SetPropertyCursor::Pull(Frame &frame, ExecutionContext &contex
context.trigger_context_collector->RegisterSetObjectProperty(lhs.ValueVertex(), self_.property_, context.trigger_context_collector->RegisterSetObjectProperty(lhs.ValueVertex(), self_.property_,
TypedValue{std::move(old_value)}, TypedValue{rhs}); TypedValue{std::move(old_value)}, TypedValue{rhs});
} }
// TODO antepusic: update text index
if (flags::run_time::GetTextSearchEnabled()) { if (flags::run_time::GetTextSearchEnabled()) {
auto new_node = lhs.ValueVertex(); auto new_node = lhs.ValueVertex();
new_node.impl_.storage_->indices_.text_index_->UpdateNode(new_node.impl_.vertex_, new_node.impl_.storage_); new_node.impl_.storage_->indices_.text_index_->UpdateNode(new_node.impl_.vertex_, new_node.impl_.storage_);
@ -2985,7 +2983,6 @@ void SetPropertiesOnRecord(TRecordAccessor *record, const TypedValue &rhs, SetPr
case TypedValue::Type::Vertex: { case TypedValue::Type::Vertex: {
PropertiesMap new_properties = get_props(rhs.ValueVertex()); PropertiesMap new_properties = get_props(rhs.ValueVertex());
update_props(new_properties); update_props(new_properties);
// TODO antepusic: update text index
if (flags::run_time::GetTextSearchEnabled()) { if (flags::run_time::GetTextSearchEnabled()) {
auto new_node = rhs.ValueVertex(); auto new_node = rhs.ValueVertex();
new_node.impl_.storage_->indices_.text_index_->UpdateNode(new_node.impl_.vertex_, new_node.impl_.storage_); new_node.impl_.storage_->indices_.text_index_->UpdateNode(new_node.impl_.vertex_, new_node.impl_.storage_);
@ -3136,7 +3133,6 @@ bool SetLabels::SetLabelsCursor::Pull(Frame &frame, ExecutionContext &context) {
} }
} }
// TODO antepusic check if text search is turned on
if (flags::run_time::GetTextSearchEnabled()) { if (flags::run_time::GetTextSearchEnabled()) {
vertex.impl_.storage_->indices_.text_index_->UpdateNode(vertex.impl_.vertex_, vertex.impl_.storage_); vertex.impl_.storage_->indices_.text_index_->UpdateNode(vertex.impl_.vertex_, vertex.impl_.storage_);
} }
@ -3302,7 +3298,6 @@ bool RemoveLabels::RemoveLabelsCursor::Pull(Frame &frame, ExecutionContext &cont
} }
} }
// TODO antepusic check if text search is turned on
if (flags::run_time::GetTextSearchEnabled()) { if (flags::run_time::GetTextSearchEnabled()) {
vertex.impl_.storage_->indices_.text_index_->UpdateNode(vertex.impl_.vertex_, vertex.impl_.storage_, self_.labels_); vertex.impl_.storage_->indices_.text_index_->UpdateNode(vertex.impl_.vertex_, vertex.impl_.storage_, self_.labels_);
} }

View File

@ -38,21 +38,6 @@ void Indices::RemoveObsoleteEntries(uint64_t oldest_active_start_timestamp) cons
->RemoveObsoleteEntries(oldest_active_start_timestamp); ->RemoveObsoleteEntries(oldest_active_start_timestamp);
} }
// void Indices::UpdateOnAddLabel(LabelId label, Vertex *vertex, const Transaction &tx) const {
// label_index_->UpdateOnAddLabel(label, vertex, tx);
// label_property_index_->UpdateOnAddLabel(label, vertex, tx);
// }
// void Indices::UpdateOnRemoveLabel(LabelId label, Vertex *vertex, const Transaction &tx) const {
// label_index_->UpdateOnRemoveLabel(label, vertex, tx);
// label_property_index_->UpdateOnRemoveLabel(label, vertex, tx);
// }
// void Indices::UpdateOnSetProperty(PropertyId property, const PropertyValue &value, Vertex *vertex,
// const Transaction &tx) const {
// label_property_index_->UpdateOnSetProperty(property, value, vertex, tx);
// }
void Indices::UpdateOnAddLabel(LabelId label, Vertex *vertex, const Transaction &tx, Storage *storage, void Indices::UpdateOnAddLabel(LabelId label, Vertex *vertex, const Transaction &tx, Storage *storage,
bool update_text_index) const { bool update_text_index) const {
label_index_->UpdateOnAddLabel(label, vertex, tx); label_index_->UpdateOnAddLabel(label, vertex, tx);

View File

@ -56,17 +56,13 @@ struct Indices {
/// This function should be called whenever a label is added to a vertex. /// This function should be called whenever a label is added to a vertex.
/// @throw std::bad_alloc /// @throw std::bad_alloc
// void UpdateOnAddLabel(LabelId label, Vertex *vertex, const Transaction &tx) const;
void UpdateOnAddLabel(LabelId label, Vertex *vertex, const Transaction &tx, Storage *storage, void UpdateOnAddLabel(LabelId label, Vertex *vertex, const Transaction &tx, Storage *storage,
bool update_text_index) const; bool update_text_index) const;
// void UpdateOnRemoveLabel(LabelId label, Vertex *vertex, const Transaction &tx) const;
void UpdateOnRemoveLabel(LabelId label, Vertex *vertex, const Transaction &tx, bool update_text_index) const; void UpdateOnRemoveLabel(LabelId label, Vertex *vertex, const Transaction &tx, bool update_text_index) const;
/// This function should be called whenever a property is modified on a vertex. /// This function should be called whenever a property is modified on a vertex.
/// @throw std::bad_alloc /// @throw std::bad_alloc
// void UpdateOnSetProperty(PropertyId property, const PropertyValue &value, Vertex *vertex,
// const Transaction &tx) const;
void UpdateOnSetProperty(PropertyId property, const PropertyValue &value, Vertex *vertex, const Transaction &tx, void UpdateOnSetProperty(PropertyId property, const PropertyValue &value, Vertex *vertex, const Transaction &tx,
Storage *storage, bool update_text_index) const; Storage *storage, bool update_text_index) const;

View File

@ -11,7 +11,6 @@
#include "storage/v2/indices/text_index.hpp" #include "storage/v2/indices/text_index.hpp"
#include "query/db_accessor.hpp" #include "query/db_accessor.hpp"
#include "storage/v2/mgcxx_mock.hpp"
#include "storage/v2/view.hpp" #include "storage/v2/view.hpp"
#include "text_search.hpp" #include "text_search.hpp"

View File

@ -12,7 +12,6 @@
#pragma once #pragma once
#include "storage/v2/id_types.hpp" #include "storage/v2/id_types.hpp"
#include "storage/v2/mgcxx_mock.hpp"
#include "storage/v2/transaction.hpp" #include "storage/v2/transaction.hpp"
#include "storage/v2/vertex.hpp" #include "storage/v2/vertex.hpp"
#include "text_search.hpp" #include "text_search.hpp"

View File

@ -21,7 +21,6 @@
#include <type_traits> #include <type_traits>
#include <utility> #include <utility>
#include "storage/v2/mgcxx_mock.hpp"
#include "storage/v2/temporal.hpp" #include "storage/v2/temporal.hpp"
#include "utils/cast.hpp" #include "utils/cast.hpp"
#include "utils/logging.hpp" #include "utils/logging.hpp"

View File

@ -11,7 +11,6 @@
#pragma once #pragma once
#include <json/json.hpp>
#include <map> #include <map>
#include <set> #include <set>

View File

@ -13,6 +13,7 @@
#include "absl/container/flat_hash_set.h" #include "absl/container/flat_hash_set.h"
#include "spdlog/spdlog.h" #include "spdlog/spdlog.h"
#include "flags/run_time_configurable.hpp"
#include "storage/v2/disk/name_id_mapper.hpp" #include "storage/v2/disk/name_id_mapper.hpp"
#include "storage/v2/storage.hpp" #include "storage/v2/storage.hpp"
#include "storage/v2/transaction.hpp" #include "storage/v2/transaction.hpp"
@ -147,8 +148,9 @@ Result<std::optional<VertexAccessor>> Storage::Accessor::DeleteVertex(VertexAcce
return res.GetError(); return res.GetError();
} }
// TODO antepusic remove from text index if (flags::run_time::GetTextSearchEnabled()) {
vertex->storage_->indices_.text_index_->RemoveNode(vertex->vertex_); vertex->storage_->indices_.text_index_->RemoveNode(vertex->vertex_);
}
const auto &value = res.GetValue(); const auto &value = res.GetValue();
if (!value) { if (!value) {
@ -187,8 +189,9 @@ Result<std::optional<std::pair<VertexAccessor, std::vector<EdgeAccessor>>>> Stor
return res.GetError(); return res.GetError();
} }
// TODO antepusic remove from text index if (flags::run_time::GetTextSearchEnabled()) {
vertex->storage_->indices_.text_index_->RemoveNode(vertex->vertex_); vertex->storage_->indices_.text_index_->RemoveNode(vertex->vertex_);
}
auto &value = res.GetValue(); auto &value = res.GetValue();
if (!value) { if (!value) {
@ -278,10 +281,11 @@ Storage::Accessor::DetachDelete(std::vector<VertexAccessor *> nodes, std::vector
return maybe_deleted_vertices.GetError(); return maybe_deleted_vertices.GetError();
} }
// TODO antepusic delete from text index here if (flags::run_time::GetTextSearchEnabled()) {
for (auto node : nodes_to_delete) { for (auto *node : nodes_to_delete) {
storage_->indices_.text_index_->RemoveNode(node); storage_->indices_.text_index_->RemoveNode(node);
} }
}
auto deleted_vertices = maybe_deleted_vertices.GetValue(); auto deleted_vertices = maybe_deleted_vertices.GetValue();

View File

@ -28,7 +28,6 @@
#include "storage/v2/durability/wal.hpp" #include "storage/v2/durability/wal.hpp"
#include "storage/v2/edge_accessor.hpp" #include "storage/v2/edge_accessor.hpp"
#include "storage/v2/indices/indices.hpp" #include "storage/v2/indices/indices.hpp"
#include "storage/v2/mgcxx_mock.hpp"
#include "storage/v2/mvcc.hpp" #include "storage/v2/mvcc.hpp"
#include "storage/v2/replication/enums.hpp" #include "storage/v2/replication/enums.hpp"
#include "storage/v2/replication/replication_client.hpp" #include "storage/v2/replication/replication_client.hpp"

View File

@ -17,13 +17,11 @@
#include <fmt/format.h> #include <fmt/format.h>
#include "flags/run_time_configurable.hpp"
#include "query/exceptions.hpp" #include "query/exceptions.hpp"
#include "storage/v2/disk/storage.hpp" #include "storage/v2/disk/storage.hpp"
#include "storage/v2/edge_accessor.hpp" #include "storage/v2/edge_accessor.hpp"
#include "storage/v2/id_types.hpp" #include "storage/v2/id_types.hpp"
#include "storage/v2/indices/indices.hpp" #include "storage/v2/indices/indices.hpp"
#include "storage/v2/mgcxx_mock.hpp"
#include "storage/v2/mvcc.hpp" #include "storage/v2/mvcc.hpp"
#include "storage/v2/property_value.hpp" #include "storage/v2/property_value.hpp"
#include "storage/v2/result.hpp" #include "storage/v2/result.hpp"
@ -290,20 +288,6 @@ Result<PropertyValue> VertexAccessor::SetProperty(PropertyId property, const Pro
storage_->indices_.UpdateOnSetProperty(property, value, vertex_, *transaction_, storage_, update_text_index); storage_->indices_.UpdateOnSetProperty(property, value, vertex_, *transaction_, storage_, update_text_index);
transaction_->manyDeltasCache.Invalidate(vertex_, property); transaction_->manyDeltasCache.Invalidate(vertex_, property);
// if (flags::run_time::GetTextSearchEnabled() && update_text_index) {
// for (auto *index_context : storage_->indices_.text_index_->GetApplicableTextIndices(vertex_)) {
// auto search_input = mgcxx::text_search::SearchInput{
// .search_query = fmt::format("metadata.gid:{}", vertex_->gid.AsInt()), .return_fields = {"data"}};
// auto search_result = mgcxx::text_search::search(*index_context, search_input);
// mgcxx::text_search::delete_document(*index_context, search_input, true);
// auto new_properties = search_result.docs[0].data; // TODO (pending real Tantivy results): parse result to
// // JSON, set property and convert back to string
// auto new_properties_document = mgcxx::text_search::DocumentInput{.data = new_properties};
// mgcxx::text_search::add_document(*index_context, new_properties_document, true);
// }
// }
return std::move(current_value); return std::move(current_value);
} }
@ -340,15 +324,6 @@ Result<bool> VertexAccessor::InitProperties(const std::map<storage::PropertyId,
}}; }};
std::invoke(atomic_memory_block); std::invoke(atomic_memory_block);
// if (flags::run_time::GetTextSearchEnabled() && update_text_index) {
// for (auto *index_context : storage_->indices_.text_index_->GetApplicableTextIndices(vertex_)) {
// auto new_properties_document =
// mgcxx::text_search::DocumentInput{}; // TODO (pending real Tantivy operation): create a JSON, set
// // properties and convert to string
// mgcxx::text_search::add_document(*index_context, new_properties_document, true);
// }
// }
return result; return result;
} }
@ -370,19 +345,6 @@ Result<std::vector<std::tuple<PropertyId, PropertyValue, PropertyValue>>> Vertex
utils::AtomicMemoryBlock atomic_memory_block{[storage = storage_, transaction = transaction_, vertex = vertex_, utils::AtomicMemoryBlock atomic_memory_block{[storage = storage_, transaction = transaction_, vertex = vertex_,
&properties, &id_old_new_change, update_text_index]() { &properties, &id_old_new_change, update_text_index]() {
id_old_new_change.emplace(vertex->properties.UpdateProperties(properties)); id_old_new_change.emplace(vertex->properties.UpdateProperties(properties));
// if (flags::run_time::GetTextSearchEnabled()) {
// for (auto *index_context : storage->indices_.text_index_->GetApplicableTextIndices(vertex)) {
// auto search_input = mgcxx::text_search::SearchInput{
// .search_query = fmt::format("metadata.gid:{}", vertex->gid.AsInt()), .return_fields = {"data"}};
// auto search_result = mgcxx::text_search::search(*index_context, search_input);
// mgcxx::text_search::delete_document(*index_context, search_input, true);
// auto new_properties = search_result.docs[0].data; // TODO (pending real Tantivy results): parse result to
// // JSON, set property and convert back to string
// auto new_properties_document = mgcxx::text_search::DocumentInput{.data = new_properties};
// mgcxx::text_search::add_document(*index_context, new_properties_document, true);
// }
// }
if (!id_old_new_change.has_value()) { if (!id_old_new_change.has_value()) {
return; return;
@ -430,14 +392,6 @@ Result<std::map<PropertyId, PropertyValue>> VertexAccessor::ClearProperties(bool
} }
vertex->properties.ClearProperties(); vertex->properties.ClearProperties();
// if (flags::run_time::GetTextSearchEnabled()) {
// for (auto *index_context : storage->indices_.text_index_->GetApplicableTextIndices(vertex)) {
// auto search_input =
// mgcxx::text_search::SearchInput{.search_query = fmt::format("metadata.gid:{}",
// vertex->gid.AsInt())};
// mgcxx::text_search::delete_document(*index_context, search_input, true);
// }
// }
}}; }};
std::invoke(atomic_memory_block); std::invoke(atomic_memory_block);