Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Implement EdgeType + Property indices #1964

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

gvolfing
Copy link
Contributor

@gvolfing gvolfing commented Apr 22, 2024

Source issue -> #662

Description

Implementation of EdgeType + Property indices.

Please delete either the [master < EPIC] or [master < Task] part, depending on what are your needs.

[master < Epic] PR

  • Write E2E tests
  • Compare the benchmarking results between the master branch and the Epic branch
  • Provide the full content or a guide for the final git message
    • [FINAL GIT MESSAGE]

[master < Task] PR

  • Provide the full content or a guide for the final git message
    • [FINAL GIT MESSAGE]

CI Testing Labels

Please select the appropriate CI test labels (CI -build=build-name -test=test-suite)

Documentation checklist

  • Add the documentation label tag
  • Add the bug / feature label tag
  • Add the milestone for which this feature is intended
    • If not known, set for a later milestone
  • Write a release note, including added/changed clauses
    • [Release note text]
  • Link the documentation PR here
    • [Documentation PR link]
  • Tag someone from docs team in the comments

@gvolfing gvolfing marked this pull request as ready for review May 9, 2024 13:49
Copy link

sonarcloud bot commented May 9, 2024

Quality Gate Passed Quality Gate passed

Issues
11 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
32.0% Duplication on New Code

See analysis details on SonarCloud

@gitbuda gitbuda modified the milestones: mg-v2.17.0, mg-v2.18.0 May 20, 2024

EdgeIndexQuery *Clone(AstStorage *storage) const override {
EdgeIndexQuery *object = storage->Create<EdgeIndexQuery>();
object->action_ = action_;
object->edge_type_ = storage->GetEdgeTypeIx(edge_type_.name);
object->properties_.resize(properties_.size());
for (auto i = 0; i < object->properties_.size(); ++i) {
object->properties_[i] = storage->GetPropertyIx(properties_[i].name);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious. Why can't we just write object->properties_[i] = properties_[i]; ?

@@ -15,6 +15,7 @@
#include <cstdint>
#include <set>

#include "storage/v2/edge.hpp"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this header file here?

@@ -391,6 +399,34 @@ PullPlanDump::PullChunk PullPlanDump::CreateEdgeTypeIndicesPullChunk() {
};
}

PullPlanDump::PullChunk PullPlanDump::CreateEdgeTypePropertyIndicesPullChunk() {
// Dump all label indices
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix comment. We dump label property indices.

}
auto properties_stringified = utils::Join(properties_string, ", ");

if (properties.size() > 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to have this validation before we allocate memory in vectors for properties and properties_string.

@@ -64,8 +64,10 @@ enum class Marker : uint8_t {
DELTA_LABEL_PROPERTY_INDEX_STATS_CLEAR = 0x64,
DELTA_EDGE_TYPE_INDEX_CREATE = 0x65,
DELTA_EDGE_TYPE_INDEX_DROP = 0x66,
DELTA_TEXT_INDEX_CREATE = 0x67,
DELTA_TEXT_INDEX_DROP = 0x68,
DELTA_EDGE_TYPE_PROPERTY_INDEX_CREATE = 0x67,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure that we want to change marker for Text index creation?
I'm afraid that customers who uses Text Index will be surprised during restore. I would suggest to not change existing markers of durability

if (!edge_type) throw RecoveryFailure("Invalid WAL data!");
delta.operation_edge_type_property.edge_type = std::move(*edge_type);
auto property = decoder->ReadString();
if (!property) throw RecoveryFailure("Invalid WAL data!");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we throw more accurate exceptions? I mean to not throw Invalid WAL data! but Invalid WAL data! Property for edge type property index is corrupted.

@@ -165,6 +166,8 @@ class OpChecker : public BaseOpChecker {
public:
void CheckOp(LogicalOperator &op, const SymbolTable &symbol_table) override {
auto *expected_op = dynamic_cast<TOp *>(&op);
auto debug_op_typeinfo = op.GetTypeInfo().name;
auto debug_expected_typeinfo = TOp::kType.name;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need these 2 variables? If yes, why we don't use them?

}

// // NOLINTNEXTLINE(hicpp-special-member-functions)
// TEST_P(DurabilityTest, EdgeTypePropertyIndexRecoveredWithoutEdgeTypeIndices) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we plan to uncomment this?


EXPECT_THAT(this->GetIds(acc->Edges(this->edge_type_id1, this->edge_prop_id1, View::NEW), View::NEW),
UnorderedElementsAre(0, 1, 2, 3, 4));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we also need to add changing property value on indexed edge type + property to test UpdateOnModifiedEdge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs needed Docs needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants