-
-
Save ZiggyMaes/2d7c414c1188e9362045c63f7d74994c to your computer and use it in GitHub Desktop.
Ceph RADOS Gateway bucket index garbage collection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Find orphaned bucket index objects in the RGW bucket index pool | |
# and clean them up if they do not belong to a bucket | |
# | |
# Author: Wido den Hollander <[email protected]> | |
# | |
INDEX_POOL=$1 | |
if [ -z "$INDEX_POOL" ]; then | |
echo "Usage: $0 <index pool>" | |
exit 1 | |
fi | |
INDEXES=$(mktemp) | |
METADATA=$(mktemp) | |
trap "rm -f ${INDEXES} ${METADATA}" EXIT | |
radosgw-admin metadata list bucket.instance|jq -r '.[]' > ${METADATA} | |
rados -p ${INDEX_POOL} ls > $INDEXES | |
for OBJECT in $(cat ${INDEXES}); do | |
MARKER=$(echo ${OBJECT}|cut -d '.' -f 3,4,5) | |
grep ${MARKER} ${METADATA} > /dev/null | |
if [ "$?" -ne 0 ]; then | |
echo $OBJECT | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment