| Constructor and Description |
|---|
DatabaseImpl()
Create an empty database object for initialization from the log.
|
DatabaseImpl(Locker locker,
String dbName,
DatabaseId id,
EnvironmentImpl envImpl,
DatabaseConfig dbConfig)
Create a database object for a new database.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addReferringHandle(Database db)
Add a referring handle
|
boolean |
allowReplicaWrite()
Used to determine whether to throw ReplicaWriteException when a write to
this database is attempted.
|
boolean |
allowsKeyUpdates() |
static Object |
bytesToObject(byte[] bytes,
String label,
ClassLoader loader)
Converts an arbitrary serialized byte array to an object.
|
void |
clearDbFileSummaries()
If
readFromLog(java.nio.ByteBuffer, int) has read the file summaries from an old MapLN,
we only need it if the MapLN is deleted (for recovery replay). |
void |
clearKeyPrefixing() |
static byte[] |
comparatorToBytes(Comparator<byte[]> comparator,
boolean byClassName,
String comparatorType)
Converts a comparator object to a serialized byte array, converting to
a class name String object if byClassName is true.
|
int |
compareEntries(DatabaseEntry entry1,
DatabaseEntry entry2,
boolean duplicates) |
long |
count(long memoryLimit)
Count entries in the database including dups, but don't dirty the cache.
|
void |
countObsoleteOldVersionDb(BaseUtilizationTracker tracker,
long mapLnLsn)
When an old version (version LT 16) MapLN deletion is replayed by
recovery, we must count it obsolete using the DbFileSummary metadata
that was maintained in this older version.
|
void |
dumpLog(StringBuilder sb,
boolean verbose)
Write the object into the string buffer for log dumping.
|
String |
dumpString(int nSpaces) |
Database |
findPrimaryDatabase()
For this secondary database return the primary that it is associated
with, or null if not associated with any primary.
|
int |
getBinDeltaPercent() |
Comparator<byte[]> |
getBtreeComparator()
This comparator should not be used directly for comparisons.
|
boolean |
getBtreeComparatorByClass() |
DbType |
getDbType() |
CacheMode |
getDefaultCacheMode()
Returns the default cache mode for this database.
|
Comparator<byte[]> |
getDuplicateComparator()
This comparator should not be used directly for comparisons.
|
boolean |
getDuplicateComparatorByClass() |
boolean |
getDupsConverted() |
EnvironmentImpl |
getEnv() |
DatabaseId |
getId() |
Comparator<byte[]> |
getKeyComparator()
Should always be used when comparing keys for this database.
|
boolean |
getKeyPrefixing() |
int |
getLogSize()
This log entry type is configured to perform marshaling (getLogSize and
writeToLog) under the write log mutex.
|
String |
getName()
Returns the DB name.
|
int |
getNodeMaxTreeEntries() |
Set<Database> |
getReferringHandles()
Returns a copy of the referring database handles.
|
ReplicationContext |
getRepContext()
Return a ReplicationContext that will indicate if this operation
should broadcast data records for this database as part the replication
stream.
|
boolean |
getSortedDuplicates() |
static boolean |
getSortedDuplicates(byte flagVal) |
long |
getTransactionId() |
Tree |
getTree() |
List<Trigger> |
getTriggers()
This method should be the only method used to obtain triggers after
reading the MapLN from the log.
|
void |
handleClosed(boolean doSyncDw,
boolean deleteTempDb)
Called after a handle onto this DB is closed.
|
boolean |
hasBtreeBinaryEqualityComparator() |
boolean |
hasDuplicateBinaryEqualityComparator() |
boolean |
hasOpenHandles()
Returns whether one or more handles are open.
|
boolean |
hasUserTriggers() |
static Comparator<byte[]> |
instantiateComparator(Class<? extends Comparator<byte[]>> comparatorClass,
String comparatorType)
Used both to read from the log and to validate a comparator when set in
DatabaseConfig.
|
boolean |
isCheckpointNeeded()
Returns whether this database's MapLN must be flushed during a
checkpoint.
|
boolean |
isDeferredWriteMode() |
boolean |
isDeleteFinished()
Returns true if this database is deleted and all cleanup/extinction is
finished.
|
boolean |
isDeleting()
Returns true if this database is being deleted.
|
boolean |
isDirty()
Returns whether this database has new (unflushed) utilization info or
the root LSN was modified after it was last logged.
|
boolean |
isDurableDeferredWrite() |
boolean |
isInternalDb() |
boolean |
isInUse()
Returns whether this DB is in use and cannot be evicted.
|
boolean |
isLNImmediatelyObsolete()
Returns whether all LNs in this DB are "immediately obsolete", meaning
two things:
1) They are counted obsolete when logged and can be ignored by the
cleaner entirely.
|
boolean |
isReplicated() |
boolean |
isTemporary() |
static boolean |
isTemporary(byte flagVal) |
boolean |
isTransactional() |
boolean |
logicalEquals(Loggable other) |
int |
noteWriteHandleClose()
Decrements the write count and returns the updated value.
|
int |
noteWriteHandleOpen()
Increments the write count and returns the updated value.
|
static byte[] |
objectToBytes(Object obj,
String label)
Converts an arbitrary object to a serialized byte array.
|
PreloadStats |
preload(PreloadConfig config)
Preload the cache, using up to maxBytes bytes or maxMillsecs msec.
|
void |
readFromLog(ByteBuffer itemBuffer,
int entryVersion)
Initialize this object from the data in itemBuf.
|
void |
removeReferringHandle(Database db)
Decrement the reference count.
|
boolean |
setBtreeComparator(Comparator<byte[]> comparator,
boolean byClassName)
Set the btree comparison function for this database.
|
void |
setCacheMode(CacheMode mode)
Sets the default mode for this database (all handles).
|
void |
setConfigProperties(Locker locker,
String dbName,
DatabaseConfig dbConfig,
EnvironmentImpl envImpl) |
void |
setDeferredWrite(boolean durableDeferredWrite)
Sets the deferred write property for the first opened handle.
|
void |
setDeleteFinished()
The delete cleanup is finished.
|
void |
setDeleteStarted()
The delete cleanup is starting.
|
void |
setDirty()
Sets dirty in order to force the MapLN to be flushed later.
|
boolean |
setDuplicateComparator(Comparator<byte[]> comparator,
boolean byClassName)
Set the duplicate comparison function for this database.
|
void |
setDupsConverted() |
void |
setEnvironmentImpl(EnvironmentImpl envImpl)
Set the db environment after reading in the DatabaseImpl from the log.
|
void |
setIsReplicatedBit() |
void |
setKeyPrefixing() |
void |
setKnownSecondary() |
void |
setNameAndType(String name) |
void |
setNodeMaxTreeEntries(int newNodeMaxTreeEntries) |
void |
setSortedDuplicates() |
void |
setTransactional(boolean transactional)
Sets the transactional property for the first opened handle.
|
boolean |
setTriggers(Locker locker,
String dbName,
List<Trigger> newTriggers,
boolean overridePersistentTriggers)
Sets the list of triggers associated with the database.
|
BtreeStats |
stat(StatsConfig config) |
void |
sync(boolean flushLog)
Flush all dirty nodes for this database to disk.
|
boolean |
unknownReplicated() |
BtreeStats |
verify(VerifyConfig config) |
void |
writeToLog(ByteBuffer logBuffer)
Serialize this object into the buffer.
|
public DatabaseImpl(Locker locker, String dbName, DatabaseId id, EnvironmentImpl envImpl, DatabaseConfig dbConfig) throws DatabaseException
DatabaseExceptionpublic DatabaseImpl()
public void setConfigProperties(Locker locker, String dbName, DatabaseConfig dbConfig, EnvironmentImpl envImpl)
public void setNameAndType(String name)
public void setKnownSecondary()
public Tree getTree()
public DatabaseId getId()
public boolean isTransactional()
public void setTransactional(boolean transactional)
public boolean isTemporary()
public static boolean isTemporary(byte flagVal)
public boolean isInternalDb()
public DbType getDbType()
public boolean isDurableDeferredWrite()
public boolean isDeferredWriteMode()
public void setDeferredWrite(boolean durableDeferredWrite)
public boolean getSortedDuplicates()
public static boolean getSortedDuplicates(byte flagVal)
public void setSortedDuplicates()
public boolean getDupsConverted()
public void setDupsConverted()
public boolean isLNImmediatelyObsolete()
public List<Trigger> getTriggers()
public boolean hasUserTriggers()
public boolean getKeyPrefixing()
public void setKeyPrefixing()
public void clearKeyPrefixing()
public boolean isReplicated()
public boolean unknownReplicated()
public void setIsReplicatedBit()
public int getNodeMaxTreeEntries()
public void setNodeMaxTreeEntries(int newNodeMaxTreeEntries)
public boolean allowReplicaWrite()
public void setCacheMode(CacheMode mode)
public CacheMode getDefaultCacheMode()
public boolean setDuplicateComparator(Comparator<byte[]> comparator, boolean byClassName) throws DatabaseException
comparator - - The Duplicate Comparison function.DatabaseExceptionpublic boolean setTriggers(Locker locker, String dbName, List<Trigger> newTriggers, boolean overridePersistentTriggers)
dbName - pass it in since it may not be available during database
creationnewTriggers - the triggers to associate with the databaseoverridePersistentTriggers - whether to overwrite persistent
triggersPersistentTrigger was changed, and therefore
may need to be stored.public boolean setBtreeComparator(Comparator<byte[]> comparator, boolean byClassName) throws DatabaseException
comparator - - The btree Comparison function.DatabaseExceptionpublic Comparator<byte[]> getBtreeComparator()
public Comparator<byte[]> getDuplicateComparator()
public Comparator<byte[]> getKeyComparator()
public boolean getBtreeComparatorByClass()
public boolean getDuplicateComparatorByClass()
public boolean allowsKeyUpdates()
public boolean hasBtreeBinaryEqualityComparator()
public boolean hasDuplicateBinaryEqualityComparator()
public void setEnvironmentImpl(EnvironmentImpl envImpl)
public EnvironmentImpl getEnv()
public boolean hasOpenHandles()
public void addReferringHandle(Database db)
public void removeReferringHandle(Database db)
public Set<Database> getReferringHandles()
public void handleClosed(boolean doSyncDw,
boolean deleteTempDb)
throws DatabaseException
DatabaseExceptionpublic int noteWriteHandleOpen()
public int noteWriteHandleClose()
public boolean isInUse()
public void sync(boolean flushLog)
throws DatabaseException
UnsupportedOperationException - via Database.sync.DatabaseExceptionpublic Database findPrimaryDatabase()
public String getName()
public void clearDbFileSummaries()
readFromLog(java.nio.ByteBuffer, int) has read the file summaries from an old MapLN,
we only need it if the MapLN is deleted (for recovery replay). In other
cases, call this method to clear it.public boolean isDirty()
public void setDirty()
public boolean isCheckpointNeeded()
public boolean isDeleting()
ExtinctionScanner.DatabaseExtinction.public boolean isDeleteFinished()
isInUse(), i.e., for which
DbTree.getDb(com.sleepycat.je.txn.Locker, java.lang.String, com.sleepycat.je.txn.HandleLocker, boolean) has been called and DbTree.releaseDb(com.sleepycat.je.dbi.DatabaseImpl) has
not yet been called. See check in incrementUseCount().public void setDeleteStarted()
public void setDeleteFinished()
public void countObsoleteOldVersionDb(BaseUtilizationTracker tracker, long mapLnLsn)
public BtreeStats stat(StatsConfig config) throws DatabaseException
DatabaseExceptionpublic BtreeStats verify(VerifyConfig config) throws DatabaseException
DatabaseExceptionpublic PreloadStats preload(PreloadConfig config) throws DatabaseException
IllegalArgumentException - via Database.preloadDatabaseExceptionpublic long count(long memoryLimit)
throws DatabaseException
DatabaseExceptionpublic String dumpString(int nSpaces)
public int getLogSize()
getLogSize in interface LoggableLoggable.getLogSize()public void writeToLog(ByteBuffer logBuffer)
LoggablewriteToLog in interface LoggablelogBuffer - is the destination bufferLoggable.writeToLog(java.nio.ByteBuffer)public void readFromLog(ByteBuffer itemBuffer, int entryVersion)
LoggablereadFromLog in interface LoggableitemBuffer - the source bufferentryVersion - the log version of the dataLoggable.readFromLog(java.nio.ByteBuffer, int)public void dumpLog(StringBuilder sb, boolean verbose)
LoggabledumpLog in interface Loggablesb - destination string bufferverbose - if true, dump the full, verbose versionLoggable.dumpLog(java.lang.StringBuilder, boolean)public long getTransactionId()
getTransactionId in interface LoggableLoggable.getTransactionId()public boolean logicalEquals(Loggable other)
logicalEquals in interface LoggableAlways return false, this item should never be compared.public static Comparator<byte[]> instantiateComparator(Class<? extends Comparator<byte[]>> comparatorClass, String comparatorType)
public static byte[] comparatorToBytes(Comparator<byte[]> comparator, boolean byClassName, String comparatorType)
EnvironmentFailureException - if the object cannot be serialized.public static byte[] objectToBytes(Object obj, String label)
public static Object bytesToObject(byte[] bytes, String label, ClassLoader loader)
public int compareEntries(DatabaseEntry entry1, DatabaseEntry entry2, boolean duplicates)
public int getBinDeltaPercent()
public ReplicationContext getRepContext()
Copyright © 2024. All rights reserved.