@InterfaceAudience.Private @InterfaceStability.Evolving public interface WAL extends Closeable
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)
Deprecated.
Since version 1.1.1. Removing because not used and exposes subtle internal
workings. Use
getEarliestMemstoreSeqNum(byte[], byte[]) |
long |
getEarliestMemstoreSeqNum(byte[] encodedRegionName,
byte[] familyName)
Gets the earliest sequence number in the memstore for this particular region and store.
|
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.
|
Long |
startCacheFlush(byte[] encodedRegionName,
Set<byte[]> flushedFamilyNames)
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.
|
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
close
in interface AutoCloseable
close
in interface Closeable
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
Long startCacheFlush(byte[] encodedRegionName, Set<byte[]> flushedFamilyNames)
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[])
,
abortCacheFlush(byte[])
void completeCacheFlush(byte[] encodedRegionName)
encodedRegionName
- Encoded region name.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()
Copyright © 2007-2016 The Apache Software Foundation. All Rights Reserved.