swamirishi commented on code in PR #8243:
URL: https://github.com/apache/ozone/pull/8243#discussion_r2040716423


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/metadata/BigIntegerCodec.java:
##########
@@ -27,6 +29,7 @@
 public final class BigIntegerCodec implements Codec<BigInteger> {
 
   private static final Codec<BigInteger> INSTANCE = new BigIntegerCodec();
+  private static final Comparator<BigInteger> COMPARATOR = (o1, o2) -> 
Objects.compare(o1, o2, BigInteger::compareTo);

Review Comment:
   By default we encode our strings UTF-8 encoding. When two strings are 
compared it is compared Lexicographically
   `  public int compareTo(String anotherString) {
           int len1 = value.length;
           int len2 = anotherString.value.length;
           int lim = Math.min(len1, len2);
           char v1[] = value;
           char v2[] = anotherString.value;
   
           int k = 0;
           while (k < lim) {
               char c1 = v1[k];
               char c2 = v2[k];
               if (c1 != c2) {
                   return c1 - c2;
               }
               k++;
           }
           return len1 - len2;
       }`
   So if the bytewiseComparator and lexicographical ordering is not same then 
there is a bug in our system.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org
For additional commands, e-mail: issues-h...@ozone.apache.org

Reply via email to