]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG: Fill in the MOSDOpReply's user_version
authorGreg Farnum <greg@inktank.com>
Tue, 20 Aug 2013 23:22:27 +0000 (16:22 -0700)
committerGreg Farnum <greg@inktank.com>
Wed, 28 Aug 2013 00:24:50 +0000 (17:24 -0700)
As part of this, rename OpContext::reply_version->reply_user_version.
The semantics that necessitate the reply_version are only for user versions,
so rename it for clarity. Then use the reply_user_version in
set_user_version() (if the op succeeded).
For now we use the PG version for ENOENT (preserving the previous
semantics), but that will get changed to the pg's user_version soon
as well.

Signed-off-by: Greg Farnum <greg@inktank.com>
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index 40e3e7dedd8981f577bdc106417e4d15499bccbe..81b037c0523689857300f287141d740a7339e093 100644 (file)
@@ -1027,10 +1027,13 @@ void ReplicatedPG::do_op(OpRequestRef op)
   }
   ctx->reply->set_result(result);
 
-  if (result >= 0)
+  if (result >= 0) {
     ctx->reply->set_replay_version(ctx->at_version);
-  else if (result == -ENOENT)
+    ctx->reply->set_user_version(ctx->reply_user_version);
+  } else if (result == -ENOENT) {
     ctx->reply->set_replay_version(info.last_update);
+    ctx->reply->set_user_version(info.last_update.version);
+  }
 
   // read or error?
   if (ctx->op_t.empty() || result < 0) {
@@ -3789,7 +3792,7 @@ int ReplicatedPG::prepare_transaction(OpContext *ctx)
 
   // read-op?  done?
   if (ctx->op_t.empty() && !ctx->modify) {
-    ctx->reply_version = ctx->obs->oi.user_version;
+    ctx->reply_user_version = ctx->obs->oi.user_version.version;
     unstable_stats.add(ctx->delta_stats, ctx->obc->obs.oi.category);
     return result;
   }
@@ -3851,7 +3854,7 @@ int ReplicatedPG::prepare_transaction(OpContext *ctx)
     /* update the user_version for any modify ops, except for the watch op */
     ctx->new_obs.oi.user_version = ctx->at_version;
   }
-  ctx->reply_version = ctx->new_obs.oi.user_version;
+  ctx->reply_user_version = ctx->new_obs.oi.user_version.version;
   ctx->bytes_written = ctx->op_t.get_encoded_bytes();
  
   if (ctx->new_obs.exists) {
index af14871fe277ecd0e419bfbaf7f103f9edeff3aa..878816fd1fa4db65f1294840b4c6b7014cc691a3 100644 (file)
@@ -116,7 +116,7 @@ public:
     utime_t mtime;
     SnapContext snapc;           // writer snap context
     eversion_t at_version;       // pg's current version pointer
-    eversion_t reply_version;    // the version that we report the client (depends on the op)
+    version_t reply_user_version;    // the version that we report the client (depends on the op)
 
     int current_osd_subop_num;