public class TranslogWriter extends TranslogReader
| 修飾子とタイプ | クラスと説明 |
|---|---|
static class |
TranslogWriter.Type |
| 修飾子とタイプ | フィールドと説明 |
|---|---|
protected long |
lastSyncedOffset |
protected int |
operationCounter |
protected ReleasableLock |
readLock |
protected ShardId |
shardId |
static String |
TRANSLOG_CODEC |
static int |
VERSION |
static int |
VERSION_CHECKPOINTS |
static int |
VERSION_CHECKSUMS |
protected ReleasableLock |
writeLock |
protected long |
writtenOffset |
channel, channelReference, closed, firstOperationOffset, generation, UNKNOWN_OP_COUNT| コンストラクタと説明 |
|---|
TranslogWriter(ShardId shardId,
long generation,
org.elasticsearch.index.translog.ChannelReference channelReference) |
| 修飾子とタイプ | メソッドと説明 |
|---|---|
Translog.Location |
add(BytesReference data)
add the given bytes to the translog and return the location they were written at
|
protected void |
checkpoint(long lastSyncPosition,
int operationCounter,
org.elasticsearch.index.translog.ChannelReference channelReference) |
protected void |
closeWithTragicEvent(Throwable throwable) |
static TranslogWriter |
create(TranslogWriter.Type type,
ShardId shardId,
String translogUUID,
long fileGeneration,
Path file,
Callback<org.elasticsearch.index.translog.ChannelReference> onClose,
int bufferSize,
org.elasticsearch.index.translog.TranslogWriter.ChannelFactory channelFactory) |
protected void |
ensureOpen() |
protected void |
flush()
Flushes the buffer if the translog is buffered.
|
Throwable |
getTragicException()
If this
TranslogWriter was closed as a side-effect of a tragic exception,
e.g. disk full while flushing a new segment, this returns the root cause exception. |
ImmutableTranslogReader |
immutableReader()
returns a new immutable reader which only exposes the current written operation *
|
TranslogReader |
newReaderFromWriter()
returns a new reader that follows the current writes (most importantly allows making
repeated snapshots that includes new content)
|
protected void |
readBytes(ByteBuffer buffer,
long position)
reads bytes at position into the given buffer, filling it.
|
long |
sizeInBytes() |
void |
sync()
write all buffered ops to disk and fsync file
|
boolean |
syncNeeded()
returns true if there are buffered ops
|
boolean |
syncUpTo(long offset)
Syncs the translog up to at least the given offset unless already synced
|
int |
totalOperations() |
void |
updateBufferSize(int bufferSize)
change the size of the internal buffer if relevant
|
close, compareTo, getFirstOperationOffset, getGeneration, isClosed, newReaderSnapshot, newSnapshot, open, path, read, read, toStringpublic static final int VERSION_CHECKSUMS
public static final int VERSION_CHECKPOINTS
public static final int VERSION
protected final ShardId shardId
protected final ReleasableLock readLock
protected final ReleasableLock writeLock
protected volatile long lastSyncedOffset
protected volatile int operationCounter
protected volatile long writtenOffset
public TranslogWriter(ShardId shardId, long generation, org.elasticsearch.index.translog.ChannelReference channelReference) throws IOException
IOExceptionpublic static TranslogWriter create(TranslogWriter.Type type, ShardId shardId, String translogUUID, long fileGeneration, Path file, Callback<org.elasticsearch.index.translog.ChannelReference> onClose, int bufferSize, org.elasticsearch.index.translog.TranslogWriter.ChannelFactory channelFactory) throws IOException
IOExceptionpublic Throwable getTragicException()
TranslogWriter was closed as a side-effect of a tragic exception,
e.g. disk full while flushing a new segment, this returns the root cause exception.
Otherwise (no tragic exception has occurred) it returns null.protected final void closeWithTragicEvent(Throwable throwable) throws IOException
IOExceptionpublic Translog.Location add(BytesReference data) throws IOException
IOExceptionpublic void updateBufferSize(int bufferSize)
throws TranslogException
public void sync()
throws IOException
IOExceptionpublic boolean syncNeeded()
public int totalOperations()
totalOperations クラス内 TranslogReaderpublic long sizeInBytes()
sizeInBytes クラス内 TranslogReaderprotected void flush()
throws IOException
IOExceptionpublic TranslogReader newReaderFromWriter()
public ImmutableTranslogReader immutableReader() throws TranslogException
public boolean syncUpTo(long offset)
throws IOException
true if this call caused an actual sync operationIOExceptionprotected void readBytes(ByteBuffer buffer, long position) throws IOException
TranslogReaderreadBytes クラス内 TranslogReaderIOExceptionprotected void checkpoint(long lastSyncPosition,
int operationCounter,
org.elasticsearch.index.translog.ChannelReference channelReference)
throws IOException
IOExceptionprotected final void ensureOpen()
ensureOpen クラス内 TranslogReaderCopyright © 2009–2016. All rights reserved.