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

expand_edge=false option causes all mutations to fail #2547

Closed
juls858 opened this issue Aug 23, 2018 · 4 comments
Closed

expand_edge=false option causes all mutations to fail #2547

juls858 opened this issue Aug 23, 2018 · 4 comments
Assignees
Labels
kind/bug Something is broken.

Comments

@juls858
Copy link

juls858 commented Aug 23, 2018

If you suspect this could be a bug, follow the template.

  • What version of Dgraph are you using?
    Dgraph version : v1.0.7
    Commit SHA-1 : f180344
    Commit timestamp : 2018-08-10 13:00:21 -0700
    Branch : HEAD

  • Have you tried reproducing the issue with latest release?
    Yes

  • What is the hardware spec (RAM, OS)?
    macOS High Sierra 10.13.6
    16 GB RAM
    Docker Version 18.06.0-ce-mac70 (26399)

  • Steps to reproduce the issue (command/config used to run Dgraph).
    Create new Dgraph instance with --expand_edge=false. This issue only occurs when this option is used on the initial run and with a new docker volume.

docker_compose.yml:

services:
  zero:
    image: dgraph/dgraph:latest
    volumes:
      - type: volume
        source: dgraph
        target: /dgraph
        volume:
          nocopy: true
    ports:
      - 5080:5080
      - 6080:6080
    restart: on-failure
    command: dgraph zero --my=zero:5080
  server:
    image: dgraph/dgraph:latest
    volumes:
      - type: volume
        source: dgraph
        target: /dgraph
        volume:
          nocopy: true
    ports:
      - 8080:8080
      - 9080:9080
    restart: on-failure
    command: dgraph server --expand_edge=false --my=server:7080 --lru_mb=4096 --zero=zero:5080
  ratel:
    image: dgraph/dgraph:latest
    volumes:
      - type: volume
        source: dgraph
        target: /dgraph
        volume:
          nocopy: true
    ports:
      - 8000:8000
    command: dgraph-ratel

volumes:
  dgraph:

Create a schema:

name: string @index(term) @lang .
age: int @index(int) .
friend: uid @count .

Insert data:

{
  set {
    _:michael <name> "Michael" .
    
  }
}

Result:

{
  "data": {
    "code": "Success",
    "message": "Done",
    "uids": {
      "michael": "0x1"
    }
  },
  "extensions": {
    "server_latency": {
      "parsing_ns": 13900,
      "processing_ns": 5005700
    },
    "txn": {
      "start_ts": 2,
      "keys": [
        "AAAEbmFtZQAAAAAAAAAAAQ=="
      ],
      "lin_read": {
        "ids": {
          "1": 7
        }
      }
    }
  }
}
-----
COMMIT ERROR (Firefox only):

{
  "errors": [
    {
      "code": "Error",
      "message": "Transaction has been aborted. Please retry."
    }
  ]
}
  • Expected behaviour and actual result.
    I expect to be able to insert data or run a /MUTATE query
    All /MUTATE queries fail and are aborted.
@manishrjain
Copy link
Contributor

Hey @danielmai , can you verify this bug?

@danielmai
Copy link
Contributor

I'm able to reproduce the bug with the same Docker Compose file.

/mutate with the header X-Dgraph-CommitNow: true results in the transaction being aborted. The mutation succeeds without it.

/mutate

$ curl -i -XPOST http://localhost:8080/mutate -d '{
   set {
     _:michael <name> "Michael" .

   }
}'

HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, X-Auth-Token, Cache-Control, X-Requested-With, X-Dgraph-CommitNow, X-Dgraph-LinRead, X-Dgraph-Vars, X-Dgraph-MutationType, X-Dgraph-IgnoreIndexConflict
Access-Control-Allow-Methods: POST, OPTIONS
Access-Control-Allow-Origin: *
Connection: close
Content-Type: application/json
Date: Thu, 23 Aug 2018 20:49:40 GMT
Content-Length: 233

{"data":{"code":"Success","message":"Done","uids":{"michael":"0x18"}},"extensions":{"server_latency":{"parsing_ns":15100,"processing_ns":3912800},"txn":{"start_ts":46,"keys":["AAAEbmFtZQAAAAAAAAAAGA=="],"lin_read":{"ids":{"1":93}}}}}

/mutate with X-Dgraph-CommitNow: true

$ curl -i -XPOST -H 'X-Dgraph-CommitNow: true' http://localhost:8080/mutate -d '{
  set {
    _:michael <name> "Michael" .

  }
}'
HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, X-Auth-Token, Cache-Control, X-Requested-With, X-Dgraph-CommitNow, X-Dgraph-LinRead, X-Dgraph-Vars, X-Dgraph-MutationType, X-Dgraph-IgnoreIndexConflict
Access-Control-Allow-Methods: POST, OPTIONS
Access-Control-Allow-Origin: *
Connection: close
Content-Type: application/json
Date: Thu, 23 Aug 2018 20:50:12 GMT
Content-Length: 144

{"errors":[{"code":"ErrorInvalidRequest","message":"rpc error: code = Aborted desc = Transaction has been aborted. Please retry."}],"data":null}

@danielmai danielmai assigned manishrjain and unassigned danielmai Aug 23, 2018
@danielmai danielmai added the kind/bug Something is broken. label Aug 23, 2018
@danielmai danielmai assigned danielmai and unassigned manishrjain Aug 23, 2018
@danielmai
Copy link
Contributor

This happens on https://tour.dgraph.io as well.

  1. Get a copy of the docker-compose.yml from the initial issue post with --expand_edge=false.
  2. Run docker-compose up.
  3. Click Run button on Load Schema step at https://tour.dgraph.io/intro/3/.
  4. Click Run button on Load Data step at https://tour.dgraph.io/intro/4/.
  5. Receive this response in the Response window:
{
  "errors": [
    {
      "code": "ErrorInvalidRequest",
      "message": "rpc error: code = Aborted desc = Transaction has been aborted. Please retry."
    }
  ],
  "data": null
}

@emersonwood
Copy link

I tested out the 1.0.8 release with expand_edge=false and then ran the test here: https://github.com/dgraph-io/dgraph/blob/master/contrib/integration/testtxn/main_test.go#L49

If I set CommitNow: true on the mutation, the transaction would abort when trying to mutate.

If I set CommitNow: false on the mutation, the transaction would abort when trying to commit manually.

dna2github pushed a commit to dna2fork/dgraph that referenced this issue Jul 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something is broken.
Development

No branches or pull requests

4 participants