[openstack-dev] [swift] eventual consistency and lost updates

Eoghan Glynn eglynn at redhat.com
Fri Jun 27 09:54:41 UTC 2014


Hi Swiftsters!

A basic question about swift eventual- versus strong-consistency.
The context is potentially using swift as a store for metric data.

Say datapoints {p1, p2, ..., p_i} are stored in a swift object.
Presumably these data are replicated across the object ring in
an eventually consistent way.

Say I want to read back this blob and update it with a further
datapoint {p_(i+1)}.

But eventual consistency tells me that I may end up folding my
new datapoint into an older version of the object:

  {p1, p2, ..., p_(i-1)}

instead of the expected:

  {p1, p2, ..., p_i}

i.e. the classic lost update problem.

So my basic questions are:

 * is read-then-update an acknowledged anti-pattern for swift?

 * if so, what are the recommended strategies for managing non-
   static data in swift?

   - e.g. write latest to a fresh object each time, do an async
     delete on the old

   - store a checksum elsewhere and detect the stale-read case

 * are the object metadata (ETag, X-Timestamp specifically)
   actually replicated in the same eventually-consistent way as
   the object content?

   (the PUT code[1] suggests data & metadata are stored together,
    but just wanted to be sure I'm reading that correctly)

Thanks,
Eoghan

[1] https://github.com/openstack/swift/blob/master/swift/obj/server.py#L441-455



More information about the OpenStack-dev mailing list