You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@tez.apache.org by "Jeff Zhang (JIRA)" <ji...@apache.org> on 2014/07/01 11:22:24 UTC

[jira] [Commented] (TEZ-1247) Method verify() of DAG can't been called multiples times in some cases

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

Jeff Zhang commented on TEZ-1247:
---------------------------------

The verify method of DAG has a piece of code which would change the DAG, and this piece of code would cause exception if called multiple times. IMHO, the verify method should not have side effect on DAG, otherwise it will confuse users. 

Have some thinking on change of DAG
*  use builder pattern to construct the DAG, and in the build method to verify the DAG rather than making the verify method public. 
*  move the add* method which as side effect to the DAGBuilder, otherwise even after user verify a correct DAG, he could still call the add* method to change the DAG. All the side-effect operation and verify logic should be in DAGBuilder. 

{code}
  public void verify(boolean restricted) throws IllegalStateException {
    if (vertices.isEmpty()) {
      throw new IllegalStateException("Invalid dag containing 0 vertices");
    }

    processEdgesAndGroups();     // has side-effect on DAG
{code}


> Method verify() of DAG can't been called multiples times in some cases
> ----------------------------------------------------------------------
>
>                 Key: TEZ-1247
>                 URL: https://issues.apache.org/jira/browse/TEZ-1247
>             Project: Apache Tez
>          Issue Type: Bug
>    Affects Versions: 0.4.0
>            Reporter: Jeff Zhang
>            Assignee: Jeff Zhang
>




--
This message was sent by Atlassian JIRA
(v6.2#6252)