summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXuehan Xu <xuxuehan@qianxin.com>2024-07-25 09:37:29 +0200
committerMatan Breizman <mbreizma@redhat.com>2024-09-04 11:48:34 +0200
commit4811263eb81ed944868cf17f87090699023585bf (patch)
tree27aa6baabd7cd4e6cbe58d4082cae2cadb537e6b
parentcrimson/osd/ops_executer: set correct clean regions for CLONE pg log (diff)
downloadceph-4811263eb81ed944868cf17f87090699023585bf.tar.xz
ceph-4811263eb81ed944868cf17f87090699023585bf.zip
crimson/osd/object_metadata_helper: take clone objects' clean regions
into account when recovering them There are cases in which clone objects' omaps/xattrs are modified, we want to avoid recover the data contents when recovering those clone objects Signed-off-by: Xuehan Xu <xuxuehan@qianxin.com>
-rw-r--r--src/crimson/osd/object_metadata_helper.cc21
-rw-r--r--src/test/crimson/test_calc_subsets.cc1
2 files changed, 20 insertions, 2 deletions
diff --git a/src/crimson/osd/object_metadata_helper.cc b/src/crimson/osd/object_metadata_helper.cc
index 3016b0ae406..12bf855afbe 100644
--- a/src/crimson/osd/object_metadata_helper.cc
+++ b/src/crimson/osd/object_metadata_helper.cc
@@ -1,3 +1,6 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:nil -*-
+// vim: ts=8 sw=2 smarttab expandtab
+
#include "crimson/osd/object_metadata_helper.h"
namespace {
@@ -23,12 +26,26 @@ subsets_t calc_clone_subsets(
subsets_t subsets;
logger().debug("{}: {} clone_overlap {} ",
__func__, soid, snapset.clone_overlap);
-
+ assert(missing.get_items().contains(soid));
+ const pg_missing_item &missing_item = missing.get_items().at(soid);
+ auto dirty_regions = missing_item.clean_regions.get_dirty_regions();
+ if (dirty_regions.empty()) {
+ logger().debug(
+ "{} {} not touched, no need to recover, skipping",
+ __func__,
+ soid);
+ return subsets;
+ }
uint64_t size = snapset.clone_size[soid.snap];
if (size) {
subsets.data_subset.insert(0, size);
}
+ // let data_subset store only the modified content of the object.
+ subsets.data_subset.intersection_of(dirty_regions);
+ logger().debug("{} {} data_subset {}",
+ __func__, soid, subsets.data_subset);
+
// TODO: make sure CEPH_FEATURE_OSD_CACHEPOOL is not supported in Crimson
// Skips clone subsets if caching was enabled (allow_incomplete_clones).
@@ -140,7 +157,7 @@ subsets_t calc_head_subsets(
subsets.data_subset.insert(0, obj_size);
}
assert(missing.get_items().contains(head));
- const pg_missing_item missing_item = missing.get_items().at(head);
+ const pg_missing_item &missing_item = missing.get_items().at(head);
// let data_subset store only the modified content of the object.
subsets.data_subset.intersection_of(missing_item.clean_regions.get_dirty_regions());
logger().debug("{} {} data_subset {}",
diff --git a/src/test/crimson/test_calc_subsets.cc b/src/test/crimson/test_calc_subsets.cc
index 7d23810c2e6..dae3cab84fe 100644
--- a/src/test/crimson/test_calc_subsets.cc
+++ b/src/test/crimson/test_calc_subsets.cc
@@ -190,6 +190,7 @@ TEST(clone_subsets, overlap)
ss.clones.push_back(snapid_t(2));
pg_missing_t missing;
pg_missing_item item;
+ item.clean_regions.mark_fully_dirty();
missing.add(clone, std::move(item));
hobject_t last_backfill{object_t{"foo1"}, "foo1", CEPH_NOSNAP, 42, 0, "nspace"};