Skip to content

Commit 4bb2291

Browse files
committed
[Fix] add defensive code for empty family scan/get
1 parent e655f24 commit 4bb2291

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/main/java/com/alipay/oceanbase/hbase/OHTable.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,9 @@ private void processColumnFilters(NavigableSet<byte[]> columnFilters,
927927
@Override
928928
public Result get(final Get get) throws IOException {
929929
if (get.getFamilyMap().keySet().isEmpty()) {
930+
if (!FeatureSupport.isEmptyFamilySupported()) {
931+
throw new FeatureNotSupportedException("empty family get not supported yet within observer version: " + ObGlobal.obVsnString());
932+
}
930933
// check nothing, use table group;
931934
} else {
932935
checkFamilyViolation(get.getFamilyMap().keySet(), false);
@@ -1012,6 +1015,9 @@ public Result[] get(List<Get> gets) throws IOException {
10121015
@Override
10131016
public ResultScanner getScanner(final Scan scan) throws IOException {
10141017
if (scan.getFamilyMap().keySet().isEmpty()) {
1018+
if (!FeatureSupport.isEmptyFamilySupported()) {
1019+
throw new FeatureNotSupportedException("empty family scan not supported yet within observer version: " + ObGlobal.obVsnString());
1020+
}
10151021
// check nothing, use table group;
10161022
} else {
10171023
checkFamilyViolation(scan.getFamilyMap().keySet(), false);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.alipay.oceanbase.hbase.util;
2+
3+
import static com.alipay.oceanbase.rpc.ObGlobal.OB_VERSION;
4+
import static com.alipay.oceanbase.rpc.ObGlobal.calcVersion;
5+
6+
7+
public class FeatureSupport {
8+
// check empty family get/scan supported
9+
public static boolean isEmptyFamilySupported() {
10+
return (OB_VERSION >= calcVersion(4, 2, 3, 0)
11+
&& OB_VERSION < calcVersion(4, 3, 0, 0))
12+
|| (OB_VERSION > calcVersion(4, 3, 4, 0));
13+
}
14+
}

0 commit comments

Comments
 (0)