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

Need clean way to handle deleted objects and tombstones [JIRA: CLIENTS-965] #283

Closed
mikedotson opened this issue Aug 23, 2016 · 5 comments
Closed
Assignees

Comments

@mikedotson
Copy link

Ruby Client returns deleted objects as a sibling conflict with no siblings that needs to be resolved in order to restore the object.

ruby --version
ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
riak-client (2.4.1)
Ubuntu 16.04 4.4.0-34-generic
advanced.config:

[
 {riak_kv, [
            {delete_mode, [keep]}
          ]}
].

The following:

bsho=bucket.new 'rubyTest'
bsho.content="Test Content"
bsho.store
bsho.delete

r=bucket.get("rubyTest", deletedvclock: true)
puts "Data: #{r.data}"

Results in:

/var/lib/gems/2.3.0/gems/riak-client-2.4.1/lib/riak/robject.rb:190:in `content': The object is in conflict (has siblings) and cannot be treated singly or saved: #<Riak::RObject {Jira,rubyTest} []> (Riak::Conflict)
    from ./jira.rb:14:in `<main>'

However, the sibling count is 0.

Current method to restore the deleted object:

d.siblings.push(Riak::RContent.new(d))
d.data="NewTest"
d.store

However, this is confusing from an API perspective and perhaps something similar to the following in order to handle tombstones and deleted objects directly may be more appropriate:

r=bucket.get("rubyTest", deletedvclock: true)
if r.isTombstone?
  r.revive
end

r.data = "test'
r.store
@Basho-JIRA Basho-JIRA changed the title Need clean way to handle deleted objects and tombstones Need clean way to handle deleted objects and tombstones [JIRA: CLIENTS-965] Aug 23, 2016
@sbishep
Copy link

sbishep commented Aug 24, 2016

Thank you Mike. I like the suggestion of the tombstone check and revive. I think it would also be clean to use a callback like "on_tombstone { revive }" similar to the on_conflict callback.

@sbishep
Copy link

sbishep commented Aug 24, 2016

I could put a PR together if you agree that is the best approach

@alexmoore
Copy link
Contributor

Hi @sbishep,

I have most of it together already, I just need to write some tests after a
Java client release. If you'd be interested in that part I can push my
changes up.

Thanks,
Alex

On Wed, Aug 24, 2016 at 1:58 PM, sbishep notifications@github.com wrote:

I could put a PR together if you agree that is the best approach


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#283 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAFnhkWrB3w_5VdR3YPHYFpBgojrqo2ks5qjIZJgaJpZM4JrcVD
.

@sbishep
Copy link

sbishep commented Aug 24, 2016

Yeah @alexmoore push up a branch and I can take a look

@sbishep
Copy link

sbishep commented Aug 29, 2016

Hi @alexmoore any update on this?

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

No branches or pull requests

5 participants