Repository navigation
Retry metadata resolution on checksum mismatch during a publish - #19
Merged
Merged
Conversation
A publish uploads maven-metadata.xml and its .sha1 separately, so a resolution that lands between the two uploads gets one old and one new file and fails at once with a checksum mismatch, although a retry moments later succeeds. The 404 retry in MavenResolver did not cover it because the mismatch was a plain IOException. - MetadataResolver throws a dedicated ChecksumMismatchException (an IOException) for the mismatch. - MavenResolver retries it like 404, re-fetching metadata and its .sha1 on each attempt with the same retryMaxAttempts and back-off; it fails with the mismatch as the cause once attempts run out. Other IOExceptions are still not retried. - A mismatched pair is never published to the local repository; a test now pins that. - README retry section documents the new retry case. Closes #18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #18
Problem
A publish uploads
maven-metadata.xmlandmaven-metadata.xml.sha1separately. A resolution that falls between the two uploads gets one old and one new file, andMetadataResolver.resolveRemotefails right away withIOException: Checksum mismatch for maven-metadata, although a retry moments later would succeed.MavenResolveronly retriedFetchException404, so the mismatch was never retried.Change
MetadataResolverthrows a dedicatedChecksumMismatchException(extendsIOException, so existing catch sites still work).MavenResolverretries it the same way as 404: the whole metadata-then-jar chain, re-fetching both metadata files on each attempt, with the sameretryMaxAttempts/retryInitialDelayMs/retryMaxDelayMs. After the last attempt it fails with the mismatch as the cause. OtherIOExceptions are still not retried.Out of scope: a jar checksum mismatch in
JarResolverstill fails immediately.Tests
MetadataResolverTest: a mismatched metadata/sha1 pair fails withChecksumMismatchExceptionand leaves no files behind.MavenResolverTest: mismatch then match resolves on the second attempt; a persistent mismatch fails afterretryMaxAttemptswith the mismatch as the cause; a plainIOExceptionis not retried.