Fix noremote_upload_local_results behavior in combined blobstore#9338
Fix noremote_upload_local_results behavior in combined blobstore#9338borkaehw wants to merge 1 commit intobazelbuild:masterfrom
Conversation
c875fd7 to
de90588
Compare
|
@borkaehw Thanks for the patch! I agree that we should have this but it's incompatible behavior. You need to make it so that this new behavior is guarded behind an incompatible flag that is disabled by default. |
|
@borkaehw here is a link for the policy with some instructions: https://bazel.build/breaking-changes-guide.html |
|
Hmm. I am wondering if it would make more sense if we gave the disk cache it's own knobs and introduced |
Hm, do you know a use case for that? |
|
I can't think of a strong use case for using the disk cache as read-only. To disable it altogether, you might as well not specify a In any case, I think this would fall outside the scope of this PR, which is to resolve #8216 (and the changes to |
de90588 to
8dfae94
Compare
|
I have made the incompatible flag and written a better commit message. I suppose GitHub issue should be created after we merge. Let me know if I did anything wrong. Thanks. |
8dfae94 to
ab923b3
Compare
ishikhman
left a comment
There was a problem hiding this comment.
LGTM.
Thanks a lot for the contribution!
| throws IOException, InterruptedException { | ||
| diskCache.putActionResult(actionKey, actionResult); | ||
| remoteCache.putActionResult(actionKey, actionResult); | ||
| if (!options.incompatibleUploadLocalResultsDiskOnly || options.remoteUploadLocalResults) { |
There was a problem hiding this comment.
I find the following version a bit more readable, but it's up to you: to change it or not :)
if (options.incompatibleUploadLocalResultsDiskOnly && !options.remoteUploadLocalResults)
There was a problem hiding this comment.
You'd need to negate the entire clause for those to be equivalent:
!(options.incompatibleUploadLocalResultsDiskOnly && !options.remoteUploadLocalResults)
I think either way works, but I prefer the original : )
There was a problem hiding this comment.
I agree with @SrodriguezO, also prefer the original. More suggestions are welcome.
I think it's important to be keep the behaviour consistent. This change makes it so that --remote_upload_local_results not longer applies to --disk_cache whether a --remote_cache is specified or not. So I think to stay sane it we should introduce the same behaviour for --remote_accept_cached? |
That's a fair point. Personally, I can't think of a use case for this, but I don't have a strong opinion either way. @borkaehw wdyt? |
I don't think we necessarily need the flags that I proposed but I think that we'll need to also disable Does that sound reasonable? |
Oh I see. Yeah we should definitely do that. |
|
@buchgr thanks for suggestions, it sounds reasonable to me. I will take a closer look. |
b2e3e95 to
8630d72
Compare
|
Just pushed changes to address comments, please take a look. Thanks. |
| } | ||
| boolean checkCache = options.remoteAcceptCached; | ||
|
|
||
| if (checkCache) { |
There was a problem hiding this comment.
hmm I see that you moved the progress status down to the other block, but will the logic between here and there cause a delay?
There was a problem hiding this comment.
It passes the tests. I don't see a strong reason to keep it separate. I might be wrong. @ishikhman do you have more context on it?
There was a problem hiding this comment.
It wouldn't cause tests to fail, the message might just not show up right away
There was a problem hiding this comment.
I don't see a bit difference to be honest. Should be fine both ways.
|
|
||
| if (options.remoteUploadLocalResults) { | ||
| if (options.remoteUploadLocalResults || | ||
| (options.incompatibleRemoteResultsDiskOnly && options.diskCache != null && !options.diskCache.isEmpty())) { |
There was a problem hiding this comment.
Can we move the options.diskCache != null && !options.diskCache.isEmpty()) part to a helper usesDiskCache method?
| public boolean remoteUploadLocalResults; | ||
|
|
||
| @Option( | ||
| name = "incompatible_remote_results_disk_only", |
There was a problem hiding this comment.
Can we rename to incompatible_remote_results_flags_ignore_disk? The current name makes me think this flag makes remote results flags apply to the disk cache only (which is the opposite of what they do)
There was a problem hiding this comment.
Sounds good. I prefer just incompatible_remote_results_ignore_disk to make it a bit shorter.
| help = | ||
| "If set to true, --noremote_upload_local_results and --noremote_accept_cached " | ||
| + "will not apply to the disk cache. " | ||
| + "If a combined cache is used, --noremote_upload_local_results will cause " |
There was a problem hiding this comment.
+ "If a combined cache is used: "
+ "\n\t--noremote_upload_local_results will cause results to be written to the disk cache, but not uploaded to the remote cache"
+ "\n\t--noremote_accept_cached will result in Bazel checking for results in the disk cache, but not in the remote cache."
+ "See #8216 for details."
eaefc90 to
4385531
Compare
|
Ping @buchgr I think there might be people who use a read-only disk cache on NFS, which is written by CI, and read by everyone else. |
|
@ishikhman friendly ping here. I think this is valuable for people. I am happy to address feedback and pushing it toward merged. |
|
@buchgr friendly ping : ) |
|
@buchgr can you please merge this when you have a minute? It was approved nearly a month ago and is just pending merge. Or maybe @ishikhman can merge it? We've been using this on our fork without issue, and we'd hate to see it rot. |
4385531 to
c14deac
Compare
|
Since #9200 was merged. Force pushed to address conflicts. |
c14deac to
fa2fc22
Compare
|
Since #10200 was merged. Force pushed to address conflicts. |
|
Just wanted to chime in and say we've been waiting for many releases (since 0.17 or earlier), hoping for this fix soon. Another friendly ping @buchgr :) |
fa2fc22 to
7fba47a
Compare
|
Since #10233 was merged. Force pushed to address conflicts. Also added tests for combined disk and grpc cache. |
7fba47a to
765e9ae
Compare
|
Not sure why |
… in combined blobstore Fixes bazelbuild#8216 RELNOTES: If --noremote_upload_local_results and --disk_cache are provided at the same time, Bazel will only upload local results to disk cache but not remote cache. If --noremote_accept_cached and --disk cache are provided at the same time, Bazel will only check results from disk cache but not remote cache.
765e9ae to
ef3bb98
Compare
|
Force push to fix |
|
@buchgr friendly ping. Thanks for making grpc-disk combined cache #10233, it improves our developer workflow dramatically. This fix is the final piece blocking us from using official release of Bazel (we have carried this commit on custom Bazel for a long time). This simple PR will bring a huge value to the community. Would you be able to take a quick look? |
|
This PR breaks the CI on |
Disable the upload action to remote cache when
--noremote_upload_local_resultsis set.This problem would only happen in
CombinedDiskHttpBlobStoreat this moment when users want read/write permission to disk cache but only read permission to remote cache.Once the GrpcCache refactoring (making GrpcCache a SimpleBlobStore implementation) is done,
CombinedDiskHttpBlobStoreshould be renamed toCombinedDiskRemoteBlobStore. Then this fix will apply to both GrpcCache and HttpCache.Fix #8216