← Back to team overview

openstack team mailing list archive

Storage - Metadata on Containers vs. Objects, info for the archives

 

For the sake of the mailing list archives, I would like to post the results of a multi-day investigation.  I hope that by posting this someone else won't have to dig up the information themselves. (though Ms. Gentle's involvement offers assurance that that documentation will soon supersede the need for this post).

Objects and Containers behave differently with respect to editing metadata.  For an object, when you POST a new set of metadata to the object, the key/value pairs in the POST completely replace any metadata that was previously set on that Object.  (This matches the behavior described in the OpenStack documentation and should, therefore, come as no surprise).


For a Container, however, the key/value pairs in a POST operation do not replace the metadata, they modify it.

For a key/value pair specified in the POST where there is already a corresponding key in the Container's metadata, the Container's meta data will be modified.  If the value given in the post is the empty string, then the key/value pair will be removed from the Container's metadata.  If the value given in the POST is not the empty string, then it will be copied into the value of the Container's metadata for the corresponding key.

If a key/value pair is given in the POST, and no corresponding key is yet found in the Container's metadata then the new key/value pair will be added to the Container's metadata (leaving existing metadata intact) if the value given in the post is not the empty string.  (if the value given is the empty string, then the key/value pair is essentially ignored).

A consequence of this behavior is that you may have a metadata key/value pair on an Object where the value of the metadata is the empty string.  For a Container, however you may not have a metadata pair where the value is the empty string.

This difference in behavior was verified as expected in bug https://bugs.launchpad.net/swift/+bug/890749.  I have asked that the documentation be updated appropriately in bug https://bugs.launchpad.net/openstack-manuals/+bug/890435.

If you found this information in a search of the archives, I hope it has been helpful to you :-)

Scott Thompson