AliyunContainerService / pouch

An Efficient Enterprise-class Container Engine
https://pouchcontainer.io
Apache License 2.0
4.64k stars 949 forks source link

feature: stat snapshot before fetch #2915

Closed ZYecho closed 5 years ago

ZYecho commented 5 years ago

Signed-off-by: zhangyue zy675793960@yeah.net

Ⅰ. Describe what this PR did

add a doc to describe this feature https://www.yuque.com/zhangyue-jlgo3/kb/epa5ml

Ⅱ. Does this pull request fix one issue?

None.

Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)

using current test case.

Ⅳ. Describe how to verify it

 ~/go/src/github.com/alibaba/pouch$ sudo pouch pull hello-world
hello-world:latest:                                                               resolved       |++++++++++++++++++++++++++++++++++++++| 
index-sha256:41a65640635299bab090f783209c1e3a3f11934cf7756b09cb2f1e02147c6ed8:    done           |++++++++++++++++++++++++++++++++++++++| 
manifest-sha256:92c7f9c92844bbbb5d0a101b22f7c2a7949e40f8ea90c8b3bc396879d95e899a: done           |++++++++++++++++++++++++++++++++++++++| 
layer-sha256:1b930d010525941c1d56ec53b97bd057a67ae1865eebf042686d2a2d18271ced:    done           |++++++++++++++++++++++++++++++++++++++| 
config-sha256:fce289e99eb9bca977dae136fbe2a82b6b7d4c372474c9235adc1741675f587e:   done           |++++++++++++++++++++++++++++++++++++++| 
elapsed: 2.1 s 

sudo ctr -a /var/run/containerd.sock content ls | grep 1b930d010525941c1d56ec53b97bd057a67ae1865eebf042686d2a2d18271ced
sha256:1b930d010525941c1d56ec53b97bd057a67ae1865eebf042686d2a2d18271ced 977 B   2 minutes   containerd.io/uncompressed=sha256:af0b15c8625bb1938f1d7b17081031f649fd14e6b233688eea3c5483994a66a3

hello-world only has one layer, and we can see that the layer don't any any fc ref point to it, so it will be deleted by containerd gc.

and other content keep original

sudo ctr -a /var/run/containerd.sock content ls
DIGEST                                  SIZE    AGE     LABELS
sha256:1b930d010525941c1d56ec53b97bd057a67ae1865eebf042686d2a2d18271ced 977 B   2 seconds   containerd.io/uncompressed=sha256:af0b15c8625bb1938f1d7b17081031f649fd14e6b233688eea3c5483994a66a3
sha256:41a65640635299bab090f783209c1e3a3f11934cf7756b09cb2f1e02147c6ed8 2.13 kB 3 seconds   containerd.io/gc.ref.content.0=sha256:92c7f9c92844bbbb5d0a101b22f7c2a7949e40f8ea90c8b3bc396879d95e899a,containerd.io/gc.ref.content.2=sha256:d1fd2e204af0a2bca3ab033b417b29c76d7950ed29a44e427d1c4d07d14f04f9,containerd.io/gc.ref.content.4=sha256:5a4bdadd9acd8779ed6fcf007a4e7ed7f919056a92c3c67824b4fded06ef0a6e,containerd.io/gc.ref.content.6=sha256:577ad4331d4fac91807308da99ecc107dcc6b2254bc4c7166325fd01113bea2a,containerd.io/gc.ref.content.8=sha256:26cbbd7458900f0d0e7bf460a08ebcb79c185b4a6c7a2c5eb45ea688cd7140c2,containerd.io/gc.ref.content.7=sha256:b0735fcb32a0e9f647c8758bfce2bf8b0e71a097549c7d3945d9ad978fd0dfec,containerd.io/gc.ref.content.1=sha256:1e44d8bca6fb0464794555e5ccd3a32e2a4f6e44a20605e4e82605189904f44d,containerd.io/gc.ref.content.3=sha256:d0d4c5389b53875b0f2364f94c466f77cf6f02811fb02f0477b97d609fb50568,containerd.io/gc.ref.content.5=sha256:12cf9ef90835465316cb0b3729c36bfd8654d7f2f697e23432fddfaa7d7e31b5
sha256:92c7f9c92844bbbb5d0a101b22f7c2a7949e40f8ea90c8b3bc396879d95e899a 524 B   3 seconds   containerd.io/gc.ref.content.0=sha256:fce289e99eb9bca977dae136fbe2a82b6b7d4c372474c9235adc1741675f587e
sha256:fce289e99eb9bca977dae136fbe2a82b6b7d4c372474c9235adc1741675f587e 1.51 kB 3 seconds   containerd.io/gc.ref.snapshot.overlayfs=sha256:af0b15c8625bb1938f1d7b17081031f649fd14e6b233688eea3c5483994a66a3

Ⅴ. Special notes for reviews

when manifest is in schema 1 (application/vnd.docker.distribution.manifest.v1+prettyjws), this feature is not enable now.

codecov[bot] commented 5 years ago

Codecov Report

Merging #2915 into master will increase coverage by 0.04%. The diff coverage is 69.28%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #2915      +/-   ##
=========================================
+ Coverage   68.85%   68.9%   +0.04%     
=========================================
  Files         291     291              
  Lines       18259   18387     +128     
=========================================
+ Hits        12573   12670      +97     
- Misses       4231    4247      +16     
- Partials     1455    1470      +15
Flag Coverage Δ
#criv1alpha2_test 38.68% <67.14%> (+0.34%) :arrow_up:
#integration_test_0 36.41% <62.14%> (+0.15%) :arrow_up:
#integration_test_1 35.84% <62.14%> (+0.17%) :arrow_up:
#integration_test_2 36.39% <62.14%> (+0.2%) :arrow_up:
#integration_test_3 35.93% <64.28%> (+0.19%) :arrow_up:
#node_e2e_test 34.43% <67.14%> (+0.22%) :arrow_up:
#unittest 27.78% <0%> (-0.23%) :arrow_down:
Impacted Files Coverage Δ
daemon/mgr/image.go 61.72% <100%> (+0.35%) :arrow_up:
ctrd/image.go 67.74% <69.06%> (+0.21%) :arrow_up:
apis/server/utils.go 71.15% <0%> (-3.85%) :arrow_down:
daemon/mgr/container.go 59.72% <0%> (-0.63%) :arrow_down:
cri/v1alpha2/cri.go 68.81% <0%> (-0.26%) :arrow_down:
ctrd/container.go 53.91% <0%> (+0.38%) :arrow_up:
cri/stream/runtime.go 70.23% <0%> (+2.38%) :arrow_up:
ctrd/watch.go 78.37% <0%> (+5.4%) :arrow_up:
cri/stream/portforward/httpstream.go 77.77% <0%> (+6.83%) :arrow_up:
ctrd/snapshotter_key.go 100% <0%> (+10%) :arrow_up: