Dgraph: has(predicate) captures nodes which had the predicate deleted

Created on 7 Sep 2018  路  7Comments  路  Source: dgraph-io/dgraph




Bug report

Desktop (please complete the following information):

  • OS: Linux + dockerImage dgraph/dgraph:v1.0.8
  • Dgraph Version: v1.0.8
  • RAM available: 8GB with "lru_mb 4096" for each Dgraph Server instance
  • Storage Type: Cloud Storage
  • Dgraph Client: ratel


if Containerization (please complete the following information):

  • Main Container Software: kubernetes v1.11.1
  • Dgraph TAG Version: v1.0.8 1dd8376f

Describe the bug

When using has(predicate) in queries we have strange results. After some debugging I found that many nodes without having the predicate were included in results.

The ones I have identified had the predicates removed.

This happens with dates, but I have not tested other predicate types.

To Reproduce
Steps to reproduce the behavior:

  • create a bunch of nodes with dates
  • delete the dates from those nodes
  • query with had(date_predicate)
  • observe nodes being returned: among the results, nodes with the predicate previously deleted are present.

{
  broken(func: has(obj.date_ended)) {
    uid
    obj.date_ended
  }
}

returns


      {
        "uid": "0x5184"
      },
      {
        "uid": "0x618c"
      },
      {
        "uid": "0x6a65"
      },
      {
        "uid": "0x9c37"
      },
      {
        "uid": "0x9d28"
      },

...

Expected behavior

not receiving nodes where predicates don't exist

Additional context

This is a fresh install of dgraph with all data added today using the dgo driver using api.NQuad

kinbug

All 7 comments

Duplicated of https://github.com/dgraph-io/dgraph/issues/2212
Should be fixed by 999a4e0c42b9a10c4111de52eb5703ad682a2bbe.
Is related to https://github.com/dgraph-io/dgraph/issues/2484

"This is a bug with has queries where empty PL's are not ignored." pawanrawal.

@slawo In this case, you are using @reverse?

It seems related but it happens in v1.0.8 so I did not bother linking this.

Also I have not tried this on other predicate types.

The issue is quite important as I use has() to filter data. In most cases on dates I'm able to use le(predicate, CURRENT_DATE) to get away with it but in some cases I need not has() and there I don't believe I can go around the issue.

The point is that it should have been fixed.

If you can make a sample mutation, the way you use it. Would help.
Mostly we need to know if you are using @reverse in your schema. At the level using "has".
We need to know why it's happening. Since we have a fix 999a4e0c42b9a10c4111de52eb5703ad682a2bbe .

However, in any case by your report its seem to be 80% chance of being duplicated.

We changed the way Posting List Deletions are happening, so maybe that's causing it. Needs investigation.

This should now be fixed. Can you test, @slawo ?

Hey @manishrjain I did a test with image: 'dgraph/dgraph:v1.0.9-rc1' and is working as expected.


{
    "set": [
        {
        "obj.date_ended": "2018-08-14T11:56:46Z"
      },
      {
        "obj.date_ended": "2018-08-14T11:56:46Z"
      },
      {
        "obj.date_ended": "2018-08-14T11:56:46Z"
      },
      {
        "obj.date_ended": "2018-08-14T11:56:46Z"
      },
      {
        "obj.date_ended": "2018-08-14T11:56:46Z"
      }
    ]
}


```js

{
delete {
<0x1> * .
<0x4> * .
<0x7> * .
<0x8> * .
<0x9> * .
}
}


And tried too

```JS
{
    delete {
      <0x1> * * .
      <0x4> * * .
      <0x7> * * .
      <0x8> * * .
      <0x9> * * .
    }
}

Thanks, @MichelDiz !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

protheusfr picture protheusfr  路  4Comments

yupengfei picture yupengfei  路  4Comments

andrewsmedina picture andrewsmedina  路  4Comments

armaneous picture armaneous  路  3Comments

fritzblue picture fritzblue  路  5Comments