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

Íñigo Goiri commented on HDFS-14795:
------------------------------------

Thanks [~leosun08] for the patch.
In functionality, it looks good; I would improve readability.
Right now, one has to be really aware of how the BlockConstructionStage stages 
go and the clientName, etc.
I would extract the two ifs and make them functions with a javadoc explaining 
why one is a transfer and why the other is a write:
{code}
if (isTransfer(stage, clientName)) {
  this.throttler = xserver.getTransferThrottler();
} else if(isWrite(stage)) {
  this.throttler = xserver.getWriteThrottler();
}
{code}
Actually, the whole code could be a function {{getThrottler()}}.
As the snippet shows, I would also change the name for {{transferThrottler}}.

Can we also add some test?


> Add Throttler for writing block
> -------------------------------
>
>                 Key: HDFS-14795
>                 URL: https://issues.apache.org/jira/browse/HDFS-14795
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>            Reporter: Lisheng Sun
>            Assignee: Lisheng Sun
>            Priority: Minor
>         Attachments: HDFS-14795.001.patch, HDFS-14795.002.patch
>
>
> DataXceiver#writeBlock
> {code:java}
> blockReceiver.receiveBlock(mirrorOut, mirrorIn, replyOut,
>             mirrorAddr, null, targets, false);
> {code}
> As above code, DataXceiver#writeBlock doesn't throttler.
>  I think it is necessary to throttle for writing block, while add throttler 
> in stage of PIPELINE_SETUP_APPEND_RECOVERY or 
> PIPELINE_SETUP_STREAMING_RECOVERY.
> Default throttler value is still null.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

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

Reply via email to