Skip to content

Commit 0fc875a

Browse files
committed
fixup: don't use obc.attr_cache; move back to disk
Signed-off-by: Radoslaw Zarzynski <[email protected]>
1 parent f9202a9 commit 0fc875a

File tree

3 files changed

+36
-6
lines changed

3 files changed

+36
-6
lines changed

src/osd/ECBackend.cc

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,6 +1444,25 @@ struct ECClassicalOp : ECCommon::RMWPipeline::Op {
14441444
}
14451445
};
14461446

1447+
std::tuple<
1448+
int,
1449+
map<string, bufferlist, less<>>,
1450+
size_t
1451+
> ECBackend::get_attrs_n_size_from_disk(const hobject_t& hoid)
1452+
{
1453+
struct stat st;
1454+
if (int r = object_stat(hoid, &st); r < 0) {
1455+
dout(10) << __func__ << ": stat error " << r << " on" << hoid << dendl;
1456+
return { r, {}, 0 };
1457+
}
1458+
map<string, bufferlist, less<>> real_attrs;
1459+
if (int r = PGBackend::objects_get_attrs(hoid, &real_attrs); r < 0) {
1460+
dout(10) << __func__ << ": get attr error " << r << " on" << hoid << dendl;
1461+
return { r, {}, 0 };
1462+
}
1463+
return { 0, real_attrs, st.st_size };
1464+
}
1465+
14471466
void ECBackend::submit_transaction(
14481467
const hobject_t &hoid,
14491468
const object_stat_sum_t &delta_stats,
@@ -1479,11 +1498,15 @@ void ECBackend::submit_transaction(
14791498
sinfo,
14801499
*(op->t),
14811500
[&](const hobject_t &i) {
1482-
ECUtil::HashInfoRef ref = unstable_hashinfo_registry.get_hash_info(
1483-
i,
1484-
true,
1485-
op->t->obc_map[hoid]->attr_cache,
1486-
op->t->obc_map[hoid]->obs.oi.size);
1501+
dout(10) << "submit_transaction: obtaining hash info for get_write_plan" << dendl;
1502+
ECUtil::HashInfoRef ref;
1503+
if (auto [r, attrs, size] = get_attrs_n_size_from_disk(i); r >= 0 || r == -ENOENT) {
1504+
ref = unstable_hashinfo_registry.get_hash_info(
1505+
i,
1506+
true,
1507+
attrs, //op->t->obc_map[hoid]->attr_cache,
1508+
size); //op->t->obc_map[hoid]->obs.oi.size);
1509+
}
14871510
if (!ref) {
14881511
derr << __func__ << ": get_hash_info(" << i << ")"
14891512
<< " returned a null pointer and there is no "

src/osd/ECBackend.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,9 +400,15 @@ class ECBackend : public PGBackend, public ECCommon {
400400

401401
ECCommon::UnstableHashInfoRegistry unstable_hashinfo_registry;
402402

403-
int object_stat(const hobject_t &hoid, struct stat* st);
403+
404+
std::tuple<
405+
int,
406+
std::map<std::string, ceph::bufferlist, std::less<>>,
407+
size_t
408+
> get_attrs_n_size_from_disk(const hobject_t& hoid);
404409

405410
public:
411+
int object_stat(const hobject_t &hoid, struct stat* st);
406412
ECBackend(
407413
PGBackend::Listener *pg,
408414
const coll_t &coll,

src/osd/PGBackend.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ typedef std::shared_ptr<const OSDMap> OSDMapRef;
5252
*/
5353
class PGBackend {
5454
public:
55+
virtual int object_stat(const hobject_t &hoid, struct stat* st) { return -1;};
5556
CephContext* cct;
5657
protected:
5758
ObjectStore *store;

0 commit comments

Comments
 (0)