On Sun, 08 Aug 2010 21:43:51 +0900, sfjro wrote:

>> it seems to work at the first glance, but it will fail in real
>> world. Because --max-delete=0 completely disable file deletion, if
>> there is any modification to the files in ro_mid branch at the RW
>> level, the script will fail.
> 
> Did it really fail on your side?
> In the previous script, I tried "echo brabra >> u/d2/1" and aubrsync
> again, and "ro_mid/d2/1" was updated expectedly.

Ok, I just thought it over again and it turns out that I was right.

Here is more for you to test:

cd /tmp

rm -fr u rw ro_mid ro_bot
mkdir rw ro_bot ro_mid u
mkdir ro_bot/d1
seq 9 | xargs -i touch ro_bot/d1/{}
ls ro_bot/d1

mount -t aufs -o br:./rw:./ro_mid:./ro_bot none ./u

# work on something old
rm u/d1/[56]
mv u/d1/{4,four}

# work on something new
mkdir ./u/d2
seq 6 | xargs -i touch u/d2/{}

seq 7 9 | xargs -i mkdir u/d2/{}
seq 7 9 | xargs -i touch u/d2/{}/{}

% ls u/d?
u/d1:
1  2  3  7  8  9  four

u/d2:
1  2  3  4  5  6  7  8  9

find rw ro_mid
aubrsync _move u rw ro_bot "--remove-source-files --exclude=$AUFS_WH_BASE 
--exclude=$AUFS_WH_PLINKDIR --exclude=$AUFS_WH_ORPHDIR --max-delete=0 -v 
rw/ ro_mid" 

% find rw ro_mid
rw
rw/.wh..wh.orph
rw/.wh..wh.plnk
rw/.wh..wh.aufs
ro_mid
ro_mid/d2
ro_mid/d2/6
ro_mid/d2/5
ro_mid/d2/4
ro_mid/d2/3
ro_mid/d2/2
ro_mid/d2/1
ro_mid/d2/9
ro_mid/d2/9/9
ro_mid/d2/8
ro_mid/d2/8/8
ro_mid/d2/7
ro_mid/d2/7/7
ro_mid/d1
ro_mid/d1/.wh.4
ro_mid/d1/.wh.5
ro_mid/d1/four
ro_mid/d1/.wh.6

-- everything get transferred over. So far so good.

# more work on something new

echo brabra >> u/d2/1

rm u/d2/2
mkdir u/d2/2

rm -rf u/d2/8
touch u/d2/8

# simulate an incremental transfer on the 2nd day:

aubrsync _move u rw ro_bot "--remove-source-files --exclude=$AUFS_WH_BASE 
--exclude=$AUFS_WH_PLINKDIR --exclude=$AUFS_WH_ORPHDIR --max-delete=0 -v 
rw/ ro_mid" 
++ rsync --exclude=lost+found -aHSx --devices --specials --delete-before 
--remove-source-files --exclude=.wh..wh.aufs --exclude=.wh..wh.plnk --
exclude=.wh..wh.orph --max-delete=0 -v rw/ ro_mid
building file list ... done
cannot delete non-empty directory: d1
cannot delete non-empty directory: d2/9
cannot delete non-empty directory: d2/7
./
d2/
d2/1
cannot delete non-empty directory: d2/8
could not make way for new regular file: d2/8
d2/2/
d2/2/.wh..wh..opq
Deletions stopped due to --max-delete limit (11 skipped)

sent 198 bytes  received 59 bytes  514.00 bytes/sec
total size is 7  speedup is 0.03
rsync error: the --max-delete limit stopped deletions (code 25) at main.c
(1060) [sender=3.0.7]

% find rw ro_mid -printf "%M %p\n"
drwxr-xr-x rw
drwxr-xr-x rw/d2
-rw-r--r-- rw/d2/8
drwxr-xr-x rw/d2/2
drwx------ rw/.wh..wh.orph
drwx------ rw/.wh..wh.plnk
-r--r--r-- rw/.wh..wh.aufs
drwxr-xr-x ro_mid
drwxr-xr-x ro_mid/d2
-rw-r--r-- ro_mid/d2/1
drwxr-xr-x ro_mid/d2/2
-r--r--r-- ro_mid/d2/2/.wh..wh..opq
-rw-r--r-- ro_mid/d2/6
-rw-r--r-- ro_mid/d2/5
-rw-r--r-- ro_mid/d2/4
-rw-r--r-- ro_mid/d2/3
drwxr-xr-x ro_mid/d2/9
-rw-r--r-- ro_mid/d2/9/9
drwxr-xr-x ro_mid/d2/8
-rw-r--r-- ro_mid/d2/8/8
drwxr-xr-x ro_mid/d2/7
-rw-r--r-- ro_mid/d2/7/7
drwxr-xr-x ro_mid/d1
-r--r--r-- ro_mid/d1/.wh.4
-r--r--r-- ro_mid/d1/.wh.5
-rw-r--r-- ro_mid/d1/four
-r--r--r-- ro_mid/d1/.wh.6

See, having "--max-delete=0" have severely damaged the usability of 
aubrsync. It only transfer the modifications half the way. 

Please double check.
Thanks

-- 
Tong (remove underscore(s) to reply)
  http://xpt.sourceforge.net/techdocs/
  http://xpt.sourceforge.net/tools/


------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 

Reply via email to