Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/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 <wido@42on.com>
- #
- 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
Add Comment
Please, Sign In to add comment