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

[jira] [Commented] (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=16769770#comment-16769770 ] 

Xu Cang commented on HBASE-21914:
---------------------------------

Actually #isFailed() does this:

{code:java}
return exception != null || state == ProcedureState.ROLLEDBACK;

{code}
So, what you want is already covered. Please correct me if I misunderstood your idea.

> 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)