@InterfaceAudience.Private @InterfaceStability.Evolving public interface WAL
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 |
append(HTableDescriptor htd,
HRegionInfo info,
WALKey key,
WALEdit edits,
AtomicLong sequenceId,
boolean inMemstore,
List<Cell> memstoreKVs)
Append a set of edits to the WAL.
|
void |
close()
Caller no longer needs any edits from this WAL.
|
void |
completeCacheFlush(byte[] encodedRegionName)
Complete the cache flush.
|
WALCoprocessorHost |
getCoprocessorHost() |
long |
getEarliestMemstoreSeqNum(byte[] encodedRegionName)
Gets the earliest sequence number in the memstore for this particular region.
|
void |
registerWALActionsListener(WALActionsListener listener)
Registers WALActionsListener
|
byte[][] |
rollWriter()
Roll the log writer.
|
byte[][] |
rollWriter(boolean force)
Roll the log writer.
|
void |
shutdown()
Stop accepting new writes.
|
boolean |
startCacheFlush(byte[] encodedRegionName)
WAL keeps track of the sequence numbers that were not yet flushed from memstores
in order to be able to do cleanup.
|
void |
sync()
Sync what we have in the WAL.
|
void |
sync(long txid)
Sync the WAL if the txId was not already sync'd.
|
String |
toString()
Human readable identifying information about the state of this WAL.
|
boolean |
unregisterWALActionsListener(WALActionsListener listener)
Unregisters WALActionsListener
|
void registerWALActionsListener(WALActionsListener listener)
boolean unregisterWALActionsListener(WALActionsListener listener)
byte[][] rollWriter() throws FailedLogCloseException, IOException
The implementation is synchronized in order to make sure there's one rollWriter running at any given time.
HRegionInfo.getEncodedName()
FailedLogCloseException
IOException
byte[][] rollWriter(boolean force) throws FailedLogCloseException, IOException
The implementation is synchronized in order to make sure there's one rollWriter running at any given time.
force
- If true, force creation of a new writer even if no entries have
been written to the current writerHRegionInfo.getEncodedName()
FailedLogCloseException
IOException
void shutdown() throws IOException
IOException
void close() throws IOException
IOException
long append(HTableDescriptor htd, HRegionInfo info, WALKey key, WALEdit edits, AtomicLong sequenceId, boolean inMemstore, List<Cell> memstoreKVs) throws IOException
key
will
have the region edit/sequence id filled in.info
- key
- 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.htd
- used to give scope for replication TODO refactor out in favor of table name and infosequenceId
- A reference to the atomic long the info
region is using as
source of its incrementing edits sequence id. Inside in this call we will increment it and
attach the sequence to the edit we apply the WAL.inMemstore
- Always true except for case where we are writing a compaction completion
record into the WAL; in this case the entry is just so we can finish an unfinished compaction
-- it is not an edit for memstore.memstoreKVs
- list of KVs added into memstorekey
will have the region edit/sequence id
in it.IOException
void sync() throws IOException
IOException
void sync(long txid) throws IOException
txid
- Transaction id to sync to.IOException
boolean startCacheFlush(byte[] encodedRegionName)
We stash the oldest seqNum for the region, and let the the next edit inserted in this
region be recorded in append(HTableDescriptor, HRegionInfo, WALKey, WALEdit,
AtomicLong, boolean, List)
as new oldest seqnum.
In case of flush being aborted, we put the stashed value back; in case of flush succeeding,
the seqNum of that first edit after start becomes the valid oldest seqNum for this region.
void completeCacheFlush(byte[] encodedRegionName)
encodedRegionName
- Encoded region name.void abortCacheFlush(byte[] encodedRegionName)
encodedRegionName
- Encoded region name.WALCoprocessorHost getCoprocessorHost()
long getEarliestMemstoreSeqNum(byte[] encodedRegionName)
encodedRegionName
- The region to get the number for.String toString()
Copyright © 2015 The Apache Software Foundation. All Rights Reserved.