pyrax icon indicating copy to clipboard operation
pyrax copied to clipboard

Object metadata is sometimes appended instead of replaced

Open mwidman opened this issue 9 years ago • 0 comments

As part of my threaded app, I am reading a timestamp in metadata on objects before processing them and at the end setting a new timestamp. As of 1.9.3 I have noticed that on some objects (which seem random), a call to get_metadata() returns the previous metadata joined together. i.e. say I do this at the end of the script one night:

orig_meta = obj.get_metadata()
print orig_meta  # {'last_timestamp': '1427433306'}
...
new_meta = {"x-object-meta-last-timestamp": str(1427336405)}
print new_meta #  {'x-object-meta-last-timestamp': '1427336405'}
obj.set_metada(new_meta)

The next night on the call to get_metadata I get, unexpectedly:

orig_meta = obj.get_metadata()
print orig_meta  # {'last_timestamp': '1427433306,1427336405'}

Any subsequent calls to get_metadata for that object (assuming I haven't set new metadata yet) return the same information. So it would seem that despite what I provided to "set_metadata", it somehow decided to append the new metadata to the previously existing metadata instead of using it to replace the old metadata.

mwidman avatar Mar 27 '15 18:03 mwidman