Skip to content

Commit

Permalink
osd/PrimaryLogPG: record prior_version for DELETE events
Browse files Browse the repository at this point in the history
Leaving this blank is inaccurate.  It also confuses the rewind
divergent log code, leading to behavior like

      ldpp_dout(dpp, 10) << __func__ << ": hoid " << hoid
			 << " prior_version or op type indicates creation,"
			 << " deleting"
			 << dendl;

Fixes: http://tracker.ceph.com/issues/20274
Signed-off-by: Sage Weil <sage@redhat.com>
  • Loading branch information
liewegas committed Jun 13, 2017
1 parent aeb4029 commit b51cc60
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/osd/PrimaryLogPG.cc
Expand Up @@ -2253,7 +2253,9 @@ void PrimaryLogPG::do_op(OpRequestRef& op)
close_op_ctx(ctx);
if (op->may_write() &&
get_osdmap()->require_osd_release >= CEPH_RELEASE_KRAKEN) {
record_write_error(op, oid, nullptr, r);
record_write_error(op, oid,
obc ? obc->obs.oi.version : eversion_t(),
nullptr, r);
} else {
osd->reply_op_error(op, r);
}
Expand Down Expand Up @@ -2352,6 +2354,7 @@ PrimaryLogPG::cache_result_t PrimaryLogPG::maybe_handle_manifest_detail(
}

void PrimaryLogPG::record_write_error(OpRequestRef op, const hobject_t &soid,
eversion_t prior_version,
MOSDOpReply *orig_reply, int r)
{
dout(20) << __func__ << " r=" << r << dendl;
Expand All @@ -2360,7 +2363,7 @@ void PrimaryLogPG::record_write_error(OpRequestRef op, const hobject_t &soid,
ObjectContextRef obc;
mempool::osd_pglog::list<pg_log_entry_t> entries;
entries.push_back(pg_log_entry_t(pg_log_entry_t::ERROR, soid,
get_next_version(), eversion_t(), 0,
get_next_version(), prior_version, 0,
reqid, utime_t(), r));

struct OnComplete {
Expand Down Expand Up @@ -3293,7 +3296,10 @@ void PrimaryLogPG::execute_ctx(OpContext *ctx)
}
reply->add_flags(CEPH_OSD_FLAG_ACK | CEPH_OSD_FLAG_ONDISK);
// append to pg log for dup detection - don't save buffers for now
record_write_error(op, soid, reply, result);
record_write_error(
op, soid,
obc->obs.oi.version,
reply, result);
return;
}

Expand Down
1 change: 1 addition & 0 deletions src/osd/PrimaryLogPG.h
Expand Up @@ -1374,6 +1374,7 @@ class PrimaryLogPG : public PG, public PGBackend::Listener {
ThreadPool::TPHandle &handle) override;
void do_op(OpRequestRef& op) override;
void record_write_error(OpRequestRef op, const hobject_t &soid,
eversion_t prior_version,
MOSDOpReply *orig_reply, int r);
void do_pg_op(OpRequestRef op);
void do_sub_op(OpRequestRef op) override;
Expand Down

0 comments on commit b51cc60

Please sign in to comment.