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

Nanda kumar commented on HDDS-247:
----------------------------------

Thanks [~shashikant] for working on this, overall the patch looks good to me.

In _ChunkGroupOutputStream#addPreallocateBlocks_ we don't need {{index}} 
variable. Natural ArrayList ordering should be sufficient here.

We don't have to call {{allocateNewBlock}} from 
{{handleCloseContainerException}}, this can be avoided by calling {{write}} 
method again.

Conditional logic can be removed in {{checkIfContainerIsClosed}}
{code:java}
  private boolean checkIfContainerIsClosed(IOException ioe) {
    Throwable throwable = ioe.getCause();
    if (throwable instanceof StorageContainerException
        && ((StorageContainerException) throwable).getResult()
        == Result.CLOSED_CONTAINER_IO) {
      return true;
    } else {
      return false;
    }
  }
{code}
can be refactored to
{code:java}
    private boolean checkIfContainerIsClosed(IOException ioe) {
    return Optional.of(ioe.getCause())
        .filter(e -> e instanceof StorageContainerException)
        .map(e -> (StorageContainerException) e)
        .filter(sce -> sce.getResult() == Result.CLOSED_CONTAINER_IO)
        .isPresent();
  }
{code}
We don't need {{ChunkOutputStreamEntry#copyBufffer}} or 
{{ChunkOutputStream#copyBuffer}}, we can use {{entry.write}}

> Handle CLOSED_CONTAINER_IO exception in ozoneClient
> ---------------------------------------------------
>
>                 Key: HDDS-247
>                 URL: https://issues.apache.org/jira/browse/HDDS-247
>             Project: Hadoop Distributed Data Store
>          Issue Type: Bug
>          Components: Ozone Client
>            Reporter: Shashikant Banerjee
>            Assignee: Shashikant Banerjee
>            Priority: Blocker
>             Fix For: 0.2.1
>
>         Attachments: HDDS-247.00.patch, HDDS-247.01.patch, HDDS-247.02.patch, 
> HDDS-247.03.patch, HDDS-247.04.patch, HDDS-247.05.patch, HDDS-247.06.patch, 
> HDDS-247.07.patch
>
>
> In case of ongoing writes by Ozone client to a container, the container might 
> get closed on the Datanodes because of node loss, out of space issues etc. In 
> such cases, the operation will fail with CLOSED_CONTAINER_IO exception. In 
> cases as such, ozone client should try to get the committed length of the 
> block from the Datanodes, and update the OM. This Jira aims  to address this 
> issue.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to