Public OSD Version
We maintain two versions on disk: an eversion_t pg_log.head and aversion_t info.user_version. Each object is tagged with both the pgversion and user_version it was last modified with. The PG version ismodified by manipulating OpContext::at_version and then persisting itto the pg log as transactions, and is incremented in all the places itused to be. The user_version is modified by manipulating the newOpContext::user_at_version and is also persisted via the pg logtransactions.user_at_version is modified only in PrimaryLogPG::prepare_transactionwhen the op was a “user modify” (a non-watch write), and the durableuser_version is updated according to the following rules:1) set user_at_version to the maximum of ctx->new_obs.oi.user_version+1and info.last_user_version+1.2) set user_at_version to the maximum of itself andctx->at_version.version.3) ctx->new_obs.oi.user_version = ctx->user_at_version (to change theobject’s user_version)
This set of update semantics mean that for traditional pools theuser_version will be equal to the past reassert_version, while forcaching pools the object and PG user-version will be able to crosspools without making a total mess of things.In order to support old clients, we keep the old reassert_version butrename it to “bad_replay_version”; we fill it in as before: for writesit is set to the at_version (and is the proper replay version); forwatches it is set to our user version; for ENOENT replies it is set tothe replay version’s epoch but the user_version’s version. We also nowfill in the version_t portion of the bad_replay_version on read ops aswell as write ops, which should be fine for all old clients.
For new clients, we prevent them from reading bad_replay_version andadd two proper members: user_version and replay_version; user_versionis filled in on every operation (reads included) while replay_versionis filled in for writes.
The objclass function get_current_version() now always returns thepg->info.last_user_version, which means it is guaranteed to containthe version of the last user update in the PG (including on reads!).