avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yang <teddyyyy...@gmail.com>
Subject simultaneous read + write?
Date Fri, 26 Aug 2011 02:17:29 GMT
I'm trying to implement an on-disk queue, which contains avro records,
SpecificRecord

my queue implementation basically contains a
SpecificDatumWriter, and a SpecificDatumReader  pointing to the same file .

the problem is, that when the reader reaches the EOF, I can no longer
use it again,
even after I append more records to the file,  if I call the same
SpecificDatumReader.read() again,
it gave me exceptions:


-------------------------------------------------------------------------------
Test set: blah.MyTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.257
sec <<< FAILURE!
testBasic(blah.MyTest)  Time elapsed: 0.24 sec  <<< ERROR!
java.lang.ArrayIndexOutOfBoundsException
    at java.lang.System.arraycopy(Native Method)
    at org.apache.avro.io.BinaryDecoder$ByteSource.compactAndFill(BinaryDecoder.java:670)
    at org.apache.avro.io.BinaryDecoder.ensureBounds(BinaryDecoder.java:453)
    at org.apache.avro.io.BinaryDecoder.readInt(BinaryDecoder.java:120)
    at org.apache.avro.io.BinaryDecoder.readIndex(BinaryDecoder.java:405)
    at org.apache.avro.io.ResolvingDecoder.doAction(ResolvingDecoder.java:229)
    at org.apache.avro.io.parsing.Parser.advance(Parser.java:88)
    at org.apache.avro.io.ResolvingDecoder.readIndex(ResolvingDecoder.java:206)
    at org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:142)
    at org.apache.avro.generic.GenericDatumReader.readRecord(GenericDatumReader.java:166)
    at org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:138)
    at org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:129)
    at blah.DiskEventsQueue.dequeue2(MyTest.java:55)
    at blah.MyTest.testBasic(MyTest.java:85)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)




Thanks
Yang

Mime
View raw message