[sheepdog] [PATCH 0/4] variable vnodes specified by free space

levin li levin108 at gmail.com
Fri Aug 3 14:09:28 CEST 2012


On 2012年08月03日 13:59, MORITA Kazutaka wrote:
> At Wed,  1 Aug 2012 10:56:12 +0800,
> levin li wrote:
>>
>> From: levin li <xingke.lwp at taobao.com>
>>
>> For sheep's first boot, we get the free disk space either by syscall
>> or by user's determination though command line argement, and then we
>> store the size into config file, and for later boot, we just read the
>> size from config file, the space size can never be changed after first
>> boot.
>>
>> The free space size of every node is notified to every other node though
>> join message, and stored in sd_node, every time a new node joins or an
>> old node leaves, we recalculate the vnodes number for every nodes.
>>
>> levin li (4):
>>   sheep: get the free disk space and store it in the config file
>>   sheep: add user-defined free disk space size
>>   sheep: recalculate the vnodes number when epoch changes
>>   sheep: remove command line argument --vnodes
>>
>>  include/internal_proto.h |    1 +
>>  sheep/group.c            |   24 +++++++++++++
>>  sheep/sheep.c            |   22 +++++++-----
>>  sheep/sheep_priv.h       |    3 ++
>>  sheep/store.c            |   86 ++++++++++++++++++++++++++++++++++++++++++++++
>>  5 files changed, 127 insertions(+), 9 deletions(-)
> 
> This patchset doesn't pass the following test:
> 
> ==
> #!/bin/bash
> 
> set -ex
> 
> dd if=/dev/zero of=/tmp/0.img seek=$((2 * 1024 ** 3 - 1)) bs=1 count=1
> dd if=/dev/zero of=/tmp/1.img seek=$((4 * 1024 ** 3 - 1)) bs=1 count=1
> dd if=/dev/zero of=/tmp/2.img seek=$((8 * 1024 ** 3 - 1)) bs=1 count=1
> 
> for i in 0 1 2; do
>     mkfs.xfs /tmp/$i.img
>     mkdir /store/$i
>     mount -o loop /tmp/$i.img /store/$i
>     sheep -d /store/$i/ -z $i -p 700$i
> done
> 
> sleep 1
> 
> for i in 0 1 2; do
>     collie node list -p 700$i
> done
> ==
> 
> The expected result is:
> 
> + collie/collie node list -p 7000
> M   Id   Host:Port         V-Nodes       Zone
> -    0   127.0.0.1:7000         27          0
> -    1   127.0.0.1:7001         54          1
> -    2   127.0.0.1:7002         109          2
> + for i in 0 1 2
> + collie/collie node list -p 7001
> M   Id   Host:Port         V-Nodes       Zone
> -    0   127.0.0.1:7000         27          0
> -    1   127.0.0.1:7001         54          1
> -    2   127.0.0.1:7002         109          2
> + for i in 0 1 2
> + collie/collie node list -p 7002
> M   Id   Host:Port         V-Nodes       Zone
> -    0   127.0.0.1:7000         27          0
> -    1   127.0.0.1:7001         54          1
> -    2   127.0.0.1:7002         109          2
> 
> But I got the following output:
> 
> + collie/collie node list -p 7000
> M   Id   Host:Port         V-Nodes       Zone
> -    0   127.0.0.1:7000      		 42          0
> -    1   127.0.0.1:7001      		 85          1
> + for i in 0 1 2
> + collie/collie node list -p 7001
> M   Id   Host:Port         V-Nodes       Zone
> -    0   127.0.0.1:7000      		 42          0
> -    1   127.0.0.1:7001      		 85          1
> + for i in 0 1 2
> + collie/collie node list -p 7002
> M   Id   Host:Port         V-Nodes       Zone
> -    0   127.0.0.1:7002      		 64          2
> 
> 
> Thanks,
> 
> Kazutaka
> 
I just tested this patch set using your script, and it gives the output:

+ mkdir /store/2
+ mount -o loop /tmp/2.img /store/2
+ sheep/sheep -d /store/2/ -z 2 -p 7002
+ sleep 1
+ for i in 0 1 2
+ collie/collie node list -p 7000
M   Id   Host:Port         V-Nodes       Zone
-    0   127.0.0.1:7000      	27          0
-    1   127.0.0.1:7001      	54          1
-    2   127.0.0.1:7002      	110          2
+ for i in 0 1 2
+ collie/collie node list -p 7001
M   Id   Host:Port         V-Nodes       Zone
-    0   127.0.0.1:7000      	27          0
-    1   127.0.0.1:7001      	54          1
-    2   127.0.0.1:7002      	110          2
+ for i in 0 1 2
+ collie/collie node list -p 7002
M   Id   Host:Port         V-Nodes       Zone
-    0   127.0.0.1:7000      	27          0
-    1   127.0.0.1:7001      	54          1
-    2   127.0.0.1:7002      	110          2

I think it's what we expected, as for your result, I think it's due to not
rebase to the latest master which has just merged the delay recovery patch set,
later I'll resend this patch set.

thanks,

levin



More information about the sheepdog mailing list