diff options
author | Sanoj Unnikrishnan <sunnikri@redhat.com> | 2017-06-29 15:39:35 +0530 |
---|---|---|
committer | Raghavendra G <rgowdapp@redhat.com> | 2017-06-30 08:39:05 +0000 |
commit | 50d72373fadf1174918e754e31bae3806aa4c214 (patch) | |
tree | 7bbd7c860e5694a6b7315ab4dbfefd54ff3a0f79 /extras/contri-add.sh | |
parent | 292b4e42fdc023e307fde35e189285040d4b9cdd (diff) |
Scripts to identify quota accouting issues
The patch contains 2 scripts:
log_accounting.sh does a du -h on the FS hierarchy and a quota list
on the hierarchy and interleaves the two output. We can then identify
which directory(s) in FS has caused the accounting to go bad and try
to investigate what fops happened on those directories. We can also
limit the set of directories on which we need to set dirty xattr to
correct accounting.
xattr_analysis.py reads all the xattr of a brick and dumps it a human
readable form to ease debugging.
Change-Id: I2155561d10c08dc3ab9e8b09dbd258f0592b4d33
BUG: 1466188
Signed-off-by: Sanoj Unnikrishnan <sunnikri@redhat.com>
Reviewed-on: https://review.gluster.org/17649
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'extras/contri-add.sh')
-rwxr-xr-x | extras/contri-add.sh | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/extras/contri-add.sh b/extras/contri-add.sh deleted file mode 100755 index 7db5edd5d20..00000000000 --- a/extras/contri-add.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash - -# This script adds contributions of files/directories in backend to volume -# size. -# It can also be used to debug by passing dir as first argument, in which case -# it will just add contributions from immediate children of a directory and -# displays only if added contributions from immediate children is different -# from size stored in directory. -# For Eg., find <backend-directory> -type d -exec ./contri-add.sh dir \{} \; -# will list all the directories which have descrepancies in their -# size/contributions. - -usage () -{ - echo >&2 "usage: $0 <file|dir> <list-of-backend-directories>" -} - -add_contributions () -{ - local var=0 - local count=0 - - SIZE=`getfattr -h -e hex -n trusted.glusterfs.quota.size $2 2>&1 | sed -e '/^#/d' | sed -e '/^getfattr/d' | sed -e '/^$/d' | cut -d'=' -f 2` - CONTRI=`getfattr -h -e hex -d -m trusted.glusterfs.quota.*.contri $2 2>&1 | sed -e '/^#/d' | sed -e '/^getfattr/d' | sed -e '/^$/d' | cut -d'=' -f 2` - - if [ $1 == "file" ]; then - PATHS=`find $2 ! -type d | sed -e "\|^$2$|d" | sed -e '/^[ \t]*$/d'` - else - PATHS=`find $2 -maxdepth 1 | sed -e "\|^$2$|d" | sed -e '/^[ \t]*$/d'` - fi - - if [ -z "$PATHS" ]; then - return 0 - fi - - CONTRIBUTIONS=`echo $PATHS | xargs getfattr -h -e hex -d -m trusted.glusterfs.quota.*.contri 2>&1 | sed -e '/^#/d' | sed -e '/^getfattr/d' | sed -e '/^$/d' | cut -d'=' -f 2 | sed -e 's/^[ \t]*\([^ \t]*\)/\1/g'` - - if [ -n "$CONTRIBUTIONS" ]; then - for i in $CONTRIBUTIONS; do - count=$(($count + 1)) - var=$(($var + $i)) - done - fi - - if [ $1 == "file" ] || [ $var -ne $(($SIZE)) ] || [ $(($SIZE)) -ne $(($CONTRI)) ]; then - if [ $1 == "dir" ]; then - TMP_PATH=`echo $2 | sed -e "s/\/home\/export\/[0-9]*/\/mnt\/raghu/g"` - stat $TMP_PATH > /dev/null - fi - - echo "file count $count" - echo "added contribution of $2=$var" - echo "size stored in xattrs on $2=$(($SIZE))" - echo "contribution of $2 to its parent directory=$(($CONTRI))" - echo "==============================================================" - fi -} - - -main () -{ - [ $# -lt 1 ] && usage - - TYPE=$1 - - shift 1 - - for i in $@; do - add_contributions $TYPE $i - done -} - -main $@
\ No newline at end of file |