Class RawStore
- java.lang.Object
-
- org.apache.derby.impl.store.raw.RawStore
-
- All Implemented Interfaces:
- java.security.PrivilegedExceptionAction<java.lang.Object>, ModuleControl, ModuleSupportable, Corruptable, RawStoreFactory
public final class RawStore extends java.lang.Object implements RawStoreFactory, ModuleControl, ModuleSupportable, java.security.PrivilegedExceptionAction<java.lang.Object>
A Raw store that implements the RawStoreFactory module by delegating all the work to the lower modules TransactionFactory, LogFactory and DataFactory.String TransactionFactoryId=Class is final as it has methods with privilege blocks and implements PrivilegedExceptionAction.
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.StringTEST_REENCRYPT_CRASH_AFTER_CHECKPOINTstatic java.lang.StringTEST_REENCRYPT_CRASH_AFTER_COMMTstatic java.lang.StringTEST_REENCRYPT_CRASH_AFTER_RECOVERY_UNDO_LOGFILE_DELETEstatic java.lang.StringTEST_REENCRYPT_CRASH_AFTER_RECOVERY_UNDO_REVERTING_KEYstatic java.lang.StringTEST_REENCRYPT_CRASH_AFTER_SWITCH_TO_NEWKEYstatic java.lang.StringTEST_REENCRYPT_CRASH_BEFORE_COMMT(re) encryption testing debug flags that are used to simulate error/crash conditions for testing purposes.static java.lang.StringTEST_REENCRYPT_CRASH_BEFORE_RECOVERY_FINAL_CLEANUP-
Fields inherited from interface org.apache.derby.iapi.store.raw.RawStoreFactory
CONTAINER_CACHE_SIZE_DEFAULT, CONTAINER_CACHE_SIZE_MAXIMUM, CONTAINER_CACHE_SIZE_MINIMUM, CONTAINER_CACHE_SIZE_PARAMETER, CONTAINER_INITIAL_PAGES, CRYPTO_OLD_EXTERNAL_KEY_VERIFY_FILE, DATA_ENCRYPT_ALGORITHM_VERSION, DB_ENCRYPTION_IN_CLEANUP, DB_ENCRYPTION_IN_PROGRESS, DB_ENCRYPTION_IN_UNDO, DB_ENCRYPTION_STATUS, DEFAULT_ENCRYPTION_BLOCKSIZE, DERBY_STORE_MAJOR_VERSION_10, DERBY_STORE_MINOR_VERSION_1, DERBY_STORE_MINOR_VERSION_10, DERBY_STORE_MINOR_VERSION_2, DERBY_STORE_MINOR_VERSION_3, DERBY_STORE_MINOR_VERSION_4, ENCRYPTED_KEY, ENCRYPTION_ALIGNMENT, ENCRYPTION_BLOCKSIZE, KEEP_TRANSACTION_LOG, LOG_ENCRYPT_ALGORITHM_VERSION, MAX_CONTAINER_INITIAL_PAGES, MINIMUM_RECORD_SIZE_DEFAULT, MINIMUM_RECORD_SIZE_MINIMUM, MINIMUM_RECORD_SIZE_PARAMETER, MODULE, OLD_ENCRYPTED_KEY, PAGE_CACHE_SIZE_DEFAULT, PAGE_CACHE_SIZE_MAXIMUM, PAGE_CACHE_SIZE_MINIMUM, PAGE_CACHE_SIZE_PARAMETER, PAGE_RESERVED_SPACE_PARAMETER, PAGE_RESERVED_ZERO_SPACE_STRING, PAGE_REUSABLE_RECORD_ID, PAGE_SIZE_DEFAULT, PAGE_SIZE_MINIMUM, PAGE_SIZE_STRING, PATCH_INITPAGE_RECOVER_ERROR, PRE_ALLOCATE_PAGE, STREAM_FILE_BUFFER_SIZE_DEFAULT, STREAM_FILE_BUFFER_SIZE_MAXIMUM, STREAM_FILE_BUFFER_SIZE_MINIMUM, STREAM_FILE_BUFFER_SIZE_PARAMETER
-
-
Constructor Summary
Constructors Constructor and Description RawStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidbackup(java.lang.String backupDir, boolean wait)Backup the database to a backup directory.voidbackup(Transaction t, java.io.File backupDir)voidbackupAndEnableLogArchiveMode(java.lang.String backupDir, boolean deleteOnlineArchivedLogFiles, boolean wait)Backup the database to a backup directory and enable the log archive mode that will keep the archived log files required for roll-forward from this version backup.voidboot(boolean create, java.util.Properties properties)Boot this module with the given properties.booleancanSupport(java.util.Properties startParams)We use this RawStore for all databases.java.io.SerializablechangeBootPassword(java.util.Properties properties, java.io.Serializable changePassword)Change the boot password.voidcheckpoint()Checkpoint the database.booleancheckVersion(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.voidcreateDataWarningFile()Use the available storage factory handle to create a readme file in "seg0" directory warning users to not edit/delete any files in the directory to avoid database corruption.voidcreateFinished()intdecrypt(byte[] ciphertext, int offset, int length, byte[] cleartext, int outputOffset)Decrypt cleartext from ciphertext.voiddisableLogArchiveMode(boolean deleteOnlineArchivedLogFiles)disables the log archival process, i.e No old log files will be kept around for a roll-forward recovery.intencrypt(byte[] cleartext, int offset, int length, byte[] ciphertext, int outputOffset, boolean newEngine)Encrypt cleartext into ciphertext.voidfailover(java.lang.String dbname)Start failover for this database.TransactionfindUserTransaction(ContextManager contextMgr, java.lang.String transName)Find a user transaction in the context manager, which must be the current context manager.voidfreeze()Freeze the database temporarily so a backup can be taken.voidfreezePersistentStore()Freeze persistent store.DaemonServicegetDaemon()If this raw store has a daemon that services its need, return the daemon.java.lang.StringgetDataFactoryModule()intgetEncryptionBlockSize()Returns the encryption block size used by the algorithm at time of creation of an encrypted databaseLockFactorygetLockFactory()Get the LockFactory to use with this store.java.lang.StringgetLogFactoryModule()java.lang.StringgetMasterFactoryModule()longgetMaxContainerId()Return an id which can be used to create a container.voidgetRawStoreProperties(PersistentSet set)Get JBMS properties relevant to raw storejava.lang.StringgetSlaveFactoryModule()java.lang.StringgetTransactionFactoryModule()TransactionInfo[]getTransactionInfo()TransactionFactorygetXactFactory()Get the Transaction Factory to use with this store.java.lang.ObjectgetXAResourceManager()voidhandleIncompleteDbCryptoOperation(java.util.Properties properties)Engine might have crashed during encryption of un-encrypted datbase or while re-encryptin an already encrypted database with a new key after all the containers or (re) encrypted.voididle()Idle the raw store as much as possible.booleanisReadOnly()Is the store read-only.StandardExceptionmarkCorrupt(StandardException originalError)Mark the module as corrupt.ScanHandleopenFlushedScan(DatabaseInstant start, int groupsIWant)Get a flushed scan.intrandom()Returns a secure random number for this raw store - if database is not encrypted, returns 0.java.lang.Objectrun()TransactionstartGlobalTransaction(ContextManager contextMgr, int format_id, byte[] global_id, byte[] branch_id)Create a global user transaction, almost all work within the raw store is performed in the context of a transaction.TransactionstartInternalTransaction(ContextManager contextMgr)Create an internal transaction.TransactionstartNestedReadOnlyUserTransaction(Transaction parentTransaction, CompatibilitySpace compatibilitySpace, ContextManager contextMgr, java.lang.String transName)Create a nested user transaction, almost all work within the raw store is performed in the context of a transaction.TransactionstartNestedUpdateUserTransaction(Transaction parentTransaction, ContextManager contextMgr, java.lang.String transName, boolean flush_log_on_xact_end)Create a nested user transaction, almost all work within the raw store is performed in the context of a transaction.voidstartReplicationMaster(java.lang.String dbmaster, java.lang.String host, int port, java.lang.String replicationMode)Start the replication master role for this databaseTransactionstartTransaction(ContextManager contextMgr, java.lang.String transName)Create a user transaction, almost all work within the raw store is performed in the context of a transaction.voidstop()Stop the module.voidstopReplicationMaster()Stop the replication master role for this database.voidunfreeze()Unfreeze the database after a backup has been taken.voidunfreezePersistentStore()Freeze persistent store.
-
-
-
Field Detail
-
TEST_REENCRYPT_CRASH_BEFORE_COMMT
public static final java.lang.String TEST_REENCRYPT_CRASH_BEFORE_COMMT
(re) encryption testing debug flags that are used to simulate error/crash conditions for testing purposes. When any one of the following flags are set to true in the debug mode, re-encryption will fail at that point.
-
TEST_REENCRYPT_CRASH_AFTER_COMMT
public static final java.lang.String TEST_REENCRYPT_CRASH_AFTER_COMMT
-
TEST_REENCRYPT_CRASH_AFTER_SWITCH_TO_NEWKEY
public static final java.lang.String TEST_REENCRYPT_CRASH_AFTER_SWITCH_TO_NEWKEY
-
TEST_REENCRYPT_CRASH_AFTER_CHECKPOINT
public static final java.lang.String TEST_REENCRYPT_CRASH_AFTER_CHECKPOINT
-
TEST_REENCRYPT_CRASH_AFTER_RECOVERY_UNDO_LOGFILE_DELETE
public static final java.lang.String TEST_REENCRYPT_CRASH_AFTER_RECOVERY_UNDO_LOGFILE_DELETE
-
TEST_REENCRYPT_CRASH_AFTER_RECOVERY_UNDO_REVERTING_KEY
public static final java.lang.String TEST_REENCRYPT_CRASH_AFTER_RECOVERY_UNDO_REVERTING_KEY
-
TEST_REENCRYPT_CRASH_BEFORE_RECOVERY_FINAL_CLEANUP
public static final java.lang.String TEST_REENCRYPT_CRASH_BEFORE_RECOVERY_FINAL_CLEANUP
-
-
Method Detail
-
canSupport
public boolean canSupport(java.util.Properties startParams)
We use this RawStore for all databases.- Specified by:
canSupportin interfaceModuleSupportable- Returns:
- true if this instance can be used, false otherwise.
-
boot
public void boot(boolean create, java.util.Properties properties) throws StandardExceptionDescription copied from interface:ModuleControlBoot 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 Derby code, and thus must not be modified by Derby 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 interfaceModuleControl- Throws:
StandardException- Module cannot be started.- See Also:
Monitor,ModuleFactory
-
stop
public void stop()
Description copied from interface:ModuleControlStop 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 interfaceModuleControl- See Also:
Monitor,ModuleFactory
-
isReadOnly
public boolean isReadOnly()
Is the store read-only.- Specified by:
isReadOnlyin interfaceRawStoreFactory- See Also:
RawStoreFactory.isReadOnly()
-
getLockFactory
public LockFactory getLockFactory()
Description copied from interface:RawStoreFactoryGet the LockFactory to use with this store.- Specified by:
getLockFactoryin interfaceRawStoreFactory
-
getXactFactory
public TransactionFactory getXactFactory()
Get the Transaction Factory to use with this store.- Specified by:
getXactFactoryin interfaceRawStoreFactory
-
getXAResourceManager
public java.lang.Object getXAResourceManager() throws StandardException- Specified by:
getXAResourceManagerin interfaceRawStoreFactory- Throws:
StandardException
-
startGlobalTransaction
public Transaction startGlobalTransaction(ContextManager contextMgr, int format_id, byte[] global_id, byte[] branch_id) throws StandardException
Description copied from interface:RawStoreFactoryCreate a global user transaction, almost all work within the raw store is performed in the context of a transaction.The (format_id, global_id, branch_id) triplet is meant to come exactly from a javax.transaction.xa.Xid. We don't use Xid so that the system can be delivered on a non-1.2 vm system and not require the javax classes in the path.
Starting a transaction always performs the following steps.
- Create an raw store transaction context
- Create a new idle transaction and then link it to the context.
Only one user transaction can be active in a context at any one time.
After a commit the transaction may be re-used.
Raw Store Transaction Context Behaviour
The cleanupOnError() method of this context behaves as follows:- If error is an instance of StandardException that has a severity less than ExceptionSeverity.TRANSACTION_SEVERITY then no action is taken.
- If error is an instance of StandardException that has a severity equal to ExceptionSeverity.TRANSACTION_SEVERITY then the context's transaction is aborted, and the transaction returned to the idle state.
- If error is an instance of StandardException that has a severity greater than ExceptionSeverity.TRANSACTION_SEVERITY then the context's transaction is aborted, the transaction closed, and the context is popped off the stack.
- If error is not an instance of StandardException then the context's transaction is aborted, the transaction closed, and the context is popped off the stack.
- Specified by:
startGlobalTransactionin interfaceRawStoreFactory- Parameters:
contextMgr- is the context manager to use. An exception will be thrown if context is not the current context.format_id- the format id part of the Xid - ie. Xid.getFormatId().global_id- the global transaction identifier part of XID - ie. Xid.getGlobalTransactionId().branch_id- The branch qualifier of the Xid - ie. Xid.getBranchQaulifier()- Throws:
StandardException- Standard Derby error policy- See Also:
Transaction,Context,StandardException
-
startTransaction
public Transaction startTransaction(ContextManager contextMgr, java.lang.String transName) throws StandardException
Description copied from interface:RawStoreFactoryCreate a user transaction, almost all work within the raw store is performed in the context of a transaction.Starting a transaction always performs the following steps.
- Create an raw store transaction context
- Create a new idle transaction and then link it to the context.
Only one user transaction and one nested user transaction can be active
in a context at any one time.
After a commit the transaction may be re-used.
Raw Store Transaction Context Behaviour
The cleanupOnError() method of this context behaves as follows:- If error is an instance of StandardException that has a severity less than ExceptionSeverity.TRANSACTION_SEVERITY then no action is taken.
- If error is an instance of StandardException that has a severity equal to ExceptionSeverity.TRANSACTION_SEVERITY then the context's transaction is aborted, and the transaction returned to the idle state.
- If error is an instance of StandardException that has a severity greater than ExceptionSeverity.TRANSACTION_SEVERITY then the context's transaction is aborted, the transaction closed, and the context is popped off the stack.
- If error is not an instance of StandardException then the context's transaction is aborted, the transaction closed, and the context is popped off the stack.
- Specified by:
startTransactionin interfaceRawStoreFactory- Parameters:
contextMgr- is the context manager to use. An exception will be thrown if context is not the current context.transName- is the name of the transaction. Thsi name will be displayed by the transactiontable VTI.- Throws:
StandardException- Standard Derby error policy- See Also:
Transaction,Context,StandardException
-
startNestedReadOnlyUserTransaction
public Transaction startNestedReadOnlyUserTransaction(Transaction parentTransaction, CompatibilitySpace compatibilitySpace, ContextManager contextMgr, java.lang.String transName) throws StandardException
Description copied from interface:RawStoreFactoryCreate a nested user transaction, almost all work within the raw store is performed in the context of a transaction.A nested user transaction is exactly the same as a user transaction, except that one can specify a compatibility space to associate with the transaction. Starting a transaction always performs the following steps.
- Create an raw store transaction context
- Create a new idle transaction and then link it to the context.
Only one user transaction and one nested user transaction can be active
in a context at any one time.
After a commit the transaction may be re-used.
Raw Store Transaction Context Behaviour
The cleanupOnError() method of this context behaves as follows:- If error is an instance of StandardException that has a severity less than ExceptionSeverity.TRANSACTION_SEVERITY then no action is taken.
- If error is an instance of StandardException that has a severity equal to ExceptionSeverity.TRANSACTION_SEVERITY then the context's transaction is aborted, and the transaction returned to the idle state. If a user transaction exists on the context stack then that transaction is aborted also.
- If error is an instance of StandardException that has a severity greater than ExceptionSeverity.TRANSACTION_SEVERITY then the context's transaction is aborted, the transaction closed, and the context is popped off the stack.
- If error is not an instance of StandardException then the context's transaction is aborted, the transaction closed, and the context is popped off the stack.
- Specified by:
startNestedReadOnlyUserTransactionin interfaceRawStoreFactory- Parameters:
parentTransaction- parent transactioncompatibilitySpace- compatibility space to use for locks.contextMgr- is the context manager to use. An exception will be thrown if context is not the current context.transName- is the name of the transaction. This name will be displayed by the transactiontable VTI.- Throws:
StandardException- Standard Derby error policy- See Also:
Transaction,Context,StandardException
-
startNestedUpdateUserTransaction
public Transaction startNestedUpdateUserTransaction(Transaction parentTransaction, ContextManager contextMgr, java.lang.String transName, boolean flush_log_on_xact_end) throws StandardException
Description copied from interface:RawStoreFactoryCreate a nested user transaction, almost all work within the raw store is performed in the context of a transaction.A nested user transaction is exactly the same as a user transaction, except that one can specify a compatibility space to associate with the transaction. Starting a transaction always performs the following steps.
- Create an raw store transaction context
- Create a new idle transaction and then link it to the context.
Only one user transaction and one nested user transaction can be active
in a context at any one time.
After a commit the transaction may be re-used.
Raw Store Transaction Context Behaviour
The cleanupOnError() method of this context behaves as follows:- If error is an instance of StandardException that has a severity less than ExceptionSeverity.TRANSACTION_SEVERITY then no action is taken.
- If error is an instance of StandardException that has a severity equal to ExceptionSeverity.TRANSACTION_SEVERITY then the context's transaction is aborted, and the transaction returned to the idle state. If a user transaction exists on the context stack then that transaction is aborted also.
- If error is an instance of StandardException that has a severity greater than ExceptionSeverity.TRANSACTION_SEVERITY then the context's transaction is aborted, the transaction closed, and the context is popped off the stack.
- If error is not an instance of StandardException then the context's transaction is aborted, the transaction closed, and the context is popped off the stack.
- Specified by:
startNestedUpdateUserTransactionin interfaceRawStoreFactory- Parameters:
parentTransaction- parent transactioncontextMgr- is the context manager to use. An exception will be thrown if context is not the current context.transName- is the name of the transaction. This name will be displayed by the transactiontable VTI.flush_log_on_xact_end- By default should the transaction commit and abort be synced to the log. Normal usage should pick true, unless there is specific performance need and usage works correctly if a commit can be lost on system crash.- Throws:
StandardException- Standard Derby error policy- See Also:
Transaction,Context,StandardException
-
findUserTransaction
public Transaction findUserTransaction(ContextManager contextMgr, java.lang.String transName) throws StandardException
Description copied from interface:RawStoreFactoryFind a user transaction in the context manager, which must be the current context manager. If a user transaction does not already exist, then create one @see #startTransaction- Specified by:
findUserTransactionin interfaceRawStoreFactory- Parameters:
contextMgr- the context manager to use. An exception will be thrown if context is not the current context.transName- If a new transaction is started, it will be given this name. The name is displayed in the transactiontable VTI.- Throws:
StandardException- Standard Derby error policy- See Also:
RawStoreFactory.startTransaction(org.apache.derby.iapi.services.context.ContextManager, java.lang.String)
-
startInternalTransaction
public Transaction startInternalTransaction(ContextManager contextMgr) throws StandardException
Description copied from interface:RawStoreFactoryCreate an internal transaction.Starting an internal transaction always performs the following steps.
- Create an raw store internal transaction context
- Create a new idle internal transaction and then link it to the
context.
AN internal transaction is identical to a user transaction with the exception that
- Logical operations are not supported
- Savepoints are not supported
- Containers are not closed when commit() is called.
- Pages are not unlatched (since containers are not closed) when commit() is called.
- During recovery time internal transactions are rolled back before user transactions.
Raw Store Internal Transaction Context Behaviour
The cleanupOnError() method of this context behaves as follows:- If error is an instance of StandardException that has a severity less than ExceptionSeverity.TRANSACTION_SEVERITY then the internal transaction is aborted, the internal transaction is closed, the context is popped off the stack, and an exception of severity Transaction exception is re-thrown.
- If error is an instance of StandardException that has a severity greater than or equal to ExceptionSeverity.TRANSACTION_SEVERITY then the context's internal transaction is aborted, the internal transaction is closed and the context is popped off the stack.
- If error is not an instance of StandardException then the context's internal transaction is aborted, the internal transaction is closed and the context is popped off the stack.
- Specified by:
startInternalTransactionin interfaceRawStoreFactory- Throws:
StandardException- Standard Derby error policy- See Also:
Transaction,Context,StandardException
-
checkpoint
public void checkpoint() throws StandardExceptionDescription copied from interface:RawStoreFactoryCheckpoint the database. The raw store will wait for any current checkpoints to complete. It will start a new checkpoint and not return until that checkpoint completes.- Specified by:
checkpointin interfaceRawStoreFactory- Throws:
StandardException- Standard Derby error policy
-
startReplicationMaster
public void startReplicationMaster(java.lang.String dbmaster, java.lang.String host, int port, java.lang.String replicationMode) throws StandardExceptionStart the replication master role for this database- Specified by:
startReplicationMasterin interfaceRawStoreFactory- Parameters:
dbmaster- The master database that is being replicated.host- The hostname for the slaveport- The port the slave is listening onreplicationMode- The type of replication contract. Currently only asynchronous replication is supported, but 1-safe/2-safe/very-safe modes may be added later.- Throws:
StandardException- 1) If replication is started on a read-only database 2) If replication is started when unlogged operations are running 3) If an error occurs while trying to boot the master.
-
stopReplicationMaster
public void stopReplicationMaster() throws StandardExceptionStop the replication master role for this database.- Specified by:
stopReplicationMasterin interfaceRawStoreFactory- Throws:
StandardException- Standard Derby exception policy, thrown on error.
-
failover
public void failover(java.lang.String dbname) throws StandardExceptionDescription copied from interface:RawStoreFactoryStart failover for this database.- Specified by:
failoverin interfaceRawStoreFactory- Parameters:
dbname- the replication database that is being failed over.- Throws:
StandardException- Standard Derby exception policy, 1) If the failover succeeds, an exception is thrown to indicate that the master database was shutdown after a successful failover 2) If a failure occurs during network communication with slave.- See Also:
RawStoreFactory.failover(String dbname).
-
freeze
public void freeze() throws StandardExceptionDescription copied from interface:RawStoreFactoryFreeze the database temporarily so a backup can be taken.Please see Derby on line documentation on backup and restore.
- Specified by:
freezein interfaceRawStoreFactory- Throws:
StandardException- Thrown on error
-
unfreeze
public void unfreeze() throws StandardExceptionDescription copied from interface:RawStoreFactoryUnfreeze the database after a backup has been taken.Please see Derby on line documentation on backup and restore.
- Specified by:
unfreezein interfaceRawStoreFactory- Throws:
StandardException- Thrown on error
-
backup
public void backup(java.lang.String backupDir, boolean wait) throws StandardExceptionBackup the database to a backup directory.- Specified by:
backupin interfaceRawStoreFactory- Parameters:
backupDir- the name of the directory where the backup should be stored. This directory will be created if it does not exist.wait- if true, waits for all the backup blocking operations in progress to finish.- Throws:
StandardException- thrown on error
-
backup
public void backup(Transaction t, java.io.File backupDir) throws StandardException
- Throws:
StandardException
-
backupAndEnableLogArchiveMode
public void backupAndEnableLogArchiveMode(java.lang.String backupDir, boolean deleteOnlineArchivedLogFiles, boolean wait) throws StandardExceptionBackup the database to a backup directory and enable the log archive mode that will keep the archived log files required for roll-forward from this version backup.- Specified by:
backupAndEnableLogArchiveModein interfaceRawStoreFactory- Parameters:
backupDir- the name of the directory where the backup should be stored. This directory will be created if it does not exist.deleteOnlineArchivedLogFiles- If true deletes online archived log files that exist before this backup, delete will occur only after the backup is complete.wait- if true, waits for all the backup blocking operations in progress to finish.- Throws:
StandardException- thrown on error.
-
disableLogArchiveMode
public void disableLogArchiveMode(boolean deleteOnlineArchivedLogFiles) throws StandardExceptionDescription copied from interface:RawStoreFactorydisables the log archival process, i.e No old log files will be kept around for a roll-forward recovery.- Specified by:
disableLogArchiveModein interfaceRawStoreFactory- Parameters:
deleteOnlineArchivedLogFiles- If true deletes all online archived log files that exist before this call immediately; Only restore that can be performed after disabling log archive mode is version recovery.- Throws:
StandardException- Thrown on error
-
idle
public void idle() throws StandardExceptionDescription copied from interface:RawStoreFactoryIdle the raw store as much as possible.- Specified by:
idlein interfaceRawStoreFactory- Throws:
StandardException- Standard Derby error policy
-
getTransactionInfo
public TransactionInfo[] getTransactionInfo()
- Specified by:
getTransactionInfoin interfaceRawStoreFactory- See Also:
AccessFactory.getTransactionInfo()
-
openFlushedScan
public ScanHandle openFlushedScan(DatabaseInstant start, int groupsIWant) throws StandardException
Description copied from interface:RawStoreFactoryGet a flushed scan.- Specified by:
openFlushedScanin interfaceRawStoreFactory- Parameters:
start- The instant for the beginning of the scan.groupsIWant- log record groups the caller wants to scan.- Throws:
StandardException- StandardDerby error policy
-
getDaemon
public DaemonService getDaemon()
Description copied from interface:RawStoreFactoryIf this raw store has a daemon that services its need, return the daemon. If not, return null- Specified by:
getDaemonin interfaceRawStoreFactory
-
createFinished
public void createFinished() throws StandardException- Specified by:
createFinishedin interfaceRawStoreFactory- Throws:
StandardException
-
getRawStoreProperties
public void getRawStoreProperties(PersistentSet set) throws StandardException
Get JBMS properties relevant to raw store- Specified by:
getRawStorePropertiesin interfaceRawStoreFactory- Throws:
StandardException- Standard Derby Error Policy
-
freezePersistentStore
public void freezePersistentStore() throws StandardExceptionFreeze persistent store. Reads can still happen, only cannot write.- Specified by:
freezePersistentStorein interfaceRawStoreFactory- Throws:
StandardException- Standard Derby Error Policy
-
unfreezePersistentStore
public void unfreezePersistentStore() throws StandardExceptionFreeze persistent store. Reads can still happen, only cannot write.- Specified by:
unfreezePersistentStorein interfaceRawStoreFactory- Throws:
StandardException- Standard Derby Error Policy
-
encrypt
public int encrypt(byte[] cleartext, int offset, int length, byte[] ciphertext, int outputOffset, boolean newEngine) throws StandardExceptionEncrypt cleartext into ciphertext.- Specified by:
encryptin interfaceRawStoreFactory- Throws:
StandardException- Standard Derby Error Policy- See Also:
CipherProvider.encrypt(byte[], int, int, byte[], int)
-
decrypt
public int decrypt(byte[] ciphertext, int offset, int length, byte[] cleartext, int outputOffset) throws StandardExceptionDecrypt cleartext from ciphertext.- Specified by:
decryptin interfaceRawStoreFactory- Throws:
StandardException- Standard Derby Error Policy- See Also:
CipherProvider.decrypt(byte[], int, int, byte[], int)
-
getEncryptionBlockSize
public int getEncryptionBlockSize()
Returns the encryption block size used by the algorithm at time of creation of an encrypted database- Specified by:
getEncryptionBlockSizein interfaceRawStoreFactory
-
random
public int random()
Description copied from interface:RawStoreFactoryReturns a secure random number for this raw store - if database is not encrypted, returns 0.- Specified by:
randomin interfaceRawStoreFactory
-
changeBootPassword
public java.io.Serializable changeBootPassword(java.util.Properties properties, java.io.Serializable changePassword) throws StandardExceptionDescription copied from interface:RawStoreFactoryChange the boot password. Return the encrypted form of the secret key. The new value must be a String of the form: oldBootPassword, newBootPassword- Specified by:
changeBootPasswordin interfaceRawStoreFactory- Throws:
StandardException- Standard Derby Error Policy
-
handleIncompleteDbCryptoOperation
public void handleIncompleteDbCryptoOperation(java.util.Properties properties) throws StandardExceptionEngine might have crashed during encryption of un-encrypted datbase or while re-encryptin an already encrypted database with a new key after all the containers or (re) encrypted. If crash has occured before all containers are encrypted, recovery wil un-do re-encryption using the transaction log, nothing to be done here. If crash has occured after database encryption status flag (RawStoreFactory.DB_ENCRYPTION_STATUS) is set, this method will do any cleanup necessary for the recovery to correctly perform the rollback if required.- Parameters:
properties- properties related to this database.- Throws:
StandardException- Standard Derby Error Policy
-
markCorrupt
public StandardException markCorrupt(StandardException originalError)
Description copied from interface:CorruptableMark the module as corrupt. It is safe to call this multiple times.- Specified by:
markCorruptin interfaceCorruptable- Returns:
- Must always return its parameter.
-
getTransactionFactoryModule
public java.lang.String getTransactionFactoryModule()
- Specified by:
getTransactionFactoryModulein interfaceRawStoreFactory
-
getSlaveFactoryModule
public java.lang.String getSlaveFactoryModule()
-
getMasterFactoryModule
public java.lang.String getMasterFactoryModule()
-
getDataFactoryModule
public java.lang.String getDataFactoryModule()
- Specified by:
getDataFactoryModulein interfaceRawStoreFactory
-
getLogFactoryModule
public java.lang.String getLogFactoryModule()
- Specified by:
getLogFactoryModulein interfaceRawStoreFactory
-
getMaxContainerId
public long getMaxContainerId() throws StandardExceptionReturn an id which can be used to create a container.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.
- Specified by:
getMaxContainerIdin interfaceRawStoreFactory- Returns:
- The an id which can be used to create a container.
- Throws:
StandardException- Standard exception policy.
-
checkVersion
public boolean checkVersion(int requiredMajorVersion, int requiredMinorVersion, java.lang.String feature) throws StandardExceptionCheck to see if a database has been upgraded to the required level in order to use a store feature.- Specified by:
checkVersionin interfaceRawStoreFactory- Parameters:
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.- Returns:
trueif the database has been upgraded to the required level,falseotherwise.- Throws:
StandardException- if the database is not at the require version whenfeaturefeature is notnull.
-
run
public final java.lang.Object run() throws java.io.IOException, StandardException- Specified by:
runin interfacejava.security.PrivilegedExceptionAction<java.lang.Object>- Throws:
java.io.IOExceptionStandardException
-
createDataWarningFile
public void createDataWarningFile() throws StandardExceptionDescription copied from interface:RawStoreFactoryUse the available storage factory handle to create a readme file in "seg0" directory warning users to not edit/delete any files in the directory to avoid database corruption.- Specified by:
createDataWarningFilein interfaceRawStoreFactory- Throws:
StandardException- See Also:
RawStoreFactory.createDataWarningFile()
-
-
DataMelt 3.0 © DataMelt by jWork.ORG