]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: during "bucket check --fix" set index entry pool id correctly 45456/head
authorJ. Eric Ivancich <ivancich@redhat.com>
Mon, 11 Oct 2021 20:17:46 +0000 (16:17 -0400)
committerCory Snyder <csnyder@iland.com>
Mon, 16 May 2022 08:46:54 +0000 (04:46 -0400)
The current code sets the pool id of bucket index entries to the
bucket index pool rather than the data pool. This fixes that.

Signed-off-by: J. Eric Ivancich <ivancich@redhat.com>
(cherry picked from commit 4c2ac79621c7d110d9b3664ef5ce2027d817560c)

Conflicts:
src/rgw/rgw_rados.cc

Cherry-pick notes:
- Conflict due to braces around if condition after change that weren't on Octopus
- Octopus using dout vs. ldpp_dout

src/rgw/rgw_rados.cc

index a677613793fb4ea3484c6743367605e9dfe3d065..fe9b8b2d0ed6bea273afef5b16a38fe92d93348a 100644 (file)
@@ -8883,6 +8883,7 @@ int RGWRados::check_disk_state(librados::IoCtx io_ctx,
        * non-bad ways this could happen (there probably are, but annoying
        * to handle!) */
     }
+
     // encode a suggested removal of that key
     list_state.ver.epoch = io_ctx.get_last_version();
     list_state.ver.pool = io_ctx.get_id();
@@ -8938,16 +8939,29 @@ int RGWRados::check_disk_state(librados::IoCtx io_ctx,
   object.meta.owner_display_name = owner.get_display_name();
 
   // encode suggested updates
-  list_state.ver.pool = io_ctx.get_id();
-  list_state.ver.epoch = astate->epoch;
+
   list_state.meta.size = object.meta.size;
   list_state.meta.accounted_size = object.meta.accounted_size;
   list_state.meta.mtime = object.meta.mtime;
   list_state.meta.category = main_category;
   list_state.meta.etag = etag;
   list_state.meta.content_type = content_type;
-  if (astate->obj_tag.length() > 0)
+
+  librados::IoCtx head_obj_ctx; // initialize to data pool so we can get pool id
+  const bool head_pool_found =
+    get_obj_head_ioctx(bucket_info, obj, &head_obj_ctx);
+  if (head_pool_found) {
+    list_state.ver.pool = head_obj_ctx.get_id();
+    list_state.ver.epoch = astate->epoch;
+  } else {
+    dout(0) << __PRETTY_FUNCTION__ <<
+      " WARNING: unable to find head object data pool for \"" <<
+      obj << "\", not updating version pool/epoch" << dendl;
+  }
+
+  if (astate->obj_tag.length() > 0) {
     list_state.tag = astate->obj_tag.c_str();
+  }
   list_state.meta.owner = owner.get_id().to_str();
   list_state.meta.owner_display_name = owner.get_display_name();