You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by cu...@apache.org on 2010/06/04 01:52:24 UTC

svn commit: r951213 - in /avro/branches/branch-1.3: ./ CHANGES.txt lang/java/src/java/org/apache/avro/file/DataFileWriter.java

Author: cutting
Date: Thu Jun  3 23:52:24 2010
New Revision: 951213

URL: http://svn.apache.org/viewvc?rev=951213&view=rev
Log:
Merge r938347 from trunk to 1.3 branch.  Fixes: AVRO-524.

Modified:
    avro/branches/branch-1.3/   (props changed)
    avro/branches/branch-1.3/CHANGES.txt
    avro/branches/branch-1.3/lang/java/src/java/org/apache/avro/file/DataFileWriter.java

Propchange: avro/branches/branch-1.3/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jun  3 23:52:24 2010
@@ -1 +1 @@
-/hadoop/avro/trunk:935526
+/hadoop/avro/trunk:935526,938347

Modified: avro/branches/branch-1.3/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/branches/branch-1.3/CHANGES.txt?rev=951213&r1=951212&r2=951213&view=diff
==============================================================================
--- avro/branches/branch-1.3/CHANGES.txt (original)
+++ avro/branches/branch-1.3/CHANGES.txt Thu Jun  3 23:52:24 2010
@@ -20,6 +20,8 @@ Avro 1.3.3 (Unreleased)
 
     AVRO-517. Resolving Decoder fails in some cases. (thiru) 
 
+    AVRO-524. DataFileWriter.appendTo leads to intermittent IOException during write() (thiru)
+
 Avro 1.3.2 (31 March 2010)
 
   IMPROVEMENTS

Modified: avro/branches/branch-1.3/lang/java/src/java/org/apache/avro/file/DataFileWriter.java
URL: http://svn.apache.org/viewvc/avro/branches/branch-1.3/lang/java/src/java/org/apache/avro/file/DataFileWriter.java?rev=951213&r1=951212&r2=951213&view=diff
==============================================================================
--- avro/branches/branch-1.3/lang/java/src/java/org/apache/avro/file/DataFileWriter.java (original)
+++ avro/branches/branch-1.3/lang/java/src/java/org/apache/avro/file/DataFileWriter.java Thu Jun  3 23:52:24 2010
@@ -31,7 +31,6 @@ import java.io.OutputStream;
 import java.io.RandomAccessFile;
 import java.io.UnsupportedEncodingException;
 import java.nio.ByteBuffer;
-import java.nio.channels.FileChannel;
 import java.rmi.server.UID;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
@@ -155,7 +154,7 @@ public class DataFileWriter<D> implement
     assertNotOpen();
     if (!file.exists())
       throw new FileNotFoundException("Not found: "+file);
-    RandomAccessFile raf = new RandomAccessFile(file, "rw");
+    RandomAccessFile raf = new RandomAccessFile(file, "r");
     FileDescriptor fd = raf.getFD();
     DataFileReader<D> reader =
       new DataFileReader<D>(new SeekableFileInput(fd),
@@ -170,11 +169,9 @@ public class DataFileWriter<D> implement
     } else {
       this.codec = CodecFactory.nullCodec().createInstance();
     }
+    raf.close();
 
-    FileChannel channel = raf.getChannel();       // seek to end
-    channel.position(channel.size());
-
-    init(new FileOutputStream(fd));
+    init(new FileOutputStream(file, true));
 
     return this;
   }