-
Notifications
You must be signed in to change notification settings - Fork 131
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
Support empty digests in stores #507
Support empty digests in stores #507
Conversation
45b8afa
to
0cb71c5
Compare
0cb71c5
to
1f95919
Compare
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.
Reviewed 7 of 12 files at r1.
Reviewable status: 7 of 12 files reviewed, 5 unresolved discussions (waiting on @adam-singer)
a discussion (no related file):
I started reading the tests, but then realized we should just write a single test that tests all stores and just calls .get()
and .has()
(separate tests) without an update to ensure it returns a success.
By doing it this way we ensure that as we add tests these new tests get tested. If we use a match
on the stores enum (in the config), we can get compile time errors if we create a new store but forget to add the test configuration to this file.
nativelink-store/src/cas_utils.rs
line 19 at r2 (raw file):
const ZERO_BYTE_DIGESTS: [DigestInfo; 2] = [ // Sha256 hash of zero bytes. DigestInfo::new(
nit: Lets make this public global consts and then link them in here so we can use them in tests without needing to import hashing functions.
nativelink-store/tests/cas_utils_test.rs
line 23 at r2 (raw file):
#[test] fn sha256_is_zero_digest() {
nit: Lets write a single test here instead.
match
on the DigestHasherFunc
's enum and use it's function to do the hashing and ensure they are inside is_zero_digest()
.
Doing it this way gives us a compile time error if we ever try to add a new digest function but forget to add the corresponding match
.
nativelink-store/tests/compression_store_test.rs
line 447 at r2 (raw file):
#[tokio::test] async fn get_part_is_zero_digest() -> Result<(), Error> { let digest = DigestInfo {
nit: Lets import the empty digests from cas_utils
.
nativelink-store/tests/compression_store_test.rs
line 447 at r2 (raw file):
#[tokio::test] async fn get_part_is_zero_digest() -> Result<(), Error> { let digest = DigestInfo {
nit: rename empty_digest
09acd83
to
a496f9a
Compare
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.
Reviewed 2 of 12 files at r1, 5 of 5 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @adam-singer)
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.
Reviewable status:
complete! all files reviewed, all discussions resolved (waiting on @adam-singer)
a496f9a
to
1e849d4
Compare
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.
Reviewed 1 of 1 files at r4, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @adam-singer)
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.
Reviewable status:
complete! all files reviewed, all discussions resolved (waiting on @adam-singer)
nativelink-store/tests/cas_utils_test.rs
line 23 at r2 (raw file):
Previously, allada (Nathan (Blaise) Bruer) wrote…
nit: Lets write a single test here instead.
match
on theDigestHasherFunc
's enum and use it's function to do the hashing and ensure they are insideis_zero_digest()
.Doing it this way gives us a compile time error if we ever try to add a new digest function but forget to add the corresponding
match
.
I did initially start with that, eventually it took more lines of passing a delegate for the creator, but we can revisit that and shrink it a bit
Description
remote_execution.proto specification allows for uploading and fetching of empty digests regardless if they have been uploaded before a fetch. Expectation is the requests should always respond successfully. This can be an optimized path in cases but violates expectations in native link underlying storage consistencies.
Fixes #
#498
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Unit tests
Checklist
bazel test //...
passes locallygit amend
see some docsThis change is![Reviewable](https://camo.githubusercontent.com/1541c4039185914e83657d3683ec25920c672c6c5c7ab4240ee7bff601adec0b/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)