Corruptable
BaseDataFileFactory
, BaseDataFileFactoryJ4
public interface DataFactory extends Corruptable
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
DB_EX_LOCKFILE_NAME |
file name that is used to acquire exclusive lock on DB.
|
static java.lang.String |
DB_LOCKFILE_NAME |
The database lock
|
static java.lang.String |
MODULE |
|
static java.lang.String |
TEMP_SEGMENT_NAME |
The temporary segment is called "tmp"
|
Modifier and Type | Method | Description |
---|---|---|
long |
addAndLoadStreamContainer(RawTransaction t,
long segmentId,
java.util.Properties tableProperties,
RowSource rowSource) |
Create and load a stream container.
|
long |
addContainer(RawTransaction t,
long segmentId,
long containerid,
int mode,
java.util.Properties tableProperties,
int temporaryFlag) |
Add a container.
|
void |
backupDataFiles(Transaction rt,
java.io.File backupDir) |
Back up the data segment of the database.
|
void |
checkpoint() |
|
void |
createFinished() |
Database creation finished
|
boolean |
databaseEncrypted() |
Returns if data base is in encrypted mode.
|
int |
decrypt(byte[] ciphertext,
int offset,
int length,
byte[] cleartext,
int outputOffset) |
Decrypt cleartext from ciphertext.
|
void |
decryptAllContainers(RawTransaction t) |
Decrypts all the containers in the data segment.
|
void |
dropContainer(RawTransaction t,
ContainerKey containerId) |
|
void |
dropStreamContainer(RawTransaction t,
long segmentId,
long containerId) |
Drop and remove a stream container.
|
int |
encrypt(byte[] cleartext,
int offset,
int length,
byte[] ciphertext,
int outputOffset,
boolean newEngine) |
Encrypt cleartext into ciphertext.
|
void |
encryptAllContainers(RawTransaction t) |
Encrypt all the containers in the data segment.
|
void |
freezePersistentStore() |
Backup restore - stop writing dirty pages or container to disk
|
int |
getEncryptionBlockSize() |
Return the encryption block size used by the algorithm at time of
encrypted database creation
|
FileResource |
getFileHandler() |
Get an object to handle non-transactional files.
|
UUID |
getIdentifier() |
Return the identifier that uniquely identifies this raw store at runtime.
|
long |
getMaxContainerId() |
Return an id which can be used to create a container.
|
java.lang.String |
getRootDirectory() |
Get the root directory of the data storage area.
|
StorageFactory |
getStorageFactory() |
|
void |
idle() |
|
boolean |
isReadOnly() |
Is the store read-only.
|
ContainerHandle |
openContainer(RawTransaction t,
ContainerKey containerId,
LockingPolicy locking,
int mode) |
Open a container that is not droped.
|
RawContainerHandle |
openDroppedContainer(RawTransaction t,
ContainerKey containerId,
LockingPolicy locking,
int mode) |
Open a container that may have been dropped.
|
StreamContainerHandle |
openStreamContainer(RawTransaction t,
long segmentId,
long containerId,
boolean hold) |
Open a stream container.
|
void |
postRecovery() |
Called after recovery is performed.
|
int |
reclaimSpace(Serviceable work,
ContextManager contextMgr) |
Reclaim space used by this factory.
|
void |
reCreateContainerForRedoRecovery(RawTransaction t,
long segmentId,
long containerId,
ByteArray containerInfo) |
re-Create a container during redo recovery.
|
void |
removeDroppedContainerFileStubs(LogInstant redoLWM) |
This function is called after a checkpoint to remove the stub files thar are not required
during recovery.
|
void |
removeOldVersionOfContainers() |
Removes old versions of the containers after a cryptographic operation
on the database.
|
void |
removeStubsOK() |
Tell the data factory it is OK to remove committed deleted containers
when the data factory shuts down.
|
void |
setDatabaseEncrypted(boolean isEncrypted) |
Sets whether the database is encrypted.
|
void |
setRawStoreFactory(RawStoreFactory rsf,
boolean create,
java.util.Properties properties) |
make data factory aware of which raw store factory it belongs to
Also need to boot the LogFactory
|
void |
setUndoInsertEventHandler(UndoHandler undo_handle) |
Register a handler class for insert undo events.
|
void |
setupCacheCleaner(DaemonService daemon) |
Set up the data factory's caches to use the specified daemon service for
background cleaning.
|
void |
stop() |
|
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.
|
markCorrupt
static final java.lang.String MODULE
static final java.lang.String TEMP_SEGMENT_NAME
static final java.lang.String DB_LOCKFILE_NAME
static final java.lang.String DB_EX_LOCKFILE_NAME
boolean isReadOnly()
ContainerHandle openContainer(RawTransaction t, ContainerKey containerId, LockingPolicy locking, int mode) throws StandardException
t
- the raw transaction that is opening the containercontainerId
- the container's identitylocking
- the locking policymode
- see the different mode in @see ContainerHandle
then will return a null handle if the container is dropped.StandardException
- Standard Derby error policyRawContainerHandle openDroppedContainer(RawTransaction t, ContainerKey containerId, LockingPolicy locking, int mode) throws StandardException
StandardException
- Standard Derby error policyopenContainer(org.apache.derby.iapi.store.raw.xact.RawTransaction, org.apache.derby.iapi.store.raw.ContainerKey, org.apache.derby.iapi.store.raw.LockingPolicy, int)
long addContainer(RawTransaction t, long segmentId, long containerid, int mode, java.util.Properties tableProperties, int temporaryFlag) throws StandardException
t
- the transaction that is creating the containersegmentId
- the segment where the container is to gomode
- whether or not to LOGGED or not. The effect of this mode
is only for this addContainer call, not persisently stored
throughout the lifetime of the containertableProperties
- properties of the container that is persistently
stored throughout the lifetime of the containerStandardException
- Standard Derby Error policylong addAndLoadStreamContainer(RawTransaction t, long segmentId, java.util.Properties tableProperties, RowSource rowSource) throws StandardException
t
- the transaction that is creating the containersegmentId
- the segment where the container is to gotableProperties
- properties of the container that is persistently
stored throughout the lifetime of the containerrowSource
- the data to load the container withStandardException
- Standard Derby Error policyStreamContainerHandle openStreamContainer(RawTransaction t, long segmentId, long containerId, boolean hold) throws StandardException
StandardException
- Standard Derby exception policyvoid dropStreamContainer(RawTransaction t, long segmentId, long containerId) throws StandardException
StandardException
- Standard Derby exception policyvoid reCreateContainerForRedoRecovery(RawTransaction t, long segmentId, long containerId, ByteArray containerInfo) throws StandardException
StandardException
- Standard Derby Error policyvoid dropContainer(RawTransaction t, ContainerKey containerId) throws StandardException
StandardException
void checkpoint() throws StandardException
StandardException
void idle() throws StandardException
StandardException
UUID getIdentifier()
void setRawStoreFactory(RawStoreFactory rsf, boolean create, java.util.Properties properties) throws StandardException
StandardException
- cannot boot the log factoryvoid createFinished() throws StandardException
StandardException
- Standard Derby exception policy.FileResource getFileHandler()
void removeStubsOK()
int reclaimSpace(Serviceable work, ContextManager contextMgr) throws StandardException
StandardException
- Standard Derby exception policyvoid postRecovery() throws StandardException
StandardException
- Standard Derby Error Policyvoid setupCacheCleaner(DaemonService daemon)
daemon
- daemon service to use for background cleaningint encrypt(byte[] cleartext, int offset, int length, byte[] ciphertext, int outputOffset, boolean newEngine) throws StandardException
StandardException
- Standard Derby Error PolicyCipherProvider.encrypt(byte[], int, int, byte[], int)
int decrypt(byte[] ciphertext, int offset, int length, byte[] cleartext, int outputOffset) throws StandardException
StandardException
- Standard Derby Error PolicyCipherProvider.decrypt(byte[], int, int, byte[], int)
void decryptAllContainers(RawTransaction t) throws StandardException
t
- the transaction that is decrypting the containerStandardException
- Standard Derby Error Policyvoid encryptAllContainers(RawTransaction t) throws StandardException
t
- the transaction that is encrypting the containers.StandardException
- Standard Derby Error Policyvoid removeOldVersionOfContainers() throws StandardException
StandardException
void setDatabaseEncrypted(boolean isEncrypted)
isEncrypted
- true
if the database is encrypted,
false
otherwiseint getEncryptionBlockSize()
void freezePersistentStore() throws StandardException
StandardException
- Standard Derby error policyvoid unfreezePersistentStore()
void writeInProgress() throws StandardException
StandardException
- Standard Derby error policyvoid writeFinished()
void backupDataFiles(Transaction rt, java.io.File backupDir) throws StandardException
StandardException
long getMaxContainerId() throws StandardException
Return an id number with is greater than any existing container in the current database. Caller will use this to allocate future container numbers - most likely caching the value and then incrementing it as it is used.
StandardException
- Standard exception policy.void removeDroppedContainerFileStubs(LogInstant redoLWM) throws StandardException
StandardException
- Standard Derby error policyStorageFactory getStorageFactory()
java.lang.String getRootDirectory()
Get the root directory of the data storage area. It is always guaranteed to be an absolute path, and it is prefixed with the JDBC sub-sub-protocol if it is not a directory database. Examples:
/path/to/database
memory:/path/to/database
void stop()
boolean databaseEncrypted()
void setUndoInsertEventHandler(UndoHandler undo_handle)
Register a class to be called when an undo of an insert is executed. When an undo of an event is executed by the raw store UndoHandler.insertUndoNotify() will be called, allowing upper level callers to execute code as necessary. The initial need is for the access layer to be able to queue post commit reclaim space in the case of inserts which are aborted (including the normal case of inserts failed for duplicate key violations) (see DERBY-4057)
Currently the handler is only called on abort of inserts on non-overflow pages that meet either of the following 2 requirements: 1) the row has either overflow columns (long columns) or the row columns span multiple pages (long rows). 2) after the action all user rows on the page are marked deleted.
undo_handle
- client code supplied undo_handle.Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.