Skip to content

Commit

Permalink
rgw: during "bucket check --fix" set index entry pool id correctly
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
ivancich committed Oct 20, 2021
1 parent c0a93a7 commit 4c2ac79
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/rgw/rgw_rados.cc
Expand Up @@ -9005,6 +9005,7 @@ int RGWRados::check_disk_state(const DoutPrefixProvider *dpp,
* 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();
Expand Down Expand Up @@ -9060,15 +9061,26 @@ int RGWRados::check_disk_state(const DoutPrefixProvider *dpp,
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;

librados::IoCtx head_obj_ctx; // initialize to data pool so we can get pool id
const bool head_pool_found =
get_obj_head_ioctx(dpp, 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 {
ldpp_dout(dpp, 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();
}
Expand Down

0 comments on commit 4c2ac79

Please sign in to comment.