Corruptable
RawStore
public interface RawStoreFactory extends Corruptable
Segments are identified by integer identifiers that are unique within a RawStoreFactory.
Containers are also identified by unique integer identifiers within a RawStoreFactory, but will overlap with segment identifiers.
LIMITS
This is a list of (hopefully) all limits within the raw store. Where a size
has more than one limit all are documented (rather than just the most
restrictive) so that the correct limit can be found if the most restictive
is every removed.
Access and RawStore work together to provide the ACID properties of transactions. On a high level, RawStore deals with anything that directly impacts persistency. On a more detailed level, RawStore provides logging, rollback and recovery, data management on page, page allocation and deallocation, container allocation and deallocation.
RawStore is organized as 3 branches, transaction, data, and logging. These branches each have its own "factory", the transaction factory hands out transactions, the data factory hands out containers, and the log factory hands out logger (or log buffers) for transactions to write on. For a more detailed description on these factories, please see their corresponding javadocs. MT - Thread Safe
ContainerHandle
Modifier and Type | Field | Description |
---|---|---|
static int |
CONTAINER_CACHE_SIZE_DEFAULT |
Default value for CONTAINER_CACHE_SIZE_PARAMETER (100).
|
static int |
CONTAINER_CACHE_SIZE_MAXIMUM |
Maximum container cache size we will accept (MAXINT).
|
static int |
CONTAINER_CACHE_SIZE_MINIMUM |
Minimum container cache size accepted (2).
|
static java.lang.String |
CONTAINER_CACHE_SIZE_PARAMETER |
Property name for the number of open files to maintain associated with
the page cache.
|
static java.lang.String |
CONTAINER_INITIAL_PAGES |
Property name for container which attempts to be created with an
initial size of this many pages.
|
static java.lang.String |
CRYPTO_OLD_EXTERNAL_KEY_VERIFY_FILE |
A File used to save the old copy of the verify key
(Attribute.CRYPTO_EXTERNAL_KEY_VERIFY_FILE) file during
re-encryption of the database.
|
static java.lang.String |
DATA_ENCRYPT_ALGORITHM_VERSION |
This variable is used to store the encryption scheme to allow
for any future changes in encryption schemes of data
This property has been introduced in version 10
Value starts at 1
|
static int |
DB_ENCRYPTION_IN_CLEANUP |
|
static int |
DB_ENCRYPTION_IN_PROGRESS |
|
static int |
DB_ENCRYPTION_IN_UNDO |
|
static java.lang.String |
DB_ENCRYPTION_STATUS |
Tracks the status of any database-wide cryptographic operations.
|
static int |
DEFAULT_ENCRYPTION_BLOCKSIZE |
default encryption block size
In old existing databases (ie 5.1.x), the default
encryption block size used is 8.
|
static int |
DERBY_STORE_MAJOR_VERSION_10 |
Derby 10 Store Major version
|
static int |
DERBY_STORE_MINOR_VERSION_1 |
Derby Store Minor Version (1)
|
static int |
DERBY_STORE_MINOR_VERSION_10 |
Derby Store Minor Version (10)
|
static int |
DERBY_STORE_MINOR_VERSION_2 |
Derby Store Minor Version (2)
|
static int |
DERBY_STORE_MINOR_VERSION_3 |
Derby Store Minor Version (3)
|
static int |
DERBY_STORE_MINOR_VERSION_4 |
Derby Store Minor Version (4)
|
static java.lang.String |
ENCRYPTED_KEY |
If dataEncryption is true, store the encrypted key in
services.properties file.
|
static int |
ENCRYPTION_ALIGNMENT |
encryption alignment requirement.
|
static java.lang.String |
ENCRYPTION_BLOCKSIZE |
encryption block size used during creation of encrypted database
This property is not set by the user; it is set by the engine when
RawStore boots up during creation of an encrypted database
|
static java.lang.String |
KEEP_TRANSACTION_LOG |
for debugging, keep all transaction logs intact.
|
static java.lang.String |
LOG_ENCRYPT_ALGORITHM_VERSION |
Store the encryption scheme used for logging
This will allow for any future changes in encryption schemes of logs
This variable has been introduced in version 10 and value starts at 1.
|
static short |
MAX_CONTAINER_INITIAL_PAGES |
Maximum number of initial pages when a container is created
|
static int |
MINIMUM_RECORD_SIZE_DEFAULT |
Default value for MINIMUM_RECORD_SIZE_PARAMETER for heap tables that
allow overflow.
|
static int |
MINIMUM_RECORD_SIZE_MINIMUM |
Minimum value for MINIMUM_RECORD_SIZE_PARAMETER (1).
|
static java.lang.String |
MINIMUM_RECORD_SIZE_PARAMETER |
Property name for the default minimum record size to be used in the
storage area.
|
static java.lang.String |
MODULE |
module name
|
static java.lang.String |
OLD_ENCRYPTED_KEY |
When the datbase is getting re-encrypted old encrypted key is
stored in the service.properties until re-encyrption
successfully completes or rolled back.
|
static int |
PAGE_CACHE_SIZE_DEFAULT |
Default value for PAGE_CACHE_SIZE_PARAMETER (1000).
|
static int |
PAGE_CACHE_SIZE_MAXIMUM |
Maximum page cache size we will accept (MAXINT).
|
static int |
PAGE_CACHE_SIZE_MINIMUM |
Minimum page cache size we will accept (40).
|
static java.lang.String |
PAGE_CACHE_SIZE_PARAMETER |
Property name for the page cache size to be used in the storage area.
|
static java.lang.String |
PAGE_RESERVED_SPACE_PARAMETER |
Property name for percentage of space to leave free on page for updates.
|
static java.lang.String |
PAGE_RESERVED_ZERO_SPACE_STRING |
|
static java.lang.String |
PAGE_REUSABLE_RECORD_ID |
Property name for container which reuses recordId when a page is
reused.
|
static int |
PAGE_SIZE_DEFAULT |
Default value for PAGE_SIZE_PARAMETER (4096).
|
static int |
PAGE_SIZE_MINIMUM |
Minimum page size we will accept (1024).
|
static java.lang.String |
PAGE_SIZE_STRING |
|
static java.lang.String |
PATCH_INITPAGE_RECOVER_ERROR |
The following is a to enable patch for databases with recovery
errors during redo of InitPage.
|
static java.lang.String |
PRE_ALLOCATE_PAGE |
Property name for the number of pages we try to pre-allocate in one
/** synchronous I/O
|
static int |
STREAM_FILE_BUFFER_SIZE_DEFAULT |
Default value for STREAM_FILE_BUFFER_SIZE_PARAMETER (16384).
|
static int |
STREAM_FILE_BUFFER_SIZE_MAXIMUM |
Maximum stream file buffer size we will accept (MAXINT).
|
static int |
STREAM_FILE_BUFFER_SIZE_MINIMUM |
Minimum stream file buffer size we will accept (1024).
|
static java.lang.String |
STREAM_FILE_BUFFER_SIZE_PARAMETER |
Property name for buffer size to be used in the stream file container.
|
Modifier and Type | Method | Description |
---|---|---|
void |
backup(java.lang.String backupDir,
boolean wait) |
Backup the database to backupDir.
|
void |
backupAndEnableLogArchiveMode(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.
|
java.io.Serializable |
changeBootPassword(java.util.Properties properties,
java.io.Serializable changePassword) |
Change the boot password.
|
void |
checkpoint() |
Checkpoint the database.
|
boolean |
checkVersion(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.
|
void |
createDataWarningFile() |
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.
|
void |
createFinished() |
|
int |
decrypt(byte[] ciphertext,
int offset,
int length,
byte[] cleartext,
int outputOffset) |
Decrypt cleartext from ciphertext.
|
void |
disableLogArchiveMode(boolean deleteOnlineArchivedLogFiles) |
disables the log archival process, i.e No old log files
will be kept around for a roll-forward recovery.
|
int |
encrypt(byte[] cleartext,
int offset,
int length,
byte[] ciphertext,
int outputOffset,
boolean newEngine) |
Encrypt cleartext into ciphertext.
|
void |
failover(java.lang.String dbname) |
Start failover for this database.
|
Transaction |
findUserTransaction(ContextManager contextMgr,
java.lang.String transName) |
Find a user transaction in the context manager, which must be the
current context manager.
|
void |
freeze() |
Freeze the database temporarily so a backup can be taken.
|
void |
freezePersistentStore() |
Freeze the database from altering any persistent storage.
|
DaemonService |
getDaemon() |
If this raw store has a daemon that services its need, return the
daemon.
|
java.lang.String |
getDataFactoryModule() |
|
int |
getEncryptionBlockSize() |
Returns the encryption block size used during creation of the encrypted database
|
LockFactory |
getLockFactory() |
Get the LockFactory to use with this store.
|
java.lang.String |
getLogFactoryModule() |
|
long |
getMaxContainerId() |
Return an id which can be used to create a container.
|
void |
getRawStoreProperties(PersistentSet tc) |
Get JBMS properties relevant to raw store
|
java.lang.String |
getTransactionFactoryModule() |
|
TransactionInfo[] |
getTransactionInfo() |
|
TransactionFactory |
getXactFactory() |
Get the Transaction Factory to use with this store.
|
java.lang.Object |
getXAResourceManager() |
|
void |
idle() |
Idle the raw store as much as possible.
|
boolean |
isReadOnly() |
Is the store read-only.
|
ScanHandle |
openFlushedScan(DatabaseInstant start,
int groupsIWant) |
Get a flushed scan.
|
int |
random() |
Returns a secure random number for this raw store - if database is not
encrypted, returns 0.
|
void |
setUndoInsertEventHandler(UndoHandler undo_handle) |
Register a handler class for insert undo events.
|
Transaction |
startGlobalTransaction(ContextManager contextMgr,
int format_id,
byte[] global_id,
byte[] local_id) |
Create a global user transaction, almost all work within the raw store
is performed in the context of a transaction.
|
Transaction |
startInternalTransaction(ContextManager contextMgr) |
Create an internal transaction.
|
Transaction |
startNestedReadOnlyUserTransaction(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.
|
Transaction |
startNestedUpdateUserTransaction(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.
|
void |
startReplicationMaster(java.lang.String dbmaster,
java.lang.String host,
int port,
java.lang.String replicationMode) |
Start the replication master role for this database
|
Transaction |
startTransaction(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.
|
void |
stopReplicationMaster() |
Stop the replication master role for this database.
|
void |
unfreeze() |
Unfreeze the database after a backup has been taken.
|
void |
unfreezePersistentStore() |
Unfreeze the database, persistent storage can now be altered.
|
markCorrupt
static final int DERBY_STORE_MINOR_VERSION_1
static final int DERBY_STORE_MINOR_VERSION_2
static final int DERBY_STORE_MINOR_VERSION_3
static final int DERBY_STORE_MINOR_VERSION_4
static final int DERBY_STORE_MINOR_VERSION_10
static final int DERBY_STORE_MAJOR_VERSION_10
static final int PAGE_SIZE_DEFAULT
static final int PAGE_SIZE_MINIMUM
static final java.lang.String PAGE_SIZE_STRING
static final java.lang.String PAGE_CACHE_SIZE_PARAMETER
static final int PAGE_CACHE_SIZE_DEFAULT
static final int PAGE_CACHE_SIZE_MINIMUM
static final int PAGE_CACHE_SIZE_MAXIMUM
static final java.lang.String CONTAINER_CACHE_SIZE_PARAMETER
static final int CONTAINER_CACHE_SIZE_DEFAULT
static final int CONTAINER_CACHE_SIZE_MINIMUM
static final int CONTAINER_CACHE_SIZE_MAXIMUM
static final short MAX_CONTAINER_INITIAL_PAGES
static final java.lang.String MINIMUM_RECORD_SIZE_PARAMETER
static final int MINIMUM_RECORD_SIZE_DEFAULT
static final int MINIMUM_RECORD_SIZE_MINIMUM
static final java.lang.String PAGE_RESERVED_SPACE_PARAMETER
static final java.lang.String PAGE_RESERVED_ZERO_SPACE_STRING
static final java.lang.String PRE_ALLOCATE_PAGE
static final java.lang.String PAGE_REUSABLE_RECORD_ID
static final java.lang.String STREAM_FILE_BUFFER_SIZE_PARAMETER
static final int STREAM_FILE_BUFFER_SIZE_DEFAULT
static final int STREAM_FILE_BUFFER_SIZE_MINIMUM
static final int STREAM_FILE_BUFFER_SIZE_MAXIMUM
static final java.lang.String CONTAINER_INITIAL_PAGES
static final int ENCRYPTION_ALIGNMENT
static final int DEFAULT_ENCRYPTION_BLOCKSIZE
static final java.lang.String ENCRYPTION_BLOCKSIZE
static final java.lang.String DATA_ENCRYPT_ALGORITHM_VERSION
static final java.lang.String LOG_ENCRYPT_ALGORITHM_VERSION
static final java.lang.String ENCRYPTED_KEY
static final java.lang.String OLD_ENCRYPTED_KEY
static final java.lang.String DB_ENCRYPTION_STATUS
The relevant operations are encryption, re-encryption and decryption. THe property is required to be able to bring the database back to state it was in before the cryptographic operation started in case the transformation of the database is aborted.
static final int DB_ENCRYPTION_IN_PROGRESS
static final int DB_ENCRYPTION_IN_UNDO
static final int DB_ENCRYPTION_IN_CLEANUP
static final java.lang.String CRYPTO_OLD_EXTERNAL_KEY_VERIFY_FILE
static final java.lang.String KEEP_TRANSACTION_LOG
static final java.lang.String PATCH_INITPAGE_RECOVER_ERROR
static final java.lang.String MODULE
boolean isReadOnly()
LockFactory getLockFactory()
void setUndoInsertEventHandler(UndoHandler undo_handle) throws StandardException
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)
StandardException
- Standard Derby error policyTransaction startTransaction(ContextManager contextMgr, java.lang.String transName) throws StandardException
Starting a transaction always performs the following steps.
Raw Store Transaction Context Behaviour
The cleanupOnError() method of this context behaves as follows:
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.StandardException
- Standard Derby error policyTransaction
,
Context
,
StandardException
Transaction startGlobalTransaction(ContextManager contextMgr, int format_id, byte[] global_id, byte[] local_id) throws StandardException
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.
Raw Store Transaction Context Behaviour
The cleanupOnError() method of this context behaves as follows:
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().local_id
- The branch qualifier of the Xid - ie.
Xid.getBranchQaulifier()StandardException
- Standard Derby error policyTransaction
,
Context
,
StandardException
Transaction findUserTransaction(ContextManager contextMgr, java.lang.String transName) throws StandardException
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.StandardException
- Standard Derby error policystartTransaction(org.apache.derby.iapi.services.context.ContextManager, java.lang.String)
Transaction startInternalTransaction(ContextManager contextMgr) throws StandardException
Starting an internal transaction always performs the following steps.
AN internal transaction is identical to a user transaction with the exception that
Raw Store Internal Transaction Context Behaviour
The cleanupOnError() method of this context behaves as follows:
StandardException
- Standard Derby error policyTransaction
,
Context
,
StandardException
Transaction startNestedReadOnlyUserTransaction(Transaction parentTransaction, CompatibilitySpace compatibilitySpace, ContextManager contextMgr, java.lang.String transName) throws StandardException
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.
Raw Store Transaction Context Behaviour
The cleanupOnError() method of this context behaves as follows:
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.StandardException
- Standard Derby error policyTransaction
,
Context
,
StandardException
Transaction startNestedUpdateUserTransaction(Transaction parentTransaction, ContextManager contextMgr, java.lang.String transName, boolean flush_log_on_xact_end) throws StandardException
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.
Raw Store Transaction Context Behaviour
The cleanupOnError() method of this context behaves as follows:
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.StandardException
- Standard Derby error policyTransaction
,
Context
,
StandardException
TransactionInfo[] getTransactionInfo()
AccessFactory.getTransactionInfo()
void startReplicationMaster(java.lang.String dbmaster, java.lang.String host, int port, java.lang.String replicationMode) throws StandardException
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.StandardException
- Standard Derby exception policy,
thrown on error.void stopReplicationMaster() throws StandardException
StandardException
- Standard Derby exception policy,
thrown on error.void failover(java.lang.String dbname) throws StandardException
dbname
- the replication database that is being failed over.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.void freeze() throws StandardException
Please see Derby on line documentation on backup and restore.
StandardException
- Thrown on errorvoid unfreeze() throws StandardException
Please see Derby on line documentation on backup and restore.
StandardException
- Thrown on errorvoid backup(java.lang.String backupDir, boolean wait) throws StandardException
Please see Derby on line documentation on backup and restore.
backupDir
- the name of the directory where the backup should be
stored.wait
- if true, waits for all the backup blocking
operations in progress to finish.StandardException
- Thrown on errorvoid backupAndEnableLogArchiveMode(java.lang.String backupDir, boolean deleteOnlineArchivedLogFiles, boolean wait) throws StandardException
backupDir
- the directory name where the
database backup should go. This
directory will be created if not it
does not exist.deleteOnlineArchivedLogFiles
- If true deletes online archived log
files that exist before this backup,
delete will occur only after backup
is complete.wait
- if true, waits for all the backup blocking
operations in progress to finish.StandardException
- Thrown on errorvoid disableLogArchiveMode(boolean deleteOnlineArchivedLogFiles) throws StandardException
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.StandardException
- Thrown on errorvoid checkpoint() throws StandardException
StandardException
- Standard Derby error policyvoid idle() throws StandardException
StandardException
- Standard Derby error policyScanHandle openFlushedScan(DatabaseInstant start, int groupsIWant) throws StandardException
start
- The instant for the beginning of the scan.groupsIWant
- log record groups the caller wants to scan.StandardException
- StandardDerby error policyDaemonService getDaemon()
java.lang.String getTransactionFactoryModule()
java.lang.String getDataFactoryModule()
java.lang.String getLogFactoryModule()
java.lang.Object getXAResourceManager() throws StandardException
StandardException
void createFinished() throws StandardException
StandardException
void getRawStoreProperties(PersistentSet tc) throws StandardException
StandardException
- Standard Derby exception policy.void freezePersistentStore() throws StandardException
StandardException
- Standard Derby exception policy.void unfreezePersistentStore() throws StandardException
StandardException
- Standard Derby exception policy.int 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)
int getEncryptionBlockSize()
int random()
java.io.Serializable changeBootPassword(java.util.Properties properties, java.io.Serializable changePassword) throws StandardException
StandardException
- Standard Derby Error Policylong 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.TransactionFactory getXactFactory()
boolean checkVersion(int requiredMajorVersion, int requiredMinorVersion, java.lang.String feature) throws StandardException
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. true
if the database has been upgraded to
the required level, false
otherwise.StandardException
- if the database is not at the require version
when feature
feature is
not null
.void createDataWarningFile() throws StandardException
StandardException
Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.