HBASE-25378 Legacy comparator in Hfile trailer will fail to load (#2756)
Signed-off-by: stack <stack@apache.com>
Signed-off-by: Viraj Jasani <vjasani@apache.org>
(cherry picked from commit 9bdac6cd17
)
This commit is contained in:
parent
aebcb2f192
commit
50890acda7
|
@ -612,6 +612,8 @@ public class FixedFileTrailer {
|
|||
comparatorKlass = CellComparatorImpl.class;
|
||||
} else if (comparatorClassName.equals(KeyValue.META_COMPARATOR.getLegacyKeyComparatorName())
|
||||
|| comparatorClassName.equals(KeyValue.META_COMPARATOR.getClass().getName())
|
||||
|| (comparatorClassName.equals("org.apache.hadoop.hbase.CellComparator$MetaCellComparator"))
|
||||
|| (comparatorClassName.equals("org.apache.hadoop.hbase.CellComparatorImpl$MetaCellComparator"))
|
||||
|| (comparatorClassName.equals("org.apache.hadoop.hbase.MetaCellComparator"))) {
|
||||
comparatorKlass = MetaCellComparator.class;
|
||||
} else if (comparatorClassName.equals("org.apache.hadoop.hbase.KeyValue$RawBytesComparator")
|
||||
|
|
|
@ -130,6 +130,11 @@ public class TestFixedFileTrailer {
|
|||
t.createComparator(KeyValue.META_COMPARATOR.getLegacyKeyComparatorName()).getClass());
|
||||
assertEquals(MetaCellComparator.class,
|
||||
t.createComparator(KeyValue.META_COMPARATOR.getClass().getName()).getClass());
|
||||
assertEquals(MetaCellComparator.class,
|
||||
t.createComparator("org.apache.hadoop.hbase.CellComparator$MetaCellComparator").getClass());
|
||||
assertEquals(MetaCellComparator.class,
|
||||
t.createComparator("org.apache.hadoop.hbase.CellComparatorImpl$MetaCellComparator")
|
||||
.getClass());
|
||||
assertEquals(MetaCellComparator.class, t.createComparator(
|
||||
MetaCellComparator.META_COMPARATOR.getClass().getName()).getClass());
|
||||
assertEquals(MetaCellComparator.META_COMPARATOR.getClass(), t.createComparator(
|
||||
|
@ -139,7 +144,8 @@ public class TestFixedFileTrailer {
|
|||
assertNull(t.createComparator(Bytes.BYTES_RAWCOMPARATOR.getClass().getName()));
|
||||
assertNull(t.createComparator("org.apache.hadoop.hbase.KeyValue$RawBytesComparator"));
|
||||
} catch (IOException e) {
|
||||
fail("Unexpected exception while testing FixedFileTrailer#createComparator()");
|
||||
fail("Unexpected exception while testing FixedFileTrailer#createComparator(), "
|
||||
+ e.getMessage());
|
||||
}
|
||||
|
||||
// Test an invalid comparatorClassName
|
||||
|
|
Loading…
Reference in New Issue