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

(fixes #5193) Serialize BucketMetadata#hashType as String #5194

Merged
merged 8 commits into from
Jan 23, 2024

Conversation

clairemcginty
Copy link
Contributor

see #5193 for motivation/details

Note that this change should have no user-facing impact--all public BucketMetadata constructors still use type HashType, not String.

I did standardize on the amount of overloaded constructors per BucketMetadata... some implementations had specializations for Void secondary keys and some did not. In the interest of simplicity (and since for the most part, users should not be constructing these directly), I removed the specialized overloads for Void secondary keys.

@@ -371,6 +393,19 @@ int rehashBucket(byte[] keyBytes, int newNumBuckets) {
// Serialization
////////////////////////////////////////

private static class HashFunctionSupplier implements Supplier<HashFunction>, Serializable {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this class/signature is required for Guava's Suppliers::memoize to construct a Serializable memoized supplier: https://github.com/google/guava/blob/v32.1.2/guava/src/com/google/common/base/Suppliers.java#L112-L115

Copy link

codecov bot commented Jan 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (8962386) 63.05% compared to head (db631c9) 63.05%.
Report is 2 commits behind head on main.

❗ Current head db631c9 differs from pull request most recent head 7578ee4. Consider uploading reports for the commit 7578ee4 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5194   +/-   ##
=======================================
  Coverage   63.05%   63.05%           
=======================================
  Files         300      300           
  Lines       10947    10947           
  Branches      740      740           
=======================================
  Hits         6903     6903           
  Misses       4044     4044           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@clairemcginty clairemcginty marked this pull request as ready for review January 22, 2024 20:47
Copy link
Contributor

@RustedBones RustedBones left a comment

Choose a reason for hiding this comment

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

If I read this correctly, this only improves case where one of the read partition hashType is not supported. We'll read metadata but fail during comparison with a message saying there is a metadata mismatch.
However if all hashType are equal but not supported, we're still failing at a later stage, correct ?

@RustedBones
Copy link
Contributor

Note: Hash function is only used on write. Reader can work even if hash type is not known as long as they match

@clairemcginty
Copy link
Contributor Author

Note: Hash function is only used on write. Reader can work even if hash type is not known as long as they match

Yup, reader only needs to access HashFunction as something Comparable across other metadata.json files 👍 After that, it doesn't need to invoke it at all.

@clairemcginty clairemcginty merged commit 3575b75 into main Jan 23, 2024
11 checks passed
@clairemcginty clairemcginty deleted the smb-string-hashtype branch January 23, 2024 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants