HDFS文件追加append里的坑

2018-12-07 00:20 

org.apache.hadoop.ipc.RemoteException: Failed to APPEND_FILE /apps/hive/warehouse/ods.db/phone/phone.txt for DFSClient_NONMAPREDUCE_1742740607_1 on 172.17.0.4 because
DFSClient_NONMAPREDUCE_1742740607_1 is already the current lease holder.

  at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.recoverLeaseInternal(FSNamesystem.java:2970)
  at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.appendFileInternal(FSNamesystem.java:2766)
  at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.appendFileInt(FSNamesystem.java:3073)
  at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.appendFile(FSNamesystem.java:3042)
  at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.append(NameNodeRpcServer.java:760)
  at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.append(ClientNamenodeProtocolServerSideTranslatorPB.java:429)
  at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java)
  at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:640)
  at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:982)
  at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2313)
  at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2309)
  at java.security.AccessController.doPrivileged(Native Method)
  at javax.security.auth.Subject.doAs(Subject.java:422)
  at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1724)

  at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2307)


原因:追加的文件被打开流被打开,然后又追加造成的。


未等fs.create关闭


将fs.append移到fs.create之后即可

发表评论

您必须 登录 才能发表留言!