]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/ceph_objectstore_tool: pass require_rollback to write_log_and_missing()
authorKefu Chai <kchai@redhat.com>
Mon, 26 Jul 2021 03:41:11 +0000 (11:41 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 26 Jul 2021 03:58:11 +0000 (11:58 +0800)
before this change, `require_rollback` is always true when it is passed
to write_log_and_missing(), which does not hurt. but this diverges from
how `PG::prepare_write()` is implemented. and probably, more important,
this is not correct, as replica pool does not `require_rollback`.

after this change, `require_rollback` is deduced from pgid. so we don't
always pass `true` to `write_log_and_missing()`.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/tools/ceph_objectstore_tool.cc

index 5035e367d813bf5a5adc4737c593c4594f958ebb..c4d30cc444b10c285928074736be4d891cb3ef1d 100644 (file)
@@ -610,18 +610,21 @@ int write_pg(ObjectStore::Transaction &t, epoch_t epoch, pg_info_t &info,
   int ret = write_info(t, epoch, info, past_intervals);
   if (ret)
     return ret;
+
   coll_t coll(info.pgid);
   map<string,bufferlist> km;
-
+  const bool require_rollback = !info.pgid.is_no_shard();
   if (!divergent.empty()) {
     ceph_assert(missing.get_items().empty());
     PGLog::write_log_and_missing_wo_missing(
-      t, &km, log, coll, info.pgid.make_pgmeta_oid(), divergent, true);
+      t, &km, log, coll, info.pgid.make_pgmeta_oid(), divergent,
+      require_rollback);
   } else {
     pg_missing_tracker_t tmissing(missing);
     bool rebuilt_missing_set_with_deletes = missing.may_include_deletes;
     PGLog::write_log_and_missing(
-      t, &km, log, coll, info.pgid.make_pgmeta_oid(), tmissing, true,
+      t, &km, log, coll, info.pgid.make_pgmeta_oid(), tmissing,
+      require_rollback,
       &rebuilt_missing_set_with_deletes);
   }
   t.omap_setkeys(coll, info.pgid.make_pgmeta_oid(), km);