Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
8554f31
MetaExecutor interface definition and demo
maochongxin May 15, 2025
633d349
delete table and table exists function
JackShi148 May 20, 2025
aa5bc40
region metrics test
JackShi148 May 21, 2025
5712ffa
set not support for interfaces
JackShi148 May 26, 2025
fe943d2
adapt hbase namespace
JackShi148 May 26, 2025
7fbe894
update test
JackShi148 May 28, 2025
5e09cc3
Merge pull request #218 from oceanbase/region_metrics
JackShi148 May 29, 2025
d398946
add enable disable to OHTableAccessControlExecutor
Zhou-jw May 29, 2025
22e61f9
resolve conflicts
Zhou-jw May 29, 2025
8f0752a
Merge pull request #221 from Zhou-jw/hbase_compat_3_2.0_enable_disable
WeiXinChan May 29, 2025
62c5c58
create_table; region_locator; table_descriptor
maochongxin May 29, 2025
5196714
Merge pull request #222 from oceanbase/meta_info_impl
WeiXinChan May 30, 2025
e133534
[Test] add create/delete table testcases
shenyunlong May 30, 2025
40ae8e5
add hash-like partition case for region locator
maochongxin Jun 3, 2025
cd69d21
Merge pull request #226 from oceanbase/fix-regionlocator-case
WeiXinChan Jun 3, 2025
5f90652
fix region locator in flink
JackShi148 Jun 3, 2025
61efd48
Merge pull request #227 from oceanbase/fix_flink_region_locator_2.0
WeiXinChan Jun 3, 2025
4164ef2
Merge pull request #225 from shenyunlong/local_hbase_compat_3_2.0
WeiXinChan Jun 3, 2025
61b48c2
adapt for disable/enable table test (#228)
GroundWu Jun 4, 2025
8a9968b
add hregionlocation test case
maochongxin Jun 4, 2025
129a0f4
disable htable ddl
maochongxin Jun 4, 2025
c5b3f97
Merge pull request #230 from oceanbase/region_locator_test_case
WeiXinChan Jun 4, 2025
4c5a936
Merge pull request #229 from oceanbase/disable_admin
WeiXinChan Jun 4, 2025
0319f35
optimize region metrics case
JackShi148 Jun 4, 2025
cc25a35
add hbase put case for perf opt (#231)
GroundWu Jun 4, 2025
f45a552
Merge pull request #232 from oceanbase/optimize_region_metrics_case
WeiXinChan Jun 4, 2025
5121a8d
adapt read hot only
WeiXinChan Apr 27, 2025
fead4db
Merge pull request #233 from shenyunlong/local_hbase_compat_3_2.0
WeiXinChan Jun 4, 2025
a0f324a
[Test] fix test compile error
shenyunlong Jun 4, 2025
257c8dc
Merge pull request #234 from shenyunlong/local_hbase_compat_3_2.0
WeiXinChan Jun 4, 2025
38a97ac
add getDesc test case
maochongxin Jun 5, 2025
d192cd4
Merge pull request #235 from oceanbase/fix_some
WeiXinChan Jun 5, 2025
692c726
change fastjson to jackson
JackShi148 Jun 12, 2025
4ec96cd
[Test] add defensive test for htable ddl
shenyunlong Jun 12, 2025
ac04d6a
[Chore] open the limiation for other htable admin operation
shenyunlong Jun 12, 2025
91c9e54
[Test] modify test cases after observer changed
shenyunlong Jun 12, 2025
ab6c9d1
add htable ddl concurrent test case (#241)
GroundWu Jun 12, 2025
7fdf24d
fix for compile
GroundWu Jun 12, 2025
53f8550
Merge pull request #243 from oceanbase/rm_fastjson_dep
WeiXinChan Jun 12, 2025
0ff5726
[Test] add testcases for pk and kv_attributes
shenyunlong Jun 13, 2025
3c9e9fc
fix namespace not exsit
JackShi148 Jun 13, 2025
25f6b26
Merge pull request #245 from oceanbase/fix_nonexists_namespace
WeiXinChan Jun 16, 2025
5fcfbcc
patch bufferedMutator deals exception
JackShi148 Jun 16, 2025
e8c0b2e
Merge pull request #246 from oceanbase/patch_buffermutator_error_dealing
WeiXinChan Jun 16, 2025
41795b1
fix jackson bug
JackShi148 Jun 16, 2025
59931e1
Merge pull request #248 from oceanbase/fix_desc_maxVersions
JackShi148 Jun 17, 2025
cdadb4a
add test case for admin interface error injection
maochongxin Jun 11, 2025
3f1de6a
Merge pull request #240 from oceanbase/admin_inj_err_test
maochongxin Jun 17, 2025
bf3161a
use table fastxml:jackson, exclude hbase-client fastxml:jackson
JackShi148 Jun 18, 2025
963c886
Merge pull request #249 from oceanbase/use_table_jackson
JackShi148 Jun 18, 2025
414972a
fix hregion location build error
maochongxin Jun 18, 2025
2cb58dd
Merge pull request #250 from oceanbase/fix-HRegionLocation-build-error
WeiXinChan Jun 18, 2025
b23214a
fix getRegion not return leader host
maochongxin Jun 19, 2025
c27889e
[Chore] add _enable_kv_hbase_admin_ddl test and fix admin ddl exception
shenyunlong Jun 19, 2025
667a16f
Merge pull request #252 from oceanbase/fix_hregion_locator_not_return…
WeiXinChan Jun 23, 2025
beb162e
[Test] add test for create/drp tablegroup and ddl stmt str
shenyunlong Jun 23, 2025
3f5d26b
Merge pull request #253 from shenyunlong/local_hbase_compat_3_2.0
WeiXinChan Jun 24, 2025
fd0931d
fix add case for secondary partition region locator
maochongxin Jun 24, 2025
9566d42
Merge pull request #254 from oceanbase/add-case-for-secondary-partiti…
WeiXinChan Jun 24, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

import com.alipay.oceanbase.hbase.OHTableClient;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
Expand Down Expand Up @@ -49,7 +51,7 @@ public static void simpleTest() throws Exception {
byte[] rowKey = toBytes("rowKey1");
byte[] column = toBytes("column1");
Put put = new Put(rowKey);
put.add(family, column, System.currentTimeMillis(), toBytes("value1"));
put.addColumn(family, column, System.currentTimeMillis(), toBytes("value1"));
hTable.put(put);

// 3. get data like hbase
Expand All @@ -58,7 +60,7 @@ public static void simpleTest() throws Exception {
Result r = hTable.get(get);
if (!r.isEmpty()) {
Cell cell = r.rawCells()[0];
System.out.printf("column1: " + CellUtil.cloneQualifier(r));
System.out.printf("column1: " + CellUtil.cloneQualifier(cell));
}

// 4. close
Expand Down
6 changes: 5 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<project.build.sourceEncoding>${project.encoding}</project.build.sourceEncoding>
<project.encoding>UTF-8</project.encoding>
<slf4j.version>1.7.21</slf4j.version>
<table.client.version>2.0.0</table.client.version>
<table.client.version>2.0.1-SNAPSHOT</table.client.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -167,6 +167,10 @@
<artifactId>jersey-json</artifactId>
<groupId>com.sun.jersey</groupId>
</exclusion>
<exclusion>
<artifactId>jackson-databind</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down
26 changes: 14 additions & 12 deletions src/main/java/com/alipay/oceanbase/hbase/OHTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,7 @@ public OHTable(Configuration configuration, String tableName) throws IOException
DEFAULT_HBASE_HTABLE_THREAD_KEEP_ALIVE_TIME);
this.executePool = createDefaultThreadPoolExecutor(1, maxThreads, keepAliveTime);
OHConnectionConfiguration ohConnectionConf = new OHConnectionConfiguration(configuration);
int numRetries = configuration.getInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER,
HConstants.DEFAULT_HBASE_CLIENT_RETRIES_NUMBER);
int numRetries = ohConnectionConf.getNumRetries();
this.obTableClient = ObTableClientManager.getOrCreateObTableClient(setUserDefinedNamespace(
this.tableNameString, ohConnectionConf));
this.obTableClient.setRpcExecuteTimeout(ohConnectionConf.getRpcTimeout());
Expand Down Expand Up @@ -273,8 +272,7 @@ public OHTable(Configuration configuration, final byte[] tableName,
this.executePool = executePool;
this.cleanupPoolOnClose = false;
OHConnectionConfiguration ohConnectionConf = new OHConnectionConfiguration(configuration);
int numRetries = configuration.getInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER,
HConstants.DEFAULT_HBASE_CLIENT_RETRIES_NUMBER);
int numRetries = ohConnectionConf.getNumRetries();
this.obTableClient = ObTableClientManager.getOrCreateObTableClient(setUserDefinedNamespace(
this.tableNameString, ohConnectionConf));
this.obTableClient.setRpcExecuteTimeout(ohConnectionConf.getRpcTimeout());
Expand Down Expand Up @@ -345,8 +343,7 @@ public OHTable(TableName tableName, Connection connection,
DEFAULT_HBASE_HTABLE_PUT_WRITE_BUFFER_CHECK);
this.writeBufferSize = connectionConfig.getWriteBufferSize();
this.tableName = tableName.getName();
int numRetries = configuration.getInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER,
HConstants.DEFAULT_HBASE_CLIENT_RETRIES_NUMBER);
int numRetries = connectionConfig.getNumRetries();
this.obTableClient = ObTableClientManager.getOrCreateObTableClient(setUserDefinedNamespace(
this.tableNameString, connectionConfig));
this.obTableClient.setRpcExecuteTimeout(rpcTimeout);
Expand Down Expand Up @@ -389,8 +386,7 @@ public OHTable(Connection connection, ObTableBuilderBase builder,
this.putWriteBufferCheck = this.configuration.getInt(HBASE_HTABLE_PUT_WRITE_BUFFER_CHECK,
DEFAULT_HBASE_HTABLE_PUT_WRITE_BUFFER_CHECK);
this.writeBufferSize = connectionConfig.getWriteBufferSize();
int numRetries = configuration.getInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER,
HConstants.DEFAULT_HBASE_CLIENT_RETRIES_NUMBER);
int numRetries = connectionConfig.getNumRetries();
this.obTableClient = ObTableClientManager.getOrCreateObTableClient(setUserDefinedNamespace(
this.tableNameString, connectionConfig));
this.obTableClient.setRpcExecuteTimeout(rpcTimeout);
Expand Down Expand Up @@ -462,7 +458,7 @@ private void finishSetUp() {
WRITE_BUFFER_SIZE_DEFAULT);
}

private OHConnectionConfiguration setUserDefinedNamespace(String tableNameString,
public static OHConnectionConfiguration setUserDefinedNamespace(String tableNameString,
OHConnectionConfiguration ohConnectionConf)
throws IllegalArgumentException {
if (tableNameString.indexOf(':') != -1) {
Expand Down Expand Up @@ -503,13 +499,15 @@ public Configuration getConfiguration() {
}

@Override
public HTableDescriptor getTableDescriptor() {
throw new FeatureNotSupportedException("not supported yet.");
public HTableDescriptor getTableDescriptor() throws IOException {
OHTableDescriptorExecutor executor = new OHTableDescriptorExecutor(tableNameString, obTableClient);
return executor.getTableDescriptor();
}

@Override
public TableDescriptor getDescriptor() throws IOException {
throw new FeatureNotSupportedException("not supported yet.");
OHTableDescriptorExecutor executor = new OHTableDescriptorExecutor(tableNameString, obTableClient);
return executor.getTableDescriptor();
}

/**
Expand Down Expand Up @@ -1950,6 +1948,8 @@ private ObTableQuery buildObTableQuery(ObHTableFilter filter, final Scan scan) {
HConstants.DEFAULT_HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE));
obTableQuery.setObKVParams(buildOBKVParams(scan));
obTableQuery.setScanRangeColumns("K", "Q", "T");
byte[] hotOnly = scan.getAttribute(HBASE_HTABLE_QUERY_HOT_ONLY);
obTableQuery.setHotOnly(hotOnly != null && Arrays.equals(hotOnly, "true".getBytes()));
return obTableQuery;
}

Expand All @@ -1967,6 +1967,8 @@ private ObTableQuery buildObTableQuery(final Get get, Collection<byte[]> columnQ
}
obTableQuery.setObKVParams(buildOBKVParams(get));
obTableQuery.setScanRangeColumns("K", "Q", "T");
byte[] hotOnly = get.getAttribute(HBASE_HTABLE_QUERY_HOT_ONLY);
obTableQuery.setHotOnly(hotOnly != null && Arrays.equals(hotOnly, "true".getBytes()));
return obTableQuery;
}

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/alipay/oceanbase/hbase/OHTableClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ public HTableDescriptor getTableDescriptor() throws IOException {

@Override
public TableDescriptor getDescriptor() throws IOException {
return null;
checkStatus();
return ohTable.getDescriptor();
}

@Override
Expand Down
25 changes: 15 additions & 10 deletions src/main/java/com/alipay/oceanbase/hbase/constants/OHConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@
public final class OHConstants {

/**
* ocenbase hbase root server http url
* oceanbase hbase root server http url
*/
public static final String HBASE_OCEANBASE_PARAM_URL = "hbase.oceanbase.paramURL";

/**
* ocenbase hbase connect server username
* oceanbase hbase connect server username
*/
public static final String HBASE_OCEANBASE_FULL_USER_NAME = "hbase.oceanbase.fullUserName";

/**
* ocenbase hbase connect server password
* oceanbase hbase connect server password
*/
public static final String HBASE_OCEANBASE_PASSWORD = "hbase.oceanbase.password";

Expand All @@ -48,39 +48,39 @@ public final class OHConstants {
public static final String HBASE_OCEANBASE_SYS_PASSWORD = "hbase.oceanbase.sysPassword";

/**
* ocenbase hbase connect server password
* oceanbase hbase connect server password
*/
public static final String HBASE_OCEANBASE_BATCH_EXECUTOR = "hbase.oceanbase.batch.executor";

/**
* ocenbase hbase connect server ODP address
* oceanbase hbase connect server ODP address
*/
public static final String HBASE_OCEANBASE_ODP_ADDR = "hbase.oceanbase.odpAddr";

/**
* ocenbase hbase connect server ODP port
* oceanbase hbase connect server ODP port
*/
public static final String HBASE_OCEANBASE_ODP_PORT = "hbase.oceanbase.odpPort";

/**
* ocenbase hbase connect server ODP mode
* oceanbase hbase connect server ODP mode
*/
public static final String HBASE_OCEANBASE_ODP_MODE = "hbase.oceanbase.odpMode";

/**
* ocenbase hbase connect server database
* oceanbase hbase connect server database
*/
public static final String HBASE_OCEANBASE_DATABASE = "hbase.oceanbase.database";

/**
* ocenbase hbase model rowkey column is consist of following column
* oceanbase hbase model rowkey column is consist of following column
* K, Q, T hbase value
*/
public static final String[] ROW_KEY_COLUMNS = new String[] { "K",
"Q", "T" };

/**
* ocenbase hbase model value column is consist of following column
* oceanbase hbase model value column is consist of following column
* V hbase value
*/
public static final String[] V_COLUMNS = new String[] { "V" };
Expand Down Expand Up @@ -124,6 +124,11 @@ public final class OHConstants {
*/
public static final String DEFAULT_HBASE_HTABLE_TEST_LOAD_SUFFIX = "_t";

/**
* use to specify whether to query only the data in hot storage when performing a query.
*/
public static final String HBASE_HTABLE_QUERY_HOT_ONLY = "hbase.htable.query.hot_only";

/*-------------------------------------------------------------------------------------------------------------*/

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*-
* #%L
* com.oceanbase:obkv-hbase-client
* %%
* Copyright (C) 2022 - 2025 OceanBase Group
* %%
* OBKV HBase Client Framework is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
* #L%
*/

package com.alipay.oceanbase.hbase.execute;

import com.alipay.oceanbase.hbase.util.OHBaseExceptionUtil;
import com.alipay.oceanbase.rpc.ObTableClient;
import com.alipay.oceanbase.rpc.exception.ObTableException;
import com.alipay.oceanbase.rpc.meta.ObTableMetaRequest;
import com.alipay.oceanbase.rpc.meta.ObTableMetaResponse;
import com.alipay.oceanbase.rpc.table.ObTable;

import java.io.IOException;

public abstract class AbstractObTableMetaExecutor<T> implements ObTableMetaExecutor<T> {

@Override
public T execute(ObTableClient client, ObTableMetaRequest request) throws IOException {
if (request.getMetaType() != getMetaType()) {
throw new IOException("Invalid meta type, expected " + getMetaType());
}
ObTable table = client.getRandomTable();
ObTableMetaResponse response;
try {
response = (ObTableMetaResponse) client.executeWithRetry(
table,
request,
null /*tableName*/
);
} catch (Exception e) {
throw OHBaseExceptionUtil.convertTableException(e);
}
return parse(response);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*-
* #%L
* com.oceanbase:obkv-hbase-client
* %%
* Copyright (C) 2022 - 2025 OceanBase Group
* %%
* OBKV HBase Client Framework is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
* #L%
*/

package com.alipay.oceanbase.hbase.execute;

import com.alipay.oceanbase.rpc.ObTableClient;
import com.alipay.oceanbase.rpc.meta.ObTableMetaRequest;
import com.alipay.oceanbase.rpc.meta.ObTableMetaResponse;
import com.alipay.oceanbase.rpc.meta.ObTableRpcMetaType;

import java.io.IOException;

public interface ObTableMetaExecutor<T> {
/**
* 执行元数据请求
* @param request 元数据请求
* @return 解析后的元数据对象
* @throws IOException 如果执行失败或解析失败
*/
T execute(ObTableClient client, ObTableMetaRequest request) throws IOException;

/**
* 解析元数据响应, 用户需要重写
* @param response 元数据响应
* @return 解析后的元数据对象
* @throws IOException 如果解析失败
*/
T parse(ObTableMetaResponse response) throws IOException;

/**
* 获取元信息类型, 用户需要重写
* @return 元信息类型
*/
ObTableRpcMetaType getMetaType() throws IOException;
}
Loading