You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by th...@apache.org on 2010/04/27 10:04:08 UTC
svn commit: r938347 - in /hadoop/avro/trunk: CHANGES.txt
lang/java/src/java/org/apache/avro/file/DataFileWriter.java
Author: thiru
Date: Tue Apr 27 08:04:08 2010
New Revision: 938347
URL: http://svn.apache.org/viewvc?rev=938347&view=rev
Log:
AVRO-524. DataFileWriter.appendTo leads to intermittent IOException during write()
Modified:
hadoop/avro/trunk/CHANGES.txt
hadoop/avro/trunk/lang/java/src/java/org/apache/avro/file/DataFileWriter.java
Modified: hadoop/avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/CHANGES.txt?rev=938347&r1=938346&r2=938347&view=diff
==============================================================================
--- hadoop/avro/trunk/CHANGES.txt (original)
+++ hadoop/avro/trunk/CHANGES.txt Tue Apr 27 08:04:08 2010
@@ -48,6 +48,8 @@ Avro 1.4.0 (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: hadoop/avro/trunk/lang/java/src/java/org/apache/avro/file/DataFileWriter.java
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/java/src/java/org/apache/avro/file/DataFileWriter.java?rev=938347&r1=938346&r2=938347&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/java/src/java/org/apache/avro/file/DataFileWriter.java (original)
+++ hadoop/avro/trunk/lang/java/src/java/org/apache/avro/file/DataFileWriter.java Tue Apr 27 08:04:08 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;
}