[ 
https://issues.apache.org/jira/browse/HDFS-6755?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mit Desai updated HDFS-6755:
----------------------------

    Description: 
Following code in DFSOutputStream may have an unnecessary sleep.

{code}
try {
          Thread.sleep(localTimeout);
          if (retries == 0) {
            throw new IOException("Unable to close file because the last block"
                + " does not have enough number of replicas.");
          }
          retries--;
          localTimeout *= 2;
          if (Time.now() - localstart > 5000) {
            DFSClient.LOG.info("Could not complete " + src + " retrying...");
          }
        } catch (InterruptedException ie) {
          DFSClient.LOG.warn("Caught exception ", ie);
        }
{code}

Currently, the code sleeps before throwing an exception which should not be the 
case.
The sleep time gets doubled on every iteration, which can make a significant 
effect if there are more than one iterations and it would sleep just to throw 
an exception. We need to move the sleep down after decrementing retries.

  was:
Following code in DFSOutputStream may have an unnecessary sleep.

{code}
try {
          Thread.sleep(localTimeout);
          if (retries == 0) {
            throw new IOException("Unable to close file because the last block"
                + " does not have enough number of replicas.");
          }
          retries--;
          localTimeout *= 2;
          if (Time.now() - localstart > 5000) {
            DFSClient.LOG.info("Could not complete " + src + " retrying...");
          }
        } catch (InterruptedException ie) {
          DFSClient.LOG.warn("Caught exception ", ie);
        }
{code}

Currently, the code sleeps before throwing an exception which should not be the 
case.
The sleep time gets doubled on every iteration, which can make a significant 
effect if there are more than one iterations. We need to move the sleep down 
after decrementing retries.


> Make DFSOutputStream more efficient
> -----------------------------------
>
>                 Key: HDFS-6755
>                 URL: https://issues.apache.org/jira/browse/HDFS-6755
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>    Affects Versions: 2.6.0
>            Reporter: Mit Desai
>            Assignee: Mit Desai
>
> Following code in DFSOutputStream may have an unnecessary sleep.
> {code}
> try {
>           Thread.sleep(localTimeout);
>           if (retries == 0) {
>             throw new IOException("Unable to close file because the last 
> block"
>                 + " does not have enough number of replicas.");
>           }
>           retries--;
>           localTimeout *= 2;
>           if (Time.now() - localstart > 5000) {
>             DFSClient.LOG.info("Could not complete " + src + " retrying...");
>           }
>         } catch (InterruptedException ie) {
>           DFSClient.LOG.warn("Caught exception ", ie);
>         }
> {code}
> Currently, the code sleeps before throwing an exception which should not be 
> the case.
> The sleep time gets doubled on every iteration, which can make a significant 
> effect if there are more than one iterations and it would sleep just to throw 
> an exception. We need to move the sleep down after decrementing retries.



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

Reply via email to