Bug 2247138

Summary: rgw-restore-bucket-index does not restore some versioned instance entries (7.0)
Product: [Red Hat Storage] Red Hat Ceph Storage Reporter: J. Eric Ivancich <ivancich>
Component: RGWAssignee: J. Eric Ivancich <ivancich>
Status: CLOSED ERRATA QA Contact: Vidushi Mishra <vimishra>
Severity: medium Docs Contact: Rivka Pollack <rpollack>
Priority: unspecified    
Version: 7.0CC: akraj, ceph-eng-bugs, cephqe-warriors, mkasturi, tserlin, vereddy, vimishra
Target Milestone: ---   
Target Release: 7.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ceph-18.2.0-106.el9cp Doc Type: Bug Fix
Doc Text:
.Object version instance IDs beginning with a hyphen are restored Previously, when restoring the index on a versioned bucket, object versions with an instance ID beginning with a hyphen would not be properly restored into the bucket index. With this fix, instance IDs beginning with a hyphen are now recognized and restored into the bucket index, as expected.
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-12-13 15:24:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2237662    

Description J. Eric Ivancich 2023-10-30 21:25:17 UTC
Description of problem: When a versioned instance of an object has an instance identifier that begins with a hyphen, the rgw-bucket-restore-bucket-index does not restore that object and fellow instances properly.


Version-Release number of selected component (if applicable):


How reproducible: Very.


Steps to Reproduce:
1. Create a versioned bucket. Add about 200 objects to it, each with two versions.
2. Capture the `radosgw-admin bi list ...` for that bucket.
3. Clear the bucket instance objects for that bucket using something like `rados clearomap ...`
4. Run `rgw-restore-bucket-index ...` on the bucket.
5. Capture the `radosgw-admin bi list ...` for that bucket again.
6. `diff` the two bi lists and look for versions appearing in the earlier but not the latter. Odds are that at least one of the instance identifiers began with a hyphen and anomalies will be seen with that object and fellow instances.

Actual results: The bi lists don't have the same instances for all objects.


Expected results: The bi lists should have the same instances for all objects.


Additional info:

Comment 1 RHEL Program Management 2023-10-30 21:25:27 UTC
Please specify the severity of this bug. Severity is defined here:
https://bugzilla.redhat.com/page.cgi?id=fields.html#bug_severity.

Comment 7 J. Eric Ivancich 2023-11-10 17:16:03 UTC
I've pasted in a script below. However, it depends on an upstream change that includes the layout "gen"eration information in `radosgw-admin bucket stats ...`. Since that change hasn't made it downstream yet, I think you can use `radosgw-admin bucket layout ...` in order to determin the "gen"eration.

Basically it figures out what all of the bucket index objects would be for a given bucket and executes `rados clearomap -p default.rgw.buckets.index <bucket-index-objext>` on each.

Oh, and in case it's not obvious, `jq` is the json query tool that I installed on my machine.

Eric

===

#!/bin/bash

temp1=/tmp/cli-1.$$
temp2=/tmp/cli-2.$$
pool="-p default.rgw.buckets.index"

export PATH=${PATH}:$(pwd)/bin

if [ $# -eq 1 ] ;then
    bucket=$1
else
    echo "Usage: $(basename $0) <bucket>"
    exit 1
fi

radosgw-admin bucket stats --bucket=${bucket} >$temp1 2>/dev/null
gen=$(jq -r '.index_generation' $temp1)
num_shards=$(jq -r '.num_shards' $temp1)
id=$(jq -r '.id' $temp1)

if [ "$num_shards" -eq 0 ] ;then
    prefix=".dir.${id}$"
elif [ "$gen" -eq 0 ] ;then
    prefix=".dir.${id}."
else
    prefix=".dir.${id}.${gen}."
fi
echo prefix is $prefix

# rados ls $pool
objs=$(rados ls $pool 2>/dev/null | grep "^$prefix")

set -x
rados clearomap $pool $objs 2>/dev/null
set +x

rm -f $temp1 $temp2

Comment 13 errata-xmlrpc 2023-12-13 15:24:36 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Red Hat Ceph Storage 7.0 Bug Fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:7780