Guest User

Untitled

a guest
Nov 15th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # Find orphaned bucket index objects in the RGW bucket index pool
  4. # and clean them up if they do not belong to a bucket
  5. #
  6. # Author: Wido den Hollander <wido@42on.com>
  7. #
  8.  
  9. INDEX_POOL=$1
  10.  
  11. if [ -z "$INDEX_POOL" ]; then
  12. echo "Usage: $0 <index pool>"
  13. exit 1
  14. fi
  15.  
  16. INDEXES=$(mktemp)
  17. METADATA=$(mktemp)
  18.  
  19. trap "rm -f ${INDEXES} ${METADATA}" EXIT
  20.  
  21. radosgw-admin metadata list bucket.instance|jq -r '.[]' > ${METADATA}
  22. rados -p ${INDEX_POOL} ls > $INDEXES
  23.  
  24. for OBJECT in $(cat ${INDEXES}); do
  25. MARKER=$(echo ${OBJECT}|cut -d '.' -f 3,4,5)
  26. grep ${MARKER} ${METADATA} > /dev/null
  27. if [ "$?" -ne 0 ]; then
  28. echo $OBJECT
  29. fi
  30. done
Add Comment
Please, Sign In to add comment