summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Farnum <greg@inktank.com>2013-09-03 10:54:23 -0700
committerGreg Farnum <greg@inktank.com>2013-09-03 10:54:23 -0700
commit087800ee49a443098e7deec90cb0ee37aed0ff26 (patch)
treee871bd1d16e8f95c34268f970775389073e3c5b2
parentd71cd549504832d121824f1508498023bcacbbfd (diff)
downloadceph-087800ee49a443098e7deec90cb0ee37aed0ff26.tar.gz
osd: provide better version bounds for cls_current_version and ENOENT replies
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>
-rw-r--r--doc/dev/versions.rst12
-rw-r--r--src/objclass/class_api.cc2
-rw-r--r--src/osd/ReplicatedPG.cc2
3 files changed, 8 insertions, 8 deletions
diff --git a/doc/dev/versions.rst b/doc/dev/versions.rst
index c6a1ee69023..4fc4d8a12b2 100644
--- a/doc/dev/versions.rst
+++ b/doc/dev/versions.rst
@@ -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!).
diff --git a/src/objclass/class_api.cc b/src/objclass/class_api.cc
index b95260b7e16..1ac224cdfe7 100644
--- a/src/objclass/class_api.cc
+++ b/src/objclass/class_api.cc
@@ -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;
}
diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc
index 1ab363091a9..0027edda077 100644
--- a/src/osd/ReplicatedPG.cc
+++ b/src/osd/ReplicatedPG.cc
@@ -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);