public final class RogLog extends com.neeve.ods.impl.StorePacketPersisterBase implements IStorePersister, IEventSource
IStorePersister.ErrorHandler, IStorePersister.LogEmptinessExpectation, IStorePersister.LogPresenceExpectation, IStorePersister.StartupExpectationIStoreWriter.LogCounters, IStoreWriter.ParametersIStoreReader.IterativeReader, IStoreReader.ReadCallback| Modifier and Type | Field and Description |
|---|---|
static String |
PROP_AUTO_FLUSH_SIZE
Deprecated.
use
PROP_WRITE_BUFFER_SIZE instead. |
static String |
PROP_AUTO_REPAIR
Property used to indicate whether should attempt to repair files on open.
|
static boolean |
PROP_AUTO_REPAIR_DEFAULT
The default value for
PROP_AUTO_REPAIR. |
static String |
PROP_CDC_ENABLED
Property used to indicate whether CDC is enabled on the log
If CDC is not enabled, then a CDC processor run on a log will not dispatch
any events.
|
static boolean |
PROP_CDC_ENABLED_DEFAULT
The default value for
PROP_CDC_ENABLED. |
static String |
PROP_DETACHED
Property used to indicate whether to persist in 'detached' mode
|
static String |
PROP_DETACHED_QUEUE_DEPTH
Property used to specify the depth of the detached thread feeder queue
|
static String |
PROP_DETACHED_QUEUE_DRAINER_CPU_AFFINITIZATION_MASK
Property used to specify the affinity mask of the detached thread.
|
static String |
PROP_DETACHED_QUEUE_OFFER_STRATEGY
Property used to specify the offer strategy of the detached thread feeder queue
|
static String |
PROP_DETACHED_QUEUE_WAIT_STRATEGY
Property used to specify the wait strategy of the detached thread feeder queue
|
static String |
PROP_FLUSH_ON_COMMIT
Property used to indicate whether a flush should be performed on commit.
|
static String |
PROP_FLUSH_USING_MAPPED_MEMORY
Property used to indicate that flush should be performed using a memory
mapped region of the log rather than via a RandomAccessFile handle
|
static boolean |
PROP_FLUSH_USING_MAPPED_MEMORY_DEFAULT
The default value for
PROP_FLUSH_USING_MAPPED_MEMORY. |
static String |
PROP_INITIAL_LOG_LENGTH
Property used to set the initial file length of the log in gigabytes.
|
static float |
PROP_INITIAL_LOG_LENGTH_DEFAULT
The default value for
PROP_INITIAL_LOG_LENGTH. |
static String |
PROP_INTEGRITY_CHECK
Property used to indicate whether to perform an integrity check of the log on open
Note:Specifying a value of false for this parameter automatically disables
transaction integrity check
|
static boolean |
PROP_INTEGRITY_CHECK_DEFAULT
The default value for
PROP_INTEGRITY_CHECK. |
static String |
PROP_LOG_BACKUP_RETENTION_COUNT
Property used to indicate the maximum number of log backups to retain
|
static int |
PROP_LOG_BACKUP_RETENTION_COUNT_DEFAULT
The default value for
PROP_LOG_BACKUP_RETENTION_COUNT. |
static String |
PROP_LOG_EMPTINESS_EXPECTATION
Property used to specify the log's emptiness expectation
This property can take the following values (caseless):
- "empty" - "notempty" If this property is not set, then no expectation is assumed This expectation is checked for existing and freshly created logs |
static String |
PROP_LOG_EMPTINESS_EXPECTATION_DEFAULT
The default value for
PROP_LOG_EMPTINESS_EXPECTATION. |
static String |
PROP_LOG_MODE
Property used to indicate that mode in which the log should be opened
|
static String |
PROP_LOG_PRESENCE_EXPECTATION
Property used to specify the log's presence expectation
This property can take the following values (caseless):
- "present" - "absent" If this property is not set, then no expectation is assumed |
static String |
PROP_LOG_PRESENCE_EXPECTATION_DEFAULT
The default value for
PROP_LOG_PRESENCE_EXPECTATION. |
static String |
PROP_LOG_SCAVENGE_POLICY
Property used to indicate policy used to scavenge logs
A log with number N is considered a candidate for scavenging when
N < live log number and N < CDC log number.
|
static String |
PROP_LOG_SCAVENGE_POLICY_DEFAULT
The default value for
PROP_LOG_SCAVENGE_POLICY. |
static String |
PROP_PAGE_SIZE
Property used to specify the log's page size.
|
static String |
PROP_PAGE_SIZE_DEFAULT
The default value for
PROP_PAGE_SIZE. |
static String |
PROP_READ_BUFFER_SIZE
Property used to specify the log's read buffer size.
|
static String |
PROP_READ_BUFFER_SIZE_DEFAULT
The default value for
PROP_READ_BUFFER_SIZE. |
static String |
PROP_SHARED
Property used to indicate whether this a shared persister or not.
|
static String |
PROP_STORE_ROOT
Property used to indicate the directory in which the log should be placed.
|
static String |
PROP_TRANSACTIONAL_INTEGRITY_CHECK
Property used to indicate whether to do a transactional integrity check of the log on open
Note:This property is only applicable if PROP_INTEGRITY_CHECK is true
|
static boolean |
PROP_TRANSACTIONAL_INTEGRITY_CHECK_DEFAULT
The default value for
PROP_TRANSACTIONAL_INTEGRITY_CHECK. |
static String |
PROP_WRITE_BUFFER_SIZE
Property used to specify the log's write buffer size.
|
static String |
PROP_WRITE_BUFFER_SIZE_DEFAULT
The default value for
PROP_WRITE_BUFFER_SIZE. |
static String |
PROP_ZERO_OUT_INITIAL
Property used to indicate whether the log should be zeroed out when freshly created
This property is only applicable if
PROP_INITIAL_LOG_LENGTH is set. |
static boolean |
PROP_ZERO_OUT_INITIAL_DEFAULT
The default value for
PROP_ZERO_OUT_INITIAL. |
| Modifier and Type | Method and Description |
|---|---|
File |
archive(File archiveFolder,
String archiveId)
Archives a transaction log's files to the specified folder, using the given archive id.
|
RogLogQueryRepository |
asRepository()
Return the log as a query repository
|
String |
backupLog(boolean shrinkToSize)
Backup a persister's log file.
|
static String |
backupLog(String logName,
Properties props,
boolean shrinkToSize)
Convenience method for backing up a log file.
|
void |
close()
Implementation of
IStorePersister.close() |
static RogLog |
create(String name)
Create a new log.
|
static RogLog |
create(String name,
Properties props)
Create a new log using a set of properties to configure it
|
static RogLog |
create(String name,
StorePersisterDescriptor descriptor)
Create a new log using a store persister descriptor to configure it.
|
RogLogCdcProcessor |
createCdcProcessor(IRogChangeDataCaptureHandler handler)
Create a log CDC processor.
|
RogLogReader |
createReader()
Create a reader of the live log file.
|
RogLogReader |
createReader(int logNumber)
Create a private reader of the numbered log file.
|
void |
delete()
Delete a log file and associated metadata files
|
void |
fail()
Force fail the log.
|
void |
fail(Exception cause)
Force fail the log.
|
static void |
failOpen(boolean val)
Force fail the next open.
|
long |
getAllocatedSize()
Get the log file's allocated size.
|
long |
getCompactionThreshold()
Get the compaction threshold (in bytes).
|
RogLogCompactor |
getCompactor()
Get the log compactor
|
StorePersisterDescriptor |
getDescriptor()
Implementation of
IStorePersister.getDescriptor()
Note: This method will return null if the log was created directly using
a property table rather than a store persister descriptor. |
IStorePersister.ErrorHandler |
getErrorHandler()
Implementation of
IStorePersister.getErrorHandler() |
IEventHandler |
getEventHandler()
Get a persister's event handler.
|
File |
getLogFile()
Get the underlying log file
|
com.eaio.uuid.UUID |
getLogUUID()
Get the log UUID.
|
RogLogMetadata |
getMetadata()
Get the log metadata
|
File |
getMetadataFile()
Get the underlying log metadata file
|
String |
getName()
Implementation of
IStorePersister.getName() |
com.neeve.pkt.log.PktRecoveryLog |
getPacketLog()
Get the backing packet log
|
long |
getSize()
Get the log file size.
|
IStorePersisterStats |
getStats()
Implementation of
IStorePersister.getStats() |
boolean |
isCompactionEnabled()
Get if compaction is enabled
|
boolean |
isOpen()
Implementation of
IStorePersister.isOpen() |
IStoreReader.IterativeReader |
iterativeReader(int flags)
Implementation of
IStoreReader.iterativeReader(int) |
void |
open()
|
void |
open(boolean concurrentReadWrite)
Implementation of
IStorePersister.open(boolean) |
void |
open(IOElasticBuffer serializedMetadata,
int serializedMetadataOffset,
boolean truncateLive)
Implementation of
IStorePersister.open(IOElasticBuffer, int, boolean) |
void |
open(IOElasticBuffer serializedMetadata,
int serializedMetadataOffset,
boolean truncateLive,
boolean concurrentReadWrite)
Implementation of
IStorePersister.open(IOElasticBuffer, int boolean, boolean) |
boolean |
read(IStoreReader.ReadCallback cb)
Implementation of
IStoreReader.read(com.neeve.ods.IStoreReader.ReadCallback) |
boolean |
read(IStoreReader.ReadCallback cb,
int flags)
Implementation of
IStoreReader.read(com.neeve.ods.IStoreReader.ReadCallback) |
void |
readMetadata(IOElasticBuffer buffer)
Implementation of
IStoreReader.readMetadata(com.neeve.io.IOElasticBuffer) |
void |
scheduleCompaction()
Schedule a log compaction
|
void |
scheduleCompactionOnNextWrite()
Deprecated.
Use
scheduleCompaction() instead |
void |
setCompactionThreshold(int val)
Set the compaction threshold.
|
void |
setErrorHandler(IStorePersister.ErrorHandler errorHandler)
|
void |
setEventHandler(IEventHandler eventHandler)
Set a persister's event handler.
|
void |
setStartupExpectation(IStorePersister.StartupExpectation expectation,
Enum<?> value)
|
String |
toString() |
boolean |
wasRepaired()
Implementation of
IStorePersister.wasRepaired() |
flush, getParameters, isShared, onRoleChange, writeCommitEntrygetChecked, getThreaded, getTracerequals, getClass, hashCode, notify, notifyAll, wait, wait, waitflush, getParameters, isShared, onRoleChange, writeCommitEntrypublic static final String PROP_STORE_ROOT
public static final String PROP_LOG_MODE
public static final String PROP_SHARED
StorePacketPersisterBase.PROP_SHARED,
Constant Field Valuespublic static final String PROP_LOG_PRESENCE_EXPECTATION
This property can take the following values (caseless):
- "present"
- "absent"
If this property is not set, then no expectation is assumed
public static final String PROP_LOG_PRESENCE_EXPECTATION_DEFAULT
PROP_LOG_PRESENCE_EXPECTATION.public static final String PROP_LOG_EMPTINESS_EXPECTATION
This property can take the following values (caseless):
- "empty"
- "notempty"
If this property is not set, then no expectation is assumed
This expectation is checked for existing and freshly created logs
public static final String PROP_LOG_EMPTINESS_EXPECTATION_DEFAULT
PROP_LOG_EMPTINESS_EXPECTATION.public static final String PROP_INTEGRITY_CHECK
Note:Specifying a value of false for this parameter automatically disables transaction integrity check
public static final boolean PROP_INTEGRITY_CHECK_DEFAULT
PROP_INTEGRITY_CHECK.public static final String PROP_TRANSACTIONAL_INTEGRITY_CHECK
Note:This property is only applicable if PROP_INTEGRITY_CHECK is true
PROP_INTEGRITY_CHECK,
Constant Field Valuespublic static final boolean PROP_TRANSACTIONAL_INTEGRITY_CHECK_DEFAULT
PROP_TRANSACTIONAL_INTEGRITY_CHECK.public static final String PROP_AUTO_REPAIR
public static final boolean PROP_AUTO_REPAIR_DEFAULT
PROP_AUTO_REPAIR.public static final String PROP_INITIAL_LOG_LENGTH
The initial length of the recovery log this can be set to the maximum size to which the log is expected to grow to avoid costs with growing the file.
public static final float PROP_INITIAL_LOG_LENGTH_DEFAULT
PROP_INITIAL_LOG_LENGTH.public static final String PROP_ZERO_OUT_INITIAL
This property is only applicable if PROP_INITIAL_LOG_LENGTH is set. If set
to true, then the log is zeroed out after initial creation.
public static final boolean PROP_ZERO_OUT_INITIAL_DEFAULT
PROP_ZERO_OUT_INITIAL.public static final String PROP_LOG_BACKUP_RETENTION_COUNT
public static final int PROP_LOG_BACKUP_RETENTION_COUNT_DEFAULT
PROP_LOG_BACKUP_RETENTION_COUNT.public static final String PROP_LOG_SCAVENGE_POLICY
A log with number N is considered a candidate for scavenging when N < live log number and N < CDC log number. This parameter specifies how such logs need to be scavenged. Currently, the only permissible value is 'Delete'
public static final String PROP_LOG_SCAVENGE_POLICY_DEFAULT
PROP_LOG_SCAVENGE_POLICY.public static final String PROP_CDC_ENABLED
If CDC is not enabled, then a CDC processor run on a log will not dispatch any events. If CDC is not enabled on a log and then reenabled later, CDC will start from the live log at the time the CDC is enabled. If a compaction occurred while CDC was disabled, then the change events that occurred during that time will be lost.
public static final boolean PROP_CDC_ENABLED_DEFAULT
PROP_CDC_ENABLED.public static final String PROP_FLUSH_USING_MAPPED_MEMORY
public static final boolean PROP_FLUSH_USING_MAPPED_MEMORY_DEFAULT
PROP_FLUSH_USING_MAPPED_MEMORY.public static final String PROP_READ_BUFFER_SIZE
public static final String PROP_READ_BUFFER_SIZE_DEFAULT
PROP_READ_BUFFER_SIZE.public static final String PROP_WRITE_BUFFER_SIZE
public static final String PROP_WRITE_BUFFER_SIZE_DEFAULT
PROP_WRITE_BUFFER_SIZE.@Deprecated public static final String PROP_AUTO_FLUSH_SIZE
PROP_WRITE_BUFFER_SIZE instead.public static final String PROP_PAGE_SIZE
public static final String PROP_PAGE_SIZE_DEFAULT
PROP_PAGE_SIZE.public static final String PROP_FLUSH_ON_COMMIT
StorePacketPersisterBase.PROP_FLUSH_ON_COMMIT,
Constant Field Valuespublic static final String PROP_DETACHED
StorePacketPersisterBase.PROP_DETACHED,
Constant Field Valuespublic static final String PROP_DETACHED_QUEUE_DEPTH
StorePacketPersisterBase.PROP_DETACHED_QUEUE_DEPTH,
Constant Field Valuespublic static final String PROP_DETACHED_QUEUE_OFFER_STRATEGY
StorePacketPersisterBase.PROP_DETACHED_QUEUE_OFFER_STRATEGY,
Constant Field Valuespublic static final String PROP_DETACHED_QUEUE_WAIT_STRATEGY
StorePacketPersisterBase.PROP_DETACHED_QUEUE_WAIT_STRATEGY,
Constant Field Valuespublic static final String PROP_DETACHED_QUEUE_DRAINER_CPU_AFFINITIZATION_MASK
StorePacketPersisterBase.PROP_DETACHED_QUEUE_DRAINER_CPU_AFFINITIZATION_MASK,
Constant Field Valuespublic static final RogLog create(String name, Properties props) throws OdsException
name - The name of the logprops - Properties to configure the log.OdsExceptionpublic static final RogLog create(String name) throws OdsException
This method calls create(name, (Properties)null)
OdsExceptionpublic static final RogLog create(String name, StorePersisterDescriptor descriptor) throws OdsException
name - The name of the logdescriptor - The store persister descriptor used to configure the logOdsExceptionpublic static final void failOpen(boolean val)
public static final String backupLog(String logName, Properties props, boolean shrinkToSize) throws Exception
logName - The log file nameprops - The log propertiesshrinkToSize - If the log should be shrinked down to size.Exception - If ther is an error backing up the logpublic final com.neeve.pkt.log.PktRecoveryLog getPacketLog()
public final File getLogFile()
public final File getMetadataFile()
public final RogLogMetadata getMetadata()
public final long getCompactionThreshold()
public final boolean isCompactionEnabled()
public final void setCompactionThreshold(int val)
val - The compaction threshold to set in megabytes. A value of 0 will switch off compaction@Deprecated public final void scheduleCompactionOnNextWrite()
scheduleCompaction() insteadpublic final void scheduleCompaction()
public final void delete()
throws IOException
IOExceptionpublic final String backupLog(boolean shrinkToSize) throws Exception
shrinkToSize - Specifies whether the backed up file should
be shrunk to the amount of space actually used in the file.IllegalStateException - Thrown if this method is invoked
after the persister has been opened.
This method backs up the persister's transaction log file. The method first shrinks the log to the amount of space actually used in the log (only if shrinkToSize is set to true) and then renames the log to a log named by appending the current date and time to the log file name. The backup file name is returned by the method.
Exceptionpublic final void setStartupExpectation(IStorePersister.StartupExpectation expectation, Enum<?> value)
IStorePersister.setStartupExpectation(com.neeve.ods.IStorePersister.StartupExpectation, java.lang.Enum<?>)setStartupExpectation in interface IStorePersisterpublic final void open(IOElasticBuffer serializedMetadata, int serializedMetadataOffset, boolean truncateLive, boolean concurrentReadWrite) throws Exception
IStorePersister.open(IOElasticBuffer, int boolean, boolean)open in interface IStorePersisterserializedMetadata - Buffer containined the serialized form
of the metadata to use for the log being opened. A value of null
indicates that the existing metadata be used for the log and, if
any metadata does not exist, then start with a fresh metadata objectserializedMetadataOffset - The offset into the serialized
metadata buffer where the serialized form of the metadata startstruncateLive - If true, then the live log file is truncated
during open. If metadata is supplied to this method, then
the live log is determined from that metadata.concurrentReadWrite - If true, the log is opened in a manner
that permits for concurrent read/write to occur on the log.Exceptionpublic final void open(IOElasticBuffer serializedMetadata, int serializedMetadataOffset, boolean truncateLive) throws Exception
IStorePersister.open(IOElasticBuffer, int, boolean)open in interface IStorePersisterExceptionpublic final void open(boolean concurrentReadWrite)
throws Exception
IStorePersister.open(boolean)open in interface IStorePersisterconcurrentReadWrite - If true, the log is opened in a manner
that permits for concurrent read/write to occur on the log.
Invoking this method is equivalent to invoking open(null, false, concurrentReadWrite)
Exceptionpublic final void open()
throws Exception
open in interface IStorePersisterExceptionpublic final com.eaio.uuid.UUID getLogUUID()
public final boolean isOpen()
IStorePersister.isOpen()isOpen in interface IStorePersisterpublic final String getName()
IStorePersister.getName()getName in interface IEventSourcegetName in interface IStorePersisterpublic final StorePersisterDescriptor getDescriptor()
IStorePersister.getDescriptor()
Note: This method will return null if the log was created directly using a property table rather than a store persister descriptor.
getDescriptor in interface IStorePersisterpublic final void setErrorHandler(IStorePersister.ErrorHandler errorHandler)
setErrorHandler in interface IStorePersisterpublic final IStorePersister.ErrorHandler getErrorHandler()
IStorePersister.getErrorHandler()getErrorHandler in interface IStorePersisterpublic final void setEventHandler(IEventHandler eventHandler)
IStorePersistersetEventHandler in interface IStorePersistereventHandler - The event handler for the persister.public IEventHandler getEventHandler()
IStorePersistergetEventHandler in interface IStorePersisterpublic final IStorePersisterStats getStats()
IStorePersister.getStats()getStats in interface IStorePersisterpublic final boolean wasRepaired()
IStorePersister.wasRepaired()wasRepaired in interface IStorePersisterpublic final void readMetadata(IOElasticBuffer buffer)
IStoreReader.readMetadata(com.neeve.io.IOElasticBuffer)readMetadata in interface IStoreReaderbuffer - The buffer to read the (serialized form of) metadata intopublic final IStoreReader.IterativeReader iterativeReader(int flags) throws Exception
IStoreReader.iterativeReader(int)iterativeReader in interface IStoreReaderflags - Flags that qualify read operations.Exceptionpublic final boolean read(IStoreReader.ReadCallback cb) throws Exception
IStoreReader.read(com.neeve.ods.IStoreReader.ReadCallback)read in interface IStoreReadercb - The callback used to return the read entries to the caller.Exceptionpublic final boolean read(IStoreReader.ReadCallback cb, int flags) throws Exception
IStoreReader.read(com.neeve.ods.IStoreReader.ReadCallback)read in interface IStoreReadercb - The callback used to return the read entries to the caller.flags - Flags that qualify read operations.Exceptionpublic final RogLogReader createReader() throws Exception
RogLogReader instance.Exception - If there is an error creating the RogLogReaderpublic final RogLogReader createReader(int logNumber) throws Exception
RogLogReader instance.Exception - If there is an error creating the RogLogReader
This method creates a private log reader of a specific numbered log file.
public final RogLogCdcProcessor createCdcProcessor(IRogChangeDataCaptureHandler handler) throws Exception
Note that only one CDC processor can be created per log.
Exception - If there is an error creating the RogLogReaderpublic final long getSize()
This method returns the amount of space used in the log file, including data that is buffered for write, but not yet flushed.
IllegalStateException - Thrown if this method is invoked
before the log has been opened.public final long getAllocatedSize()
This method returns the actual size of the log file currently allocated.
This call differs from getSize() in that this value may be
greater if the log has been preallocated to a larger size.
IllegalStateException - Thrown if this method is invoked
before the log has been opened.public final void fail(Exception cause)
fail in interface IStorePersistercause - The cause of the failure.
CAUTION: This method is only for testing purposes and should not be invoked outside of test frameworks.
This method invokes the error handler if installed and marks the log has failed. This will cause all subsequent commits or syncs to immediately fail with a runtime exception.
public final void fail()
This method invokes the following:
fail(new OdsException("force failed by user"))
fail in interface IStorePersisterpublic final RogLogQueryRepository asRepository()
public final RogLogCompactor getCompactor()
public final File archive(File archiveFolder, String archiveId) throws IOException
archiveFolder - The folder to which to archive this transaction log's files.archiveId - The archive id with which to suffix archived files.IOException - If there is an error creating the backup files.IllegalStateException - If the transaction log is not in a state where it can be archived (e.g. open)public final void close()
IStorePersister.close()close in interface IStorePersisterCopyright © 2019 N5 Technologies, Inc. All Rights Reserved.