@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.
|
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.
|
default void |
init()
Used to initialize the WAL.
|
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.
|
default void |
skipRemoteWAL(boolean markerEditOnly)
Tell the WAL that when creating new writer you can skip creating the remote writer.
|
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
default void init() throws IOException
IOException
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
when
- timeout, it would throw WALSyncTimeoutIOException
.IOException
void sync(long txid) throws IOException
txid
- Transaction id to sync to.when
- timeout, it would throw WALSyncTimeoutIOException
.IOException
default void sync(boolean forceSync) throws IOException
forceSync
- Flag to force sync rather than flushing to the buffer. Example - Hadoop hflush
vs hsync.when
- timeout, it would throw WALSyncTimeoutIOException
.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.when
- timeout, it would throw WALSyncTimeoutIOException
.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.default void skipRemoteWAL(boolean markerEditOnly)
Used by sync replication for switching states from ACTIVE, where the remote cluster is broken.
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.