Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
Description
Ozone Manager uses concatenated keys as table/cache keys. For instance, a key of the key_table is a result of: "/" + volume + "/" + "bucket" + "/" + key.
That unnecessarily creates and throws away multiple significant string objects for every request, e.g volume keys, bucket keys, key keys. (Even volume keys are a concatenation of "/" + volume?).
A simple composite key would eliminate the need for string concatenation, e.g.
public class KeyTableKey { private final String volume; private final String bucket; private final String key; privale final int hashCode; public KeyIdentifier(String volume, String bucket, String key) { this.volume = volume; this.bucket = bucket this.key = key; this.hashCode = volume.hashcode() * 31 * 31 + bucket.hashCode() * 31 + key.hashCode(); } public boolean equals(Object other) { // return true if the components are equals } public int hashCode() { return hashCode; } }
For backward compatibility, we can implement a KeyTableKeyCodec that generates the same binary as the concatenated content.
Attachments
1.
|
Remove volume concatenated key | Open | Unassigned | |
2.
|
Remove bucket concatenated key | Open | Unassigned | |
3.
|
Remove key concatenated key | Open | Unassigned |