]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/ReplicatedPG: do not set ctx->user_at_version unless ctx->user_modify
authorSage Weil <sage@inktank.com>
Sat, 31 Aug 2013 00:20:54 +0000 (17:20 -0700)
committerSage Weil <sage@inktank.com>
Sun, 1 Sep 2013 15:42:57 +0000 (08:42 -0700)
Leave ctx->user_at_version set to the previous oi.user_version unless/until
we find that ctx->user_modify is true.

Signed-off-by: Sage Weil <sage@inktank.com>
src/osd/ReplicatedPG.cc

index 5f458644af0fc37ee47ce76e3ef9fd73a81303c1..a50e0f263d6fa4e7aedb512b8960ee3e09d47083 100644 (file)
@@ -969,7 +969,7 @@ void ReplicatedPG::execute_ctx(OpContext *ctx)
             << dendl;  
   }
 
-  ctx->user_at_version = info.last_user_version;
+  ctx->user_at_version = obc->obs.oi.user_version;
 
   // note my stats
   utime_t now = ceph_clock_now(g_ceph_context);
@@ -3951,14 +3951,14 @@ int ReplicatedPG::prepare_transaction(OpContext *ctx)
 
   // finish and log the op.
   if (ctx->user_modify) {
-    /* update the user_version for any modify ops, except for the watch op */
-    ++ctx->user_at_version;
-    assert(ctx->user_at_version > ctx->new_obs.oi.user_version);
+    // update the user_version for any modify ops, except for the watch op
+    ctx->user_at_version = MAX(info.last_user_version, ctx->new_obs.oi.user_version) + 1;
     /* In order for new clients and old clients to interoperate properly
      * when exchanging versions, we need to lower bound the user_version
      * (which our new clients pay proper attention to)
      * by the at_version (which is all the old clients can ever see). */
-    ctx->user_at_version = MAX(ctx->at_version.version, ctx->user_at_version);
+    if (ctx->at_version.version > ctx->user_at_version)
+      ctx->user_at_version = ctx->at_version.version;
     ctx->new_obs.oi.user_version = ctx->user_at_version;
   }
   ctx->bytes_written = ctx->op_t.get_encoded_bytes();