Skip to content
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

Optimize obkv_params method #60

Open
wants to merge 1 commit into
base: HBase_1.x_compatible
Choose a base branch
from
Open
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
20 changes: 7 additions & 13 deletions src/main/java/com/alipay/oceanbase/hbase/OHTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -515,11 +515,10 @@ public Result call() throws IOException {
scan.setCaching(1);
scan.setReversed(true);
obTableQuery = buildObTableQuery(filter, scan);
obTableQuery.setObKVParams(buildOBKVParams(scan));
} else {
obTableQuery = buildObTableQuery(filter, get.getRow(), true,
get.getRow(), true);
obTableQuery.setObKVParams(buildOBKVParams(get));
obTableQuery.setHBaseParams(buildObHBaseParams(get));
}
request = buildObTableQueryRequest(obTableQuery,
getTargetTableName(tableNameString));
Expand All @@ -538,11 +537,10 @@ public Result call() throws IOException {
scan.setCaching(1);
scan.setReversed(true);
obTableQuery = buildObTableQuery(filter, scan);
obTableQuery.setObKVParams(buildOBKVParams(scan));
} else {
obTableQuery = buildObTableQuery(filter, get.getRow(), true,
get.getRow(), true);
obTableQuery.setObKVParams(buildOBKVParams(get));
obTableQuery.setHBaseParams(buildObHBaseParams(get));
}
request = buildObTableQueryRequest(obTableQuery,
getTargetTableName(tableNameString, Bytes.toString(family)));
Expand Down Expand Up @@ -709,26 +707,22 @@ private void validatePut(Put put) {
}
}

private ObKVParams buildOBKVParams(final Scan scan) {
ObKVParams obKVParams = new ObKVParams();
private ObHBaseParams buildObHBaseParams(final Scan scan) {
ObHBaseParams obHBaseParams = new ObHBaseParams();
if (scan != null) {
obHBaseParams.setCaching(scan.getCaching());
obHBaseParams.setCallTimeout(scannerTimeout);
obHBaseParams.setCacheBlock(scan.isGetScan());
obHBaseParams.setAllowPartialResults(scan.getAllowPartialResults());
}
obKVParams.setObParamsBase(obHBaseParams);
return obKVParams;
return obHBaseParams;
}

private ObKVParams buildOBKVParams(final Get get) {
ObKVParams obKVParams = new ObKVParams();
private ObHBaseParams buildObHBaseParams(final Get get) {
ObHBaseParams obHBaseParams = new ObHBaseParams();
obHBaseParams.setCheckExistenceOnly(get.isCheckExistenceOnly());
obHBaseParams.setCacheBlock(get.getCacheBlocks());
obKVParams.setObParamsBase(obHBaseParams);
return obKVParams;
return obHBaseParams;
}

/**
Expand Down Expand Up @@ -1471,7 +1465,7 @@ private ObTableQuery buildObTableQuery(ObHTableFilter filter, final Scan scan) {
obTableQuery.setMaxResultSize(scan.getMaxResultSize() > 0 ? scan.getMaxResultSize()
: configuration.getLong(HConstants.HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE_KEY,
HConstants.DEFAULT_HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE));
obTableQuery.setObKVParams(buildOBKVParams(scan));
obTableQuery.setHBaseParams(buildObHBaseParams(scan));
return obTableQuery;
}

Expand Down