public class SDatabaseConfig
extends java.lang.Object
For a user created instance, no attribute is set by default. In addition, calling the getter method of an unset attribute results in an IllegalStateException. To set an attribute, call the setter method of the attribute.
When used to create a database, system default values are used for unset attributes. When used to modify the configuration of an existing database, only set attributes are modified; unset attributes are not modified.
Constructor and Description |
---|
SDatabaseConfig()
Create an empty SDatabaseConfig with no attribute set.
|
Modifier and Type | Method and Description |
---|---|
SDatabaseConfig |
cloneConfig()
Create a deep copy of this configuration object.
|
boolean |
getAllowCreate()
Return true if the
SEnvironment.openDatabase(com.sleepycat.client.STransaction, java.lang.String, java.lang.String, com.sleepycat.client.SDatabaseConfig) method is
configured
to create the database if it does not already exist. |
int |
getBlobThreshold()
Return the threshold value in bytes beyond which data items are
stored as blobs.
|
java.util.Comparator<byte[]> |
getBtreeComparator()
Always return null.
|
int |
getBtreeMinKey()
Return the minimum number of key/data pairs intended to be stored
on any single Btree leaf page.
|
boolean |
getBtreeRecordNumbers()
Return true if the Btree is configured to support retrieval by record
number.
|
boolean |
getChecksum()
Return true if the database environment is configured to do checksum
verification of pages read into the cache from the backing filestore.
|
boolean |
getExclusiveCreate()
Return true if the
SEnvironment.openDatabase(com.sleepycat.client.STransaction, java.lang.String, java.lang.String, com.sleepycat.client.SDatabaseConfig) method is
configured to fail if the database already exists. |
protected java.lang.Object |
getField(F field)
Return the value set on a specified field.
|
int |
getHashFillFactor()
Return the hash table density.
|
int |
getHashNumElements()
Return the estimate of the final size of the hash table.
|
int |
getHeapRegionSize()
Return the number of pages in a region of the database.
|
long |
getHeapsize()
Return the maximum on-disk database file size.
|
boolean |
getMultiversion()
Return true if the database is configured for multiversion concurrency
control.
|
java.lang.Boolean |
getNoWaitDbExclusiveLock()
Return whether the
SDatabase handle is configured to obtain a
write lock on the entire database. |
int |
getPageSize()
Return the size of the pages used to hold items in the database, in
bytes.
|
SCacheFilePriority |
getPriority()
Return the cache priority for pages referenced by this handle.
|
int |
getQueueExtentSize()
Return the size of the extents used to hold pages in a Queue database,
specified as a number of pages.
|
boolean |
getReadOnly()
Return true if the database is configured in read-only mode.
|
boolean |
getReadUncommitted()
Return true if the database is configured to support read uncommitted.
|
int |
getRecordLength()
Return the database record length, in bytes.
|
int |
getRecordPad()
Return the padding character for short, fixed-length records for the
Queue and Recno access methods.
|
boolean |
getRenumbering()
Return true if the logical record numbers are mutable, and change as
records are added to and deleted from the database.
|
boolean |
getReverseSplitOff()
Return true if the Btree has been configured to not do reverse splits.
|
boolean |
getSortedDuplicates()
Return true if the database is configured to support sorted duplicate
data items.
|
protected T |
getThriftObj() |
boolean |
getTransactional()
Always return true.
|
boolean |
getTransactionNotDurable()
Return true if the database environment is configured to not write log
records for this database.
|
SDatabaseType |
getType()
Return the type of the database.
|
boolean |
getUnsortedDuplicates()
Return true if the database is configured to support duplicate data
items.
|
SDatabaseConfig |
setAllowCreate(boolean allowCreate)
Configure the
SEnvironment.openDatabase(com.sleepycat.client.STransaction, java.lang.String, java.lang.String, com.sleepycat.client.SDatabaseConfig) method to create
the database if it does not already exist. |
SDatabaseConfig |
setBlobThreshold(int value)
Set the size in bytes which is used to determine when a data item will
be stored as a blob.
|
SDatabaseConfig |
setBtreeMinKey(int btMinKey)
Set the minimum number of key/data pairs intended to be stored on any
single Btree leaf page.
|
SDatabaseConfig |
setBtreeRecordNumbers(boolean btreeRecordNumbers)
Configure the Btree to support retrieval by record number.
|
SDatabaseConfig |
setChecksum(boolean checksum)
Configure the database environment to do checksum verification of
pages read into the cache from the backing filestore.
|
SDatabaseConfig |
setExclusiveCreate(boolean exclusiveCreate)
Configure the
SEnvironment.openDatabase(com.sleepycat.client.STransaction, java.lang.String, java.lang.String, com.sleepycat.client.SDatabaseConfig) method to fail if
the database already exists. |
SDatabaseConfig |
setHashFillFactor(int hashFillFactor)
Set the desired density within the hash table.
|
SDatabaseConfig |
setHashNumElements(int hashNumElements)
Set an estimate of the final size of the hash table.
|
SDatabaseConfig |
setHeapRegionSize(int npages)
Sets the number of pages in a region of a database configured to use
the Heap access method.
|
SDatabaseConfig |
setHeapsize(long bytes)
Set the maximum on-disk database file size used by a database configured
to use the Heap access method.
|
SDatabaseConfig |
setMultiversion(boolean multiversion)
Configured the database with support for multiversion concurrency
control.
|
SDatabaseConfig |
setNoWaitDbExclusiveLock(java.lang.Boolean noWaitDbExclLock)
Configure the
SDatabase handle to obtain a write lock on the
entire database. |
SDatabaseConfig |
setPageSize(int pageSize)
Set the size of the pages used to hold items in the database, in bytes.
|
SDatabaseConfig |
setPriority(SCacheFilePriority priority)
Set the cache priority for pages referenced by the DB handle.
|
SDatabaseConfig |
setQueueExtentSize(int queueExtentSize)
Set the size of the extents used to hold pages in a Queue database,
specified as a number of pages.
|
SDatabaseConfig |
setReadOnly(boolean readOnly)
Configure the database in read-only mode.
|
SDatabaseConfig |
setReadUncommitted(boolean readUncommitted)
Configure the database to support read uncommitted.
|
SDatabaseConfig |
setRecordLength(int recordLength)
Specify the database record length, in bytes.
|
SDatabaseConfig |
setRecordPad(int recordPad)
Set the padding character for short, fixed-length records for the Queue
and Recno access methods.
|
SDatabaseConfig |
setRenumbering(boolean renumbering)
Configure the logical record numbers to be mutable, and change as
records are added to and deleted from the database.
|
SDatabaseConfig |
setReverseSplitOff(boolean reverseSplitOff)
Configure the Btree to not do reverse splits.
|
SDatabaseConfig |
setSortedDuplicates(boolean sortedDuplicates)
Configure the database to support sorted, duplicate data items.
|
SDatabaseConfig |
setTransactionNotDurable(boolean transactionNotDurable)
Configure the database environment to not write log records for this
database.
|
SDatabaseConfig |
setType(SDatabaseType type)
Configure the type of the database.
|
SDatabaseConfig |
setUnsortedDuplicates(boolean unsortedDuplicates)
Configure the database to support unsorted duplicate data items.
|
public SDatabaseConfig()
public SDatabaseConfig cloneConfig()
public boolean getAllowCreate()
SEnvironment.openDatabase(com.sleepycat.client.STransaction, java.lang.String, java.lang.String, com.sleepycat.client.SDatabaseConfig)
method is
configured
to create the database if it does not already exist.
SEnvironment.openDatabase(com.sleepycat.client.STransaction, java.lang.String, java.lang.String, com.sleepycat.client.SDatabaseConfig)
method is
configured to create the database if it does not already existpublic SDatabaseConfig setAllowCreate(boolean allowCreate)
SEnvironment.openDatabase(com.sleepycat.client.STransaction, java.lang.String, java.lang.String, com.sleepycat.client.SDatabaseConfig)
method to create
the database if it does not already exist.allowCreate
- if true, configure the SEnvironment.openDatabase(com.sleepycat.client.STransaction, java.lang.String, java.lang.String, com.sleepycat.client.SDatabaseConfig)
method to create the database if it does not already exist.public int getBlobThreshold()
public SDatabaseConfig setBlobThreshold(int value)
Any data item that is equal to or larger in size than the threshold value will automatically be stored as a blob.
It is illegal to enable blob in the database which is configured with chksum, encryption, duplicates, sorted duplicates, compression, multiversion concurrency control and transactional read operations with degree 1 isolation.
This threshold value can not be set after opening the database.
value
- The size in bytes which is used to determine when a data
item will be stored as a blob; if 0, blob will be never used by the
database.public java.util.Comparator<byte[]> getBtreeComparator()
public int getBtreeMinKey()
public SDatabaseConfig setBtreeMinKey(int btMinKey)
This value is used to determine if key or data items will be stored on overflow pages instead of Btree leaf pages. The value must be at least 2; if the value is not explicitly set, a value of 2 is used.
This method configures a database, not only operations performed using the specified handle.
This attribute cannot be changed after the database is created. If opening an existing database, this attribute is ignored.
btMinKey
- The minimum number of key/data pairs intended to be
stored on any single Btree leaf page.public boolean getBtreeRecordNumbers()
public SDatabaseConfig setBtreeRecordNumbers(boolean btreeRecordNumbers)
Logical record numbers in Btree databases are mutable in the face of record insertion or deletion.
Maintaining record counts within a Btree introduces a serious point of contention, namely the page locations where the record counts are stored. In addition, the entire database must be locked during both insertions and deletions, effectively single-threading the database for those operations. Configuring a Btree for retrieval by record number can result in serious performance degradation for some applications and data sets.
Retrieval by record number may not be configured for a Btree that also supports duplicate data items.
This method configures a database, not only operations performed using the specified handle.
If the database already exists when the database is opened, any database configuration specified by this method must be the same as the existing database or an error will be returned.
btreeRecordNumbers
- if true, configure the Btree to support
retrieval by record number.public boolean getChecksum()
public SDatabaseConfig setChecksum(boolean checksum)
Berkeley DB uses the SHA1 Secure Hash Algorithm if encryption is also configured for this database, and a general hash algorithm if it is not.
Calling this method only affects the specified SDatabase
handle
(and any other library handles opened within the scope of that handle).
If the database already exists when the database is opened, any database configuration specified by this method will be ignored. If creating additional databases in a file, the checksum behavior specified must be consistent with the existing databases in the file or an error will be returned.
checksum
- if true, configure the database environment to do
checksum verification of pages read into the cache from the backing
filestorepublic boolean getExclusiveCreate()
SEnvironment.openDatabase(com.sleepycat.client.STransaction, java.lang.String, java.lang.String, com.sleepycat.client.SDatabaseConfig)
method is
configured to fail if the database already exists.SEnvironment.openDatabase(com.sleepycat.client.STransaction, java.lang.String, java.lang.String, com.sleepycat.client.SDatabaseConfig)
method is
configured to fail if the database already existspublic SDatabaseConfig setExclusiveCreate(boolean exclusiveCreate)
SEnvironment.openDatabase(com.sleepycat.client.STransaction, java.lang.String, java.lang.String, com.sleepycat.client.SDatabaseConfig)
method to fail if
the database already exists.
The exclusiveCreate mode is only meaningful if specified with the allowCreate mode.
exclusiveCreate
- if true, configure the SEnvironment.openDatabase(com.sleepycat.client.STransaction, java.lang.String, java.lang.String, com.sleepycat.client.SDatabaseConfig)
method to fail if the database already existspublic int getHashFillFactor()
public SDatabaseConfig setHashFillFactor(int hashFillFactor)
If no value is specified, the fill factor will be selected dynamically as pages are filled.
The density is an approximation of the number of keys allowed to accumulate in any one bucket, determining when the hash table grows or shrinks. If you know the average sizes of the keys and data in your data set, setting the fill factor can enhance performance. A reasonable rule computing fill factor is to set it to the following:
(pagesize - 32) / (average_key_size + average_data_size + 8)
This method configures a database, not only operations performed using the specified handle.
This attribute cannot be changed after the database is created. If opening an existing database, this attribute is ignored.
hashFillFactor
- the desired density within the hash tablepublic int getHashNumElements()
public SDatabaseConfig setHashNumElements(int hashNumElements)
In order for the estimate to be used when creating the database, the
setHashFillFactor(int)
method must also be called. If the estimate
or fill factor are not set or are set too low, hash tables will still
expand gracefully as keys are entered, although a slight performance
degradation may be noticed.
This method configures a database, not only operations performed using the specified handle.
This attribute cannot be changed after the database is created. If opening an existing database, this attribute is ignored.
hashNumElements
- an estimate of the final size of the hash table.public long getHeapsize()
public SDatabaseConfig setHeapsize(long bytes)
SHeapFullException
.
The size specified to this method must be at least three times the
database page size. That is, a Heap database must contain at least three
database pages. You can set the database page size using setPageSize(int)
.
This method may not be called after the database is opened. Further, if this method is called on an existing Heap database, the size specified here must match the size used to create the database. Note, however, that specifying an incorrect size to this method will not result in an error return until the database is opened.
bytes
- the maximum on-disk database file sizepublic int getHeapRegionSize()
public SDatabaseConfig setHeapRegionSize(int npages)
setPageSize(int)
.
This method may not be called after the database is opened. Further, if this method is called on an existing Heap database, the value specified here will be ignored. If the specified region size is larger than the maximum region size for the database's page size, an error will be returned when the database is opened. The maximum allowable region size will be included in the error message.
npages
- The size of the region, in pages.public boolean getMultiversion()
public SDatabaseConfig setMultiversion(boolean multiversion)
STransactionConfig.setSnapshot(boolean)
) for more information.
Multiversion access is not supported for queue databases.multiversion
- if true, configure the database with support for
multiversion concurrency control.public java.lang.Boolean getNoWaitDbExclusiveLock()
SDatabase
handle is configured to obtain a
write lock on the entire database.SDatabase
handle is configured for immediate
exclusive database locking. In this case, the locking operation will
error out if it cannot immediately obtain an exclusive lock. False if
the SDatabase
handle is configured for exclusive database
locking. In this case, it will block until it can obtain the exclusive
database lock when database is opened. Null if the SDatabase
handle is not configured for exclusive locking.public SDatabaseConfig setNoWaitDbExclusiveLock(java.lang.Boolean noWaitDbExclLock)
SDatabase
handle to obtain a write lock on the
entire database.
Handles configured for a write lock on the entire database can only have one active transaction at a time.
noWaitDbExclLock
- If True, configure the SDatabase
handle
to obtain a write lock on the entire database. When the database is
opened it will immediately throw SLockNotGrantedException
if it
cannot obtain the exclusive lock immediately. If False, configure the
SDatabase
handle to obtain a write lock on the entire database.
When the database is opened, it will block until it can obtain the
exclusive lock. If null, do not configure the SDatabase
handle
to obtain a write lock on the entire database.public int getPageSize()
public SDatabaseConfig setPageSize(int pageSize)
The minimum page size is 512 bytes, the maximum page size is 64K bytes, and the page size must be a power-of-two. If the page size is not explicitly set, one is selected based on the underlying filesystem I/O block size. The automatically selected size has a lower limit of 512 bytes and an upper limit of 16K bytes.
This method configures a database, not only operations performed using the specified handle.
This method may not be called after the database is opened. If the database already exists when it is opened, the information specified to this method will be ignored. If creating additional databases in a file, the page size specified must be consistent with the existing databases in the file or an error will be returned.
pageSize
- the size of the pages used to hold items in the
database, in bytes.public SCacheFilePriority getPriority()
public SDatabaseConfig setPriority(SCacheFilePriority priority)
The priority of a page biases the replacement algorithm to be more or less likely to discard a page when space is needed in the buffer pool. The bias is temporary, and pages will eventually be discarded if they are not referenced again. The priority setting is only advisory, and does not guarantee pages will be treated in a specific way.
priority
- the desired cache priority.public int getQueueExtentSize()
public SDatabaseConfig setQueueExtentSize(int queueExtentSize)
Each extent is created as a separate physical file. If no extent size is set, the default behavior is to create only a single underlying database file.
This method configures a database, not only operations performed using the specified handle.
This method may not be called after the database is opened. If the database already exists when it is opened, the information specified to this method will be ignored.
queueExtentSize
- The number of pages in a Queue database extent.public boolean getReadOnly()
public SDatabaseConfig setReadOnly(boolean readOnly)
Any attempt to modify items in the database will fail, regardless of the actual permissions of any underlying files.
readOnly
- if true, configure the database in read-only mode.public boolean getReadUncommitted()
public SDatabaseConfig setReadUncommitted(boolean readUncommitted)
Read operations on the database may request the return of modified
but not yet committed data. This flag must be specified on all
SDatabase
handles used to perform read uncommitted or database
updates, otherwise requests for read uncommitted may not be honored and
the read may block.
readUncommitted
- if true, configure the database to support read
uncommitted.public int getRecordLength()
public SDatabaseConfig setRecordLength(int recordLength)
For the Queue access method, specify the record length. For the Queue access method, the record length must be enough smaller than the database's page size that at least one record plus the database page's metadata information can fit on each database page.
For the Recno access method, specify the records are fixed-length,
not byte-delimited, and are of length recordLength
.
Any records added to the database that are less than the specified
length are automatically padded (see setRecordPad(int)
for more
information).
Any attempt to insert records into the database that are greater than the specified length will cause the call to fail.
This method configures a database, not only operations performed using the specified handle.
This method may not be called after the database is opened. If the database already exists when it is opened, the information specified to this method will be ignored.
recordLength
- the database record length, in bytes.public int getRecordPad()
public SDatabaseConfig setRecordPad(int recordPad)
If no pad character is specified, "space" characters (that is, ASCII 0x20) are used for padding.
This method configures a database, not only operations performed using the specified handle.
This method may not be called after the database is opened. If the database already exists when it is opened, the information specified to this method will be ignored.
recordPad
- the padding character for short, fixed-length records
for the Queue and Recno access methods.public boolean getRenumbering()
public SDatabaseConfig setRenumbering(boolean renumbering)
For example, the deletion of record number 4 causes records numbered 5 and greater to be renumbered downward by one. If a cursor was positioned to record number 4 before the deletion, it will refer to the new record number 4, if any such record exists, after the deletion. If a cursor was positioned after record number 4 before the deletion, it will be shifted downward one logical record, continuing to refer to the same record as it did before.
Creating new records will cause the creation of multiple records if
the record number is more than one greater than the largest record
currently in the database. For example, creating record 28, when
record 25 was previously the last record in the database, will
create records 26 and 27 as well as 28. Attempts to retrieve
records that were created in this manner will result in an error
return of SOperationStatus.KEYEMPTY
.
If a created record is not at the end of the database, all records following the new record will be automatically renumbered upward by one. For example, the creation of a new record numbered 8 causes records numbered 8 and greater to be renumbered upward by one. If a cursor was positioned to record number 8 or greater before the insertion, it will be shifted upward one logical record, continuing to refer to the same record as it did before.
For these reasons, concurrent access to a Recno database configured with mutable record numbers may be largely meaningless, although it is supported.
Calling this method affects the database, including all threads of control accessing the database.
If the database already exists when the database is opened, any database configuration specified by this method must be the same as the existing database or an error will be returned.
renumbering
- if true, configure the logical record numbers to be
mutable, and change as records are added to and deleted from the
database.public boolean getReverseSplitOff()
public SDatabaseConfig setReverseSplitOff(boolean reverseSplitOff)
As pages are emptied in a database, the Btree implementation attempts to coalesce empty pages into higher-level pages in order to keep the database as small as possible and minimize search time. This can hurt performance in applications with cyclical data demands; that is, applications where the database grows and shrinks repeatedly. For example, because Berkeley DB does page-level locking, the maximum level of concurrency in a database of two pages is far smaller than that in a database of 100 pages, so a database that has shrunk to a minimal size can cause severe deadlocking when a new cycle of data insertion begins.
Calling this method only affects the specified SDatabase
handle
(and any other library handles opened within the scope of that handle).
reverseSplitOff
- if true, configure the Btree to not do reverse
splits.public boolean getSortedDuplicates()
public SDatabaseConfig setSortedDuplicates(boolean sortedDuplicates)
Insertion when the key of the key/data pair being inserted already exists in the database will be successful. The ordering of
If a primary database is to be associated with one or more secondary databases, it may not be configured for duplicates.
A Btree that supports duplicate data items cannot also be configured for retrieval by record number.
Calling this method affects the database, including all threads of control accessing the database.
If the database already exists when the database is opened, any database configuration specified by this method must be the same as the existing database or an error will be returned.
sortedDuplicates
- if true, configure the database to support
duplicate data itemspublic boolean getUnsortedDuplicates()
public SDatabaseConfig setUnsortedDuplicates(boolean unsortedDuplicates)
Insertion when the key of the key/data pair being inserted already exists in the database will be successful. The ordering of duplicates in the database is determined by the order of insertion, unless the ordering is otherwise specified by use of a database cursor operation.
If a primary database is to be associated with one or more secondary databases, it may not be configured for duplicates.
Sorted duplicates are preferred to unsorted duplicates for performance reasons. Unsorted duplicates should only be used by applications wanting to order duplicate data items manually.
Calling this method affects the database, including all threads of control accessing the database.
If the database already exists when the database is opened, any database configuration specified by this method must be the same as the existing database or an error will be returned.
unsortedDuplicates
- if true, configure the database to support
unsorted duplicate data itemspublic boolean getTransactional()
public boolean getTransactionNotDurable()
public SDatabaseConfig setTransactionNotDurable(boolean transactionNotDurable)
This means that updates of this database exhibit the ACI (atomicity,
consistency, and isolation) properties, but not D (durability); that
is, database integrity will be maintained, but if the server fails,
integrity will not persist. The database file must be verified and/or
restored from backup after a failure. In order to ensure integrity
after server shut down, all database changes must be flushed from the
database environment cache using SEnvironment.checkpoint(com.sleepycat.client.SCheckpointConfig)
.
All database handles for a single physical file must call this method, including database handles for different databases in a physical file.
Calling this method only affects the specified SDatabase
handle
(and any other library handles opened within the scope of that handle).
transactionNotDurable
- if true, configure the database environment
to not write log records for this databasepublic SDatabaseType getType()
This method may be used to determine the type of the database after opening it.
public SDatabaseConfig setType(SDatabaseType type)
type
- the type of the database.protected T getThriftObj()
protected java.lang.Object getField(F field) throws java.lang.IllegalStateException
field
- the fieldjava.lang.IllegalStateException
- if the field is not setCopyright (c) 2016, 2019 Oracle and/or its affiliates. All rights reserved.