You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Jack Park <ja...@topicquests.org> on 2012/12/27 05:47:55 UTC

New user: version conflict for ....

I am running against a networked Solr4 installation -- but not using
any of the cloud apparatus. I wish to update a document (Node) with
new information. I send back as a partial update using SolrJ's add()
command
document id
the new or updated field
version number precisely as it was fetched

What I get back is an error message:
version conflict for MyFirstNode1356582803755
expected=1422480157168369664 actual=1422480158385766400

When I look at that document in the admin browser, it looks like this:
{
    "TupleListProperty": [
        "250d3a66\\-c2cc\\-4c83\\-9b93\\-46cfdde120b8"
    ],
    "_version_": 1422480158385766400,
    "LocatorPropertyType": "MyFirstNode1356582803755"
}

which means all the other data in that node were replaced.

There must be something obvious I am missing. Is there a particular
recipe online using SolrJ to do this properly?

Many thanks in advance
Jack

Re: New user: version conflict for ....

Posted by Jack Park <ja...@topicquests.org>.
Hi Chris,

Your suspicion turned out to be spot on with a code glitch.

The history of this has been due to a fairly weak understanding of how
partial update works. The first code error was just a simple,stupid
one in which I was not working against a "current" copy of the
document. But, when I got that single update working, I revised the
unit test to increase the complexity.

The core unit test creates two "nodes", and then wires them together
with a third node which serves as a relation topic between the two
nodes; yes, I am building topic maps here.  Each actor node
(SolrDocument) is constructed, then is updated with an addition to a
multi-valued field which contains node identifiers for the TupleNode,
a SolrDocument which turns a relationship between two actors into a
topic itself.  The update is that of adding a value to a previously
empty field.

The second version of the unit test creates the two actors, and a
first relation, then adds a second one.  This is where I discovered
(lots of trial and error here), that you don't send in the list in the
add or set, rather you send in one value at a time.

I am imagining that the solution to sending in multivalued updates on
the same field might mean a custom update handler which reduces HTTP
round trips when dealing with a list of values to add. Perhaps there
is a documented way to do multiple updates on the same document/field
pair in a single call?

Many thanks.
Jack

On Mon, Dec 31, 2012 at 12:06 PM, Chris Hostetter
<ho...@fucit.org> wrote:
>
> : any of the cloud apparatus. I wish to update a document (Node) with
> : new information. I send back as a partial update using SolrJ's add()
> : command
> : document id
> : the new or updated field
> : version number precisely as it was fetched
>
> can you give us more details about what your client code is doing --
> ideally just include a complate example.
>
> : What I get back is an error message:
> : version conflict for MyFirstNode1356582803755
> : expected=1422480157168369664 actual=1422480158385766400
>
> that error suggests that in between the time you downloaded the document,
> and when you sent the request to update the document, some other update
> was already recieved and changed the version number.
>
> : When I look at that document in the admin browser, it looks like this:
>         ...
> : which means all the other data in that node were replaced.
>
> Are you sure the field values were replaced by *your* changes, the ones
> that you sent when that error was returned, or is it possible some other
> instnace of your code did the exact same update and got a success?
>
> Checking your server logs to see if multiple update commands were recieved
> by solr is one way to help verify this.
>
> my suspicion is that maybe you have a glitch in your code that results in
> the update operation actually happening twice -- and it's the second
> update command that is getting the error.
>
>
>
> -Hoss

Re: New user: version conflict for ....

Posted by Chris Hostetter <ho...@fucit.org>.
: any of the cloud apparatus. I wish to update a document (Node) with
: new information. I send back as a partial update using SolrJ's add()
: command
: document id
: the new or updated field
: version number precisely as it was fetched

can you give us more details about what your client code is doing -- 
ideally just include a complate example.

: What I get back is an error message:
: version conflict for MyFirstNode1356582803755
: expected=1422480157168369664 actual=1422480158385766400

that error suggests that in between the time you downloaded the document, 
and when you sent the request to update the document, some other update 
was already recieved and changed the version number.

: When I look at that document in the admin browser, it looks like this:
	...
: which means all the other data in that node were replaced.

Are you sure the field values were replaced by *your* changes, the ones 
that you sent when that error was returned, or is it possible some other 
instnace of your code did the exact same update and got a success?

Checking your server logs to see if multiple update commands were recieved 
by solr is one way to help verify this.

my suspicion is that maybe you have a glitch in your code that results in 
the update operation actually happening twice -- and it's the second 
update command that is getting the error.



-Hoss