-
Notifications
You must be signed in to change notification settings - Fork 22
fix enable & disable syntax errors #224
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
Zhou-jw
wants to merge
7
commits into
oceanbase:hbase_compat_3_2.0
Choose a base branch
from
Zhou-jw:hbase_compat_3_2.0_enable_disable
base: hbase_compat_3_2.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b418bc9
fix syntax errors
Zhou-jw 701c1e9
fix syntax errors
Zhou-jw e552174
Merge remote-tracking branch 'upstream/hbase_compat_3_2.0' into hbase…
Zhou-jw 9e17e34
Merge remote-tracking branch 'upstream/hbase_compat_3_2.0' into hbase…
Zhou-jw 1bfe302
Align obkv-hbase enable/disable exception handling with HBase
Zhou-jw c328bca
resolve conflicts
Zhou-jw da5089c
Align obkv-hbase enable/disable exception handling with HBase
Zhou-jw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,9 @@ | |
|
||
import com.alibaba.fastjson.JSON; | ||
import com.alipay.oceanbase.hbase.execute.AbstractObTableMetaExecutor; | ||
import com.alipay.oceanbase.rpc.protocol.payload.ResultCodes; | ||
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.meta.ObTableRpcMetaType; | ||
|
@@ -33,23 +35,51 @@ public Void parse(ObTableMetaResponse response) throws IOException { | |
return null; | ||
} | ||
|
||
public void enableTable(String tableName) throws IOException, TableNotFoundException, TableNotEnabledException { | ||
public Void enableTable(String tableName) throws IOException, TableNotFoundException, TableNotEnabledException { | ||
ObTableMetaRequest request = new ObTableMetaRequest(); | ||
request.setMetaType(getMetaType()); | ||
Map<String, Object> requestData = new HashMap<>(); | ||
requestData.put("table_name", tableName); | ||
String jsonData = JSON.toJSONString(requestData); | ||
request.setData(jsonData); | ||
execute(tableClient, request); | ||
try{ | ||
return execute(tableClient, request); | ||
} catch (IOException e) { | ||
Throwable cause = e.getCause(); | ||
if (cause instanceof ObTableException) { | ||
ObTableException obEx = (ObTableException) cause; | ||
int errCode = obEx.getErrorCode(); | ||
if(ResultCodes.OB_KV_TABLE_NOT_DISABLED.errorCode == errCode) { | ||
throw new TableNotEnabledException("Table is not enabled: " + tableName + obEx); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 异常描述有误 |
||
} else if (ResultCodes.OB_TABLEGROUP_NOT_EXIST.errorCode == errCode) { | ||
throw new TableNotFoundException("Table not found: " + tableName + obEx); | ||
} | ||
} | ||
throw e; | ||
} | ||
} | ||
|
||
public void disableTable(String tableName) throws IOException, TableNotFoundException, TableNotDisabledException { | ||
public Void disableTable(String tableName) throws IOException, TableNotFoundException, TableNotDisabledException { | ||
ObTableMetaRequest request = new ObTableMetaRequest(); | ||
request.setMetaType(getMetaType()); | ||
Map<String, Object> requestData = new HashMap<>(); | ||
requestData.put("table_name", tableName); | ||
String jsonData = JSON.toJSONString(requestData); | ||
request.setData(jsonData); | ||
execute(tableClient, request); | ||
try{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 漏了空格 |
||
return execute(tableClient, request); | ||
} catch (IOException e) { | ||
Throwable cause = e.getCause(); | ||
if (cause instanceof ObTableException) { | ||
ObTableException obEx = (ObTableException) cause; | ||
int errCode = obEx.getErrorCode(); | ||
if(ResultCodes.OB_KV_TABLE_NOT_DISABLED.errorCode == errCode) { | ||
throw new TableNotEnabledException("Table is not enabled: " + tableName + obEx); | ||
} else if (ResultCodes.OB_TABLEGROUP_NOT_EXIST.errorCode == errCode) { | ||
throw new TableNotFoundException("Table not found: " + tableName + obEx); | ||
} | ||
} | ||
throw e; | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
漏了空格