streamnative / bookkeeper-achieved

Apache Bookkeeper
https://bookkeeper.apache.org
Apache License 2.0
3 stars 2 forks source link

ISSUE-2492: Bug in ArrayGroupSort.java (in line 88, keySize shall be groupSize) #275

Closed sijie closed 3 years ago

sijie commented 3 years ago

Original Issue: apache/bookkeeper#2492


BUG REPORT

Describe the bug

I am browsing the codes and just suspecting there is a bug in ArrayGroupSort.java(https://github.com/apache/bookkeeper/blob/master/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/ArrayGroupSort.java#L88)

in line 88, keySize shall be groupSize instead?

    private boolean isLess(long[] array, int idx1, int idx2) {
        for (int i = 0; i < keySize; i++) {     // bug? keySize shall be groupSize instead?
            long k1 = array[idx1 + i];
            long k2 = array[idx2 + i];
            if (k1 < k2) {
                return true;
            } else if (k1 > k2) {
                return false;
            }
        }

        return false;
    }

To Reproduce

N/A

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

N/A

Additional context

N/A