Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 50 additions & 13 deletions src/main/java/com/alipay/oceanbase/hbase/OHTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
import org.apache.hadoop.hbase.util.VersionInfo;
import org.slf4j.Logger;

import javax.swing.plaf.synth.Region;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.*;
Expand Down Expand Up @@ -2436,27 +2435,65 @@ public void refreshTableEntry(String familyString, boolean hasTestLoad) throws E
}

public byte[][] getStartKeys() throws IOException {
if (regionLocator == null) {
OHRegionLocatorExecutor executor = new OHRegionLocatorExecutor(tableNameString, obTableClient);
regionLocator = executor.getRegionLocator(tableNameString);
byte[][] startKeys = new byte[0][];
if (ObGlobal.isHBaseAdminSupport()) {
// 4.3.5.3 and above, OCP and ODP mode use regionLocator to getStartKeys
if (regionLocator == null) {
OHRegionLocatorExecutor executor = new OHRegionLocatorExecutor(tableNameString, obTableClient);
regionLocator = executor.getRegionLocator(tableNameString);
}
startKeys = regionLocator.getStartKeys();
} else if (!obTableClient.isOdpMode()) {
// before 4.3.5.3 only support in OCP mode
try {
startKeys = obTableClient.getHBaseTableStartKeys(tableNameString);
} catch (Exception e) {
throw new IOException("Fail to get start keys of HBase Table: " + tableNameString, e);
}
} else {
throw new IOException("not supported yet in odp mode, only support in ObServer 4.3.5.3 and above");
}
return regionLocator.getStartKeys();

return startKeys;
}

public byte[][] getEndKeys() throws IOException {
if (regionLocator == null) {
OHRegionLocatorExecutor executor = new OHRegionLocatorExecutor(tableNameString, obTableClient);
regionLocator = executor.getRegionLocator(tableNameString);
byte[][] endKeys = new byte[0][];
if (ObGlobal.isHBaseAdminSupport()) {
// 4.3.5.3 and above, OCP and ODP mode use regionLocator to getEndKeys
if (regionLocator == null) {
OHRegionLocatorExecutor executor = new OHRegionLocatorExecutor(tableNameString, obTableClient);
regionLocator = executor.getRegionLocator(tableNameString);
}
endKeys = regionLocator.getEndKeys();
} else if (!obTableClient.isOdpMode()) {
// before 4.3.5.3 only support in OCP mode
try {
endKeys = obTableClient.getHBaseTableEndKeys(tableNameString);
} catch (Exception e) {
throw new IOException("Fail to get start keys of HBase Table: " + tableNameString, e);
}
} else {
throw new IOException("not supported yet in odp mode, only support in ObServer 4.3.5.3 and above");
}
return regionLocator.getEndKeys();

return endKeys;
}

public Pair<byte[][], byte[][]> getStartEndKeys() throws IOException {
if (regionLocator == null) {
OHRegionLocatorExecutor executor = new OHRegionLocatorExecutor(tableNameString, obTableClient);
regionLocator = executor.getRegionLocator(tableNameString);
if (ObGlobal.isHBaseAdminSupport()) {
// 4.3.5.3 and above, OCP and ODP mode use regionLocator to getStartEndKeys
if (regionLocator == null) {
OHRegionLocatorExecutor executor = new OHRegionLocatorExecutor(tableNameString, obTableClient);
regionLocator = executor.getRegionLocator(tableNameString);
}
return regionLocator.getStartEndKeys();
} else if (!obTableClient.isOdpMode()) {
// before 4.3.5.3 only support in OCP mode
return new Pair<>(getStartKeys(), getEndKeys());
} else {
throw new IOException("not supported yet in odp mode, only support in ObServer 4.3.5.3 and above");
}
return regionLocator.getStartEndKeys();
}

private CompareFilter.CompareOp getCompareOp(CompareOperator cmpOp) {
Expand Down