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

Count index missing a node after live import #3528

Closed
mehdiym opened this issue Jun 6, 2019 · 5 comments
Closed

Count index missing a node after live import #3528

mehdiym opened this issue Jun 6, 2019 · 5 comments
Labels
area/querylang Issues related to the query language specification and implementation. kind/bug Something is broken. status/accepted We accept to investigate/work on it.

Comments

@mehdiym
Copy link

mehdiym commented Jun 6, 2019

  • What version of Dgraph are you using?
    1.0.15

  • What is the hardware spec (RAM, OS)?
    16Go RAM, Linux Debian stable

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

    • set a schema including a @count index (and a @reverse index) on a predicate
    • live load a previous export
    • query with a count function at root : eq(count(predicate), 1)
  • Expected behaviour and actual result.
    Expected : No count different than 1
    Actual : One node with a count greater than one

My request in ratel:

{
  me(func: eq(count(answer), 1)) {
    count(answer)
  }
}

The response:

{
  "extensions": {
    "server_latency": {
      "parsing_ns": 18314,
      "processing_ns": 2869208,
      "encoding_ns": 1473700
    },
    "txn": {
      "start_ts": 1163
    }
  },
  "data": {
    "me": [
      {
        "count(answer)": 2
      },
      {
        "count(answer)": 1
      },
      {
        "count(answer)": 1
      },
      {
        "count(answer)": 1
      }
    ]
  }
}

If I go to the schema tab, disable the @count index and re-enable it, then the query works as expected.

Note: My live import inserts many nodes but it is always that same node that gets wrong.

@MichelDiz
Copy link
Contributor

Hi, Can you share a RDF example that we can reproduce this?

@mehdiym
Copy link
Author

mehdiym commented Jun 6, 2019

Alright, where can I send you my gziped export and my schema?
I'd rather not publicly upload my dump here.

@MichelDiz MichelDiz added area/querylang Issues related to the query language specification and implementation. kind/bug Something is broken. labels Jun 6, 2019
@danielmai
Copy link
Contributor

Interesting that re-indexing the @count index makes the query work as expected.

I can reproduce the issue the steps you shared. Funny, when I run dgraph live --conc 1 to turn off concurrent mutations (default concurrency is 10), the query works as expected. Even --conc 2 shows the query issue. I suspect this issue is related with concurrent mutations to the same subject-predicate.

@mehdiym
Copy link
Author

mehdiym commented Jun 7, 2019

I'm "glad" you can reproduce it.
Please note that I just reproduced the same bug but on nodes that were NOT imported by the live tool: on a fully generated database.
It happens during running my high concurrency integration tests.

@danielmai danielmai added the status/accepted We accept to investigate/work on it. label Jun 7, 2019
@danielmai
Copy link
Contributor

This issue is fixed with #3545 that has been merged in master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/querylang Issues related to the query language specification and implementation. kind/bug Something is broken. status/accepted We accept to investigate/work on it.
Development

No branches or pull requests

3 participants