@InterfaceAudience.Private @InterfaceStability.Evolving public interface WAL extends Closeable, WALFileLengthProvider
Modifier and Type | Interface and Description |
---|---|
static class |
WAL.Entry
Utility class that lets us keep track of the edit with it's key.
|
static interface |
WAL.Reader
When outside clients need to consume persisted WALs, they rely on a provided Reader.
|
Modifier and Type | Method and Description |
---|---|
void |
abortCacheFlush(byte[] encodedRegionName)
Abort a cache flush.
|
long |
appendData(RegionInfo info,
WALKeyImpl key,
WALEdit edits)
Append a set of data edits to the WAL.
|
long |
appendMarker(RegionInfo info,
WALKeyImpl key,
WALEdit edits)
Append an operational 'meta' event marker edit to the WAL.
|
void |
close()
Caller no longer needs any edits from this WAL.
|
void |
completeCacheFlush(byte[] encodedRegionName,
long maxFlushedSeqId)
Complete the cache flush.
|
WALCoprocessorHost |
getCoprocessorHost()
Returns Coprocessor host.
|
long |
getEarliestMemStoreSeqNum(byte[] encodedRegionName)
Deprecated.
Since version 1.2.0. Removing because not used and exposes subtle internal
workings. Use
getEarliestMemStoreSeqNum(byte[], byte[]) |
long |
getEarliestMemStoreSeqNum(byte[] encodedRegionName,
byte[] familyName)
Gets the earliest unflushed sequence id in the memstore for the store.
|
static long |
getTimestamp(String name)
Split a WAL filename to get a start time.
|
void |
registerWALActionsListener(WALActionsListener listener)
Registers WALActionsListener
|
Map<byte[],List<byte[]>> |
rollWriter()
Roll the log writer.
|
Map<byte[],List<byte[]>> |
rollWriter(boolean force)
Roll the log writer.
|
void |
shutdown()
Stop accepting new writes.
|
Long |
startCacheFlush(byte[] encodedRegionName,
Map<byte[],Long> familyToSeq) |
Long |
startCacheFlush(byte[] encodedRegionName,
Set<byte[]> families)
WAL keeps track of the sequence numbers that are as yet not flushed im memstores in order to be
able to do accounting to figure which WALs can be let go.
|
void |
sync()
Sync what we have in the WAL.
|
default void |
sync(boolean forceSync) |
void |
sync(long txid)
Sync the WAL if the txId was not already sync'd.
|
default void |
sync(long txid,
boolean forceSync) |
String |
toString()
Human readable identifying information about the state of this WAL.
|
boolean |
unregisterWALActionsListener(WALActionsListener listener)
Unregisters WALActionsListener
|
void |
updateStore(byte[] encodedRegionName,
byte[] familyName,
Long sequenceid,
boolean onlyIfGreater)
updates the seuence number of a specific store.
|
getLogFileSizeIfBeingWritten
void registerWALActionsListener(WALActionsListener listener)
boolean unregisterWALActionsListener(WALActionsListener listener)
Map<byte[],List<byte[]>> rollWriter() throws FailedLogCloseException, IOException
RegionInfo.getEncodedName()
FailedLogCloseException
IOException
Map<byte[],List<byte[]>> rollWriter(boolean force) throws IOException
RegionInfo.getEncodedName()
IOException
void shutdown() throws IOException
IOException
void close() throws IOException
close
in interface AutoCloseable
close
in interface Closeable
IOException
long appendData(RegionInfo info, WALKeyImpl key, WALEdit edits) throws IOException
key
will have the region edit/sequence id filled in.info
- the regioninfo associated with appendkey
- Modified by this call; we add to it this edits region edit/sequence id.edits
- Edits to append. MAY CONTAIN NO EDITS for case where we want to get an edit
sequence id that is after all currently appended edits.key
will have the region edit/sequence id
in it.IOException
appendMarker(RegionInfo, WALKeyImpl, WALEdit)
long appendMarker(RegionInfo info, WALKeyImpl key, WALEdit edits) throws IOException
appendData(RegionInfo, WALKeyImpl, WALEdit)
is that a marker will not have transitioned
through the memstore.
The WAL is not flushed/sync'd after this transaction completes BUT on return this edit must
have its region edit/sequence id assigned else it messes up our unification of mvcc and
sequenceid. On return key
will have the region edit/sequence id filled in.info
- the regioninfo associated with appendkey
- Modified by this call; we add to it this edits region edit/sequence id.edits
- Edits to append. MAY CONTAIN NO EDITS for case where we want to get an edit
sequence id that is after all currently appended edits.key
will have the region edit/sequence id
in it.IOException
appendData(RegionInfo, WALKeyImpl, WALEdit)
void updateStore(byte[] encodedRegionName, byte[] familyName, Long sequenceid, boolean onlyIfGreater)
void sync() throws IOException
IOException
void sync(long txid) throws IOException
txid
- Transaction id to sync to.IOException
default void sync(boolean forceSync) throws IOException
forceSync
- Flag to force sync rather than flushing to the buffer. Example - Hadoop hflush
vs hsync.IOException
default void sync(long txid, boolean forceSync) throws IOException
txid
- Transaction id to sync to.forceSync
- Flag to force sync rather than flushing to the buffer. Example - Hadoop hflush
vs hsync.IOException
Long startCacheFlush(byte[] encodedRegionName, Set<byte[]> families)
Currently, it is expected that the update lock is held for the region; i.e. no concurrent appends while we set up cache flush.
families
- Families to flush. May be a subset of all families in the region.HConstants.NO_SEQNUM
if we are flushing the whole region OR if we are
flushing a subset of all families but there are no edits in those families not being
flushed; in other words, this is effectively same as a flush of all of the region
though we were passed a subset of regions. Otherwise, it returns the sequence id of the
oldest/lowest outstanding edit.completeCacheFlush(byte[], long)
,
abortCacheFlush(byte[])
Long startCacheFlush(byte[] encodedRegionName, Map<byte[],Long> familyToSeq)
void completeCacheFlush(byte[] encodedRegionName, long maxFlushedSeqId)
encodedRegionName
- Encoded region name.maxFlushedSeqId
- The maxFlushedSeqId for this flush. There is no edit in memory that is
less that this sequence id.startCacheFlush(byte[], Set)
,
abortCacheFlush(byte[])
void abortCacheFlush(byte[] encodedRegionName)
encodedRegionName
- Encoded region name.WALCoprocessorHost getCoprocessorHost()
@Deprecated long getEarliestMemStoreSeqNum(byte[] encodedRegionName)
getEarliestMemStoreSeqNum(byte[], byte[])
encodedRegionName
- The region to get the number for.long getEarliestMemStoreSeqNum(byte[] encodedRegionName, byte[] familyName)
encodedRegionName
- The region to get the number for.familyName
- The family to get the number for.String toString()
static long getTimestamp(String name)
10.20.20.171%3A60020.1277499063250
where 1277499063250
is the
timestamp. Could also be a meta WAL which adds a '.meta' suffix or a synchronous replication
WAL which adds a '.syncrep' suffix. Check for these. File also may have no timestamp on it. For
example the recovered.edits files are WALs but are named in ascending order. Here is an
example: 0000000000000016310. Allow for this.name
- Name of the WAL file.Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.