Skip to content

Commit

Permalink
Merge pull request ceph#57383 from athanatos/sjust/wip-65867-user-ver…
Browse files Browse the repository at this point in the history
…sion

crimson: fix user_version handling

Reviewed-by: Matan Breizman <[email protected]>
Reviewed-by: Xuehan Xu <[email protected]>
  • Loading branch information
Matan-B authored May 19, 2024
2 parents 14a1ef9 + 85fdada commit e03f7be
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 21 deletions.
17 changes: 9 additions & 8 deletions src/crimson/osd/ops_executer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,6 @@ std::vector<pg_log_entry_t> OpsExecuter::prepare_transaction(
// entry.
assert(obc->obs.oi.soid.snap >= CEPH_MAXSNAP);
std::vector<pg_log_entry_t> log_entries;
osd_op_params->at_version.version++;
log_entries.emplace_back(
obc->obs.exists ?
pg_log_entry_t::MODIFY : pg_log_entry_t::DELETE,
Expand Down Expand Up @@ -931,7 +930,9 @@ std::unique_ptr<OpsExecuter::CloningContext> OpsExecuter::execute_clone(
return std::vector<snapid_t>{std::begin(snapc.snaps), last};
}();

auto clone_obc = prepare_clone(coid);
auto clone_obc = prepare_clone(coid, osd_op_params->at_version);
osd_op_params->at_version.version++;

// make clone
backend.clone(clone_obc->obs.oi, initial_obs, clone_obc->obs, txn);

Expand Down Expand Up @@ -961,10 +962,10 @@ std::unique_ptr<OpsExecuter::CloningContext> OpsExecuter::execute_clone(
pg_log_entry_t::CLONE,
coid,
clone_obc->obs.oi.version,
initial_obs.oi.version,
initial_obs.oi.user_version,
clone_obc->obs.oi.prior_version,
clone_obc->obs.oi.user_version,
osd_reqid_t(),
initial_obs.oi.mtime, // will be replaced in `apply_to()`
clone_obc->obs.oi.mtime, // will be replaced in `apply_to()`
0
};
encode(cloned_snaps, cloning_ctx->log_entry.snaps);
Expand Down Expand Up @@ -1039,13 +1040,13 @@ OpsExecuter::flush_clone_metadata(
}

ObjectContextRef OpsExecuter::prepare_clone(
const hobject_t& coid)
const hobject_t& coid,
eversion_t version)
{
ceph_assert(pg->is_primary());
osd_op_params->at_version.version++;
ObjectState clone_obs{coid};
clone_obs.exists = true;
clone_obs.oi.version = osd_op_params->at_version;
clone_obs.oi.version = version;
clone_obs.oi.prior_version = obc->obs.oi.version;
clone_obs.oi.copy_user_bits(obc->obs.oi);
clone_obs.oi.clear_flag(object_info_t::FLAG_WHITEOUT);
Expand Down
6 changes: 2 additions & 4 deletions src/crimson/osd/ops_executer.h
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,8 @@ class OpsExecuter : public seastar::enable_lw_shared_from_this<OpsExecuter> {
version_t get_last_user_version() const;

ObjectContextRef prepare_clone(
const hobject_t& coid);
const hobject_t& coid,
eversion_t version);

void apply_stats();
};
Expand Down Expand Up @@ -519,9 +520,6 @@ OpsExecuter::flush_changes_n_do_ops_effects(
ceph_assert(want_mutate);
}
if (want_mutate) {
if (osd_op_params->user_modify) {
osd_op_params->user_at_version = osd_op_params->at_version.version;
}
maybe_mutated = flush_clone_metadata(
prepare_transaction(ops),
snap_mapper,
Expand Down
1 change: 0 additions & 1 deletion src/crimson/osd/osd_operations/osdop_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ struct osd_op_params_t {
eversion_t pg_trim_to;
eversion_t min_last_complete_ondisk;
eversion_t last_complete;
version_t user_at_version = 0;
bool user_modify = false;
ObjectCleanRegions clean_regions;
interval_set<uint64_t> modified_ranges;
Expand Down
1 change: 0 additions & 1 deletion src/crimson/osd/pg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,6 @@ PG::submit_transaction(
}

epoch_t map_epoch = get_osdmap_epoch();
ceph_assert(!has_reset_since(osd_op_p.at_version.epoch));

peering_state.pre_submit_op(obc->obs.oi.soid, log_entries, osd_op_p.at_version);
peering_state.update_trim_to();
Expand Down
9 changes: 2 additions & 7 deletions src/crimson/osd/pg_backend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,10 @@ PGBackend::mutate_object(
{
logger().trace("mutate_object: num_ops={}", txn.get_num_ops());
if (obc->obs.exists) {
#if 0
obc->obs.oi.version = ctx->at_version;
obc->obs.oi.prior_version = ctx->obs->oi.version;
#endif

obc->obs.oi.prior_version = obc->obs.oi.version;
obc->obs.oi.version = osd_op_p.at_version;
if (osd_op_p.user_at_version > obc->obs.oi.user_version)
obc->obs.oi.user_version = osd_op_p.user_at_version;
if (osd_op_p.user_modify)
obc->obs.oi.user_version = osd_op_p.at_version.version;
obc->obs.oi.last_reqid = osd_op_p.req_id;
obc->obs.oi.mtime = osd_op_p.mtime;
obc->obs.oi.local_mtime = ceph_clock_now();
Expand Down

0 comments on commit e03f7be

Please sign in to comment.