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

fix for deletion of reinserted causing a quad does not exist error #747

Merged
merged 3 commits into from
Oct 21, 2018
Merged

Conversation

3pCode
Copy link
Contributor

@3pCode 3pCode commented Oct 21, 2018

When reinserting a previously deleted quad, and attempting to then delete it a quad does not exist error was given for the the kv stores, issue was retrieval of the primitive from the log was finding the prviously deleted, not the previously inserted quad. Change retrieval from the log to iterate in reverse to ensure the latest is retrieved when multiple hits. Added unit test.

@3pCode 3pCode requested a review from dennwc as a code owner October 21, 2018 00:16
Copy link
Member

@dennwc dennwc left a comment

Choose a reason for hiding this comment

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

Thank you for tracking this down. The change looks good, only a few minor comments:

for i := 0; i < 2; i++ {
w.AddQuad(quad.Make("<bob>", "<follows>", "<sally>", nil))
err = w.RemoveQuad(quad.Make("<bob>", "<follows>", "<sally>", nil))
assert.Nil(t, err, "Remove quad failed")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
assert.Nil(t, err, "Remove quad failed")
require.NoError(t, err, "Remove quad failed")

})

for i := 0; i < 2; i++ {
w.AddQuad(quad.Make("<bob>", "<follows>", "<sally>", nil))
Copy link
Member

Choose a reason for hiding this comment

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

Please check an error when adding quads

@@ -675,9 +675,10 @@ func (qs *QuadStore) hasPrimitive(ctx context.Context, tx BucketTx, p *proto.Pri
if !get && unique {
return p, nil
}
for _, x := range options {
for ix := len(options) - 1; ix >= 0; ix-- {
Copy link
Member

Choose a reason for hiding this comment

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

Using i as a name is fine

Suggested change
for ix := len(options) - 1; ix >= 0; ix-- {
for i := len(options) - 1; i >= 0; i-- {

@dennwc dennwc added this to the v0.7.5 milestone Oct 21, 2018
Copy link
Member

@dennwc dennwc left a comment

Choose a reason for hiding this comment

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

LGTM!

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