Hi,

As a part of improvements in "gluster volume heal commands", we need a command 
which can give indication regarding the Number of files which requires self 
heal. Although this information can be retrieved by "gluster volume heal 
volume-name info" command. But it collects the list of files with names which 
is a time consuming operation. So a command just informing the number of files 
which requires self-heal is needed.



Xattrop directory contains the hard links represented in the gfid form to dummy 
link.

Example:

under indices/xatttop/ we have 6 entries:

1111111 ----------. 3 root root    0 Aug 27 17:13 
00000000-0000-0000-0000-000000000001                            line-1
1111111 ----------. 3 root root    0 Aug 27 17:13 
85998df6-571a-4329-a38c-111111111111                            line-2
1111111 ----------. 3 root root    0 Aug 27 17:13 
xattrop-11111111-1111-1111-1111-111111111111                    line-3

2222222 ----------. 3 root root    0 Aug 27 17:13 
00000000-0000-0000-0000-000000000002                            line-4
2222222 ----------. 3 root root    0 Aug 27 17:13 
85998df6-571a-4329-a38c-222222222222                            line-5
2222222 ----------. 3 root root    0 Aug 27 17:13 
xattrop-22222222-2222-2222-2222-222222222222                    line-6

Here we have two dummy "xattrop" prefixed entries (line-3 and line-6). line-1 
and line-2 are hard links to line-3.  line-4 and line-5 are hard links to 
line-6.
So 1,2,4,5 are the entries which requires self-heal.

I am planning to introduce one more directory dummy_xattrop under indices. 
[indices/dummy_xattrop]
which will contain only the dummy xattrop entries of indices/xattrop directory.

Example:
under indices/dummy_xattrop:
1111111 ----------. 3 root root    0 Aug 27 17:13 
xattrop-dummy-11111111-1111-1111-1111-111111111111                line-7
2222222 ----------. 3 root root    0 Aug 27 17:13 
xattrop-dummy-22222222-2222-2222-2222-222222222222                line-8

line-7 entry is hard link to line-3 entry and line-8 entry is hard link to 
line-6 entry.

Now if we need the no. of files to be healed from this brick then
a = hard link counts for inode 1111111 and subtract 2 [ here 2 links 
corresponds to line-3 and line-7 as they are dummy]
b = hard link counts for inode 2222222 and subtract 2 [ here 2 links 
corresponds to line-6 and line-8 as they are dummy]

No of entries corresponding to this brick = a+b. In a similar fashion for other 
bricks also we can determine the number of entries present.


Advantages:
-----------
1. No of network calls involved are very few. Involved system call are readdir 
of indices/dummy_xattrop which is expected to contain very few entries and stat
   for each entry.

2. Very quick way of retrieving this information.

3. Command is expected to work at both volume level and replica-group level.


Output will give the entries per brick.

Replica-0:

BRICK1: 192.168.122.2:/rep-0_brick1     count:10
Brick2: 192.168.122.3:/rep_0-brick2     count:20

Replica-1:

BRICK1: 192.168.122.4:/rep-1_brick1     count:10
BRICK2: 192.168.122.5:/rep-1_brick2     count:20


Regards,
Venkatesh Somyajulu

_______________________________________________
Gluster-devel mailing list
Gluster-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/gluster-devel

Reply via email to