public interface IHABufferStrategy extends IBufferStrategy
IBufferStrategy
.NULL
Modifier and Type | Method and Description |
---|---|
void |
computeDigest(Object snapshot,
MessageDigest digest)
Compute the digest of the entire backing store (including the magic, file
version, root blocks, etc).
|
long |
getBlockSequence()
Return the #of
WriteCache blocks that were written out for the
last write set. |
long |
getCurrentBlockSequence()
Return the then-current write cache block sequence.
|
StoreState |
getStoreState()
A StoreState object references critical transient data that can be used
to determine a degree of consistency between stores, specifically for an
HA context.
|
WriteCacheService |
getWriteCacheService()
Return the
WriteCacheService (mainly for debugging). |
void |
postHACommit(IRootBlockView rootBlock)
Provides a trigger for synchronization of transient state after a commit.
|
ByteBuffer |
readFromLocalStore(long addr)
Read from the local store in support of failover reads on nodes in a
highly available
Quorum . |
ByteBuffer |
readRaw(long fileOffset,
ByteBuffer transfer)
Used to support the rebuild protocol.
|
void |
resetFromHARootBlock(IRootBlockView rootBlock)
Reload from the current root block - CAUTION : THIS IS NOT A
RESET / ABORT.
|
Future<Void> |
sendHALogBuffer(IHALogRequest req,
IHAWriteMessage msg,
IBufferAccess b)
Send an
IHAWriteMessage and the associated raw buffer through the
write pipeline. |
Future<Void> |
sendRawBuffer(IHARebuildRequest req,
long sequence,
long quorumToken,
long fileExtent,
long offset,
int nbytes,
ByteBuffer b)
Send an
IHAWriteMessage and the associated raw buffer through the
write pipeline. |
void |
setExtentForLocalStore(long extent)
Extend local store for a highly available
Quorum . |
Object |
snapshotAllocators()
Snapshot the allocators in preparation for computing a digest of the
committed allocations.
|
void |
writeOnStream(OutputStream os,
AbstractJournal.ISnapshotData coreData,
Quorum<HAGlue,QuorumService<HAGlue>> quorum,
long token)
Write a consistent snapshot of the committed state of the backing store.
|
void |
writeRawBuffer(HARebuildRequest req,
IHAWriteMessage msg,
ByteBuffer transfer)
Used to support the rebuild protocol
|
void |
writeRawBuffer(IHAWriteMessage msg,
IBufferAccess b)
Write a buffer containing data replicated from the master onto the local
persistence store.
|
abort, closeForWrites, commit, getAddressManager, getBufferMode, getCounters, getExtent, getHeaderSize, getInitialExtent, getMaximumExtent, getMaxRecordSize, getMetaBitsAddr, getMetaStartAddr, getNextOffset, getOffsetBits, getUserExtent, isDirty, readRootBlock, requiresCommit, transferTo, truncate, useChecksums, writeRootBlock
close, delete, deleteResources, destroy, force, getFile, getResourceMetadata, getUUID, isFullyBuffered, isOpen, isReadOnly, isStable, read, size, write
getByteCount, getOffset, getPhysicalAddress, toAddr, toString
getInputStream, getOutputStream
void writeRawBuffer(IHAWriteMessage msg, IBufferAccess b) throws IOException, InterruptedException
InterruptedException
IOException
Future<Void> sendHALogBuffer(IHALogRequest req, IHAWriteMessage msg, IBufferAccess b) throws IOException, InterruptedException
IHAWriteMessage
and the associated raw buffer through the
write pipeline.req
- The IHALogRequest
for some HALog file.msg
- The IHAWriteMessage
.b
- The raw buffer. Bytes from position to limit will be sent.
remaining() must equal IHAWriteMessageBase.getSize()
.Future
for that request.IOException
InterruptedException
Future<Void> sendRawBuffer(IHARebuildRequest req, long sequence, long quorumToken, long fileExtent, long offset, int nbytes, ByteBuffer b) throws IOException, InterruptedException
IHAWriteMessage
and the associated raw buffer through the
write pipeline.req
- The IHARebuildRequest
to replicate the backing file to
the requesting service.sequence
- The sequence of this IHAWriteMessage
(origin ZERO
(0)).quorumToken
- The quorum token of the leader, which must remain valid across
the rebuild protocol.fileExtent
- The file extent as of the moment that the leader begins to
replicate the existing backing file.offset
- The starting offset (relative to the root blocks).nbytes
- The #of bytes to be sent.b
- The raw buffer. The buffer will be cleared and filled with the
specified data, then sent down the write pipeline.Future
for that request.IOException
InterruptedException
ByteBuffer readFromLocalStore(long addr) throws InterruptedException
Quorum
.InterruptedException
void setExtentForLocalStore(long extent) throws IOException, InterruptedException
Quorum
.InterruptedException
IOException
void resetFromHARootBlock(IRootBlockView rootBlock)
Note: This method is used when the root blocks of the leader are
installed onto a follower. This can change the UUID
for the
backing store file. The IHABufferStrategy
implementation MUST
update any cached value for that UUID
.
Use postHACommit(IRootBlockView)
rather than this method in the
2-phase commit on the follower.
void postHACommit(IRootBlockView rootBlock)
For the RWStore this is used to resynchronize the allocators during the 2-phase commit on the follower with the delta in the allocators from the write set associated with that commit.
rootBlock
- The newly installed root block.long getBlockSequence()
WriteCache
blocks that were written out for the
last write set. This is used to communicate the #of write cache blocks in
the commit point back to AbstractJournal.commitNow(long)
. It is
part of the commit protocol.
Note: This DOES NOT reflect the current value of the block sequence
counter for ongoing writes. That counter is owned by the
WriteCacheService
.
WriteCacheService.resetSequence()
,
FIXME I would prefer to expose the {@link WriteCacheService} to the
{@link AbstractJournal} and let it directly invoke
{@link WriteCacheService#resetSequence()}. The current pattern
requires the {@link IHABufferStrategy} implementations to track the
lastBlockSequence and is messy.
long getCurrentBlockSequence()
getBlockSequence()
Object snapshotAllocators()
null
if the snapshot is a NOP for the
IBufferStrategy
(e.g., for the WORM).void computeDigest(Object snapshot, MessageDigest digest) throws DigestException, IOException
Note: The digest is not reliable unless you either use a snapshot or suspend writes (on the quorum) while it is computed.
snapshot
- The allocator snapshot (optional). When given, the digest is
computed only for the snapshot. When null
it is
computed for the entire file.DigestException
IOException
ByteBuffer readRaw(long fileOffset, ByteBuffer transfer)
fileOffset
- - absolute file offsettransfer
- - target buffer for readvoid writeRawBuffer(HARebuildRequest req, IHAWriteMessage msg, ByteBuffer transfer) throws IOException
req
- msg
- transfer
- IOException
void writeOnStream(OutputStream os, AbstractJournal.ISnapshotData coreData, Quorum<HAGlue,QuorumService<HAGlue>> quorum, long token) throws IOException, QuorumException
Note: The caller is able to obtain both root blocks atomically, while the strategy may not be aware of the root blocks or may not be able to coordinate their atomic capture.
Note: The caller must ensure that the resulting snapshot will be consistent either by ensuring that no writes occur or by taking a read-lock that will prevent overwrites of committed state during this operation.
os
- Where to write the data.quorum
- The Quorum
.token
- The token that must remain valid during this operation.IOException
QuorumException
- if the service is not joined with the met quorum for that
token at any point during the operation.WriteCacheService getWriteCacheService()
WriteCacheService
(mainly for debugging).StoreState getStoreState()
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.