accumulo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Billie J Rinaldi <billie.j.rina...@ugov.gov>
Subject Re: Accumulo on MapR Continued
Date Sat, 31 Mar 2012 03:15:41 GMT
It is my understanding that the file length is a valid file position.  If you are at position
0 and read one byte, you get the first byte of the file.  If you are at position length-1
and read one byte, you get the last byte of the file.  At that point you are at position equal
to the file length, and attempting to read an additional byte will give an EOF indicator (for
an InputStream read(), this would mean returning -1).  Seeking to the file length should just
cause a read to give an EOF.

Billie


----- Original Message -----
> From: "Keys Botzum" <kbotzum@maprtech.com>
> To: user@accumulo.apache.org
> Sent: Friday, March 30, 2012 10:12:00 PM
> Subject: Re: Accumulo on MapR Continued
> Billie,
> 
> 
> Thanks for the quick reply. I did some checking and the Hadoop docs
> indicate that seeking past the end of the file is illegal.
> 
> 
> 
> http://hadoop.apache.org/common/docs/current/api/org/apache/hadoop/fs/FSDataInputStream.html#seek%28long%29
> seek
> public void seek (long desired)
> throws IOException Description copied from interface: Seekable Seek to
> the given offset from the start of the file. The next read() will be
> from that location. Can't seek past the end of the file.
> 
> Specified by: seek in interface Seekable Throws: IOException
> 
> 
> The code below that is seeking to the file length is actually seeking
> one byte past the end of the file since the first byte in a file is
> byte zero. To me this seems like an Accumulo bug. Can this be fixed?
> 
> 
> Thanks,
> Keys
> ________________________________
> Keys Botzum
> Senior Principal Technologist
> WW Systems Engineering
> kbotzum@maprtech.com
> 443-718-0098
> MapR Technologies
> http://www.mapr.com
> 
> 
> 
> 
> 
> On Mar 30, 2012, at 5:04 PM, Billie J Rinaldi wrote:
> 
> 
> 
> I ran the following JUnit test and verified that the value printed out
> was the file length.
> 
> @Test
> public void testSeekToEOF() throws IOException {
> FileSystem fs = FileSystem.get(new Configuration());
> FSDataInputStream fdi = fs.open(new Path("README"));
> System.out.println("seeking to end: " + fdi.available());
> fdi.seek(fdi.available());
> fdi.close();
> }
> 
> 
> ----- Original Message -----
> 
> 
> From: "Keys Botzum" < kbotzum@maprtech.com >
> 
> 
> To: user@accumulo.apache.org
> 
> 
> Sent: Friday, March 30, 2012 4:56:09 PM
> 
> 
> Subject: Re: Accumulo on MapR Continued
> 
> 
> Can you share the program? I can try running it and answer your
> 
> 
> question. I can also of course check with MapR engineering to see if
> 
> 
> that's the issue.
> 
> 
> 
> 
> 
> 
> 
> 
> Much appreciated,
> 
> 
> Keys
> 
> 
> 
> 
> 
> ________________________________
> 
> 
> Keys Botzum
> 
> 
> Senior Principal Technologist
> 
> 
> WW Systems Engineering
> 
> 
> kbotzum@maprtech.com
> 
> 
> 443-718-0098
> 
> 
> MapR Technologies
> 
> 
> http://www.mapr.com
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> On Mar 30, 2012, at 4:48 PM, Billie J Rinaldi wrote:
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> On Friday, March 30, 2012 2:07:49 PM, "Keys Botzum" <
> 
> 
> kbotzum@maprtech.com > wrote:
> 
> 
> 
> 
> 
> 
> 
> 
> 30 11:00:15,778 [tabletserver.Tablet] ERROR: Failed to find lastkey
> 
> 
> 
> 
> 
> 
> 
> 
> Seeking beyond EOF, filelen 733, wantpos 733
> 
> 
> 
> 
> 
> It looks like Accumulo is trying to seek to the last position in a
> 
> 
> file. I just wrote a little program that opens a file in HDFS and
> 
> 
> seeks to its file length, and it didn't throw an error. Does MapR not
> 
> 
> allow this? If that is the desired MapR behavior, we could try to
> 
> 
> determine whether Accumulo could avoid performing that seek.
> 
> 
> 
> 
> 
> Billie

Mime
View raw message