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

Version ignored when using rest / batch #4808

Closed
kataik opened this issue Aug 17, 2015 · 1 comment
Closed

Version ignored when using rest / batch #4808

kataik opened this issue Aug 17, 2015 · 1 comment
Assignees
Labels
Milestone

Comments

@kataik
Copy link

kataik commented Aug 17, 2015

Hi All,
I've been trying to execute the following operation against our OrientDB:

{
    "transaction": true,
    "operations": [{
        "record": {
            "userID": "35862601",
            "externalID": "35862601",
            "@rid": "#12:44", "@class": "User", "@version": 5
        },
        "type": "u"
    }]
}

The response I get is:
com.orientechnologies.orient.core.exception.OConcurrentModificationException: Cannot UPDATE the record #12:44 because the version is not the latest. Probably you are updating an old record or it has been modified by another user (db=v5 your=v0)

your=v0 which means that my `"@Version": 5' is ignored.

Am I using an incorrect syntax? I've found no such example in the documentation. Could somebody help me please?

@lvca lvca self-assigned this Aug 18, 2015
@lvca lvca added the bug label Aug 18, 2015
@lvca lvca added this to the 2.1.1 milestone Aug 18, 2015
lvca added a commit that referenced this issue Aug 18, 2015
lvca added a commit that referenced this issue Aug 18, 2015
@lvca lvca closed this as completed Aug 18, 2015
@kstock
Copy link

kstock commented Mar 30, 2016

VERSIONS:
I've noticed this issue reappearing in OrientDB Server v2.0.13 and orientdb-community-2.2.0-beta.


PROBLEM:

I'm getting the same problem as this issue, the version is being ignored when I try to update via http batch api.

ADDITIONALLY, this issue makes it look like the version must be passed for HTTP batch however in the documentation example I do not see the version being passed.
http://orientdb.com/docs/last/OrientDB-REST.html#batch

This may be another issue, but I've seen http batch update not return this error in OrientDB 2.1.6 however the update was completely overwriting the document (erasing fields that were not in the update request). The documentation does not specify that update means a partial update so I do not know if this is expected behavior.


REPLICATION:

in my example replication I use:
https://github.com/jkbrzt/httpie

with OrientDB Server v2.0.13 I created a data base named test and inserted one document via

insert into V set foo = 1
$ http -b -a admin:admin POST ":2480/command/test/sql/select from V limit 1" 
{
    "result": [
        {
            "@class": "V", 
            "@rid": "#9:0", 
            "@type": "d", 
            "@version": 1, 
            "foo": 1
        }
    ]
}

attempt to update using data:

{
  "transaction": true,
  "operations": [
    {
      "type": "u",
      "record": {
        "foo": 2,
        "@rid": "#9:0",
        "@version": 1
      }
    }
  ]
}
$ DATA='{"operations":[{"record":{"@version":1,"@rid":"#9:0","foo":2},"type":"u"}],"transaction":true}'

$ echo $DATA | http -b -a admin:admin POST ":2480/batch/test/"

fails with

com.orientechnologies.orient.core.exception.OConcurrentModificationException: Cannot UPDATE the record #9:0 because the version is not the latest. Probably you are updating an old record or it has been modified by another user (db=v1 your=v0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants