diff options
author | Jason Dillaman <dillaman@redhat.com> | 2018-10-18 19:24:18 +0200 |
---|---|---|
committer | Jason Dillaman <dillaman@redhat.com> | 2018-10-29 15:48:41 +0100 |
commit | 45b3cedb487330822b2251e34c74a3558167cdf8 (patch) | |
tree | 4431bcccf7d39a923cb8912b9b79d955c59ba014 | |
parent | osd/PGLog: optionally record error return codes for extra_reqids (diff) | |
download | ceph-45b3cedb487330822b2251e34c74a3558167cdf8.tar.xz ceph-45b3cedb487330822b2251e34c74a3558167cdf8.zip |
osd/PrimaryLogPG: propagate error return codes on object copy_get ops
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
-rw-r--r-- | src/osd/PGLog.h | 12 | ||||
-rw-r--r-- | src/osd/PrimaryLogPG.cc | 14 | ||||
-rw-r--r-- | src/osd/PrimaryLogPG.h | 2 | ||||
-rw-r--r-- | src/osdc/Objecter.h | 9 |
4 files changed, 31 insertions, 6 deletions
diff --git a/src/osd/PGLog.h b/src/osd/PGLog.h index c7658ed26d2..532da798824 100644 --- a/src/osd/PGLog.h +++ b/src/osd/PGLog.h @@ -325,7 +325,8 @@ public: /// get a (bounded) list of recent reqids for the given object void get_object_reqids(const hobject_t& oid, unsigned max, - mempool::osd_pglog::vector<pair<osd_reqid_t, version_t> > *pls) const { + mempool::osd_pglog::vector<pair<osd_reqid_t, version_t> > *pls, + mempool::osd_pglog::map<uint32_t, int> *return_codes) const { // make sure object is present at least once before we do an // O(n) search. if (!(indexed_data & PGLOG_INDEXED_OBJECTS)) { @@ -333,12 +334,19 @@ public: } if (objects.count(oid) == 0) return; + for (list<pg_log_entry_t>::const_reverse_iterator i = log.rbegin(); i != log.rend(); ++i) { if (i->soid == oid) { - if (i->reqid_is_indexed()) + if (i->reqid_is_indexed()) { + if (i->op == pg_log_entry_t::ERROR) { + // propagate op errors to the cache tier's PG log + return_codes->emplace(pls->size(), i->return_code); + } pls->push_back(make_pair(i->reqid, i->user_version)); + } + pls->insert(pls->end(), i->extra_reqids.begin(), i->extra_reqids.end()); if (pls->size() >= max) { if (pls->size() > max) { diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index c0ccd802e12..875c7ad4e7a 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -8485,8 +8485,10 @@ void PrimaryLogPG::finish_ctx(OpContext *ctx, int log_op_type) } if (!ctx->extra_reqids.empty()) { - dout(20) << __func__ << " extra_reqids " << ctx->extra_reqids << dendl; + dout(20) << __func__ << " extra_reqids " << ctx->extra_reqids << " " + << ctx->extra_reqid_return_codes << dendl; ctx->log.back().extra_reqids.swap(ctx->extra_reqids); + ctx->log.back().extra_reqid_return_codes.swap(ctx->extra_reqid_return_codes); } // apply new object state. @@ -8784,7 +8786,9 @@ int PrimaryLogPG::do_copy_get(OpContext *ctx, bufferlist::const_iterator& bp, if (cursor.is_complete()) { // include reqids only in the final step. this is a bit fragile // but it works... - pg_log.get_log().get_object_reqids(ctx->obc->obs.oi.soid, 10, &reply_obj.reqids); + pg_log.get_log().get_object_reqids(ctx->obc->obs.oi.soid, 10, + &reply_obj.reqids, + &reply_obj.reqid_return_codes); dout(20) << " got reqids" << dendl; } @@ -8820,7 +8824,8 @@ void PrimaryLogPG::fill_in_copy_get_noent(OpRequestRef& op, hobject_t oid, uint64_t features = m->get_features(); object_copy_data_t reply_obj; - pg_log.get_log().get_object_reqids(oid, 10, &reply_obj.reqids); + pg_log.get_log().get_object_reqids(oid, 10, &reply_obj.reqids, + &reply_obj.reqid_return_codes); dout(20) << __func__ << " got reqids " << reply_obj.reqids << dendl; encode(reply_obj, osd_op.outdata, features); osd_op.rval = -ENOENT; @@ -8922,6 +8927,7 @@ void PrimaryLogPG::_copy_some(ObjectContextRef obc, CopyOpRef cop) &cop->results.source_data_digest, &cop->results.source_omap_digest, &cop->results.reqids, + &cop->results.reqid_return_codes, &cop->results.truncate_seq, &cop->results.truncate_size, &cop->rval); @@ -9464,6 +9470,7 @@ void PrimaryLogPG::finish_copyfrom(CopyFromCallback *cb) obs.oi.truncate_size = cb->results->truncate_size; ctx->extra_reqids = cb->results->reqids; + ctx->extra_reqid_return_codes = cb->results->reqid_return_codes; // cache: clear whiteout? if (obs.oi.is_whiteout()) { @@ -9627,6 +9634,7 @@ void PrimaryLogPG::finish_promote(int r, CopyResults *results, tctx->new_obs.exists = true; tctx->extra_reqids = results->reqids; + tctx->extra_reqid_return_codes = results->reqid_return_codes; if (whiteout) { // create a whiteout diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index 3707bb98473..f93aeed5b4c 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -95,6 +95,7 @@ public: uint32_t source_data_digest, source_omap_digest; uint32_t data_digest, omap_digest; mempool::osd_pglog::vector<pair<osd_reqid_t, version_t> > reqids; // [(reqid, user_version)] + mempool::osd_pglog::map<uint32_t, int> reqid_return_codes; // map reqids by index to error code map<string, bufferlist> attrs; // xattrs uint64_t truncate_seq; uint64_t truncate_size; @@ -576,6 +577,7 @@ public: int num_write; ///< count update ops mempool::osd_pglog::vector<pair<osd_reqid_t, version_t> > extra_reqids; + mempool::osd_pglog::map<uint32_t, int> extra_reqid_return_codes; hobject_t new_temp_oid, discard_temp_oid; ///< temp objects we should start/stop tracking diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index 0dc1eebe80b..99b12346f38 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -737,6 +737,7 @@ struct ObjectOperation { uint32_t *out_data_digest; uint32_t *out_omap_digest; mempool::osd_pglog::vector<pair<osd_reqid_t, version_t> > *out_reqids; + mempool::osd_pglog::map<uint32_t, int> *out_reqid_return_codes; uint64_t *out_truncate_seq; uint64_t *out_truncate_size; int *prval; @@ -752,6 +753,7 @@ struct ObjectOperation { uint32_t *dd, uint32_t *od, mempool::osd_pglog::vector<pair<osd_reqid_t, version_t> > *oreqids, + mempool::osd_pglog::map<uint32_t, int> *oreqid_return_codes, uint64_t *otseq, uint64_t *otsize, int *r) @@ -761,6 +763,7 @@ struct ObjectOperation { out_omap_data(o), out_snaps(osnaps), out_snap_seq(osnap_seq), out_flags(flags), out_data_digest(dd), out_omap_digest(od), out_reqids(oreqids), + out_reqid_return_codes(oreqid_return_codes), out_truncate_seq(otseq), out_truncate_size(otsize), prval(r) {} @@ -801,6 +804,8 @@ struct ObjectOperation { *out_omap_digest = copy_reply.omap_digest; if (out_reqids) *out_reqids = copy_reply.reqids; + if (out_reqid_return_codes) + *out_reqid_return_codes = copy_reply.reqid_return_codes; if (out_truncate_seq) *out_truncate_seq = copy_reply.truncate_seq; if (out_truncate_size) @@ -827,6 +832,7 @@ struct ObjectOperation { uint32_t *out_data_digest, uint32_t *out_omap_digest, mempool::osd_pglog::vector<pair<osd_reqid_t, version_t> > *out_reqids, + mempool::osd_pglog::map<uint32_t, int> *out_reqid_return_codes, uint64_t *truncate_seq, uint64_t *truncate_size, int *prval) { @@ -841,7 +847,8 @@ struct ObjectOperation { out_attrs, out_data, out_omap_header, out_omap_data, out_snaps, out_snap_seq, out_flags, out_data_digest, - out_omap_digest, out_reqids, truncate_seq, + out_omap_digest, out_reqids, + out_reqid_return_codes, truncate_seq, truncate_size, prval); out_bl[p] = &h->bl; out_handler[p] = h; |