org.apache.derby.impl.store.raw.log
Class ReadOnly

java.lang.Object
  extended byorg.apache.derby.impl.store.raw.log.ReadOnly
All Implemented Interfaces:
Corruptable, LogFactory, ModuleSupportable

public class ReadOnly
extends java.lang.Object
implements LogFactory, ModuleSupportable

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
private  java.lang.String logArchiveDirectory
           
 
Fields inherited from interface org.apache.derby.iapi.store.raw.log.LogFactory
LOG_DIRECTORY_NAME, MODULE, RT_READONLY, RUNTIME_ATTRIBUTES
 
Constructor Summary
ReadOnly()
           
 
Method Summary
 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, DataFactory df)
          perform a checkpoint during rollforward recovery
 boolean copyActiveLogFiles(java.io.File toDir)
           
 void deleteOnlineArchivedLogFiles()
           
 void disableLogArchiveMode()
           
 void enableLogArchiveMode()
           
 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.
 StorageFile getLogDirectory()
          Return the location of the log directory.
 void getLogFactoryProperties(PersistentSet set)
          Get JBMS properties relavent to the log factory
 Logger getLogger()
           
 LogInstant getTruncationLWM(UUID name)
           
 boolean inRFR()
           
 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(RawStoreFactory rawStoreFactory, DataFactory dataFactory, TransactionFactory transactionFactory)
          MT - not needed, no work is done
 void removeTruncationLWM(UUID name)
           
 void removeTruncationLWM(UUID name, RawStoreFactory rawStoreFactory, TransactionFactory transFactory)
           
 void setTruncationLWM(UUID name, LogInstant instant)
           
 LogInstant setTruncationLWM(UUID name, LogInstant instant, RawStoreFactory rawStoreFactory, TransactionFactory transFactory)
           
 void unfreezePersistentStore()
          Backup restore - start sending log record to the log stream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logArchiveDirectory

private java.lang.String logArchiveDirectory
Constructor Detail

ReadOnly

public ReadOnly()
Method Detail

getLogger

public Logger getLogger()
Specified by:
getLogger in interface LogFactory

recover

public void recover(RawStoreFactory rawStoreFactory,
                    DataFactory dataFactory,
                    TransactionFactory transactionFactory)
             throws StandardException
MT - not needed, no work is done

Specified by:
recover in interface LogFactory
Parameters:
rawStoreFactory - - the raw store
dataFactory - - the data factory
transactionFactory - - the transaction factory
Throws:
StandardException - Cloudscape Standard Error Policy

checkpoint

public boolean checkpoint(RawStoreFactory rawStoreFactory,
                          DataFactory dataFactory,
                          TransactionFactory transactionFactory,
                          boolean wait)
MT - not needed, no work is done

Specified by:
checkpoint in interface LogFactory
Parameters:
rawStoreFactory - - the raw store
dataFactory - - the data factory
transactionFactory - - the transaction factory
wait - - if true; waits for the checkpoint to completed even if it is being done my an another thread.
Returns:
true if checkpoint is successful

markCorrupt

public StandardException markCorrupt(StandardException originalError)
Description copied from interface: Corruptable
Mark the module as corrupt. It is safe to call this multiple times.

Specified by:
markCorrupt in interface Corruptable
Returns:
Must always return its parameter.

flush

public void flush(LogInstant where)
           throws StandardException
Description copied from interface: LogFactory
Flush all unwritten log record up to the log instance indicated to disk.

Specified by:
flush in interface LogFactory
Parameters:
where - flush log up to here
Throws:
StandardException - cannot flush log file due to sync error

canSupport

public boolean canSupport(java.util.Properties startParams)
Description copied from interface: ModuleSupportable
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

Specified by:
canSupport in interface ModuleSupportable
Returns:
true if this instance can be used, false otherwise.

setTruncationLWM

public LogInstant setTruncationLWM(UUID name,
                                   LogInstant instant,
                                   RawStoreFactory rawStoreFactory,
                                   TransactionFactory transFactory)
                            throws StandardException
Throws:
StandardException

setTruncationLWM

public void setTruncationLWM(UUID name,
                             LogInstant instant)
                      throws StandardException
Throws:
StandardException - functionality not implmented

removeTruncationLWM

public void removeTruncationLWM(UUID name,
                                RawStoreFactory rawStoreFactory,
                                TransactionFactory transFactory)
                         throws StandardException
Throws:
StandardException - functionality not implmented

getTruncationLWM

public LogInstant getTruncationLWM(UUID name)
                            throws StandardException
Throws:
StandardException - functionality not implmented

removeTruncationLWM

public void removeTruncationLWM(UUID name)
                         throws StandardException
Throws:
StandardException - functionality not implmented

openFlushedScan

public ScanHandle openFlushedScan(DatabaseInstant i,
                                  int groupsIWant)
                           throws StandardException
Description copied from interface: LogFactory
Get a ScanHandle to scan flushed records from the log.

MT- read only

Specified by:
openFlushedScan in interface LogFactory
Parameters:
groupsIWant - - log record groups the scanner wants.
Returns:
the LogScan.
Throws:
StandardException - functionality not implmented

openForwardsScan

public LogScan openForwardsScan(LogInstant startAt,
                                LogInstant stopAt)
                         throws StandardException
Description copied from interface: LogFactory
Get a LogScan to scan the log in a forward direction.

MT- read only

Specified by:
openForwardsScan in interface LogFactory
Parameters:
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.
Returns:
the LogScan.
Throws:
StandardException - functionality not implmented

getFirstUnflushedInstant

public LogInstant getFirstUnflushedInstant()
Description copied from interface: LogFactory
Get the instant for the last record in the log.

Specified by:
getFirstUnflushedInstant in interface LogFactory

openForwardsFlushedScan

public LogScan openForwardsFlushedScan(LogInstant startAt)
                                throws StandardException
Description copied from interface: LogFactory
Get a LogScan to scan flushed records from the log.

MT- read only

Specified by:
openForwardsFlushedScan in interface LogFactory
Parameters:
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.
Returns:
the LogScan.
Throws:
StandardException - functionality not implmented

freezePersistentStore

public void freezePersistentStore()
                           throws StandardException
Backup restore - stop sending log record to the log stream

Specified by:
freezePersistentStore in interface LogFactory
Throws:
StandardException - Standard Cloudscape error policy

unfreezePersistentStore

public void unfreezePersistentStore()
                             throws StandardException
Backup restore - start sending log record to the log stream

Specified by:
unfreezePersistentStore in interface LogFactory
Throws:
StandardException - Standard Cloudscape error policy

logArchived

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

Specified by:
logArchived in interface LogFactory
Returns:
true if the log is being archived.

getLogFactoryProperties

public void getLogFactoryProperties(PersistentSet set)
Get JBMS properties relavent to the log factory

Specified by:
getLogFactoryProperties in interface LogFactory

getLogDirectory

public StorageFile getLogDirectory()
Description copied from interface: LogFactory
Return the location of the log directory.

Specified by:
getLogDirectory in interface LogFactory

getCanonicalLogPath

public java.lang.String getCanonicalLogPath()
Description copied from interface: LogFactory
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.

Specified by:
getCanonicalLogPath in interface LogFactory

enableLogArchiveMode

public void enableLogArchiveMode()
Specified by:
enableLogArchiveMode in interface LogFactory

disableLogArchiveMode

public void disableLogArchiveMode()
Specified by:
disableLogArchiveMode in interface LogFactory

deleteOnlineArchivedLogFiles

public void deleteOnlineArchivedLogFiles()
Specified by:
deleteOnlineArchivedLogFiles in interface LogFactory

inRFR

public boolean inRFR()
Specified by:
inRFR in interface LogFactory

checkpointInRFR

public void checkpointInRFR(LogInstant cinstant,
                            long redoLWM,
                            DataFactory df)
                     throws StandardException
perform a checkpoint during rollforward recovery

Specified by:
checkpointInRFR in interface LogFactory
Parameters:
cinstant - The LogInstant of the checkpoint
redoLWM - Redo Low Water Mark in the check point record
Throws:
StandardException - - encounter exception during checkpoint

copyActiveLogFiles

public boolean copyActiveLogFiles(java.io.File toDir)
                           throws StandardException
Specified by:
copyActiveLogFiles in interface LogFactory
Throws:
StandardException

Built on Mon 2007-06-04 09:58:47+0400, from revision ???

Apache Derby V10.1 Engine Documentation - Copyright © 1997,2005 The Apache Software Foundation or its licensors, as applicable.