From: Radoslaw Zarzynski Date: Wed, 31 Jan 2024 14:47:23 +0000 (+0000) Subject: fixup: don't use obc.attr_cache; move back to disk X-Git-Tag: testing/wip-batrick-testing-20240411.154038~431^2~2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=0fc875a6416171386057b167c6d7681463773e60;p=ceph-ci.git fixup: don't use obc.attr_cache; move back to disk Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/osd/ECBackend.cc b/src/osd/ECBackend.cc index 318b1aca1f2..e455c5062b7 100644 --- a/src/osd/ECBackend.cc +++ b/src/osd/ECBackend.cc @@ -1444,6 +1444,25 @@ struct ECClassicalOp : ECCommon::RMWPipeline::Op { } }; +std::tuple< + int, + map>, + size_t +> ECBackend::get_attrs_n_size_from_disk(const hobject_t& hoid) +{ + struct stat st; + if (int r = object_stat(hoid, &st); r < 0) { + dout(10) << __func__ << ": stat error " << r << " on" << hoid << dendl; + return { r, {}, 0 }; + } + map> real_attrs; + if (int r = PGBackend::objects_get_attrs(hoid, &real_attrs); r < 0) { + dout(10) << __func__ << ": get attr error " << r << " on" << hoid << dendl; + return { r, {}, 0 }; + } + return { 0, real_attrs, st.st_size }; +} + void ECBackend::submit_transaction( const hobject_t &hoid, const object_stat_sum_t &delta_stats, @@ -1479,11 +1498,15 @@ void ECBackend::submit_transaction( sinfo, *(op->t), [&](const hobject_t &i) { - ECUtil::HashInfoRef ref = unstable_hashinfo_registry.get_hash_info( - i, - true, - op->t->obc_map[hoid]->attr_cache, - op->t->obc_map[hoid]->obs.oi.size); + dout(10) << "submit_transaction: obtaining hash info for get_write_plan" << dendl; + ECUtil::HashInfoRef ref; + if (auto [r, attrs, size] = get_attrs_n_size_from_disk(i); r >= 0 || r == -ENOENT) { + ref = unstable_hashinfo_registry.get_hash_info( + i, + true, + attrs, //op->t->obc_map[hoid]->attr_cache, + size); //op->t->obc_map[hoid]->obs.oi.size); + } if (!ref) { derr << __func__ << ": get_hash_info(" << i << ")" << " returned a null pointer and there is no " diff --git a/src/osd/ECBackend.h b/src/osd/ECBackend.h index 56e1c972fe2..db003f0adcb 100644 --- a/src/osd/ECBackend.h +++ b/src/osd/ECBackend.h @@ -400,9 +400,15 @@ public: ECCommon::UnstableHashInfoRegistry unstable_hashinfo_registry; - int object_stat(const hobject_t &hoid, struct stat* st); + + std::tuple< + int, + std::map>, + size_t + > get_attrs_n_size_from_disk(const hobject_t& hoid); public: + int object_stat(const hobject_t &hoid, struct stat* st); ECBackend( PGBackend::Listener *pg, const coll_t &coll, diff --git a/src/osd/PGBackend.h b/src/osd/PGBackend.h index 274d1fb874b..c44c90514a3 100644 --- a/src/osd/PGBackend.h +++ b/src/osd/PGBackend.h @@ -52,6 +52,7 @@ typedef std::shared_ptr OSDMapRef; */ class PGBackend { public: + virtual int object_stat(const hobject_t &hoid, struct stat* st) { return -1;}; CephContext* cct; protected: ObjectStore *store;