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

Íñigo Goiri edited comment on HDFS-13994 at 10/18/18 6:09 PM:
--------------------------------------------------------------

Just for the record, my three points weren't about things to fix but just for 
me to summarize the changes and go over them.
In general, the changes make sense to me.

For the SimulatedFSDataset, do we really want to do an "active" wait?
We are yielding here but pretty much this is active.
Sleeping 100 ms keeps the old behavior.
Then, I'm not a big fan of do/while but I understand that you want to skip the 
first loop; I guess I can live with that.


was (Author: elgoiri):
Just for the record, my three points weren't about things to fix but just for 
me to summarize the changes and go over them.
In general, the changes make sense to me.

For the SimulatedFSDataset, do we really want to do an "active" wait?
We are yielding here but pretty much this is active.
Sleeping 100 ms keeps the old behavior.
Then, I'm not a big fna of do/while but I understand that you want to skip the 
first loop; I guess I can live with that.

> DataNode BlockSender waitForMinLength
> -------------------------------------
>
>                 Key: HDFS-13994
>                 URL: https://issues.apache.org/jira/browse/HDFS-13994
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: datanode
>    Affects Versions: 3.2.0
>            Reporter: BELUGA BEHR
>            Assignee: BELUGA BEHR
>            Priority: Minor
>         Attachments: HDFS-13994.1.patch, HDFS-13994.2.patch, 
> HDFS-13994.3.patch, HDFS-13994.4.patch
>
>
> {code:java|title=BlockSender.java}
>   private static void waitForMinLength(ReplicaInPipeline rbw, long len)
>       throws IOException {
>     // Wait for 3 seconds for rbw replica to reach the minimum length
>     for (int i = 0; i < 30 && rbw.getBytesOnDisk() < len; i++) {
>       try {
>         Thread.sleep(100);
>       } catch (InterruptedException ie) {
>         throw new IOException(ie);
>       }
>     }
>     long bytesOnDisk = rbw.getBytesOnDisk();
>     if (bytesOnDisk < len) {
>       throw new IOException(
>           String.format("Need %d bytes, but only %d bytes available", len,
>               bytesOnDisk));
>     }
>   }
>  {code}
> It is not very efficient to poll for status in this way.  Instead, use 
> {{notifyAll}} within the {{ReplicaInPipeline}} to notify the caller when the 
> replica has reached a certain size.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to