You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Xiang Li (JIRA)" <ji...@apache.org> on 2019/02/16 01:04:00 UTC

[jira] [Comment Edited] (HBASE-21914) Set assert to check if exception is set in procedures

    [ https://issues.apache.org/jira/browse/HBASE-21914?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16769927#comment-16769927 ] 

Xiang Li edited comment on HBASE-21914 at 2/16/19 1:03 AM:
-----------------------------------------------------------

Hi [~xucang], I got your idea. 
Do you mind check the latest master branch
{code:title=Procedure.java|borderStyle=solid}
public synchronized boolean isFailed() {
    return state == ProcedureState.FAILED || state == ProcedureState.ROLLEDBACK;
}
{code}
Checking in git log, that was changed from the version in comment to the one above by HBASE-17863


was (Author: water):
Hi [~xucang], I got your idea. 
Do you mind check the latest master branch
{code:title=Procedure.java|borderStyle=solid}
public synchronized boolean isFailed() {
    return state == ProcedureState.FAILED || state == ProcedureState.ROLLEDBACK;
  }
{code}
Checking in git log, that was changed from the version in comment to the one above by HBASE-17863

> Set assert to check if exception is set in procedures
> -----------------------------------------------------
>
>                 Key: HBASE-21914
>                 URL: https://issues.apache.org/jira/browse/HBASE-21914
>             Project: HBase
>          Issue Type: Bug
>          Components: proc-v2
>            Reporter: Xiang Li
>            Assignee: Xiang Li
>            Priority: Critical
>
> Take CreateTableProcedure as an example, in executeFromState()
> {code:java}
> case CREATE_TABLE_PRE_OPERATION:
>   // Verify if we can create the table
>   boolean exists = !prepareCreate(env);
>   releaseSyncLatch();
>   
>   if (exists) {
>     assert isFailed() : "the delete should have an exception here";
>     return Flow.NO_MORE_STATE;
> }  
> {code}
> The following assertion:
> {code}
> assert isFailed() : "the delete should have an exception here";
> {code}
> If I get the idea behind "the delete should have an exception here" correctly, it is to make sure that when setting the state to FAILED, the exception must be set. (or must call setFailure()). But the assertion only check isFailed() but no "!hasException()"



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)