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

Solr Adapter Optimistic Locking #453

Closed
tpendragon opened this issue Jul 18, 2018 · 4 comments
Closed

Solr Adapter Optimistic Locking #453

tpendragon opened this issue Jul 18, 2018 · 4 comments
Assignees

Comments

@tpendragon
Copy link
Collaborator

tpendragon commented Jul 18, 2018

Create a shared spec in lib/valkyrie/specs/shared_specs/, but don't include it in lib/valkyrie/specs/shared_specs.rb

Create a Valkyrie::Persistence::StaleObjectError

Child of #286

@tpendragon
Copy link
Collaborator Author

@awead
Copy link
Contributor

awead commented Jul 18, 2018

Add the _version_field to the document that is sent to Solr. The value would be the value of optimistic_lock_tag.

@awead
Copy link
Contributor

awead commented Jul 18, 2018

Example test:

>  resource = Valkyrie::Resource.find(id)
>  RSolr::Client.update(id, { foo: "bar" })
>  resource.save
=> Error!

@awead
Copy link
Contributor

awead commented Jul 30, 2018

If you provide the incorrect version, Solr returns 409:

(byebug) document = { id: "b994b8ec-8eb3-4070-aa7d-f75897ab12be", foo_tesim: "bar", _version_:"1234" }
{:id=>"b994b8ec-8eb3-4070-aa7d-f75897ab12be", :foo_tesim=>"bar", :_version_=>"1234"}
(byebug) solr.add [document]
*** RSolr::Error::Http Exception: RSolr::Error::Http - 409 Conflict
Error: {
  "responseHeader":{
    "status":409,
    "QTime":0},
  "error":{
    "metadata":[
      "error-class","org.apache.solr.common.SolrException",
      "root-error-class","org.apache.solr.common.SolrException"],
    "msg":"version conflict for b994b8ec-8eb3-4070-aa7d-f75897ab12be expected=1234 actual=1607421963757682688",
    "code":409}}

hackartisan added a commit that referenced this issue Jul 30, 2018
connected to #286
connected to #453

Co-authored-by: Adam Wead <[email protected]>
Co-authored-by: Michael Tribone <[email protected]>
@hackartisan hackartisan self-assigned this Jul 30, 2018
hackartisan added a commit that referenced this issue Jul 30, 2018
connected to #286
connected to #453

Co-authored-by: Adam Wead <[email protected]>
Co-authored-by: Michael Tribone <[email protected]>
hackartisan added a commit that referenced this issue Jul 30, 2018
connected to #286
connected to #453

Co-authored-by: Adam Wead <[email protected]>
Co-authored-by: Michael Tribone <[email protected]>
hackartisan added a commit that referenced this issue Jul 30, 2018
connected to #286
connected to #453

Co-authored-by: Adam Wead <[email protected]>
Co-authored-by: Michael Tribone <[email protected]>
@mtribone mtribone self-assigned this Jul 30, 2018
@awead awead self-assigned this Jul 30, 2018
awead added a commit that referenced this issue Jul 31, 2018
Fixes #453

Co-authored-by: Mike Tribone <[email protected]>
Co-authored-by: Anna Headley <[email protected]>
awead added a commit that referenced this issue Aug 1, 2018
Fixes #453

Co-authored-by: Mike Tribone <[email protected]>
Co-authored-by: Anna Headley <[email protected]>
hackartisan added a commit that referenced this issue Aug 1, 2018
Fixes #453

Co-authored-by: Mike Tribone <[email protected]>
Co-authored-by: Anna Headley <[email protected]>
hackartisan added a commit that referenced this issue Aug 1, 2018
Fixes #453

Co-authored-by: Mike Tribone <[email protected]>
Co-authored-by: Anna Headley <[email protected]>
awead added a commit that referenced this issue Aug 1, 2018
Fixes #453

Co-authored-by: Mike Tribone <[email protected]>
Co-authored-by: Anna Headley <[email protected]>
jrgriffiniii pushed a commit that referenced this issue Aug 7, 2018
Fixes #453

Co-authored-by: Mike Tribone <[email protected]>
Co-authored-by: Anna Headley <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants