I have used python to create file and read the file via thrift , and my
hadoop is 0.20.
But when i try to append the existed file , and my code is:

  def write_file(self,name,data):
    try :
      path=Pathname()
      path.pathname=name
      filehandler=self.client.append(path)
      print self.client.write(filehandler,data)
    except ThriftIOException , tx:
      print "Error in writing the file with the given name",name
      print tx.message
      return False

When append the file , this code self.client.append(path) throws an
exception.

org.apache.hadoop.hdfs.protocol.AlreadyBeingCreatedException: failed to
create file /user/hadoop/test/testtxt5 for DFSClient_-1186455082 on client
10.18.138.201 because current leaseholder is trying to recreate file.
 at
org.apache.hadoop.hdfs.server.namenode.FSNamesystem.startFileInternal(FSNamesystem.java:1068)
at
org.apache.hadoop.hdfs.server.namenode.FSNamesystem.appendFile(FSNamesystem.java:1181)
 at
org.apache.hadoop.hdfs.server.namenode.NameNode.append(NameNode.java:422)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:512)
 at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:968)
at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:964)
 at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:396)
 at org.apache.hadoop.ipc.Server$Handler.run(Server.java:962)


Can anyone explain this ?

Thanks!




-- 
Best regards,

Ivy Tang

Reply via email to