From 57e346b169890073ac065c493e061a191c83977f Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Tue, 20 Aug 2013 16:22:27 -0700 Subject: [PATCH] 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 --- src/osd/ReplicatedPG.cc | 11 +++++++---- src/osd/ReplicatedPG.h | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) 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; -- 2.39.5