Skip to content

Commit

Permalink
Fix some cache misses (#566)
Browse files Browse the repository at this point in the history
* Don't try to re-retrieve post-build output a second time.

* version bump
  • Loading branch information
peterebden authored Feb 27, 2019
1 parent 30365d9 commit 137ceba
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
Version 13.4.7
--------------

* Fix for some incorrect cache misses by not re-retrieving post-build output.
* Config hash filters out PATH since items located via it are hashed directly.


Version 13.4.6
--------------

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
13.4.6
13.4.7
4 changes: 3 additions & 1 deletion src/build/build_step.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ func buildTarget(tid int, state *core.BuildState, target *core.BuildTarget) (err
// We don't record rule hashes for filegroups since we know the implementation and the check
// is just "are these the same file" which we do anyway, and it means we don't have to worry
// about two rules outputting the same file.
haveRunPostBuildFunction := false
if !target.IsFilegroup && !needsBuilding(state, target, false) {
log.Debug("Not rebuilding %s, nothing's changed", target.Label)
if postBuildOutput, err = runPostBuildFunctionIfNeeded(tid, state, target, ""); err != nil {
Expand All @@ -131,6 +132,7 @@ func buildTarget(tid int, state *core.BuildState, target *core.BuildTarget) (err
}
log.Debug("Rebuilding %s after post-build function", target.Label)
}
haveRunPostBuildFunction = true
}
oldOutputHash, outputHashErr := OutputHash(state, target)
if target.IsFilegroup {
Expand Down Expand Up @@ -187,7 +189,7 @@ func buildTarget(tid int, state *core.BuildState, target *core.BuildTarget) (err
if state.Cache != nil {
// Note that ordering here is quite sensitive since the post-build function can modify
// what we would retrieve from the cache.
if target.PostBuildFunction != nil {
if target.PostBuildFunction != nil && !haveRunPostBuildFunction {
log.Debug("Checking for post-build output file for %s in cache...", target.Label)
if state.Cache.RetrieveExtra(target, cacheKey, target.PostBuildOutputFileName()) {
if postBuildOutput, err = runPostBuildFunctionIfNeeded(tid, state, target, postBuildOutput); err != nil {
Expand Down

0 comments on commit 137ceba

Please sign in to comment.