Skip to content

Implement Admin Region metrics #218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: hbase_2.0
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.alipay.oceanbase.hbase.execute;

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 new IOException("Failed to execute request", e);
}
return parse(response);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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