Interface RawStoreFactory

All Superinterfaces:
Corruptable
All Known Implementing Classes:
RawStore

public interface RawStoreFactory extends Corruptable
RawStoreFactory implements a single unit of transactional storage. A RawStoreFactory contains Segments and Segments contain Containers.

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.

  • Field -
    • Max length 2^31 - 1 (2147483647) -
  • Record -
    • Max number of fields 2^31 - 1 (2147483647) - from use of Object[] array to represent row, which can "only" have int sized number of array members.
  • Page -
  • Container -
  • Segment -
  • Raw Store -

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

See Also:
  • Field Details

    • DERBY_STORE_MINOR_VERSION_1

      static final int DERBY_STORE_MINOR_VERSION_1
      Derby Store Minor Version (1)
      See Also:
    • DERBY_STORE_MINOR_VERSION_2

      static final int DERBY_STORE_MINOR_VERSION_2
      Derby Store Minor Version (2)
      See Also:
    • DERBY_STORE_MINOR_VERSION_3

      static final int DERBY_STORE_MINOR_VERSION_3
      Derby Store Minor Version (3)
      See Also:
    • DERBY_STORE_MINOR_VERSION_4

      static final int DERBY_STORE_MINOR_VERSION_4
      Derby Store Minor Version (4)
      See Also:
    • DERBY_STORE_MINOR_VERSION_10

      static final int DERBY_STORE_MINOR_VERSION_10
      Derby Store Minor Version (10)
      See Also:
    • DERBY_STORE_MAJOR_VERSION_10

      static final int DERBY_STORE_MAJOR_VERSION_10
      Derby 10 Store Major version
      See Also:
    • PAGE_SIZE_DEFAULT

      static final int PAGE_SIZE_DEFAULT
      Default value for PAGE_SIZE_PARAMETER (4096).
      See Also:
    • PAGE_SIZE_MINIMUM

      static final int PAGE_SIZE_MINIMUM
      Minimum page size we will accept (1024).
      See Also:
    • PAGE_SIZE_STRING

      static final String PAGE_SIZE_STRING
      See Also:
    • PAGE_CACHE_SIZE_PARAMETER

      static final String PAGE_CACHE_SIZE_PARAMETER
      Property name for the page cache size to be used in the storage area. Equal to 'derby.storage.pageCacheSize'
      See Also:
    • PAGE_CACHE_SIZE_DEFAULT

      static final int PAGE_CACHE_SIZE_DEFAULT
      Default value for PAGE_CACHE_SIZE_PARAMETER (1000).
      See Also:
    • PAGE_CACHE_SIZE_MINIMUM

      static final int PAGE_CACHE_SIZE_MINIMUM
      Minimum page cache size we will accept (40).
      See Also:
    • PAGE_CACHE_SIZE_MAXIMUM

      static final int PAGE_CACHE_SIZE_MAXIMUM
      Maximum page cache size we will accept (MAXINT).
      See Also:
    • CONTAINER_CACHE_SIZE_PARAMETER

      static final String CONTAINER_CACHE_SIZE_PARAMETER
      Property name for the number of open files to maintain associated with the page cache. Internally this is referred to as the "ContainerCache". Each object in this cache maps to a java level "open" file on a file in the database directory. Although actual implementation depends on JVM implementation, this usually maps to underlying open file resources in the underlying operating system. Setting this number too high may result in I/O failures reported by Derby, which are the result of hitting some user and/or OS limit on the number of open files allowed. These I/O errors may happen during read, write and/or open operations. Sometimes these limits can be avoided simply by executing an OS specific command to raise the maximum open files allowed by whatever mechanism is used to control resources allowed to be consumed by the JVM. Derby may also open other files separate from this cache, so exausting the open file resource may cause other operations than I/O to data pages to fail. A partial list of these operations includes: recovery logging, error logging, external sorting, and LOB disk overflow. The default maximum size of this cache is 100 open files. The minimum size of this cache is 2 open files, attempting to set this cache to a smaller size or a negative number will result in a size 2 cache. Setting the cache size to a number bigger than an INT, or any sort of illegal format number will result in a cache size of 100 open files. Equal to 'derby.storage.fileCacheSize'
      See Also:
    • CONTAINER_CACHE_SIZE_DEFAULT

      static final int CONTAINER_CACHE_SIZE_DEFAULT
      Default value for CONTAINER_CACHE_SIZE_PARAMETER (100).
      See Also:
    • CONTAINER_CACHE_SIZE_MINIMUM

      static final int CONTAINER_CACHE_SIZE_MINIMUM
      Minimum container cache size accepted (2).
      See Also:
    • CONTAINER_CACHE_SIZE_MAXIMUM

      static final int CONTAINER_CACHE_SIZE_MAXIMUM
      Maximum container cache size we will accept (MAXINT).
      See Also:
    • MAX_CONTAINER_INITIAL_PAGES

      static final short MAX_CONTAINER_INITIAL_PAGES
      Maximum number of initial pages when a container is created
      See Also:
    • MINIMUM_RECORD_SIZE_PARAMETER

      static final String MINIMUM_RECORD_SIZE_PARAMETER
      Property name for the default minimum record size to be used in the storage area. Minimum record size is the minimum number of bytes that a record will reserve on disk.
      See Also:
    • MINIMUM_RECORD_SIZE_DEFAULT

      static final int MINIMUM_RECORD_SIZE_DEFAULT
      Default value for MINIMUM_RECORD_SIZE_PARAMETER for heap tables that allow overflow. By setting minimumRecordSize to 12 bytes, we guarantee there is enough space to update the a head row even if there is not enough space on the page. The 12 bytes of user data along with the existing space in the record header will guarantee there is room to write an overflow row header which will use the same initial portion of the record header and at most 12 additional bytes for an overflow pointer (page + id). Note that this is the "user" portion of the record. The record also will contain space for the "non-user" portion which includes the offset table and the record header.
      See Also:
    • MINIMUM_RECORD_SIZE_MINIMUM

      static final int MINIMUM_RECORD_SIZE_MINIMUM
      Minimum value for MINIMUM_RECORD_SIZE_PARAMETER (1).
      See Also:
    • PAGE_RESERVED_SPACE_PARAMETER

      static final String PAGE_RESERVED_SPACE_PARAMETER
      Property name for percentage of space to leave free on page for updates.
      See Also:
    • PAGE_RESERVED_ZERO_SPACE_STRING

      static final String PAGE_RESERVED_ZERO_SPACE_STRING
      See Also:
    • PRE_ALLOCATE_PAGE

      static final String PRE_ALLOCATE_PAGE
      Property name for the number of pages we try to pre-allocate in one /** synchronous I/O
      See Also:
    • PAGE_REUSABLE_RECORD_ID

      static final String PAGE_REUSABLE_RECORD_ID
      Property name for container which reuses recordId when a page is reused. Defaults to false, which means recordId is never reused. This property should NOT be set by the end user, only Access should set it for special conglomerates which does not count on permanant unique recordIds for all records.
      See Also:
    • STREAM_FILE_BUFFER_SIZE_PARAMETER

      static final String STREAM_FILE_BUFFER_SIZE_PARAMETER
      Property name for buffer size to be used in the stream file container. Equal to 'derby.storage.streamFileBufferSize'
      See Also:
    • STREAM_FILE_BUFFER_SIZE_DEFAULT

      static final int STREAM_FILE_BUFFER_SIZE_DEFAULT
      Default value for STREAM_FILE_BUFFER_SIZE_PARAMETER (16384).
      See Also:
    • STREAM_FILE_BUFFER_SIZE_MINIMUM

      static final int STREAM_FILE_BUFFER_SIZE_MINIMUM
      Minimum stream file buffer size we will accept (1024).
      See Also:
    • STREAM_FILE_BUFFER_SIZE_MAXIMUM

      static final int STREAM_FILE_BUFFER_SIZE_MAXIMUM
      Maximum stream file buffer size we will accept (MAXINT).
      See Also:
    • CONTAINER_INITIAL_PAGES

      static final String CONTAINER_INITIAL_PAGES
      Property name for container which attempts to be created with an initial size of this many pages. Defaults to 1 page.
      All containers are guarenteed to be created with at least 1 page, if this property is set, it will attempt to allocate CONTAINER_INITIAL_PAGES, but with no guarentee. CONTAIENR_INITIAL_PAGES legally ranges from 1 to MAX_CONTAINER_INITIAL_PAGES. Values < 1 will be set to 1 and values > MAX_CONTAINER_INITIAL_PAGES will be set to MAX_CONTAINER_INITIAL_PAGES This property should only be set in the PROPERTIES list in a CREATE TABLE or CREATE INDEX statement. The global setting of this property has no effect.
      See Also:
    • ENCRYPTION_ALIGNMENT

      static final int ENCRYPTION_ALIGNMENT
      encryption alignment requirement.
      See Also:
    • DEFAULT_ENCRYPTION_BLOCKSIZE

      static final int DEFAULT_ENCRYPTION_BLOCKSIZE
      default encryption block size In old existing databases (ie 5.1.x), the default encryption block size used is 8. Do not change this value unless you account for downgrade issues
      See Also:
    • ENCRYPTION_BLOCKSIZE

      static final 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
      See Also:
    • DATA_ENCRYPT_ALGORITHM_VERSION

      static final 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
      See Also:
    • LOG_ENCRYPT_ALGORITHM_VERSION

      static final 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.
      See Also:
    • ENCRYPTED_KEY

      static final String ENCRYPTED_KEY
      If dataEncryption is true, store the encrypted key in services.properties file. It is really the encrypted key, but the property key is called the encryptedBootPassword.
      See Also:
    • OLD_ENCRYPTED_KEY

      static final 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. It is really the old encryptedkey, but the property key is called the OldEncryptedBootPassword.
      See Also:
    • DB_ENCRYPTION_STATUS

      static final String DB_ENCRYPTION_STATUS
      Tracks the status of any database-wide cryptographic operations.

      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.

      See Also:
    • DB_ENCRYPTION_IN_PROGRESS

      static final int DB_ENCRYPTION_IN_PROGRESS
      See Also:
    • DB_ENCRYPTION_IN_UNDO

      static final int DB_ENCRYPTION_IN_UNDO
      See Also:
    • DB_ENCRYPTION_IN_CLEANUP

      static final int DB_ENCRYPTION_IN_CLEANUP
      See Also:
    • CRYPTO_OLD_EXTERNAL_KEY_VERIFY_FILE

      static final 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.
      See Also:
    • KEEP_TRANSACTION_LOG

      static final String KEEP_TRANSACTION_LOG
      for debugging, keep all transaction logs intact.
      See Also:
    • PATCH_INITPAGE_RECOVER_ERROR

      static final String PATCH_INITPAGE_RECOVER_ERROR
      The following is a to enable patch for databases with recovery errors during redo of InitPage. If this property is set and the page on the disk is corrupted and is getting exceptions like invalid page format ids, we cook up the page during the recovery time. We have seen this kind of problem with 1.5.1 databases from customer Tridium ( Bug no: 3813). This patch needs to be kept unless we find the problem is during recovery process. If we discover this problem is actaully happening at the recovery then this patch should be backed out.
      See Also:
    • MODULE

      static final String MODULE
      module name
      See Also:
  • Method Details

    • isReadOnly

      boolean isReadOnly()
      Is the store read-only.
    • getLockFactory

      LockFactory getLockFactory()
      Get the LockFactory to use with this store.
    • setUndoInsertEventHandler

      void setUndoInsertEventHandler(UndoHandler undo_handle) throws StandardException
      Register a handler class for insert undo events.

      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)

      Throws:
      StandardException - Standard Derby error policy
    • startTransaction

      Transaction startTransaction(ContextManager contextMgr, String transName) throws StandardException
      Create 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.

      1. Create an raw store transaction context
      2. 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.