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

Delete links with indices #187

Merged
merged 9 commits into from
Jul 19, 2024
Merged

Conversation

kirillvasilenko
Copy link
Collaborator

@kirillvasilenko kirillvasilenko commented Jul 18, 2024

Fixed OVertexEntity.deleteLink() and Co, OVertexEntity.setLink() and Co. Added tests.

@kirillvasilenko kirillvasilenko marked this pull request as ready for review July 18, 2024 14:46
@andrii0lomakin
Copy link
Collaborator

@kirillvasilenko can you answer my questions?

@kirillvasilenko
Copy link
Collaborator Author

@andrii0lomakin, sure. As soon as you ask them :)

image

@andrii0lomakin
Copy link
Collaborator

image

@kirillvasilenko
Copy link
Collaborator Author

@andrii0lomakin, it seems distributed anomalies in action. I will answer you here as I do not have those questions on my side :)

How it is possible that the bag is null

Normally, it should not be possible. But if we delete an edge when the complementary property has already been created but has not been initialized, it is possible.

Do not save the edge?

Yeah, I tried, the tests work. I kept this save() because of the "not save() phobia" I got while working with Orient. If you prefer me to remove that operator, no problem, only say.

@andrii0lomakin
Copy link
Collaborator

Yeah, I tried, the tests work. I kept this save() because of the "not save() phobia" I got while working with Orient. If you prefer me >to remove that operator, no problem, only say.
I am afraid and can recreate record, please remove this line and I will merge PR

@kirillvasilenko
Copy link
Collaborator Author

@andrii0lomakin, you got it.

Now, additionally to the "not saved()" phobia, I have the "saved() but may be recreated" phobia :((

private fun OVertex.deleteTargetEntityIdIfLinkIndexed(linkName: String, targetId: ORID) {
val linkTargetEntityIdPropertyName = linkTargetEntityIdPropertyName(linkName)
if (requireSchemaClass().existsProperty(linkTargetEntityIdPropertyName)) {
val bag = getProperty<ORidBag>(linkTargetEntityIdPropertyName) ?: ORidBag()
Copy link
Collaborator

Choose a reason for hiding this comment

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

How is it possible that ridbag will not exist in this case? Is it not a bug?


val edge = findEdge(edgeClassName, target.vertex.identity)
edge?.delete()
edge?.save<OEdge>()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did you try not to save the deleted edge? It looks like, using this approach, we risk recreating them instead of deleting them.

@andrii0lomakin andrii0lomakin merged commit c06120b into graph-store Jul 19, 2024
1 check passed
@andrii0lomakin andrii0lomakin deleted the delete-links-with-indices branch July 19, 2024 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants