-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nydusify: introduce chunkdict generate subcommand #1401
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the failing unit tests, thanks!
dce32c0
to
f43d991
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1401 +/- ##
==========================================
- Coverage 61.34% 61.24% -0.11%
==========================================
Files 144 145 +1
Lines 47001 48383 +1382
Branches 44537 45906 +1369
==========================================
+ Hits 28835 29630 +795
- Misses 16685 17194 +509
- Partials 1481 1559 +78
|
de21a76
to
3c427af
Compare
9d17ca3
to
b04d80e
Compare
e4b7288
to
c7654ba
Compare
ba3c206
to
7fc7008
Compare
builder/src/chunkdict_generator.rs
Outdated
inode.set_blocks(256); | ||
let node_info = NodeInfo { | ||
explicit_uidgid: true, | ||
src_dev: 66305, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This value is meaningless, maybe set it to zero.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
builder/src/chunkdict_generator.rs
Outdated
let node_info = NodeInfo { | ||
explicit_uidgid: true, | ||
src_dev: 66305, | ||
src_ino: 24772610, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
builder/src/chunkdict_generator.rs
Outdated
let node_info = NodeInfo { | ||
explicit_uidgid: true, | ||
src_dev: 66305, | ||
src_ino: 24775126, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
builder/src/chunkdict_generator.rs
Outdated
) -> Result<()> { | ||
for chunk_info in chunkdict.iter() { | ||
let chunk_size: u32 = chunk_info.chunk_compressed_size; | ||
let file_offset = 1 as u64 * chunk_size as u64; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this value valid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corr.
// update blob context | ||
let (blob_index, blob_ctx) = | ||
blob_mgr.get_or_cerate_blob_for_chunkdict(ctx, &chunk_info.chunk_blob_id)?; | ||
if blob_ctx.blob_id.is_empty() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A chunk must belong to a blob, when will the blob_id
be empty?
builder/src/generate.rs
Outdated
@@ -0,0 +1,257 @@ | |||
// Copyright (C) 2022 Nydus Developers. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file should be removed?
src/bin/nydus-image/main.rs
Outdated
.num_args(1..), | ||
) | ||
.arg( | ||
Arg::new("digester") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we need this option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted.
src/bin/nydus-image/main.rs
Outdated
) | ||
.arg( | ||
Arg::new("features") | ||
.long("features") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we need this option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted.
src/bin/nydus-image/main.rs
Outdated
let path_name: Vec<&str> = path.split('/').collect(); | ||
|
||
// Extract the image name and version name from the bootstrap directory | ||
let bootstrap_dir = match path_name.get(path_name.len() - 2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/bin/nydus-image/main.rs
Outdated
let full_image_name: Vec<&str> = bootstrap_dir.split(':').collect(); | ||
let image_name = match full_image_name.get(full_image_name.len() - 2) { | ||
Some(&second_last) => second_last.to_string(), | ||
None => bail!("Invalid image name"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also print the image name in the error message.
src/bin/nydus-image/main.rs
Outdated
Some(&second_last) => second_last.to_string(), | ||
None => bail!("Invalid image name"), | ||
}; | ||
let version_name = match full_image_name.last() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It better be let image_tag
.
.set_blob_accessible(matches.get_one::<String>("config").is_some()); | ||
build_ctx.configuration = config; | ||
build_ctx.blob_storage = Some(chunkdict_bootstrap_path); | ||
build_ctx.blob_features = BlobFeatures::CAP_TAR_TOC; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blob_features
should be from the base bootstrap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
src/bin/nydus-image/main.rs
Outdated
// Build_ctx.blob_features.insert(BlobFeatures::ENCRYPTED); | ||
build_ctx.features = features; | ||
|
||
let digester = matches |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
digester
should also be from the base bootstrap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
|
||
|
||
|
||
| image_name | version number | total_image_size(OCI) | total_image_size(nydus) | total_image_size (nydus after dedulicating) | chunkdict_image_size | dedulicating rate | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be number of versions
?
|
||
| image_name | version number | total_image_size(OCI) | total_image_size(nydus) | total_image_size (nydus after dedulicating) | chunkdict_image_size | dedulicating rate | | ||
|------------|----------------|-----------------------|-------------------------|---------------------------------------------|----------------------|-------------------| | ||
| redis | 10 | 341.78 | 419.37 | 319.48 | 41.87 | 23.82% | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All image size should be MB
unit.
| image_name | version number | total_image_size(OCI) | total_image_size(nydus) | total_image_size (nydus after dedulicating) | chunkdict_image_size | dedulicating rate | | ||
|------------|----------------|-----------------------|-------------------------|---------------------------------------------|----------------------|-------------------| | ||
| redis | 10 | 341.78 | 419.37 | 319.48 | 41.87 | 23.82% | | ||
| ubuntu | 10 | 290.26 | 308.59 | 140.28 | 30.8 | 54.54% | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's split the table into two, one for "image info" and one for "deduplication result"
|
||
// jsonData := `{ | ||
// "endpoint": "oss-cn-zhangjiakou.aliyuncs.com", | ||
// "access_key_id": "LTAI5tKHuSQQXVjSE7PgKYhf", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The AK is leaked.
ctx.Binary.Nydusify, logLevel, image2, target2v6, ctx.Binary.Builder, ctx.Env.TempDir, | ||
) | ||
tool.RunWithoutOutput(i.T, convertCmd2) | ||
convertCmd3 := fmt.Sprintf( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should write a helper func for image conversion, instead of writing three times.
// "bucket_name": "testcompact1" | ||
// }` | ||
|
||
// formattedData, err := json.MarshalIndent(json.RawMessage(jsonData), "", " ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the unused codes.
) | ||
tool.RunWithoutOutput(i.T, checkCmd) | ||
|
||
// Generate v5 chunkdcit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should write a helper func for each of the v5 and v6.
) | ||
tool.RunWithoutOutput(i.T, checkCmd1) | ||
|
||
// Test v5 chunkdict convert |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems the codes is unformatted.
|
||
|
||
### Exponential smoothing algorithm test table | ||
Step 1: Download 10 OCI versions of an image and count the total size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the list format for steps.
Brief introduction
Add functionlity to generate chunk dictionary by database file and algorithm "exponential_smoothing"
Implement the command
nydus-image chunkdict generate --database
commandBasic Usage
nydus-image chunkdict generate --database ./metadata.db
Details