Skip to content

Commit 7ca35cf

Browse files
authored
Merge pull request #269 from oceanbase/cherry-pick-4bb2291e-to-hbase_2.0.0-alpha4-20250708_180032
Cherry-pick: [Fix] add defensive code for empty family scan/get
2 parents 937aaf0 + 384a359 commit 7ca35cf

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
@@ -931,6 +931,9 @@ private void processColumnFilters(NavigableSet<byte[]> columnFilters,
931931
@Override
932932
public Result get(final Get get) throws IOException {
933933
if (get.getFamilyMap().keySet().isEmpty()) {
934+
if (!FeatureSupport.isEmptyFamilySupported()) {
935+
throw new FeatureNotSupportedException("empty family get not supported yet within observer version: " + ObGlobal.obVsnString());
936+
}
934937
// check nothing, use table group;
935938
} else {
936939
checkFamilyViolation(get.getFamilyMap().keySet(), false);
@@ -1016,6 +1019,9 @@ public Result[] get(List<Get> gets) throws IOException {
10161019
@Override
10171020
public ResultScanner getScanner(final Scan scan) throws IOException {
10181021
if (scan.getFamilyMap().keySet().isEmpty()) {
1022+
if (!FeatureSupport.isEmptyFamilySupported()) {
1023+
throw new FeatureNotSupportedException("empty family scan not supported yet within observer version: " + ObGlobal.obVsnString());
1024+
}
10191025
// check nothing, use table group;
10201026
} else {
10211027
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)