Skip to content

Commit cd69d21

Browse files
authored
Merge pull request #226 from oceanbase/fix-regionlocator-case
add hash-like partition case for region locator
2 parents 5196714 + 40ae8e5 commit cd69d21

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

src/main/java/com/alipay/oceanbase/hbase/util/OHTableDescriptorExecutor.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import org.apache.hadoop.hbase.HColumnDescriptor;
1111
import org.apache.hadoop.hbase.HTableDescriptor;
1212
import org.apache.hadoop.hbase.TableName;
13-
import sun.font.SunFontManager;
1413

1514
import java.io.IOException;
1615
import java.util.HashMap;

src/test/java/com/alipay/oceanbase/hbase/OHConnectionTest.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.apache.hadoop.conf.Configuration;
2323
import org.apache.hadoop.hbase.Cell;
2424
import org.apache.hadoop.hbase.CellUtil;
25+
import org.apache.hadoop.hbase.HConstants;
2526
import org.apache.hadoop.hbase.TableName;
2627
import org.apache.hadoop.hbase.client.*;
2728
import org.apache.hadoop.hbase.util.Bytes;
@@ -30,6 +31,7 @@
3031

3132
import java.io.IOException;
3233
import java.util.ArrayList;
34+
import java.util.Arrays;
3335
import java.util.List;
3436
import java.util.Optional;
3537
import java.util.concurrent.*;
@@ -990,6 +992,21 @@ public void testRangePartitionWithRegionLocator() throws Exception {
990992
});
991993
}
992994
}
995+
@Test
996+
public void testKeyPartitionWithRegionLocator() throws IOException {
997+
final String tableNameStr = "test_multi_cf";
998+
final TableName tableName = TableName.valueOf(tableNameStr);
999+
final Configuration conf = ObHTableTestUtil.newConfiguration();
1000+
connection = ConnectionFactory.createConnection(conf);
1001+
hTable = connection.getTable(tableName);
1002+
RegionLocator locator = connection.getRegionLocator(tableName);
1003+
byte[][] startKeys = locator.getStartKeys();
1004+
byte[][] endKeys = locator.getEndKeys();
1005+
Assert.assertEquals("Should have 1 region", 1, startKeys.length);
1006+
Assert.assertEquals("Should have 1 region", 1, endKeys.length);
1007+
Assert.assertEquals(startKeys[0], endKeys[0]);
1008+
Assert.assertEquals(startKeys[0], HConstants.EMPTY_BYTE_ARRAY);
1009+
}
9931010

9941011
@Test
9951012
public void testBufferedMutatorPeriodicFlush() throws Exception {

src/test/java/com/alipay/oceanbase/hbase/OHTableAdminInterfaceTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ public void testAdminEnDisableTable() throws Exception {
356356
// enable an enabled table
357357
thrown = assertThrows(IOException.class,
358358
() -> {
359-
admin.disableTable(TableName.valueOf("n1", "test");
359+
admin.disableTable(TableName.valueOf("n1", "test"));
360360
});
361361
assertTrue(thrown.getCause() instanceof ObTableException);
362362
Assert.assertEquals(ResultCodes.OB_KV_TABLE_NOT_ENABLED.errorCode, ((ObTableException) thrown.getCause()).getErrorCode());

0 commit comments

Comments
 (0)