-
Notifications
You must be signed in to change notification settings - Fork 43
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
[MBUILDCACHE-103] Allow incremental restore in case of plugin parameter mismatch #177
base: master
Are you sure you want to change the base?
Conversation
846045a
to
ee35226
Compare
ee35226
to
1c85628
Compare
for (MojoExecution cacheCandidate : cachedSegment) { | ||
if (cacheController.isForcedExecution(project, cacheCandidate)) { | ||
forcedExecutionMojos.add(cacheCandidate); | ||
} else { | ||
if (!reconciliationExecutionMojos.isEmpty()) { |
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.
what is this check for?
@@ -267,6 +286,12 @@ private CacheRestorationStatus restoreProject( | |||
// mojoExecutionScope.seed( | |||
// org.apache.maven.api.MojoExecution.class, new DefaultMojoExecution(cacheCandidate)); | |||
mojoExecutionRunner.run(cacheCandidate); | |||
} else if (reconciliationExecutionMojos.contains(cacheCandidate)) { |
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.
I'm not convinced that this logic is valid. If you have build 1 with the plugins [(X, parameters PX1), (Y, parameters PX1)], with the flag "on",the new cached build might be a result of [(X, parameters PX2), (Y, parameters PY1)]. The issue here is that without tracking inputs/outputs, we can't guarantee that reusing PY1 is valid if the first plugin changed parameters. It's possible that it relies on outputs from the first plugin and could yield a different result without the cache. This logic seems flawed to me at the moment. It might lead to all sorts of corruptions inadvertently. it probably could run for certain plugins in presence of additional metadata, but not in a general case.
This optimization could work for a leaf plugins (plugins which do not contribute and do not impact subsequent plugins) but that will require additional plugin metadata
ArtifactRestorationReport restorationReport = cacheController.restoreProjectArtifacts(cacheResult); | ||
ArtifactRestorationReport restorationReport = cacheController.restoreProjectArtifacts( | ||
cacheResult, | ||
!containsExecution(plannedExecutions, "org.apache.maven.plugins", "maven-jar-plugin", "jar")); |
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 hardcoded list of plugins doesnt look good and manifests a workaround which might not work in general case. What is it for?
This PR adds configuration flag
maven.build.cache.incrementalReconciliationOnParameterMismatch
to allow the following behaviour. If a parameter mismatch is detected, the build will try to complete starting with the mismatched parameter instead of throwing the whole cache entry. At the end, it will save the result.The correct behaviour of the operation is subordinated to the correct configuration of
attachedOutputs
parameter.Orthogonal subject, but I think
attachedOutputs
should be set to the following values by default:Following this checklist to help us incorporate your
contribution quickly and easily:
for the change (usually before you start working on it). Trivial changes like typos do not
require a JIRA issue. Your pull request should address just this issue, without
pulling in other changes.
[MBUILDCACHE-XXX] - Fixes bug in ApproximateQuantiles
,where you replace
MBUILDCACHE-XXX
with the appropriate JIRA issue. Best practiceis to use the JIRA issue title in the pull request title and in the first line of the
commit message.
mvn clean verify
to make sure basic checks pass. A more thorough check willbe performed on your pull request automatically.
If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.
I hereby declare this contribution to be licenced under the Apache License Version 2.0, January 2004
In any other case, please file an Apache Individual Contributor License Agreement.