ModuleSupportable
, Corruptable
, LogFactory
public 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 LogFactory
public void createDataWarningFile() throws StandardException
createDataWarningFile
in interface LogFactory
StandardException
public void setRawStoreFactory(RawStoreFactory rsf)
setRawStoreFactory
in interface LogFactory
public void recover(DataFactory dataFactory, TransactionFactory transactionFactory) throws StandardException
recover
in interface LogFactory
dataFactory
- - the data factorytransactionFactory
- - the transaction factoryStandardException
- Standard Derby Error Policypublic boolean checkpoint(RawStoreFactory rawStoreFactory, DataFactory dataFactory, TransactionFactory transactionFactory, boolean wait)
checkpoint
in interface LogFactory
rawStoreFactory
- - 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)
Corruptable
markCorrupt
in interface Corruptable
public void flush(LogInstant where) throws StandardException
LogFactory
flush
in interface LogFactory
where
- 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 ModuleSupportable
public LogInstant setTruncationLWM(UUID name, LogInstant instant, RawStoreFactory rawStoreFactory, TransactionFactory transFactory) throws StandardException
StandardException
public 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
LogFactory
MT- read only
openFlushedScan
in interface LogFactory
i
- - 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
LogFactory
MT- read only
openForwardsScan
in interface LogFactory
startAt
- - 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()
LogFactory
getFirstUnflushedInstant
in interface LogFactory
public long getFirstUnflushedInstantAsLong()
LogFactory
getFirstUnflushedInstantAsLong
in interface LogFactory
public LogScan openForwardsFlushedScan(LogInstant startAt) throws StandardException
LogFactory
MT- read only
openForwardsFlushedScan
in interface LogFactory
startAt
- - 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 LogFactory
StandardException
- Standard Derby error policypublic void unfreezePersistentStore() throws StandardException
unfreezePersistentStore
in interface LogFactory
StandardException
- Standard Derby error policypublic boolean logArchived()
logArchived
in interface LogFactory
public void getLogFactoryProperties(PersistentSet set)
getLogFactoryProperties
in interface LogFactory
public StorageFile getLogDirectory()
LogFactory
getLogDirectory
in interface LogFactory
public java.lang.String getCanonicalLogPath()
LogFactory
getCanonicalLogPath
in interface LogFactory
public void enableLogArchiveMode()
enableLogArchiveMode
in interface LogFactory
public void disableLogArchiveMode()
disableLogArchiveMode
in interface LogFactory
public void deleteOnlineArchivedLogFiles()
deleteOnlineArchivedLogFiles
in interface LogFactory
public boolean inRFR()
inRFR
in interface LogFactory
public void checkpointInRFR(LogInstant cinstant, long redoLWM, long undoLWM, DataFactory df) throws StandardException
checkpointInRFR
in interface LogFactory
cinstant
- The LogInstant of the checkpointredoLWM
- Redo Low Water Mark in the check point recordundoLWM
- Undo Low Water Mark in the checkpointdf
- - the data factoryStandardException
public void startLogBackup(java.io.File toDir) throws StandardException
startLogBackup
in interface LogFactory
StandardException
public void endLogBackup(java.io.File toDir) throws StandardException
endLogBackup
in interface LogFactory
StandardException
public void abortLogBackup()
abortLogBackup
in interface LogFactory
public void setDatabaseEncrypted(boolean isEncrypted, boolean flushLog)
Read-only database can not be re-encrypted, nothing to do in this case.
setDatabaseEncrypted
in interface LogFactory
isEncrypted
- 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 LogFactory
StandardException
public boolean isCheckpointInLastLogFile() throws StandardException
isCheckpointInLastLogFile
in interface LogFactory
StandardException
public void deleteLogFileAfterCheckpointLogFile() throws StandardException
deleteLogFileAfterCheckpointLogFile
in interface LogFactory
StandardException
public boolean checkVersion(int requiredMajorVersion, int requiredMinorVersion, java.lang.String feature) throws StandardException
checkVersion
in interface LogFactory
requiredMajorVersion
- 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 LogFactory
masterFactory
- 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 LogFactory
public void stopReplicationMasterRole()
stopReplicationMasterRole
in interface LogFactory
Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.