Skip to content

Conversation

BraveY
Copy link

@BraveY BraveY commented Feb 24, 2025

Relevant Issue (if applicable)

If there are Issues related to this PullRequest, please list it.

Details

Please describe the details of PullRequest.

In P2P transmission, errors in the pulled Chunk information may occur due to network issues or other reasons. To address this, CRC32 has been introduced to verify the integrity of Chunk data. Compared to the case without enabling verification, using CRC32 increases the processing time by approximately 5.6%, which is an acceptable overhead.

Types of changes

What types of changes does your PullRequest introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation Update (if none of the other choices apply)

Checklist

Go over all the following points, and put an x in all the boxes that apply.

  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@BraveY BraveY requested a review from a team as a code owner February 24, 2025 03:28
@BraveY BraveY requested review from gaius-qi, hsiangkao and power-more and removed request for a team February 24, 2025 03:28
@BraveY BraveY changed the title Support CRC32 validation for both RAFS V5 and V6. [WIP]Support CRC32 validation for both RAFS V5 and V6. Feb 24, 2025
@BraveY BraveY closed this Mar 22, 2025
@BraveY BraveY reopened this Mar 22, 2025
@BraveY BraveY force-pushed the feat-crc branch 3 times, most recently from b34dc5d to 631049c Compare April 14, 2025 09:02
Copy link

codecov bot commented Apr 14, 2025

Codecov Report

Attention: Patch coverage is 61.39089% with 161 lines in your changes missing coverage. Please review.

Project coverage is 55.34%. Comparing base (31c8e89) to head (3ce40e9).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
utils/src/crc32.rs 60.00% 21 Missing and 1 partial ⚠️
rafs/src/metadata/chunk.rs 70.17% 15 Missing and 2 partials ⚠️
src/bin/nydus-image/deduplicate.rs 63.33% 1 Missing and 10 partials ⚠️
storage/src/meta/mod.rs 38.88% 11 Missing ⚠️
rafs/src/metadata/direct_v5.rs 0.00% 10 Missing ⚠️
rafs/src/metadata/direct_v6.rs 37.50% 10 Missing ⚠️
builder/src/compact.rs 11.11% 8 Missing ⚠️
rafs/src/metadata/md_v5.rs 11.11% 8 Missing ⚠️
rafs/src/mock/mock_chunk.rs 0.00% 8 Missing ⚠️
builder/src/core/context.rs 33.33% 6 Missing ⚠️
... and 15 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1670      +/-   ##
==========================================
+ Coverage   55.31%   55.34%   +0.03%     
==========================================
  Files         196      197       +1     
  Lines       55347    55706     +359     
  Branches    46817    47176     +359     
==========================================
+ Hits        30614    30833     +219     
- Misses      23143    23273     +130     
- Partials     1590     1600      +10     
Files with missing lines Coverage Δ
api/src/config.rs 88.78% <ø> (ø)
builder/src/stargz.rs 75.00% <100.00%> (ø)
storage/src/cache/dummycache.rs 94.50% <100.00%> (ø)
storage/src/meta/batch.rs 97.56% <100.00%> (+0.01%) ⬆️
utils/src/lib.rs 98.80% <ø> (ø)
builder/src/chunkdict_generator.rs 0.00% <0.00%> (ø)
builder/src/directory.rs 0.00% <0.00%> (ø)
rafs/src/metadata/cached_v5.rs 80.81% <87.50%> (+0.06%) ⬆️
src/bin/nydus-image/inspect.rs 0.00% <0.00%> (ø)
builder/src/attributes.rs 75.75% <92.30%> (+4.60%) ⬆️
... and 20 more

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@@ -270,6 +270,7 @@ impl Generator {
chunk.set_uncompressed_size(chunk_info.chunk_uncompressed_size);
chunk.set_uncompressed_offset(chunk_info.chunk_uncompressed_offset);
chunk.set_id(RafsDigest::from_string(&chunk_info.chunk_digest));
// TODO: set crc32 of chunk.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add it now?

@@ -337,6 +337,10 @@ impl Node {
external_compressed_offset += compressed_size as u64;
external_blob_ctx.chunk_size = external_chunk_size as u32;

if ctx.crc_checker != crc::Algorithm::None {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

crc_checker -> crc_algorithm

@@ -583,6 +583,15 @@ impl RafsV6SuperBlockExt {
self.s_flags |= c.bits();
}

/// Set CRC algorithm to handle chunk of the Rafs filesystem.
pub fn set_crc_checker(&mut self, crc_algo: crc::Algorithm) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set_crc_algorithm

- Add CRC32 algorithm implementation wiht crc-rs crate.
- Introduced a crc_enable option to the nydus builder.
- Support for generating CRC32 checksums when building images.
- Support for validating CRC32 in both normal chunk or external chunks.

Signed-off-by: Yang Kaiyong <yangkaiyong.yky@antgroup.com>
@BraveY BraveY force-pushed the feat-crc branch 7 times, most recently from cfb2067 to 3e56b46 Compare April 18, 2025 02:01
@BraveY BraveY changed the title [WIP]Support CRC32 validation for both RAFS V5 and V6. Support CRC32 validation for both RAFS V5 and V6. Apr 18, 2025
Signed-off-by: Yang Kaiyong <yangkaiyong.yky@antgroup.com>
Copy link
Collaborator

@imeoer imeoer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, others LGTM!

@imeoer imeoer merged commit 96c3e55 into dragonflyoss:master Apr 18, 2025
66 of 68 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants