cayleygraph / cayleygraph/cayley

deletion of reinserted quad gives quad does not exist error, quad is returned by /api/v2/read

Open
#737 8 comments 0 reactions 1 assignee Claimed by @dennwc View on GitHub
bug
Dominant language
Go
Stars
15.1k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

**Description**

Using boltDB, and the V2 rest apis, after removing a quad, re-adding the quad, then attempting to delete the quad again results in a quad does not exist error from the api. After receiving the error, a call to /api/v2/read, does return the quad, however the /api/v2/delete api still behaves as though the quad does not exist.

**Steps to reproduce the issue**
(Invocation of the rest api's was performed using the swagger client v2 rest apis)

1. Init an empty bolt db, and start cayley with boltdb as backend using `cayley http --db=bolt --dbpath=/tmp/someBoltDBFolder/`
1. Using the api/v2/write api, add the following quads

```
"Feeling happy" .
"Feeling sad" .
"Feeling happy" .
.
```

`curl -X POST "http://localhost:64210/api/v2/write" -H "accept: application/json" -H "Content-Type: application/n-quads" -d " \"Feeling happy\" . \"Feeling sad\" . \"Feeling happy\" . ."`

2. Using the api/v2/write api, add the following quad
` .`

`curl -X POST "http://localhost:64210/api/v2/write" -H "accept: application/json" -H "Content-Type: application/n-quads" -d " ."`

3. Using the api/v2/delete api, delete the quad
` .`

`curl -X POST "http://localhost:64210/api/v2/delete" -H "accept: application/json" -H "Content-Type: application/n-quads" -d " ."`

4. Using the api/v2/write api, reinsert the deleted quad
` .`

5.Using the api/v2/delete api, attempt to delete the quad again
` .`

`curl -X POST "http://localhost:64210/api/v2/delete" -H "accept: application/json" -H "Content-Type: application/n-quads" -d " ."`

This yields the error:
{
"error": "delete -- -> : quad does not exist"
}

6. Using the /api/v2/read api, confirm the quad actually does exist:
curl -X GET "http://localhost:64210/api/v2/read?format=nquads" -H "accept: application/n-quads"

```
"Feeling happy" .
"Feeling sad" .
"Feeling happy" .
.
.

```

**Received results:**

Step 5, should have resulted in a successful deletion, but instead reported the quad did not exist.
```
{
"error": "delete -- -> : quad does not exist"
}
```

**Expected results:**
Deletion in step 5 would succeed.

**Output of `cayley version` or commit hash:**
./cayley version
Cayley version: 0.7.3
Git commit hash: 782194b030b5170bbb0852c5e29f209e8012be37
Build date: 2018-04-23T15:41:54Z

**Environment details:**
OSX 10.12.16

Backend database: bundled bolt version with cayley. Also reproduced with leveldb.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.