|
|||||||||
| Home >> All >> org >> apache >> derby >> impl >> store >> raw >> [ data overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.derby.impl.store.raw.data
Class BaseDataFileFactory

java.lang.Objectorg.apache.derby.impl.store.raw.data.BaseDataFileFactory
- All Implemented Interfaces:
- org.apache.derby.iapi.services.cache.CacheableFactory, org.apache.derby.iapi.store.raw.Corruptable, org.apache.derby.iapi.store.raw.data.DataFactory, org.apache.derby.iapi.services.monitor.ModuleControl, org.apache.derby.iapi.services.monitor.ModuleSupportable, java.security.PrivilegedExceptionAction
- public class BaseDataFileFactory
- extends java.lang.Object
- implements org.apache.derby.iapi.store.raw.data.DataFactory, org.apache.derby.iapi.services.cache.CacheableFactory, org.apache.derby.iapi.services.monitor.ModuleControl, org.apache.derby.iapi.services.monitor.ModuleSupportable, java.security.PrivilegedExceptionAction
- extends java.lang.Object
Provides the abstract class with most of the implementation of DataFactory and ModuleControl shared by all the different filesystem implementations.
RESOLVE (mikem - 2/19/98) - Currently only getContainerClass() is abstract, there are probably more routines which should be abstract. Also the other implementations should probably inherit from the abstract class, rather than from the DataFileFactory class. Also there probably should be a generic directory and the rest of the filesystem implementations parallel to it. I wanted to limit the changes going into the branch and then fix inheritance stuff in main.
The code in this class was moved over from DataFileFactory.java and then that file was made to inherit from this one.
| Fields inherited from interface org.apache.derby.iapi.store.raw.data.DataFactory |
DB_EX_LOCKFILE_NAME, DB_LOCKFILE_NAME, MODULE, TEMP_SEGMENT_NAME |
| Constructor Summary | |
BaseDataFileFactory()
|
|
| Method Summary | |
long |
addAndLoadStreamContainer(org.apache.derby.iapi.store.raw.xact.RawTransaction t,
long segmentId,
java.util.Properties tableProperties,
org.apache.derby.iapi.store.access.RowSource rowSource)
Add and load a stream container |
long |
addContainer(org.apache.derby.iapi.store.raw.xact.RawTransaction t,
long segmentId,
long input_containerid,
int mode,
java.util.Properties tableProperties,
int temporaryFlag)
Add a container with a specified page size to a segment. |
void |
boot(boolean create,
java.util.Properties startParams)
Boot this module with the given properties. |
private void |
bootLogFactory(boolean create,
java.util.Properties startParams)
|
boolean |
canSupport(java.util.Properties startParams)
See if this implementation can support any attributes that are listed in properties. |
void |
checkpoint()
|
void |
createFinished()
Database creation finished |
boolean |
databaseEncrypted()
|
int |
decrypt(byte[] ciphertext,
int offset,
int length,
byte[] cleartext,
int outputOffset)
Decrypt cleartext from ciphertext. |
void |
dropContainer(org.apache.derby.iapi.store.raw.xact.RawTransaction t,
org.apache.derby.iapi.store.raw.ContainerKey ckey)
Drop a container. |
void |
dropStreamContainer(org.apache.derby.iapi.store.raw.xact.RawTransaction t,
long segmentId,
long containerId)
Drop a stream container. |
int |
encrypt(byte[] cleartext,
int offset,
int length,
byte[] ciphertext,
int outputOffset)
Encrypt cleartext into ciphertext. |
(package private) void |
fileToRemove(org.apache.derby.io.StorageFile file,
boolean remove)
Add a file to the list of files to be removed post recovery. |
private long |
findMaxContainerId()
Find the largest containerid is seg 0. |
(package private) void |
flush(org.apache.derby.iapi.store.raw.log.LogInstant instant)
Ask the log factory to flush up to this log instant. |
void |
freezePersistentStore()
Backup restore - stop writing dirty pages or container to disk |
org.apache.derby.io.StorageFile |
getAlternateContainerPath(org.apache.derby.iapi.store.raw.ContainerKey containerId,
boolean stub)
Return an alternate path to a container file that is relative to the root directory. |
long[] |
getCacheStats(java.lang.String cacheName)
Get cache statistics for the specified cache |
(package private) org.apache.derby.iapi.services.cache.CacheManager |
getContainerCache()
|
org.apache.derby.io.StorageFile |
getContainerPath(org.apache.derby.iapi.store.raw.ContainerKey containerId,
boolean stub)
Return the path to a container file. |
private org.apache.derby.io.StorageFile |
getContainerPath(org.apache.derby.iapi.store.raw.ContainerKey containerId,
boolean stub,
int code)
|
int |
getEncryptionBlockSize()
Returns the encryption block size used by the algorithm at time of creation of an encrypted database |
org.apache.derby.iapi.store.access.FileResource |
getFileHandler()
Get an object to handle non-transactional files. |
org.apache.derby.catalog.UUID |
getIdentifier()
Return my unique identifier |
int |
getIntParameter(java.lang.String parameterName,
java.util.Properties properties,
int defaultValue,
int minimumValue,
int maximumValue)
|
private void |
getJBMSLockOnDB(org.apache.derby.catalog.UUID myUUID,
org.apache.derby.iapi.services.uuid.UUIDFactory uuidFactory,
java.lang.String databaseDirectory)
check to see if we are the only JBMS opened agains this database. |
(package private) org.apache.derby.iapi.store.raw.log.LogFactory |
getLogFactory()
|
private AllocationActions |
getLoggableAllocationActions()
Get the loggable allocation action that is associated with this implementation |
private PageActions |
getLoggablePageActions()
|
long |
getMaxContainerId()
Return an id which can be used to create a container. |
(package private) long |
getNextId()
|
(package private) org.apache.derby.iapi.services.cache.CacheManager |
getPageCache()
|
(package private) org.apache.derby.iapi.store.raw.RawStoreFactory |
getRawStoreFactory()
|
java.lang.String |
getRootDirectory()
Get the root directory of the data storage area. |
org.apache.derby.io.StorageFactory |
getStorageFactory()
|
(package private) org.apache.derby.io.StorageFile |
getTempDirectory()
|
java.lang.String |
getVersionedName(java.lang.String name,
long generationId)
|
private boolean |
handleServiceType(java.util.Properties startParams,
java.lang.String type)
Does this factory support this service type. |
void |
idle()
|
boolean |
isReadOnly()
Is the store read-only. |
private void |
logMsg(java.lang.String msg)
|
org.apache.derby.iapi.error.StandardException |
markCorrupt(org.apache.derby.iapi.error.StandardException originalError)
Really this is just a convience routine for callers that might not have access to a log factory. |
org.apache.derby.iapi.services.cache.Cacheable |
newCacheable(org.apache.derby.iapi.services.cache.CacheManager cm)
|
(package private) org.apache.derby.iapi.services.cache.Cacheable |
newContainerObject()
Return the Class of the Containers to be produced by this factory. |
org.apache.derby.iapi.store.raw.ContainerHandle |
openContainer(org.apache.derby.iapi.store.raw.xact.RawTransaction t,
org.apache.derby.iapi.store.raw.ContainerKey containerId,
org.apache.derby.iapi.store.raw.LockingPolicy locking,
int mode)
Open a container that is not droped. |
private org.apache.derby.iapi.store.raw.data.RawContainerHandle |
openContainer(org.apache.derby.iapi.store.raw.xact.RawTransaction t,
org.apache.derby.iapi.store.raw.ContainerKey identity,
org.apache.derby.iapi.store.raw.LockingPolicy locking,
int mode,
boolean droppedOK)
|
org.apache.derby.iapi.store.raw.data.RawContainerHandle |
openDroppedContainer(org.apache.derby.iapi.store.raw.xact.RawTransaction t,
org.apache.derby.iapi.store.raw.ContainerKey containerId,
org.apache.derby.iapi.store.raw.LockingPolicy locking,
int mode)
Open a container that may have been dropped. |
org.apache.derby.iapi.store.raw.StreamContainerHandle |
openStreamContainer(org.apache.derby.iapi.store.raw.xact.RawTransaction t,
long segmentId,
long containerId,
boolean hold)
open an exsisting streamContainer |
private void |
pageToDirty(org.apache.derby.iapi.store.raw.xact.RawTransaction t,
StoredPage page)
This page is going from clean to dirty, this is a chance for the sub class to do something if so desired |
void |
postRecovery()
Called after recovery is performed. |
private void |
privGetJBMSLockOnDB()
|
private void |
privReleaseJBMSLockOnDB()
|
private void |
privRestoreDataDirectory()
|
(package private) int |
random()
return a secure random number |
int |
reclaimSpace(org.apache.derby.iapi.services.daemon.Serviceable work,
org.apache.derby.iapi.services.context.ContextManager contextMgr)
Reclaim space used by this factory. |
void |
reCreateContainerForLoadTran(org.apache.derby.iapi.store.raw.xact.RawTransaction t,
long segmentId,
long containerId,
org.apache.derby.iapi.util.ByteArray containerInfo)
re-Create a container during recovery load tran. |
private void |
releaseJBMSLockOnDB()
|
void |
removeDroppedContainerFileStubs(org.apache.derby.iapi.store.raw.log.LogInstant redoLWM)
Delete the stub files thare not required for recovery. |
private void |
removeStubs()
Remove stubs in this database. |
void |
removeStubsOK()
Tell the data factory it is OK to remove committed deleted containers when the data factory shuts down. |
private void |
removeTempDirectory()
|
void |
resetCacheStats(java.lang.String cacheName)
Reset the cache statistics for the specified cache |
private void |
restoreDataDirectory(java.lang.String backupPath)
removes the data directory(seg*) from database home directory and restores it from backup location. |
java.lang.Object |
run()
This method performs an operation that requires higher privileges to successfully complete. |
void |
setRawStoreFactory(org.apache.derby.iapi.store.raw.RawStoreFactory rsf,
boolean create,
java.util.Properties startParams)
make data factory aware of which raw store factory it belongs to Also need to boot the LogFactory |
void |
stop()
Stop the module. |
void |
stubFileToRemoveAfterCheckPoint(org.apache.derby.io.StorageFile file,
org.apache.derby.iapi.store.raw.log.LogInstant logInstant,
java.lang.Object identity)
keeps track of information about the stub files of the committed deleted containers. |
private void |
syncSideLog(long bipLocation)
Ask the log factory to flush the side log up to this bip location Not implemented in this class - subclass who deals with side log must override this. |
void |
unfreezePersistentStore()
Backup restore - start writing dirty pages or container to disk |
void |
writeFinished()
Backup restore - write finished, if this is the last writer, allow the persistent store to proceed. |
void |
writeInProgress()
Backup restore - don't allow the persistent store to be frozen - or if it is already frozen, block. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
subSubProtocol
private java.lang.String subSubProtocol
storageFactory
org.apache.derby.io.StorageFactory storageFactory
writableStorageFactory
org.apache.derby.io.WritableStorageFactory writableStorageFactory
nextContainerId
private long nextContainerId
databaseEncrypted
private boolean databaseEncrypted
pageCache
private org.apache.derby.iapi.services.cache.CacheManager pageCache
containerCache
private org.apache.derby.iapi.services.cache.CacheManager containerCache
logFactory
private org.apache.derby.iapi.store.raw.log.LogFactory logFactory
jbmsVersion
private org.apache.derby.iapi.services.info.ProductVersionHolder jbmsVersion
rawStoreFactory
private org.apache.derby.iapi.store.raw.RawStoreFactory rawStoreFactory
dataDirectory
private java.lang.String dataDirectory
throwDBlckException
private boolean throwDBlckException
identifier
private org.apache.derby.catalog.UUID identifier
freezeSemaphore
private java.lang.Object freezeSemaphore
isFrozen
private boolean isFrozen
writersInProgress
private int writersInProgress
removeStubsOK
private boolean removeStubsOK
isCorrupt
private boolean isCorrupt
inCreateNoLog
private boolean inCreateNoLog
fileLockOnDB
private org.apache.derby.io.StorageRandomAccessFile fileLockOnDB
exFileLock
private org.apache.derby.io.StorageFile exFileLock
istream
private org.apache.derby.iapi.services.stream.HeaderPrintWriter istream
LINE
private static final java.lang.String LINE
- See Also:
- Constant Field Values
dataNotSyncedAtAllocation
boolean dataNotSyncedAtAllocation
dataNotSyncedAtCheckpoint
boolean dataNotSyncedAtCheckpoint
loggablePageActions
private PageActions loggablePageActions
loggableAllocActions
private AllocationActions loggableAllocActions
readOnly
private boolean readOnly
supportsRandomAccess
private boolean supportsRandomAccess
fileHandler
private org.apache.derby.iapi.store.access.FileResource fileHandler
droppedTableStubInfo
private java.util.Hashtable droppedTableStubInfo
postRecoveryRemovedFiles
private java.util.Hashtable postRecoveryRemovedFiles
actionCode
private int actionCode
GET_TEMP_DIRECTORY_ACTION
private static final int GET_TEMP_DIRECTORY_ACTION
- See Also:
- Constant Field Values
REMOVE_TEMP_DIRECTORY_ACTION
private static final int REMOVE_TEMP_DIRECTORY_ACTION
- See Also:
- Constant Field Values
GET_CONTAINER_PATH_ACTION
private static final int GET_CONTAINER_PATH_ACTION
- See Also:
- Constant Field Values
containerId
private org.apache.derby.iapi.store.raw.ContainerKey containerId
stub
private boolean stub
GET_ALTERNATE_CONTAINER_PATH_ACTION
private static final int GET_ALTERNATE_CONTAINER_PATH_ACTION
- See Also:
- Constant Field Values
FIND_MAX_CONTAINER_ID_ACTION
private static final int FIND_MAX_CONTAINER_ID_ACTION
- See Also:
- Constant Field Values
DELETE_IF_EXISTS_ACTION
private static final int DELETE_IF_EXISTS_ACTION
- See Also:
- Constant Field Values
GET_PATH_ACTION
private static final int GET_PATH_ACTION
- See Also:
- Constant Field Values
POST_RECOVERY_REMOVE_ACTION
private static final int POST_RECOVERY_REMOVE_ACTION
- See Also:
- Constant Field Values
REMOVE_STUBS_ACTION
private static final int REMOVE_STUBS_ACTION
- See Also:
- Constant Field Values
actionFile
private org.apache.derby.io.StorageFile actionFile
BOOT_ACTION
private static final int BOOT_ACTION
- See Also:
- Constant Field Values
GET_LOCK_ON_DB_ACTION
private static final int GET_LOCK_ON_DB_ACTION
- See Also:
- Constant Field Values
myUUID
private org.apache.derby.catalog.UUID myUUID
uuidFactory
private org.apache.derby.iapi.services.uuid.UUIDFactory uuidFactory
databaseDirectory
private java.lang.String databaseDirectory
RELEASE_LOCK_ON_DB_ACTION
private static final int RELEASE_LOCK_ON_DB_ACTION
- See Also:
- Constant Field Values
RESTORE_DATA_DIRECTORY_ACTION
private static final int RESTORE_DATA_DIRECTORY_ACTION
- See Also:
- Constant Field Values
backupPath
private java.lang.String backupPath
backupRoot
private java.io.File backupRoot
bfilelist
private java.lang.String[] bfilelist
| Constructor Detail |
BaseDataFileFactory
public BaseDataFileFactory()
| Method Detail |
canSupport
public boolean canSupport(java.util.Properties startParams)
- Description copied from interface:
org.apache.derby.iapi.services.monitor.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:
canSupportin interfaceorg.apache.derby.iapi.services.monitor.ModuleSupportable
boot
public void boot(boolean create,
java.util.Properties startParams)
throws org.apache.derby.iapi.error.StandardException
- Description copied from interface:
org.apache.derby.iapi.services.monitor.ModuleControl - Boot this module with the given properties. Creates a module instance
that can be found using the findModule() methods of Monitor.
The module can only be found using one of these findModule() methods
once this method has returned.
An implementation's boot method can throw StandardException. If it is thrown the module is not registered by the monitor and therefore cannot be found through a findModule(). In this case the module's stop() method is not called, thus throwing this exception must free up any resources.
When create is true the contents of the properties object will be written to the service.properties of the persistent service. Thus any code that requires an entry in service.properties must explicitly place the value in this properties set using the put method.
Typically the properties object contains one or more default properties sets, which are not written out to service.properties. These default sets are how callers modify the create process. In a JDBC connection database create the first set of defaults is a properties object that contains the attributes that were set on the jdbc:derby: URL. This attributes properties set has the second default properties set as its default. This set (which could be null) contains the properties that the user set on their DriverManager.getConnection() call, and are thus not owned by cloudscape code, and thus must not be modified by cloudscape code.When create is false the properties object contains all the properties set in the service.properties file plus a limited number of attributes from the JDBC URL attributes or connection properties set. This avoids properties set by the user compromising the boot process. An example of a property passed in from the JDBC world is the bootPassword for encrypted databases.
Code should not hold onto the passed in properties reference after boot time as its contents may change underneath it. At least after the complete boot is completed, the links to all the default sets will be removed.
- Specified by:
bootin interfaceorg.apache.derby.iapi.services.monitor.ModuleControl
stop
public void stop()
- Description copied from interface:
org.apache.derby.iapi.services.monitor.ModuleControl - Stop the module.
The module may be found via a findModule() method until some time after
this method returns. Therefore the factory must be prepared to reject requests
to it once it has been stopped. In addition other modules may cache a reference
to the module and make requests of it after it has been stopped, these requests
should be rejected as well.
- Specified by:
stopin interfaceorg.apache.derby.iapi.store.raw.data.DataFactory
newCacheable
public org.apache.derby.iapi.services.cache.Cacheable newCacheable(org.apache.derby.iapi.services.cache.CacheManager cm)
- Specified by:
newCacheablein interfaceorg.apache.derby.iapi.services.cache.CacheableFactory
createFinished
public void createFinished()
throws org.apache.derby.iapi.error.StandardException
- Database creation finished
- Specified by:
createFinishedin interfaceorg.apache.derby.iapi.store.raw.data.DataFactory
openContainer
public org.apache.derby.iapi.store.raw.ContainerHandle openContainer(org.apache.derby.iapi.store.raw.xact.RawTransaction t, org.apache.derby.iapi.store.raw.ContainerKey containerId, org.apache.derby.iapi.store.raw.LockingPolicy locking, int mode) throws org.apache.derby.iapi.error.StandardException
- Description copied from interface:
org.apache.derby.iapi.store.raw.data.DataFactory - Open a container that is not droped.
- Specified by:
openContainerin interfaceorg.apache.derby.iapi.store.raw.data.DataFactory
openDroppedContainer
public org.apache.derby.iapi.store.raw.data.RawContainerHandle openDroppedContainer(org.apache.derby.iapi.store.raw.xact.RawTransaction t, org.apache.derby.iapi.store.raw.ContainerKey containerId, org.apache.derby.iapi.store.raw.LockingPolicy locking, int mode) throws org.apache.derby.iapi.error.StandardException
- Description copied from interface:
org.apache.derby.iapi.store.raw.data.DataFactory - Open a container that may have been dropped.
Only internal raw store code should call this, e.g. recovery.
- Specified by:
openDroppedContainerin interfaceorg.apache.derby.iapi.store.raw.data.DataFactory
openContainer
private org.apache.derby.iapi.store.raw.data.RawContainerHandle openContainer(org.apache.derby.iapi.store.raw.xact.RawTransaction t, org.apache.derby.iapi.store.raw.ContainerKey identity, org.apache.derby.iapi.store.raw.LockingPolicy locking, int mode, boolean droppedOK) throws org.apache.derby.iapi.error.StandardException
addContainer
public long addContainer(org.apache.derby.iapi.store.raw.xact.RawTransaction t, long segmentId, long input_containerid, int mode, java.util.Properties tableProperties, int temporaryFlag) throws org.apache.derby.iapi.error.StandardException
- Add a container with a specified page size to a segment.
- Specified by:
addContainerin interfaceorg.apache.derby.iapi.store.raw.data.DataFactory
addAndLoadStreamContainer
public long addAndLoadStreamContainer(org.apache.derby.iapi.store.raw.xact.RawTransaction t, long segmentId, java.util.Properties tableProperties, org.apache.derby.iapi.store.access.RowSource rowSource) throws org.apache.derby.iapi.error.StandardException
- Add and load a stream container
- Specified by:
addAndLoadStreamContainerin interfaceorg.apache.derby.iapi.store.raw.data.DataFactory
openStreamContainer
public org.apache.derby.iapi.store.raw.StreamContainerHandle openStreamContainer(org.apache.derby.iapi.store.raw.xact.RawTransaction t, long segmentId, long containerId, boolean hold) throws org.apache.derby.iapi.error.StandardException
- open an exsisting streamContainer
- Specified by:
openStreamContainerin interfaceorg.apache.derby.iapi.store.raw.data.DataFactory
dropStreamContainer
public void dropStreamContainer(org.apache.derby.iapi.store.raw.xact.RawTransaction t, long segmentId, long containerId) throws org.apache.derby.iapi.error.StandardException
- Drop a stream container.
Synchronisation
This call will remove the container.
- Specified by:
dropStreamContainerin interfaceorg.apache.derby.iapi.store.raw.data.DataFactory
reCreateContainerForLoadTran
public void reCreateContainerForLoadTran(org.apache.derby.iapi.store.raw.xact.RawTransaction t, long segmentId, long containerId, org.apache.derby.iapi.util.ByteArray containerInfo) throws org.apache.derby.iapi.error.StandardException
- re-Create a container during recovery load tran.
called ONLY during recovery load tran.
- Specified by:
reCreateContainerForLoadTranin interfaceorg.apache.derby.iapi.store.raw.data.DataFactory
dropContainer
public void dropContainer(org.apache.derby.iapi.store.raw.xact.RawTransaction t, org.apache.derby.iapi.store.raw.ContainerKey ckey) throws org.apache.derby.iapi.error.StandardException
- Drop a container.
Synchronisation
This call will mark the container as dropped and then obtain an CX lock on the container. Once a container has been marked as dropped it cannot be retrieved by an openContainer() call unless explicitly with droppedOK.
Once the exclusive lock has been obtained the container is removed and all its pages deallocated. The container will be fully removed at the commit time of the transaction.
- Specified by:
dropContainerin interfaceorg.apache.derby.iapi.store.raw.data.DataFactory
checkpoint
public void checkpoint()
throws org.apache.derby.iapi.error.StandardException
- Specified by:
checkpointin interfaceorg.apache.derby.iapi.store.raw.data.DataFactory
idle
public void idle()
throws org.apache.derby.iapi.error.StandardException
- Specified by:
idlein interfaceorg.apache.derby.iapi.store.raw.data.DataFactory
setRawStoreFactory
public void setRawStoreFactory(org.apache.derby.iapi.store.raw.RawStoreFactory rsf, boolean create, java.util.Properties startParams) throws org.apache.derby.iapi.error.StandardException
- Description copied from interface:
org.apache.derby.iapi.store.raw.data.DataFactory - make data factory aware of which raw store factory it belongs to
Also need to boot the LogFactory
- Specified by:
setRawStoreFactoryin interfaceorg.apache.derby.iapi.store.raw.data.DataFactory
getIdentifier
public org.apache.derby.catalog.UUID getIdentifier()
- Return my unique identifier
- Specified by:
getIdentifierin interfaceorg.apache.derby.iapi.store.raw.data.DataFactory
reclaimSpace
public int reclaimSpace(org.apache.derby.iapi.services.daemon.Serviceable work, org.apache.derby.iapi.services.context.ContextManager contextMgr) throws org.apache.derby.iapi.error.StandardException
- Description copied from interface:
org.apache.derby.iapi.store.raw.data.DataFactory - Reclaim space used by this factory. Called by post commit daemon.
- Specified by:
reclaimSpacein interfaceorg.apache.derby.iapi.store.raw.data.DataFactory
markCorrupt
public org.apache.derby.iapi.error.StandardException markCorrupt(org.apache.derby.iapi.error.StandardException originalError)
- Really this is just a convience routine for callers that might not
have access to a log factory.
- Specified by:
markCorruptin interfaceorg.apache.derby.iapi.store.raw.Corruptable
getFileHandler
public org.apache.derby.iapi.store.access.FileResource getFileHandler()
- Description copied from interface:
org.apache.derby.iapi.store.raw.data.DataFactory - Get an object to handle non-transactional files.
- Specified by:
getFileHandlerin interfaceorg.apache.derby.iapi.store.raw.data.DataFactory
removeStubsOK
public void removeStubsOK()
- Description copied from interface:
org.apache.derby.iapi.store.raw.data.DataFactory - Tell the data factory it is OK to remove committed deleted containers
when the data factory shuts down.
- Specified by:
removeStubsOKin interfaceorg.apache.derby.iapi.store.raw.data.DataFactory
getIntParameter
public int getIntParameter(java.lang.String parameterName, java.util.Properties properties, int defaultValue, int minimumValue, int maximumValue)
getContainerCache
org.apache.derby.iapi.services.cache.CacheManager getContainerCache()
getPageCache
org.apache.derby.iapi.services.cache.CacheManager getPageCache()
getCacheStats
public long[] getCacheStats(java.lang.String cacheName)
- Description copied from interface:
org.apache.derby.iapi.store.raw.data.DataFactory - Get cache statistics for the specified cache
- Specified by:
getCacheStatsin interfaceorg.apache.derby.iapi.store.raw.data.DataFactory
resetCacheStats
public void resetCacheStats(java.lang.String cacheName)
- Description copied from interface:
org.apache.derby.iapi.store.raw.data.DataFactory - Reset the cache statistics for the specified cache
- Specified by:
resetCacheStatsin interfaceorg.apache.derby.iapi.store.raw.data.DataFactory
flush
void flush(org.apache.derby.iapi.store.raw.log.LogInstant instant) throws org.apache.derby.iapi.error.StandardException
- Ask the log factory to flush up to this log instant.
syncSideLog
private void syncSideLog(long bipLocation)
throws org.apache.derby.iapi.error.StandardException
- Ask the log factory to flush the side log up to this bip location
Not implemented in this class - subclass who deals with side log must
override this.
getLogFactory
org.apache.derby.iapi.store.raw.log.LogFactory getLogFactory()
getRawStoreFactory
org.apache.derby.iapi.store.raw.RawStoreFactory getRawStoreFactory()
getRootDirectory
public java.lang.String getRootDirectory()
- Get the root directory of the data storage area. Is always guaranteed to be an absolute path.
newContainerObject
org.apache.derby.iapi.services.cache.Cacheable newContainerObject()
- Return the Class of the Containers to be produced by this factory.
Concrete implementations of a DataFactory must implement this routine to indicate what kind of containers are produced. For instance the DataFileFactory produce RAFContainer's.
It is expected that this class is called only once, and thus does not worry about the overhead of repeated Class.forName() lookups.
pageToDirty
private void pageToDirty(org.apache.derby.iapi.store.raw.xact.RawTransaction t, StoredPage page) throws org.apache.derby.iapi.error.StandardException
- This page is going from clean to dirty, this is a chance for the
sub class to do something if so desired
getLoggablePageActions
private PageActions getLoggablePageActions() throws org.apache.derby.iapi.error.StandardException
getLoggableAllocationActions
private AllocationActions getLoggableAllocationActions()
- Get the loggable allocation action that is associated with this implementation
getTempDirectory
org.apache.derby.io.StorageFile getTempDirectory()
removeTempDirectory
private void removeTempDirectory()
getContainerPath
public org.apache.derby.io.StorageFile getContainerPath(org.apache.derby.iapi.store.raw.ContainerKey containerId, boolean stub)
- Return the path to a container file.
Return the path to a container file that is relative to the root directory.
The format of the name of an existing container file is: segNNN/cXXX.dat The format of the name of a stub describing a dropped container file is: segNNN/dXXX.dat NNN = segment number, currently 0 is where normal db files are found. XXX = The hex representation of the container number The store will always create containers with this format name, but the store will also recognize the following two formats when attempting to open files - as some copy tools have uppercased our filesnames when moving across operating systems: The format of the name of an existing container file is: segNNN/CXXX.DAT The format of the name of a stub describing a dropped container file is: segNNN/DXXX.DAT
getContainerPath
private org.apache.derby.io.StorageFile getContainerPath(org.apache.derby.iapi.store.raw.ContainerKey containerId, boolean stub, int code)
getAlternateContainerPath
public org.apache.derby.io.StorageFile getAlternateContainerPath(org.apache.derby.iapi.store.raw.ContainerKey containerId, boolean stub)
- Return an alternate path to a container file that is relative to the root directory.
The alternate path uses upper case 'C','D', and 'DAT' instead of
lower case - there have been cases of people copying the database and
somehow upper casing all the file names.
The intended use is as a bug fix for track 3444.
removeStubs
private void removeStubs()
- Remove stubs in this database. Stubs are committed deleted containers
stubFileToRemoveAfterCheckPoint
public void stubFileToRemoveAfterCheckPoint(org.apache.derby.io.StorageFile file, org.apache.derby.iapi.store.raw.log.LogInstant logInstant, java.lang.Object identity)
- keeps track of information about the stub files of the committed deleted
containers. We use the info to delete them at checkpoints.
In addition to the file info , we also keep track of the identity of the
container; which helps to remove entry in the cache and the log instant
when the stub was created, which helps us to figure out whether we
require the stub file for the crash recovery.
We maintain the information in a hashtable:
key(LOG INSTANT) Values: File handle , and ContainerIdentity.
removeDroppedContainerFileStubs
public void removeDroppedContainerFileStubs(org.apache.derby.iapi.store.raw.log.LogInstant redoLWM) throws org.apache.derby.iapi.error.StandardException
- Delete the stub files thare not required for recovery. A stub files
is not required to be around if the recovery is not going to see
any log record that belong to that container. Since the stub files
are create as a post commit operations, they are not necessary during
undo operation of the recovery.
To remove a stub file we have to be sure that it was created before the
redoLWM in the check point record. We can be sure that the stub is not
require if the log instant when it was created is less than the redoLWM.
JAVADOC
org.apache.derby.impl.store.raw.data.BaseDataFileFactory