]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
fixup: don't use obc.attr_cache; move back to disk
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Wed, 31 Jan 2024 14:47:23 +0000 (14:47 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Thu, 1 Feb 2024 00:50:12 +0000 (00:50 +0000)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/osd/ECBackend.cc
src/osd/ECBackend.h
src/osd/PGBackend.h

index 318b1aca1f2fb538fcbaea8bfe6639475af44c20..e455c5062b74ebc87c27c1057fc5266f43cbda3d 100644 (file)
@@ -1444,6 +1444,25 @@ struct ECClassicalOp : ECCommon::RMWPipeline::Op {
   }
 };
 
+std::tuple<
+  int,
+  map<string, bufferlist, less<>>,
+  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<string, bufferlist, less<>> 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 "
index 56e1c972fe244b94c4c0ec934f453e350c726de6..db003f0adcb9249f5d8b0fbab904317cabd62d8b 100644 (file)
@@ -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<std::string, ceph::bufferlist, std::less<>>,
+    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,
index 274d1fb874bcd82636ae316a2252e108c434bf4b..c44c90514a3925809cdecc308fefdf55390617af 100644 (file)
@@ -52,6 +52,7 @@ typedef std::shared_ptr<const OSDMap> OSDMapRef;
   */
  class PGBackend {
  public:
+  virtual int object_stat(const hobject_t &hoid, struct stat* st) { return -1;};
    CephContext* cct;
  protected:
    ObjectStore *store;