Fix treatment of NNHAStatusHeartbeat in protobuffer.
Committing without pre-commit review since it's a pretty trivial merge fix git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-1623@1214543 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8134b1c870
commit
ecdf9da770
|
@ -116,6 +116,7 @@ public class DatanodeProtocolServerSideTranslatorPB implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
builder.setHaStatus(PBHelper.convert(response.getNameNodeHaState()));
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1259,4 +1259,23 @@ public class PBHelper {
|
||||||
throw new IllegalArgumentException("Unexpected NNHAStatusHeartbeat.State:" + s.getState());
|
throw new IllegalArgumentException("Unexpected NNHAStatusHeartbeat.State:" + s.getState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static NNHAStatusHeartbeatProto convert(NNHAStatusHeartbeat hb) {
|
||||||
|
if (hb == null) return null;
|
||||||
|
NNHAStatusHeartbeatProto.Builder builder =
|
||||||
|
NNHAStatusHeartbeatProto.newBuilder();
|
||||||
|
switch (hb.getState()) {
|
||||||
|
case ACTIVE:
|
||||||
|
builder.setState(NNHAStatusHeartbeatProto.State.ACTIVE);
|
||||||
|
break;
|
||||||
|
case STANDBY:
|
||||||
|
builder.setState(NNHAStatusHeartbeatProto.State.STANDBY);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("Unexpected NNHAStatusHeartbeat.State:" +
|
||||||
|
hb.getState());
|
||||||
|
}
|
||||||
|
builder.setTxid(hb.getTxId());
|
||||||
|
return builder.build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue