* Problem in src_cmpxattr?
@ 2014-11-13 14:03 Joaquim Rocha
2014-11-13 14:42 ` Sage Weil
0 siblings, 1 reply; 2+ messages in thread
From: Joaquim Rocha @ 2014-11-13 14:03 UTC (permalink / raw)
To: ceph-devel
Hi there,
I need to create an object O (if it doesn't exist) and set an xattr on
it based on a condition that another xattr in a different object (X)
should obey. For this, on the same write operation (called on O) I call
create (not exclusively), setxattr and src_cmpxattr (with X as the
src_oid), respectively.
What I noticed is that if object O does not exist, the src_cmpxattr
returns -ENOENT (even if object X does exist). IMO, this error should
only be returned if X didn't exist and not O.
Is this the correct expectation for what src_cmpxattr should do (compare
an xattr on the given source object to the parameters given)?
Is this somehow expected? If so, is there any other way that I can
accomplish what I need as mentioned above?
Thank you in advance,
--
Joaquim Rocha
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Problem in src_cmpxattr?
2014-11-13 14:03 Problem in src_cmpxattr? Joaquim Rocha
@ 2014-11-13 14:42 ` Sage Weil
0 siblings, 0 replies; 2+ messages in thread
From: Sage Weil @ 2014-11-13 14:42 UTC (permalink / raw)
To: Joaquim Rocha; +Cc: ceph-devel
Hi Joaquim,
On Thu, 13 Nov 2014, Joaquim Rocha wrote:
> Hi there,
>
> I need to create an object O (if it doesn't exist) and set an xattr on it
> based on a condition that another xattr in a different object (X) should obey.
> For this, on the same write operation (called on O) I call create (not
> exclusively), setxattr and src_cmpxattr (with X as the src_oid), respectively.
>
> What I noticed is that if object O does not exist, the src_cmpxattr returns
> -ENOENT (even if object X does exist). IMO, this error should only be returned
> if X didn't exist and not O.
This will only work if you force rados to store O and X in the same PG in
the cluster. This is done with the locator_set_key() method, which
essentially let's you specify a string other than the object name to
decide where the object goes. So you could store O in the 'O' slot
(default), then set the locator key to '0' and store X in the same place.
Then the src_cmpxattr method should do what you want.
This lets you have a cluster of objects that are stored together and that
you can clone data between using clone_range. But you can't do this sort
of test-and-set between arbitrary objects in the cluster because they
will usually be stored on different OSDs...
> Is this the correct expectation for what src_cmpxattr should do (compare an
> xattr on the given source object to the parameters given)?
>
> Is this somehow expected? If so, is there any other way that I can accomplish
> what I need as mentioned above?
Yeah, the ENOENT is telling you that there is no O stored at locator key
X.
We would love to add some simple transactional support to rados that would
let you do this in the general case, but there's a long list of other
important things to get done first!
sage
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-11-13 14:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-13 14:03 Problem in src_cmpxattr? Joaquim Rocha
2014-11-13 14:42 ` Sage Weil
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.