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

[master < T1209] Fix API bug on accessing deleted object #1209

Merged
merged 15 commits into from Sep 8, 2023

Conversation

antoniofilipovic
Copy link
Collaborator

@antoniofilipovic antoniofilipovic commented Aug 29, 2023

Issue: When doing detach delete on graph, and accessing deleted objects from C++ API, if you are accessing From and To vertex of deleted edge, error occurs that you are accessing deleted vertex although it shouldn't.

When a vertex is detach deleted, its VertexAccessor is marked for_deleted_, and out|in EdgeAccessors are marked for_deleted_. VertexAccessors which you can access from EdgeAccessor are not marked for_deleted_. This creates a slight problem when working with deleted objects in API, because only EdgeAccessor is marked for_deleted_ not also its VertexAccessors. Therefore some VertexAccessors have wrong information, marking for_deleted_ as false instead of true.

[master < Task] PR

  • Check, and update documentation if necessary
  • Provide the full content or a guide for the final git message

To keep docs changelog up to date, one more thing to do:

  • Write a release note here, including added/changed clauses
  • Tag someone from docs team in the comments

@gitbuda gitbuda added this to the mg-v2.11.0 milestone Sep 1, 2023
@antoniofilipovic antoniofilipovic marked this pull request as ready for review September 6, 2023 10:48
@antepusic antepusic added bug bug Ready for review PR is ready for review labels Sep 6, 2023
@Josipmrden Josipmrden changed the title [master < T] Fix API bug on accessing deleted object [master < T1209] Fix API bug on accessing deleted object Sep 6, 2023
Copy link
Contributor

@antepusic antepusic left a comment

Choose a reason for hiding this comment

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

Everything looks fine, but I’d prefer to extend FromVertex and ToVertex instead of creating new methods. The new ones’ names (FromVertexWithDeleted and ToVertexWithDeleted) really aren’t very clear, and tbh I can’t think of a name that’s both clear and descriptive.

Clarification: I recommend sth like this:

VertexAccessor EdgeAccessor::FromVertex(bool edge_for_deleted = false) const {
  if (UNLIKELY(edge_for_deleted)) {
    return VertexAccessor{from_vertex_, transaction_, indices_,
                          constraints_, config_,      for_deleted_ && from_vertex_->deleted};
  } 
  return VertexAccessor{from_vertex_, transaction_, indices_, constraints_, config_};
}

tests/e2e/triggers/on_delete_triggers.cpp Outdated Show resolved Hide resolved
src/query/db_accessor.hpp Outdated Show resolved Hide resolved
src/storage/v2/edge_accessor.cpp Show resolved Hide resolved
@antoniofilipovic antoniofilipovic added Ship it PR ready to be merged and removed Ready for review PR is ready for review labels Sep 8, 2023
@gitbuda gitbuda removed the Ship it PR ready to be merged label Sep 8, 2023
@gitbuda gitbuda merged commit b094fdb into master Sep 8, 2023
6 checks passed
@gitbuda gitbuda deleted the fix-trigger-for-deleted-api-issue branch September 8, 2023 17:52
@vpavicic vpavicic added the Docs - changelog only Docs - changelog only label Sep 12, 2023
@vpavicic
Copy link
Contributor

@antoniofilipovic - can you write me a release note (RN)?

@antoniofilipovic
Copy link
Collaborator Author

This PR enables to access deleted vertex from deleted edge when being processed as part of trigger function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bug Docs - changelog only Docs - changelog only
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

6 participants