]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: provide better version bounds for cls_current_version and ENOENT replies
authorGreg Farnum <greg@inktank.com>
Tue, 3 Sep 2013 17:54:23 +0000 (10:54 -0700)
committerGreg Farnum <greg@inktank.com>
Tue, 3 Sep 2013 17:54:23 +0000 (10:54 -0700)
Following the changes to when we set or increase the user_version, we
want to continue to return the best lower bound we can on the version
of any newly-created object. For ENOENT replies that means returning
info.last_user_version instead of the (potentially-zero) ctx->user_at_version.

Similarly, for cls_current_version we want to return the last version on
the PG rather than the last update to the object in order to provide
sensible version ordering across object deletes and creates.

Update the versions doc so it continues to be precise.

Signed-off-by: Greg Farnum <greg@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
doc/dev/versions.rst
src/objclass/class_api.cc
src/osd/ReplicatedPG.cc

index c6a1ee690231b7e6b9b6472541229beeafa4e756..4fc4d8a12b260e5dc518dca9c1aedff24bb0aa3f 100644 (file)
@@ -12,11 +12,12 @@ transactions.
 user_at_version is modified only in ReplicatedPG::prepare_transaction
 when the op was a "user modify" (a non-watch write), and the durable
 user_version is updated according to the following rules:
-1) increment user_at_version
+1) set user_at_version to the maximum of ctx->new_obs.oi.user_version+1
+   and info.last_user_version+1.
 2) set user_at_version to the maximum of itself and
-ctx->at_version.version.
+   ctx->at_version.version.
 3) ctx->new_obs.oi.user_version = ctx->user_at_version (to change the
-object's user_version)
+   object's user_version)
 
 This set of update semantics mean that for traditional pools the
 user_version will be equal to the past reassert_version, while for
@@ -36,6 +37,5 @@ is filled in on every operation (reads included) while replay_version
 is filled in for writes.
 
 The objclass function get_current_version() now always returns the
-user_at_version, which means it is guaranteed to contain the version
-of the last user update in the PG (including on reads!).
-
+pg->info.last_user_version, which means it is guaranteed to contain
+the version of the last user update in the PG (including on reads!).
index b95260b7e16667ae4629169265e678fa14f52b56..1ac224cdfe7d9f6cab1f03abb6a735c4f9705d89 100644 (file)
@@ -582,7 +582,7 @@ uint64_t cls_current_version(cls_method_context_t hctx)
 {
   ReplicatedPG::OpContext *ctx = *(ReplicatedPG::OpContext **)hctx;
 
-  return ctx->user_at_version;
+  return ctx->pg->info.last_user_version;
 }
 
 
index 1ab363091a93efdcc8e118c380c5259c0599f889..0027edda077a32ac45e95cdc48992eb13e799443 100644 (file)
@@ -1049,7 +1049,7 @@ void ReplicatedPG::execute_ctx(OpContext *ctx)
       reply->set_reply_versions(eversion_t(), ctx->obs->oi.user_version);
     } else if (result == -ENOENT) {
       // on ENOENT, set a floor for what the next user version will be. 
-      reply->set_enoent_reply_versions(info.last_update, ctx->user_at_version);
+      reply->set_enoent_reply_versions(info.last_update, info.last_user_version);
     }
     
     reply->add_flags(CEPH_OSD_FLAG_ACK | CEPH_OSD_FLAG_ONDISK);