Skip to content

HBASE-30159 Make hash algorithm configurable for HashTable and SyncTable#8321

Open
jinhyukify wants to merge 1 commit into
apache:masterfrom
jinhyukify:HBASE-30159
Open

HBASE-30159 Make hash algorithm configurable for HashTable and SyncTable#8321
jinhyukify wants to merge 1 commit into
apache:masterfrom
jinhyukify:HBASE-30159

Conversation

@jinhyukify
Copy link
Copy Markdown
Contributor

Comment on lines +229 to +230
ImmutableMap<Integer, ImmutableBytesWritable> expectedHashes =
ImmutableMap.<Integer, ImmutableBytesWritable> builder()
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

for (int i = 0; i < args.length - NUM_ARGS; i++) {
String cmd = args[i];
if (cmd.equals("-h") || cmd.startsWith("--h")) {
if (cmd.equals("-h") || cmd.equals("--help")) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Without this change, we cannot use options that start with --h including --hashAlgorithm

endTime = Long.parseLong(endTimeString);
}

hashAlgorithm = p.getProperty("hashAlgorithm", DEFAULT_HASH_ALGORITHM);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For old HashTable files, we fall back to the original MD5 algorithm.

empty.writePartitionFile(fs.getConf(), new Path(testDir, HashTable.PARTITIONS_FILE_NAME));

HashTable.TableHash tableHash = HashTable.TableHash.read(fs.getConf(), testDir);
assertEquals("MD5", tableHash.hashAlgorithm,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we refer to DEFAULT_HASH_ALGORITHM here?

Comment on lines +655 to +656
System.err.println(" hashAlgorithm MessageDigest algorithm to use for batch hashes");
System.err.println(" (defaults to " + DEFAULT_HASH_ALGORITHM + ")");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would it help to show the available candidates?

jshell> System.out.println(java.security.Security.getAlgorithms("MessageDigest"));
[SHA3-512, SHA-1, SHA-384, SHA3-384, SHA-224, SHA-512/256, SHA-256, MD2, SHA-512/224, SHA3-256, SHA-512, SHA3-224, MD5]

Too many?

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