|
@@ -726,10 +726,13 @@ public class NNThroughputBenchmark {
|
|
|
*/
|
|
|
void sendHeartbeat() throws IOException {
|
|
|
// register datanode
|
|
|
- DatanodeCommand cmd = nameNode.sendHeartbeat(
|
|
|
+ DatanodeCommand[] cmds = nameNode.sendHeartbeat(
|
|
|
dnRegistration, DF_CAPACITY, DF_USED, DF_CAPACITY - DF_USED, 0, 0);
|
|
|
- if(cmd != null)
|
|
|
- LOG.debug("sendHeartbeat Name-node reply: " + cmd.getAction());
|
|
|
+ if(cmds != null) {
|
|
|
+ for (DatanodeCommand cmd : cmds ) {
|
|
|
+ LOG.debug("sendHeartbeat Name-node reply: " + cmd.getAction());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
boolean addBlock(Block blk) {
|
|
@@ -757,13 +760,18 @@ public class NNThroughputBenchmark {
|
|
|
*/
|
|
|
int replicateBlocks() throws IOException {
|
|
|
// register datanode
|
|
|
- DatanodeCommand cmd = nameNode.sendHeartbeat(
|
|
|
+ DatanodeCommand[] cmds = nameNode.sendHeartbeat(
|
|
|
dnRegistration, DF_CAPACITY, DF_USED, DF_CAPACITY - DF_USED, 0, 0);
|
|
|
- if(cmd == null || cmd.getAction() != DatanodeProtocol.DNA_TRANSFER)
|
|
|
- return 0;
|
|
|
- // Send a copy of a block to another datanode
|
|
|
- BlockCommand bcmd = (BlockCommand)cmd;
|
|
|
- return transferBlocks(bcmd.getBlocks(), bcmd.getTargets());
|
|
|
+ if (cmds != null) {
|
|
|
+ for (DatanodeCommand cmd : cmds) {
|
|
|
+ if (cmd.getAction() == DatanodeProtocol.DNA_TRANSFER) {
|
|
|
+ // Send a copy of a block to another datanode
|
|
|
+ BlockCommand bcmd = (BlockCommand)cmd;
|
|
|
+ return transferBlocks(bcmd.getBlocks(), bcmd.getTargets());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
/**
|