Skip to content

Conversation

@yma955
Copy link
Member

@yma955 yma955 commented Dec 3, 2024

@yma955 yma955 requested review from ligangty and sswguo December 3, 2024 01:11
@yma955
Copy link
Member Author

yma955 commented Dec 3, 2024

@ligangty @sswguo please help to review, thanks.

long currentBlock = Math.min( remaining, BOLCK_SIZE );
MappedByteBuffer buffer = channel.map( FileChannel.MapMode.READ_ONLY, position, currentBlock );
digest.update( buffer );
position += currentBlock;
Copy link
Member

Choose a reason for hiding this comment

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

Is there any 3rd lib for this? like e.g.: commons-codec .

Copy link
Member Author

Choose a reason for hiding this comment

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

@sswguo done in new commit.


private final String PART_ARCHIVE_SUFFIX = PART_SUFFIX + ARCHIVE_SUFFIX;

private static final int threads = 4 * Runtime.getRuntime().availableProcessors();
Copy link
Member

Choose a reason for hiding this comment

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

maybe we can make it configurable.

Copy link
Member Author

Choose a reason for hiding this comment

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

@sswguo sure, done in new commit.

@yma955 yma955 changed the title Fix corrupted archive with checksu validation, synchronized lock and API enhancement Fix corrupted archive with checksum validation, synchronized lock and API enhancement Dec 3, 2024
{
while ( isInProgress( buildConfigId ) )
{
logger.info( "There is already generation process in progress for buildConfigId {}, try lock wait.",
Copy link
Member

Choose a reason for hiding this comment

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

can we just throw warning to user that there is already process in progress, please try later ? sorry if I miss some requirements. ; -)

Copy link
Member Author

Choose a reason for hiding this comment

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

@sswguo You mean don't let the coming process wait, just warn to user and return? Not sure whether PNC care the response of archive generation since this should be at the end of build, if that's the point I will comment to confirm.

Copy link
Member

Choose a reason for hiding this comment

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

We can confirm that which case will send two same archive requests in a short time.

Copy link
Member Author

@yma955 yma955 Dec 3, 2024

Choose a reason for hiding this comment

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

@sswguo probably large build with large archive file, since PNC UI doesn't allow concurrent builds with the same config ID, the previous build might be already done but generation with download was still in progress, then another build was in progress and used the same workspace to process download or generation, so we need to know if they want to handle the generation response themselves or just let archive go with the right thing, comment on JIRA and discuss on meeting.

@yma955
Copy link
Member Author

yma955 commented Dec 4, 2024

@sswguo, @ligangty new commit c6a9cd9 based on PNC discussion, please review.

@sswguo
Copy link
Member

sswguo commented Dec 5, 2024

LGTM.

+ " \"path\": \"\"," + " \"md5\": \"\"," + " \"sha256\": \"\","
+ " \"sha1\": \"\"," + " \"size\": 001" + " }," + "..."
+ "]}", schema = @Schema( implementation = HistoricalContentDTO.class ) ) )
@APIResponse( responseCode = "409", description = "The archive created request is conflicted" )
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if 409 is good response to PNC as this may fail the request. We should let them know if we agree to use this.

Copy link
Member Author

@yma955 yma955 Dec 5, 2024

Choose a reason for hiding this comment

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

Can't add @michalovjan to review, could you help to confirm on this? Also comment on JIRA https://issues.redhat.com/browse/MMENG-4256.

Choose a reason for hiding this comment

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

Hi @yma96, I'd rather have just 202 Accepted if that's okay.

But if you're keen on having 409, we'd need to add that to repository-driver so that we don't unnecessarily retry requests. It's doable.

Copy link
Member Author

Choose a reason for hiding this comment

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

@michalovjan make sense, I'll change to 202 accepted to avoid more code change from PNC.

@yma955
Copy link
Member Author

yma955 commented Dec 6, 2024

Merge this and prepare devel test, leave comment for any other concern.

@yma955 yma955 merged commit db204c2 into Commonjava:1.1.x Dec 6, 2024
1 check 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.

4 participants