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 -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html