Skip to content
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

Ensure namedSetOfFiles URIs specify blob type correctly #19044

Closed

Conversation

tylerwilliams
Copy link
Contributor

@tylerwilliams tylerwilliams commented Jul 25, 2023

I noticed when testing the BLAKE3 digest function that uploaded files were being referenced incorrectly in the BES because they were missing the digest type. This CL fixes that.

Before:
image
After:

image

@tylerwilliams tylerwilliams requested a review from a team as a code owner July 25, 2023 05:09
@github-actions github-actions bot added awaiting-review PR is awaiting review from an assigned reviewer team-Remote-Exec Issues and PRs for the Execution (Remote) team labels Jul 25, 2023
@tylerwilliams tylerwilliams changed the title Ensure namedSetOfFiles URIs specify blob type Ensure namedSetOfFiles URIs specify blob type correctly Jul 25, 2023
@tylerwilliams
Copy link
Contributor Author

@coeuvre I think this is the last one

}

/**
* Collects metadata for {@code file}. Depending on the underlying filesystem used this method
* might do I/O.
*/
private PathMetadata readPathMetadata(Path path, LocalFile file) throws IOException {
DigestUtil digestUtil = new DigestUtil(xattrProvider, path.getFileSystem().getDigestFunction());
Copy link
Member

Choose a reason for hiding this comment

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

I think we can just use path.getFileSystem().getDigestFunction() instead of creating a DigestUtil.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

DigestUtil exposes the DigestFunction.Value which is distinct from DigestHashFunction which is returned by the method you're suggesting.

So we're using DigestUtil to convert basically.

Copy link
Contributor Author

@tylerwilliams tylerwilliams Jul 25, 2023

Choose a reason for hiding this comment

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

Also -- sorry it wasn't clear, DigestUtil was already being created in this function (L217), i just moved it up so I can reference it :)

Copy link
Member

Choose a reason for hiding this comment

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

Argh, yes. Sorry I didn't read the code carefully.

Digest digest = metadata.getDigest();
DigestFunction.Value digestFunction = metadata.getDigestFunction();
String out;
if (isOldStyleDigestFunction(digestFunction)) {
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 have a unit test for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@coeuvre
Copy link
Member

coeuvre commented Jul 25, 2023

Optional: we might also want to make similar changes to Http/Disk cache in a separate PR.

@tylerwilliams
Copy link
Contributor Author

tylerwilliams commented Jul 26, 2023

Optional: we might also want to make similar changes to Http/Disk cache in a separate PR.

@coeuvre DiskCache PR is here: #19073

@coeuvre
Copy link
Member

coeuvre commented Jul 27, 2023

Thanks! I probably need more time to import this because I need to figure out how to build blake3 internally for remote module so the test can be executed (previously, I skipped that).

@tylerwilliams
Copy link
Contributor Author

Thanks! I probably need more time to import this because I need to figure out how to build blake3 internally for remote module so the test can be executed (previously, I skipped that).

@coeuvre Friendly ping on this and #19073 :) LMK if there's anything I can do to make these easier to merge.

@copybara-service copybara-service bot closed this in 1929367 Aug 3, 2023
@github-actions github-actions bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Aug 3, 2023
@iancha1992
Copy link
Member

The changes in this PR have been included in Bazel 6.4.0 RC1. Please test out the release candidate and report any issues as soon as possible. If you're using Bazelisk, you can point to the latest RC by setting USE_BAZEL_VERSION=last_rc.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Remote-Exec Issues and PRs for the Execution (Remote) team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants