Skip to content

Commit

Permalink
(contd.) fix: if the max ordinal for a map value is zero then reserve…
Browse files Browse the repository at this point in the history
… 1 bit for it instead of nothing
  • Loading branch information
Sunjeet committed Dec 20, 2024
1 parent 2ba691b commit 4e204c7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package com.netflix.hollow.api.producer.validation;public class PrimaryKeyViolationValidator {
}
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ private void calculateNumShards() {
}

long bitsPerKeyElement = 64 - Long.numberOfLeadingZeros(maxKeyOrdinal + 1);
long bitsPerValueElement = 64 - Long.numberOfLeadingZeros(maxValueOrdinal);
long bitsPerValueElement = maxValueOrdinal == 0 ? 1 : 64 - Long.numberOfLeadingZeros(maxValueOrdinal);
long bitsPerMapSizeValue = 64 - Long.numberOfLeadingZeros(maxMapSize);
long bitsPerMapPointer = 64 - Long.numberOfLeadingZeros(totalOfMapBuckets);

Expand Down

0 comments on commit 4e204c7

Please sign in to comment.