try {
stat = getFileInfo(src);
if (namenodeProtocolProxy != null
&& namenodeProtocolProxy.isMethodSupported(
"appendAndFetchOldGS", String.class, String.class)) {
LocatedBlockWithOldGS loc = namenode.appendAndFetchOldGS(src,
clientName);
lastBlock = loc;
if (loc != null) {
updateNamespaceIdIfNeeded(loc.getNamespaceID());
updateDataTransferProtocolVersionIfNeeded(loc.getDataProtocolVersion());
getNewNameNodeIfNeeded(loc.getMethodFingerPrint());
}
} else if (namenodeProtocolProxy != null
&& dataTransferVersion >= DataTransferProtocol.APPEND_BLOCK_VERSION) {
// fail the request if the data transfer version support the new append
// protocol, but the namenode method is not supported.
// This should not happen unless there is a bug.
throw new IOException ("DataTransferVersion " + dataTransferVersion +
"requires the method appendAndFetchOldGS is supported in Namenode");
} else if (namenodeProtocolProxy != null
&& namenodeProtocolProxy.isMethodSupported(
"appendAndFetchMetaInfo", String.class, String.class)) {
LocatedBlockWithMetaInfo loc = namenode.appendAndFetchMetaInfo(src,
clientName);
lastBlock = loc;
if (loc != null) {
updateNamespaceIdIfNeeded(loc.getNamespaceID());
updateDataTransferProtocolVersionIfNeeded(loc.getDataProtocolVersion());
getNewNameNodeIfNeeded(loc.getMethodFingerPrint());
}
} else {
lastBlock = namenode.append(src, clientName);
}