]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd, tools: read_log_and_missing of PGLog takes CephContext
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Mon, 11 Jul 2022 17:02:20 +0000 (17:02 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Thu, 8 Sep 2022 16:45:43 +0000 (22:15 +0530)
Will be needed for dealing with the conf.

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
(cherry picked from commit fb746dd346f350e43ad1c35244dc3a1eb6bc22f3)
(cherry picked from commit 145b331eb82e0b3acc619f54faf761c3d9f59a6f)

Resolves: rhbz#2093106

src/osd/PGLog.h
src/tools/ceph_objectstore_tool.cc
src/tools/ceph_objectstore_tool.h

index 25c88217c51cce1ddd35c7da9e58eeea2495b396..9abfb3271e04dbe253aa9d5ccb2ff76d19f6fa07 100644 (file)
@@ -1395,7 +1395,7 @@ public:
     bool debug_verify_stored_missing = false
     ) {
     return read_log_and_missing(
-      store, ch, pgmeta_oid, info,
+      cct, store, ch, pgmeta_oid, info,
       log, missing, oss,
       tolerate_divergent_missing_log,
       &clear_divergent_priors,
@@ -1406,6 +1406,7 @@ public:
 
   template <typename missing_type>
   static void read_log_and_missing(
+    CephContext *cct,
     ObjectStore *store,
     ObjectStore::CollectionHandle &ch,
     ghobject_t pgmeta_oid,
index 111147610f753a2b7511244be02965ff07a83b8f..c12a741e97afa29daa1790bf96de58284447cb5c 100644 (file)
@@ -437,7 +437,7 @@ static int get_fd_data(int fd, bufferlist &bl)
   return 0;
 }
 
-int get_log(ObjectStore *fs, __u8 struct_ver,
+int get_log(CephContext *cct, ObjectStore *fs, __u8 struct_ver,
            spg_t pgid, const pg_info_t &info,
            PGLog::IndexedLog &log, pg_missing_t &missing)
 {
@@ -449,7 +449,7 @@ int get_log(ObjectStore *fs, __u8 struct_ver,
     ostringstream oss;
     ceph_assert(struct_ver > 0);
     PGLog::read_log_and_missing(
-      fs, ch,
+      cct, fs, ch,
       pgid.make_pgmeta_oid(),
       info, log, missing,
       oss,
@@ -1078,7 +1078,8 @@ int add_osdmap(ObjectStore *store, metadata_section &ms)
   return get_osdmap(store, ms.map_epoch, ms.osdmap, ms.osdmap_bl);
 }
 
-int ObjectStoreTool::do_export(ObjectStore *fs, coll_t coll, spg_t pgid,
+int ObjectStoreTool::do_export(
+    CephContext *cct, ObjectStore *fs, coll_t coll, spg_t pgid,
     pg_info_t &info, epoch_t map_epoch, __u8 struct_ver,
     const OSDSuperblock& superblock,
     PastIntervals &past_intervals)
@@ -1088,7 +1089,7 @@ int ObjectStoreTool::do_export(ObjectStore *fs, coll_t coll, spg_t pgid,
 
   cerr << "Exporting " << pgid << " info " << info << std::endl;
 
-  int ret = get_log(fs, struct_ver, pgid, info, log, missing);
+  int ret = get_log(cct, fs, struct_ver, pgid, info, log, missing);
   if (ret > 0)
       return ret;
 
@@ -4521,7 +4522,7 @@ int main(int argc, char **argv)
 
     if (op == "export" || op == "export-remove") {
       ceph_assert(superblock != nullptr);
-      ret = tool.do_export(fs.get(), coll, pgid, info, map_epoch, struct_ver, *superblock, past_intervals);
+      ret = tool.do_export(cct.get(), fs.get(), coll, pgid, info, map_epoch, struct_ver, *superblock, past_intervals);
       if (ret == 0) {
         cerr << "Export successful" << std::endl;
         if (op == "export-remove") {
@@ -4540,7 +4541,7 @@ int main(int argc, char **argv)
     } else if (op == "log") {
       PGLog::IndexedLog log;
       pg_missing_t missing;
-      ret = get_log(fs.get(), struct_ver, pgid, info, log, missing);
+      ret = get_log(cct.get(), fs.get(), struct_ver, pgid, info, log, missing);
       if (ret < 0)
           goto out;
 
index aafe886ba697058114c5f013563d1ac7d26dfaa0..82aa83e5d2c3d5ed38b34fc7f72564b08b0aa8e4 100644 (file)
@@ -27,7 +27,7 @@ class ObjectStoreTool : public RadosDump
     int dump_export(Formatter *formatter);
     int do_import(ObjectStore *store, OSDSuperblock& sb, bool force,
                  std::string pgidstr);
-    int do_export(ObjectStore *fs, coll_t coll, spg_t pgid,
+    int do_export(CephContext *cct, ObjectStore *fs, coll_t coll, spg_t pgid,
           pg_info_t &info, epoch_t map_epoch, __u8 struct_ver,
           const OSDSuperblock& superblock,
           PastIntervals &past_intervals);