From: Greg Farnum Date: Tue, 20 Aug 2013 23:22:27 +0000 (-0700) Subject: ReplicatedPG: Fill in the MOSDOpReply's user_version X-Git-Tag: v0.69~40^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=57e346b169890073ac065c493e061a191c83977f;p=ceph.git ReplicatedPG: Fill in the MOSDOpReply's user_version 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 --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 40e3e7dedd898..81b037c052368 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -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) { diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index af14871fe277e..878816fd1fa4d 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -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;