Top Description Fields Constructors Methods
org.apache.derby.impl.store.raw.log

public Class ReadOnly

extends Object
implements LogFactory, ModuleSupportable
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.services.monitor.ModuleSupportable, org.apache.derby.iapi.store.raw.log.LogFactory, org.apache.derby.iapi.store.raw.Corruptable
Imports
org.apache.derby.shared.common.reference.SQLState, org.apache.derby.iapi.services.monitor.ModuleControl, .ModuleSupportable, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.services.io.Formatable, org.apache.derby.iapi.services.property.PersistentSet, org.apache.derby.iapi.store.raw.Compensation, .Loggable, .RawStoreFactory, .ScanHandle, org.apache.derby.iapi.store.raw.log.LogFactory, .LogInstant, .Logger, .LogScan, org.apache.derby.iapi.store.replication.master.MasterFactory, org.apache.derby.iapi.store.raw.data.DataFactory, org.apache.derby.iapi.store.raw.xact.TransactionFactory, .RawTransaction, .TransactionId, org.apache.derby.shared.common.error.StandardException, org.apache.derby.io.StorageFile, org.apache.derby.iapi.store.access.DatabaseInstant, org.apache.derby.catalog.UUID, java.util.Properties, java.io.File

A read-only version of the log factory. It doesn't do anything, it doesn't check that the database needs recovery or not.

It doesn't handle undo. No recovery.

Multithreading considerations:
This class must be MT-safe.

Field Summary

Modifier and TypeField and Description
private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public boolean
canSupport(Properties startParams)

Implements org.apache.derby.iapi.services.monitor.ModuleSupportable.canSupport.

See if this implementation can support any attributes that are listed in properties.

public boolean
checkpoint(RawStoreFactory
- the raw store
rawStoreFactory
,
DataFactory
- the data factory
dataFactory
,
TransactionFactory
- the transaction factory
transactionFactory
,
boolean
- 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.
wait
)

Implements org.apache.derby.iapi.store.raw.log.LogFactory.checkpoint.

MT - not needed, no work is done

public void
checkpointInRFR(LogInstant
The LogInstant of the checkpoint
cinstant
,
long
Redo Low Water Mark in the check point record
redoLWM
,
long
Undo Low Water Mark in the checkpoint
undoLWM
,
DataFactory
- the data factory
df
)

Implements org.apache.derby.iapi.store.raw.log.LogFactory.checkpointInRFR.

Perform a checkpoint during rollforward recovery.

public boolean
checkVersion(int
required database Engine major version
requiredMajorVersion
,
int
required database Engine minor version
requiredMinorVersion
,
String
Non-null to throw an exception, null to return the state of the version match.
feature
)

Implements org.apache.derby.iapi.store.raw.log.LogFactory.checkVersion.

Check to see if a database has been upgraded to the required level in order to use a store feature.

public void
public void
public void
public void
public void
public void
public void
flush(LogInstant
flush log up to here
where
)

Implements org.apache.derby.iapi.store.raw.log.LogFactory.flush.

Flush all unwritten log record up to the log instance indicated to disk.

public void
freezePersistentStore()

Implements org.apache.derby.iapi.store.raw.log.LogFactory.freezePersistentStore.

Backup restore - stop sending log record to the log stream

public String
getCanonicalLogPath()

Implements org.apache.derby.iapi.store.raw.log.LogFactory.getCanonicalLogPath.

Return the canonical directory of the PARENT of the log directory.

public LogInstant
public long
getFirstUnflushedInstantAsLong()

Implements org.apache.derby.iapi.store.raw.log.LogFactory.getFirstUnflushedInstantAsLong.

Get the log instant long value of the first log record that has not been flushed.

public StorageFile
getLogDirectory()

Implements org.apache.derby.iapi.store.raw.log.LogFactory.getLogDirectory.

Return the location of the log directory.

public void
public Logger
public LogInstant
public boolean

Returns:

false always since replication is not applicable here.
inReplicationMasterMode
()

Implements org.apache.derby.iapi.store.raw.log.LogFactory.inReplicationMasterMode.

Replication not applicable on readonly databases.

public boolean
public boolean
public boolean
logArchived()

Implements org.apache.derby.iapi.store.raw.log.LogFactory.logArchived.

Backup restore - is the log being archived to some directory?

public StandardException
markCorrupt(StandardException originalError)

Implements org.apache.derby.iapi.store.raw.Corruptable.markCorrupt.

Mark the module as corrupt.

public ScanHandle
openFlushedScan(DatabaseInstant
- 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.
i
,
int
- log record groups the scanner wants.
groupsIWant
)

Implements org.apache.derby.iapi.store.raw.log.LogFactory.openFlushedScan.

Get a ScanHandle to scan flushed records from the log.

public LogScan
openForwardsFlushedScan(LogInstant
- 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.
startAt
)

Implements org.apache.derby.iapi.store.raw.log.LogFactory.openForwardsFlushedScan.

Get a LogScan to scan flushed records from the log.

public LogScan
openForwardsScan(LogInstant
- 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.
startAt
,
LogInstant
- 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.
stopAt
)

Implements org.apache.derby.iapi.store.raw.log.LogFactory.openForwardsScan.

Get a LogScan to scan the log in a forward direction.

public void
recover(DataFactory
- the data factory
dataFactory
,
TransactionFactory
- the transaction factory
transactionFactory
)

Implements org.apache.derby.iapi.store.raw.log.LogFactory.recover.

MT - not needed, no work is done

public void
removeTruncationLWM(UUID name, RawStoreFactory rawStoreFactory, TransactionFactory transFactory)

public void
public void
setDatabaseEncrypted(boolean
true if the database is encrypted, false if not
isEncrypted
,
boolean
true if log needs to be flushed, false otherwise
flushLog
)

Implements org.apache.derby.iapi.store.raw.log.LogFactory.setDatabaseEncrypted.

Sets whether the database is encrypted.

public void
public LogInstant
setTruncationLWM(UUID name, LogInstant instant, RawStoreFactory rawStoreFactory, TransactionFactory transFactory)

public void
public void
public void
public void
startReplicationMasterRole(MasterFactory
The MasterFactory service responsible for controlling the master side replication behaviour.
masterFactory
)

Implements org.apache.derby.iapi.store.raw.log.LogFactory.startReplicationMasterRole.

Replication not applicable on readonly databases

public void
public void
unfreezePersistentStore()

Implements org.apache.derby.iapi.store.raw.log.LogFactory.unfreezePersistentStore.

Backup restore - start sending log record to the log stream

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

logArchiveDirectoryback to summary
private String logArchiveDirectory

Constructor Detail

ReadOnlyback to summary
public ReadOnly()

Method Detail

abortLogBackupback to summary
public void abortLogBackup()

Implements org.apache.derby.iapi.store.raw.log.LogFactory.abortLogBackup.

canSupportback to summary
public boolean canSupport(Properties startParams)

Implements org.apache.derby.iapi.services.monitor.ModuleSupportable.canSupport.

Doc from org.apache.derby.iapi.services.monitor.ModuleSupportable.canSupport.

See if this implementation can support any attributes that are listed in properties. This call may be made on a newly created instance before the boot() method has been called, or after the boot method has been called for a running module.

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

Returns:boolean

true if this instance can be used, false otherwise.

checkpointback to summary
public boolean checkpoint(RawStoreFactory rawStoreFactory, DataFactory dataFactory, TransactionFactory transactionFactory, boolean wait)

Implements org.apache.derby.iapi.store.raw.log.LogFactory.checkpoint.

MT - not needed, no work is done

Parameters
rawStoreFactory:RawStoreFactory

Doc from org.apache.derby.iapi.store.raw.log.LogFactory.checkpoint.

- the raw store

dataFactory:DataFactory

Doc from org.apache.derby.iapi.store.raw.log.LogFactory.checkpoint.

- the data factory

transactionFactory:TransactionFactory

Doc from org.apache.derby.iapi.store.raw.log.LogFactory.checkpoint.

- the transaction factory

wait:boolean

Doc from org.apache.derby.iapi.store.raw.log.LogFactory.checkpoint.

- 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.

Returns:boolean

Doc from org.apache.derby.iapi.store.raw.log.LogFactory.checkpoint.

true if checkpoint is successful, Will return false if wait is false and the routine finds another thread executing a checkpoint.

checkpointInRFRback to summary
public void checkpointInRFR(LogInstant cinstant, long redoLWM, long undoLWM, DataFactory df) throws StandardException

Implements org.apache.derby.iapi.store.raw.log.LogFactory.checkpointInRFR.

Perform a checkpoint during rollforward recovery.

Parameters
cinstant:LogInstant

Doc from org.apache.derby.iapi.store.raw.log.LogFactory.checkpointInRFR.

The LogInstant of the checkpoint

redoLWM:long

Doc from org.apache.derby.iapi.store.raw.log.LogFactory.checkpointInRFR.

Redo Low Water Mark in the check point record

undoLWM:long

Doc from org.apache.derby.iapi.store.raw.log.LogFactory.checkpointInRFR.

Undo Low Water Mark in the checkpoint

df:DataFactory

Doc from org.apache.derby.iapi.store.raw.log.LogFactory.checkpointInRFR.

- the data factory

Exceptions
StandardException:

Doc from org.apache.derby.iapi.store.raw.log.LogFactory.checkpointInRFR.

- encounter exception during checkpoint

checkVersionback to summary
public boolean checkVersion(int requiredMajorVersion, int requiredMinorVersion, String feature) throws StandardException

Implements org.apache.derby.iapi.store.raw.log.LogFactory.checkVersion.

Check to see if a database has been upgraded to the required level in order to use a store feature. This method is generally used to prevent writes to data/log file by a particular store feature until the database is upgraded to the required version. In read-only database writes are not allowed, so nothing to do for this method in this implementation of the log factory.

Parameters
requiredMajorVersion:int

required database Engine major version

requiredMinorVersion:int

required database Engine minor version

feature:String

Non-null to throw an exception, null to return the state of the version match.

Returns:boolean

Doc from org.apache.derby.iapi.store.raw.log.LogFactory.checkVersion.

true if the database has been upgraded to the required level, false otherwise.

Exceptions
StandardException:
not implemented exception is thrown
createDataWarningFileback to summary
public void createDataWarningFile() throws StandardException

Implements org.apache.derby.iapi.store.raw.log.LogFactory.createDataWarningFile.

Not applicable in readonly databases

deleteLogFileAfterCheckpointLogFileback to summary
public void deleteLogFileAfterCheckpointLogFile() throws StandardException

Implements org.apache.derby.iapi.store.raw.log.LogFactory.deleteLogFileAfterCheckpointLogFile.

deleteOnlineArchivedLogFilesback to summary
public void deleteOnlineArchivedLogFiles()

Implements org.apache.derby.iapi.store.raw.log.LogFactory.deleteOnlineArchivedLogFiles.

disableLogArchiveModeback to summary
public void disableLogArchiveMode()

Implements org.apache.derby.iapi.store.raw.log.LogFactory.disableLogArchiveMode.

enableLogArchiveModeback to summary
public void enableLogArchiveMode()

Implements org.apache.derby.iapi.store.raw.log.LogFactory.enableLogArchiveMode.

endLogBackupback to summary
public void endLogBackup(File toDir) throws StandardException

Implements org.apache.derby.iapi.store.raw.log.LogFactory.endLogBackup.

flushback to summary
public void flush(LogInstant where) throws StandardException

Implements org.apache.derby.iapi.store.raw.log.LogFactory.flush.

Doc from org.apache.derby.iapi.store.raw.log.LogFactory.flush.

Flush all unwritten log record up to the log instance indicated to disk.

Parameters
where:LogInstant

flush log up to here

Exceptions
StandardException:
cannot flush log file due to sync error
freezePersistentStoreback to summary
public void freezePersistentStore() throws StandardException

Implements org.apache.derby.iapi.store.raw.log.LogFactory.freezePersistentStore.

Backup restore - stop sending log record to the log stream

Exceptions
StandardException:
Standard Derby error policy
getCanonicalLogPathback to summary
public String getCanonicalLogPath()

Implements org.apache.derby.iapi.store.raw.log.LogFactory.getCanonicalLogPath.

Doc from org.apache.derby.iapi.store.raw.log.LogFactory.getCanonicalLogPath.

Return the canonical directory of the PARENT of the log directory. The log directory live in the "log" subdirectory of this path. If the log is at the default location (underneath the database directory), this returns null. Should only be called after the log factory is booted.

getFirstUnflushedInstantback to summary
public LogInstant getFirstUnflushedInstant()

Implements org.apache.derby.iapi.store.raw.log.LogFactory.getFirstUnflushedInstant.

Doc from org.apache.derby.iapi.store.raw.log.LogFactory.getFirstUnflushedInstant.

Get the instant for the last record in the log.

getFirstUnflushedInstantAsLongback to summary
public long getFirstUnflushedInstantAsLong()

Implements org.apache.derby.iapi.store.raw.log.LogFactory.getFirstUnflushedInstantAsLong.

Doc from org.apache.derby.iapi.store.raw.log.LogFactory.getFirstUnflushedInstantAsLong.

Get the log instant long value of the first log record that has not been flushed. Only works after recover() has finished, or (if in slave replication mode) after calling initializeReplicationSlaveRole.

Returns:long

the log instant long value of the first log record that has not been flushed

getLogDirectoryback to summary
public StorageFile getLogDirectory()

Implements org.apache.derby.iapi.store.raw.log.LogFactory.getLogDirectory.

Doc from org.apache.derby.iapi.store.raw.log.LogFactory.getLogDirectory.

Return the location of the log directory.

getLogFactoryPropertiesback to summary
public void getLogFactoryProperties(PersistentSet set)

Implements org.apache.derby.iapi.store.raw.log.LogFactory.getLogFactoryProperties.

Get JBMS properties relevant to the log factory

getLoggerback to summary
public Logger getLogger()

Implements org.apache.derby.iapi.store.raw.log.LogFactory.getLogger.

getTruncationLWMback to summary
public LogInstant getTruncationLWM(UUID name) throws StandardException
Exceptions
StandardException:
functionality not implemented
inReplicationMasterModeback to summary
public boolean inReplicationMasterMode()

Implements org.apache.derby.iapi.store.raw.log.LogFactory.inReplicationMasterMode.

Replication not applicable on readonly databases.

Returns:boolean

false always since replication is not applicable here.

inRFRback to summary
public boolean inRFR()

Implements org.apache.derby.iapi.store.raw.log.LogFactory.inRFR.

isCheckpointInLastLogFileback to summary
public boolean isCheckpointInLastLogFile() throws StandardException

Implements org.apache.derby.iapi.store.raw.log.LogFactory.isCheckpointInLastLogFile.

logArchivedback to summary
public boolean logArchived()

Implements org.apache.derby.iapi.store.raw.log.LogFactory.logArchived.

Backup restore - is the log being archived to some directory? if RawStore.LOG_ARCHIVAL_DIRECTORY is set to some value, that means the log is meant to be archived. Else, log not archived.

Returns:boolean

Doc from org.apache.derby.iapi.store.raw.log.LogFactory.logArchived.

true if the log is being archived.

markCorruptback to summary
public StandardException markCorrupt(StandardException originalError)

Implements org.apache.derby.iapi.store.raw.Corruptable.markCorrupt.

Doc from org.apache.derby.iapi.store.raw.Corruptable.markCorrupt.

Mark the module as corrupt. It is safe to call this multiple times.

Returns:StandardException

Must always return its parameter.

openFlushedScanback to summary
public ScanHandle openFlushedScan(DatabaseInstant i, int groupsIWant) throws StandardException

Implements org.apache.derby.iapi.store.raw.log.LogFactory.openFlushedScan.

Doc from org.apache.derby.iapi.store.raw.log.LogFactory.openFlushedScan.

Get a ScanHandle to scan flushed records from the log.

MT- read only

Parameters
i:DatabaseInstant

- 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:int

- log record groups the scanner wants.

Returns:ScanHandle

the LogScan.

Exceptions
StandardException:
functionality not implemented
openForwardsFlushedScanback to summary
public LogScan openForwardsFlushedScan(LogInstant startAt) throws StandardException

Implements org.apache.derby.iapi.store.raw.log.LogFactory.openForwardsFlushedScan.

Doc from org.apache.derby.iapi.store.raw.log.LogFactory.openForwardsFlushedScan.

Get a LogScan to scan flushed records from the log.

MT- read only

Parameters
startAt:LogInstant

- 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.

Returns:LogScan

the LogScan.

Exceptions
StandardException:
functionality not implemented
openForwardsScanback to summary
public LogScan openForwardsScan(LogInstant startAt, LogInstant stopAt) throws StandardException

Implements org.apache.derby.iapi.store.raw.log.LogFactory.openForwardsScan.

Doc from org.apache.derby.iapi.store.raw.log.LogFactory.openForwardsScan.

Get a LogScan to scan the log in a forward direction.

MT- read only

Parameters
startAt:LogInstant

- 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:LogInstant

- 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.

Returns:LogScan

the LogScan.

Exceptions
StandardException:
functionality not implemented
recoverback to summary
public void recover(DataFactory dataFactory, TransactionFactory transactionFactory) throws StandardException

Implements org.apache.derby.iapi.store.raw.log.LogFactory.recover.

MT - not needed, no work is done

Parameters
dataFactory:DataFactory

Doc from org.apache.derby.iapi.store.raw.log.LogFactory.recover.

- the data factory

transactionFactory:TransactionFactory

Doc from org.apache.derby.iapi.store.raw.log.LogFactory.recover.

- the transaction factory

Exceptions
StandardException:
Standard Derby Error Policy
removeTruncationLWMback to summary
public void removeTruncationLWM(UUID name, RawStoreFactory rawStoreFactory, TransactionFactory transFactory) throws StandardException
Exceptions
StandardException:
functionality not implemented
removeTruncationLWMback to summary
public void removeTruncationLWM(UUID name) throws StandardException
Exceptions
StandardException:
functionality not implemented
setDatabaseEncryptedback to summary
public void setDatabaseEncrypted(boolean isEncrypted, boolean flushLog)

Implements org.apache.derby.iapi.store.raw.log.LogFactory.setDatabaseEncrypted.

Sets whether the database is encrypted.

Read-only database can not be re-encrypted, nothing to do in this case.

Parameters
isEncrypted:boolean

Doc from org.apache.derby.iapi.store.raw.log.LogFactory.setDatabaseEncrypted.

true if the database is encrypted, false if not

flushLog:boolean

Doc from org.apache.derby.iapi.store.raw.log.LogFactory.setDatabaseEncrypted.

true if log needs to be flushed, false otherwise

setRawStoreFactoryback to summary
public void setRawStoreFactory(RawStoreFactory rsf)

Implements org.apache.derby.iapi.store.raw.log.LogFactory.setRawStoreFactory.

Not applicable in readonly databases

setTruncationLWMback to summary
public LogInstant setTruncationLWM(UUID name, LogInstant instant, RawStoreFactory rawStoreFactory, TransactionFactory transFactory) throws StandardException
setTruncationLWMback to summary
public void setTruncationLWM(UUID name, LogInstant instant) throws StandardException
Exceptions
StandardException:
functionality not implemented
startLogBackupback to summary
public void startLogBackup(File toDir) throws StandardException

Implements org.apache.derby.iapi.store.raw.log.LogFactory.startLogBackup.

startNewLogFileback to summary
public void startNewLogFile() throws StandardException

Implements org.apache.derby.iapi.store.raw.log.LogFactory.startNewLogFile.

startReplicationMasterRoleback to summary
public void startReplicationMasterRole(MasterFactory masterFactory) throws StandardException

Implements org.apache.derby.iapi.store.raw.log.LogFactory.startReplicationMasterRole.

Replication not applicable on readonly databases

Parameters
masterFactory:MasterFactory

Doc from org.apache.derby.iapi.store.raw.log.LogFactory.startReplicationMasterRole.

The MasterFactory service responsible for controlling the master side replication behaviour.

Exceptions
StandardException:
always thrown, indicating that ReadOnly databases can not be replicated
stopReplicationMasterRoleback to summary
public void stopReplicationMasterRole()

Implements org.apache.derby.iapi.store.raw.log.LogFactory.stopReplicationMasterRole.

Replication not applicable on readonly databases

unfreezePersistentStoreback to summary
public void unfreezePersistentStore() throws StandardException

Implements org.apache.derby.iapi.store.raw.log.LogFactory.unfreezePersistentStore.

Backup restore - start sending log record to the log stream

Exceptions
StandardException:
Standard Derby error policy