本文目标是:
- 弄清updateBlockForPipeline这个RPC的作用。
- 弄清updateBlockForPipeline RPC的使用场景,代码里的调用点。
一、updateBlockForPipeline的作用
其定义在ClientProtocol接口里,是Client与NameNode之间的接口。
看其代码注释描述:
为一个under construction状态下的block获取一个新的GS与access token。
此RPC只有在client需要恢复一个失败的pipeline时、或者为了append建立一个pipeline时会被调用。
/*** Get a new generation stamp together with an access token for* a block under construction** This method is called only when a client needs to recover a failed* pipeline or set up a pipeline for appending to a block.** @param block a block* @param clientName the name of the client* @return a located block with a new generation stamp and an access token* @throws IOException if any error occurs*/