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 mutation on non-existing triple deletes index entry #3803

Closed
prashant-shahi opened this issue Aug 13, 2019 · 3 comments

Comments

@prashant-shahi
Copy link
Member

commented Aug 13, 2019

  • What version of Dgraph are you using?
Dgraph version   : v1.0.12-rc3-649-g2883f667
Commit SHA-1     : 2883f667
Commit timestamp : 2019-08-08 18:47:40 +0530
Branch           : master
Go version       : go1.12.5
  • Have you tried reproducing the issue with the latest release?
    Yes.

  • Steps to reproduce the issue (command/config used to run Dgraph).

    • Follow the tour to setup Dgraph.
    • Follow the tour to alter schema and load data.
    • Open Dgraph UI by visiting http://localhost:8000 and get the uid of Michael using following graphql+- query.
      {
          get_michael(func: anyofterms(name, "Michael")) {
              uid
              name
          }
      }
    • Go to delete data tour. Run the following :
      {
          delete {
              <uid_of_michael> <name> "Asdf" .
          }
      }
    • Now, using the graphql+- query of 3rd step again, we will get empty response. But when we query using uid or has, we will see that name predicate with value Michael is still there.
      {
          get_michael(func: uid(uid_of_michael)) {
              uid
              name
          }
      }
  • Expected behavior and actual result.
    Not affecting any data at all.

@MichelDiz MichelDiz added the kind/bug label Aug 13, 2019

@danielmai

This comment has been minimized.

Copy link
Member

commented Aug 13, 2019

This does not happen in v1.0.16 because delete in v1.0 only supports "S P *" for value predicates instead of specifying the same value.

@MichelDiz

This comment has been minimized.

Copy link
Member

commented Aug 13, 2019

This happens in master. But if we do <uid_of_michael> <name> "Michael" . Works fine.
The issue is, deleting something without the correct value ("Asdf" ≠ "Michael"). We should show some error or message.

@MichelDiz

This comment has been minimized.

Copy link
Member

commented Aug 13, 2019

BTW, the real issue here is that when you delete a predicate(name) with the wrong value. It looks like it was removed from indexing. I've tested with others persons*. All nodes and names are still there. But I can't use eq, anyofterms and so on. But you can find it by other predicates, by has or by uid.

And the right usage is "S P *" <0xfffd8d67d832e097> <name> * .

@danielmai danielmai changed the title Delete mutation on non-existing single triple causes abnormality Delete mutation on non-existing triple deletes index entry Aug 14, 2019

pawanrawal added a commit that referenced this issue Aug 21, 2019

Bugfix: Set found to false to avoid deleting index edge when value do…
…esn't match. (#3843)

Return found as false to avoid deleting index corresponding to a uid when the value doesn't match. For scalar values, after fingerprinting found is always true as values get fingerprinted to math.MaxUint64. Hence we return found as false from this second check. Fixes #3803.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.