ModuleSupportable, Corruptable, LogFactorypublic class ReadOnly extends java.lang.Object implements LogFactory, ModuleSupportable
It doesn't handle undo. No recovery.
Multithreading considerations:
This class must be MT-safe.
| Modifier and Type | Field | Description |
|---|---|---|
private java.lang.String |
logArchiveDirectory |
LOG_DIRECTORY_NAME, MODULE, RT_READONLY, RUNTIME_ATTRIBUTES| Constructor | Description |
|---|---|
ReadOnly() |
| Modifier and Type | Method | Description |
|---|---|---|
void |
abortLogBackup() |
|
boolean |
canSupport(java.util.Properties startParams) |
See if this implementation can support any attributes that are listed in properties.
|
boolean |
checkpoint(RawStoreFactory rawStoreFactory,
DataFactory dataFactory,
TransactionFactory transactionFactory,
boolean wait) |
MT - not needed, no work is done
|
void |
checkpointInRFR(LogInstant cinstant,
long redoLWM,
long undoLWM,
DataFactory df) |
Perform a checkpoint during rollforward recovery.
|
boolean |
checkVersion(int requiredMajorVersion,
int requiredMinorVersion,
java.lang.String feature) |
Check to see if a database has been upgraded to the required
level in order to use a store feature.
|
void |
createDataWarningFile() |
Not applicable in readonly databases
|
void |
deleteLogFileAfterCheckpointLogFile() |
|
void |
deleteOnlineArchivedLogFiles() |
|
void |
disableLogArchiveMode() |
|
void |
enableLogArchiveMode() |
|
void |
endLogBackup(java.io.File toDir) |
|
void |
flush(LogInstant where) |
Flush all unwritten log record up to the log instance indicated to disk.
|
void |
freezePersistentStore() |
Backup restore - stop sending log record to the log stream
|
java.lang.String |
getCanonicalLogPath() |
Return the canonical directory of the PARENT of the log directory.
|
LogInstant |
getFirstUnflushedInstant() |
Get the instant for the last record in the log.
|
long |
getFirstUnflushedInstantAsLong() |
Get the log instant long value of the first log record that has not
been flushed.
|
StorageFile |
getLogDirectory() |
Return the location of the log directory.
|
void |
getLogFactoryProperties(PersistentSet set) |
Get JBMS properties relevant to the log factory
|
Logger |
getLogger() |
|
LogInstant |
getTruncationLWM(UUID name) |
|
boolean |
inReplicationMasterMode() |
Replication not applicable on readonly databases.
|
boolean |
inRFR() |
|
boolean |
isCheckpointInLastLogFile() |
|
boolean |
logArchived() |
Backup restore - is the log being archived to some directory?
|
StandardException |
markCorrupt(StandardException originalError) |
Mark the module as corrupt.
|
ScanHandle |
openFlushedScan(DatabaseInstant i,
int groupsIWant) |
Get a ScanHandle to scan flushed records from the log.
|
LogScan |
openForwardsFlushedScan(LogInstant startAt) |
Get a LogScan to scan flushed records from the log.
|
LogScan |
openForwardsScan(LogInstant startAt,
LogInstant stopAt) |
Get a LogScan to scan the log in a forward direction.
|
void |
recover(DataFactory dataFactory,
TransactionFactory transactionFactory) |
MT - not needed, no work is done
|
void |
removeTruncationLWM(UUID name) |
|
void |
removeTruncationLWM(UUID name,
RawStoreFactory rawStoreFactory,
TransactionFactory transFactory) |
|
void |
setDatabaseEncrypted(boolean isEncrypted,
boolean flushLog) |
Sets whether the database is encrypted.
|
void |
setRawStoreFactory(RawStoreFactory rsf) |
Not applicable in readonly databases
|
void |
setTruncationLWM(UUID name,
LogInstant instant) |
|
LogInstant |
setTruncationLWM(UUID name,
LogInstant instant,
RawStoreFactory rawStoreFactory,
TransactionFactory transFactory) |
|
void |
startLogBackup(java.io.File toDir) |
|
void |
startNewLogFile() |
|
void |
startReplicationMasterRole(MasterFactory masterFactory) |
Replication not applicable on readonly databases
|
void |
stopReplicationMasterRole() |
Replication not applicable on readonly databases
|
void |
unfreezePersistentStore() |
Backup restore - start sending log record to the log stream
|
public Logger getLogger()
getLogger in interface LogFactorypublic void createDataWarningFile()
throws StandardException
createDataWarningFile in interface LogFactoryStandardExceptionpublic void setRawStoreFactory(RawStoreFactory rsf)
setRawStoreFactory in interface LogFactorypublic void recover(DataFactory dataFactory, TransactionFactory transactionFactory) throws StandardException
recover in interface LogFactorydataFactory - - the data factorytransactionFactory - - the transaction factoryStandardException - Standard Derby Error Policypublic boolean checkpoint(RawStoreFactory rawStoreFactory, DataFactory dataFactory, TransactionFactory transactionFactory, boolean wait)
checkpoint in interface LogFactoryrawStoreFactory - - the raw storedataFactory - - the data factorytransactionFactory - - the transaction factorywait - - if true waits for any existing checkpoint to complete
and then executes and waits for another checkpoint.
if false if another thead is executing a checkpoint
routine will return immediately.public StandardException markCorrupt(StandardException originalError)
CorruptablemarkCorrupt in interface Corruptablepublic void flush(LogInstant where) throws StandardException
LogFactoryflush in interface LogFactorywhere - flush log up to hereStandardException - cannot flush log file due to sync errorpublic boolean canSupport(java.util.Properties startParams)
ModuleSupportable
The module can check for attributes in the properties to
see if it can fulfill the required behaviour. E.g. the raw
store may define an attribute called RawStore.Recoverable.
If a temporary raw store is required the property RawStore.recoverable=false
would be added to the properties before calling bootServiceModule. If a
raw store cannot support this attribute its canSupport method would
return null. Also see the Monitor class's prologue to see how the
identifier is used in looking up properties.
Actually a better way maybe to have properties of the form
RawStore.Attributes.mandatory=recoverable,smallfootprint and
RawStore.Attributes.requested=oltp,fast
canSupport in interface ModuleSupportablepublic LogInstant setTruncationLWM(UUID name, LogInstant instant, RawStoreFactory rawStoreFactory, TransactionFactory transFactory) throws StandardException
StandardExceptionpublic void setTruncationLWM(UUID name, LogInstant instant) throws StandardException
StandardException - functionality not implementedpublic void removeTruncationLWM(UUID name, RawStoreFactory rawStoreFactory, TransactionFactory transFactory) throws StandardException
StandardException - functionality not implementedpublic LogInstant getTruncationLWM(UUID name) throws StandardException
StandardException - functionality not implementedpublic void removeTruncationLWM(UUID name) throws StandardException
StandardException - functionality not implementedpublic ScanHandle openFlushedScan(DatabaseInstant i, int groupsIWant) throws StandardException
LogFactoryMT- read only
openFlushedScan in interface LogFactoryi - - the LogInstant where we start our scan. null means
start at the beginning of the log. This function raises an error
if startAt is a LogInstant which is not in the log.groupsIWant - - log record groups the scanner wants.StandardException - functionality not implementedpublic LogScan openForwardsScan(LogInstant startAt, LogInstant stopAt) throws StandardException
LogFactoryMT- read only
openForwardsScan in interface LogFactorystartAt - - the LogInstant where we start our scan. null means
start at the beginning of the log. This function raises an error
if startAt is a LogInstant which is not in the log.stopAt - - the LogInstant where we stop our scan. null means
stop at the end of the log. This function raises an error
if stopAt is a LogInstant which is not in the log.StandardException - functionality not implementedpublic LogInstant getFirstUnflushedInstant()
LogFactorygetFirstUnflushedInstant in interface LogFactorypublic long getFirstUnflushedInstantAsLong()
LogFactorygetFirstUnflushedInstantAsLong in interface LogFactorypublic LogScan openForwardsFlushedScan(LogInstant startAt) throws StandardException
LogFactoryMT- read only
openForwardsFlushedScan in interface LogFactorystartAt - - the LogInstant where we start our scan. null means
start at the beginning of the log. This function raises an error
if startAt is a LogInstant which is not in the log.StandardException - functionality not implementedpublic void freezePersistentStore()
throws StandardException
freezePersistentStore in interface LogFactoryStandardException - Standard Derby error policypublic void unfreezePersistentStore()
throws StandardException
unfreezePersistentStore in interface LogFactoryStandardException - Standard Derby error policypublic boolean logArchived()
logArchived in interface LogFactorypublic void getLogFactoryProperties(PersistentSet set)
getLogFactoryProperties in interface LogFactorypublic StorageFile getLogDirectory()
LogFactorygetLogDirectory in interface LogFactorypublic java.lang.String getCanonicalLogPath()
LogFactorygetCanonicalLogPath in interface LogFactorypublic void enableLogArchiveMode()
enableLogArchiveMode in interface LogFactorypublic void disableLogArchiveMode()
disableLogArchiveMode in interface LogFactorypublic void deleteOnlineArchivedLogFiles()
deleteOnlineArchivedLogFiles in interface LogFactorypublic boolean inRFR()
inRFR in interface LogFactorypublic void checkpointInRFR(LogInstant cinstant, long redoLWM, long undoLWM, DataFactory df) throws StandardException
checkpointInRFR in interface LogFactorycinstant - The LogInstant of the checkpointredoLWM - Redo Low Water Mark in the check point recordundoLWM - Undo Low Water Mark in the checkpointdf - - the data factoryStandardExceptionpublic void startLogBackup(java.io.File toDir)
throws StandardException
startLogBackup in interface LogFactoryStandardExceptionpublic void endLogBackup(java.io.File toDir)
throws StandardException
endLogBackup in interface LogFactoryStandardExceptionpublic void abortLogBackup()
abortLogBackup in interface LogFactorypublic void setDatabaseEncrypted(boolean isEncrypted,
boolean flushLog)
Read-only database can not be re-encrypted, nothing to do in this case.
setDatabaseEncrypted in interface LogFactoryisEncrypted - true if the database is encrypted,
false if notflushLog - true if log needs to be flushed,
false otherwisepublic void startNewLogFile()
throws StandardException
startNewLogFile in interface LogFactoryStandardExceptionpublic boolean isCheckpointInLastLogFile()
throws StandardException
isCheckpointInLastLogFile in interface LogFactoryStandardExceptionpublic void deleteLogFileAfterCheckpointLogFile()
throws StandardException
deleteLogFileAfterCheckpointLogFile in interface LogFactoryStandardExceptionpublic boolean checkVersion(int requiredMajorVersion,
int requiredMinorVersion,
java.lang.String feature)
throws StandardException
checkVersion in interface LogFactoryrequiredMajorVersion - required database Engine major versionrequiredMinorVersion - required database Engine minor versionfeature - Non-null to throw an exception, null to return the
state of the version match. true if the database has been upgraded to
the required level, false otherwise.StandardException - not implemented exception is thrownpublic void startReplicationMasterRole(MasterFactory masterFactory) throws StandardException
startReplicationMasterRole in interface LogFactorymasterFactory - The MasterFactory service responsible for
controlling the master side replication behaviour.StandardException - always thrown, indicating that
ReadOnly databases can not be replicatedpublic boolean inReplicationMasterMode()
inReplicationMasterMode in interface LogFactorypublic void stopReplicationMasterRole()
stopReplicationMasterRole in interface LogFactoryApache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.