-
Notifications
You must be signed in to change notification settings - Fork 212
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
fix: correct some bugs and add feature of backend config for optimize subcommand #1661
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1661 +/- ##
==========================================
- Coverage 60.05% 59.85% -0.21%
==========================================
Files 147 147
Lines 49624 49791 +167
Branches 47078 47222 +144
==========================================
- Hits 29802 29800 -2
- Misses 18040 18208 +168
- Partials 1782 1783 +1
|
} | ||
impl PrefetchFileInfo { | ||
fn from_input(input: &str) -> Result<Self> { | ||
let parts: Vec<&str> = input.split_whitespace().collect(); |
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.
How we can handle the path with blank char like /path/to/file foo
? how about defining a JSON format like:
{
"version": "v1",
"files": [
{
"path": "/path/to/file",
"ranges": [[100, 20], [140, 50]] // [[offset, size]]
},
]
}
It's make extensible easier.
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.
Now we have not considered this case, how about making it as a to-do item and optimize it in later patches.
.help("Config file of backend") | ||
.conflicts_with("backend-config") | ||
.required(false), | ||
) | ||
.arg( | ||
Arg::new("blob-dir") |
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.
Maybe the option is unnecessary if we have backend-config
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.
Can we add a usage in |
chunks of a file may come from multiple blobs, we should find blob file for each chunk. Signed-off-by: Xin Yin <yinxin.x@bytedance.com>
For nydus-image optimize subcommand, support prefetch file with ranges. Signed-off-by: Xin Yin <yinxin.x@bytedance.com>
The bootstrap generated by optimize subcommand missed extended table, which cause runtime use Digested ChunkMap. Signed-off-by: Xin Yin <yinxin.x@bytedance.com>
For nydus-image optimize subcommand, skip bad prefetch file instead of stopping whole build process, such as symlink. Signed-off-by: Xing Ma <maxing.lan@bytedance.com>
When the inode of the prefetch files has hardlinks, there are two bugs: 1. hardlink is broken, because layer_idx is changed which is used as a key for identifying hardlink in inode_map; 2. prefetching of the other identical inode will fall into other blob, which may cause perfomance issue due to IO amplifying. This commit fixes two above bugs. Signed-off-by: Xing Ma <maxing.lan@bytedance.com>
Now it only updates blob_ctx during the build process without persisting these changes to blob_info. This results in incorrect metadata which can be shown by using nydus-image check. Signed-off-by: maxing.lan <maxing.lan@bytedance.com>
Blob meta info is only for fs-version 6, so we move the corresponding code in one place for better judgement branch. Besides, fix two potential bugs: 1. for fs-version 5, we don't align the chunk offset up to 4k, wrong rounding up will cause coredump in runtime. 2. use BlobChunkInfoV2Ondisk instead of BlobChunkInfoV1Ondisk to keep consistent with generate_chunk_info() which returns BlobChunkInfoV2Ondisk. Theoretical risk, not fully verified. Signed-off-by: maxing.lan <maxing.lan@bytedance.com>
8de409d
to
2d570a0
Compare
With backend configure supoorted, we can read chunk on demand by specifying backend such as registry without downloadling whole image during image building. Signed-off-by: maxing.lan <maxing.lan@bytedance.com>
When localfs-backend is true (default is false), still pull whole image to build optimized image; otherwise, use registry backend to fetch needed chunk during building process. Signed-off-by: maxing.lan <maxing.lan@bytedance.com>
2d570a0
to
98d0637
Compare
Details
There are some bugs in optimize subcommand, following bugs are fixed in this patchset:
By the way, implement the backend config support for optimize subcommand, thus we can read chunk on-demand during build process.
Types of changes
What types of changes does your PullRequest introduce? Put an
x
in all the boxes that apply: