@InterfaceAudience.Private public interface WALTailingReader extends Closeable
Modifier and Type | Interface and Description |
---|---|
static class |
WALTailingReader.Result |
static class |
WALTailingReader.State |
Modifier and Type | Method and Description |
---|---|
void |
close()
Override to remove the 'throws IOException' as we are just a reader.
|
long |
getPosition()
Get the current reading position.
|
WALTailingReader.Result |
next(long limit)
Read the next entry and make sure the position after reading does not go beyond the given
limit . |
void |
resetTo(long position,
boolean resetCompression)
Reopen the reader to see if there is new data arrives, and also seek(or skip) to the given
position.
|
WALTailingReader.Result next(long limit)
limit
.
Notice that we will not throw any checked exception out, all the states are represented by the
return value. Of course we will log the exceptions out. The reason why we do this is that, for
tailing a WAL file which is currently being written, we will hit EOFException many times, so it
should not be considered as an 'exception' and also, creating an Exception is a bit expensive.limit
- the position limit. See HBASE-14004 for more details about why we need this
limitation. -1 means no limit.long getPosition() throws IOException
IOException
void resetTo(long position, boolean resetCompression) throws IOException
position
, then the reader will locate to the first entry. Notice that, since we have a
magic header and a pb header, the first WAL entry is not located at position 0, so passing 0
will cause trouble.position
- the position we want to start reading from after resetting, or -1 if
you want to start reading from the beginning.resetCompression
- whether we also need to clear the compression context. If true
,
we will use skip instead of seek after resetting.IOException
void close()
close
in interface AutoCloseable
close
in interface Closeable
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.