Implement layer merge

A new command merges multiple snapshot/clone layers into one of them,
so merged layers can be deleted after this procedure
This commit is contained in:
Vitaliy Filippov
2021-07-31 00:23:30 +03:00
parent a02b02eb04
commit acf637950c
15 changed files with 915 additions and 301 deletions
+1 -2
View File
@@ -9,7 +9,6 @@ LD_PRELOAD=libasan.so.5 \
$ETCDCTL get --prefix '/vitastor/pg/state'
LD_PRELOAD=libasan.so.5 \
build/src/vitastor-rm --etcd_address $ETCD_URL --pool 1 --inode 1
build/src/vitastor-cmd rm --etcd_address $ETCD_URL --pool 1 --inode 1
format_green OK
+14
View File
@@ -38,4 +38,18 @@ node mon/merge.js ./testdata/layer0.bin ./testdata/layer1.bin ./testdata/check.b
cmp ./testdata/merged.bin ./testdata/check.bin
# Test merge
$ETCDCTL put /vitastor/config/inode/1/3 '{"parent_id":2,"name":"testimg","size":'$((32*1024*1024))'}'
build/src/vitastor-cmd merge --etcd_address $ETCD_URL testimg@0 testimg --target testimg
$ETCDCTL put /vitastor/config/inode/1/3 '{"name":"testimg","size":'$((32*1024*1024))'}'
qemu-img convert -S 4096 -p \
-f raw "vitastor:etcd_host=127.0.0.1\:$ETCD_PORT/v3:image=testimg" \
-O raw ./testdata/merged-by-tool.bin
cmp ./testdata/merged.bin ./testdata/merged-by-tool.bin
format_green OK