Modifier and Type | Field and Description |
---|---|
static boolean |
forceTreeWalkForTruncateAndRemove
For unit testing, setting this field to true will force a walk of the
tree to count utilization during truncate/remove, rather than using the
per-database info.
|
Constructor and Description |
---|
DatabaseImpl()
Create an empty database object for initialization from the log.
|
DatabaseImpl(java.lang.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
|
static java.util.Comparator<byte[]> |
bytesToComparator(byte[] comparatorBytes,
java.lang.String comparatorType)
Converts an arbitrary string of bytes to a comparator.
|
void |
checkIsDeleted(java.lang.String operation) |
void |
clearKeyPrefixing() |
void |
clearUtilizationRepairDone()
Is public for unit testing.
|
DatabaseImpl |
cloneDatabase()
Create a clone of this database that can be used as the new empty
database when truncating this database.
|
long |
count()
Count entries in the database including dups, but don't dirty the cache.
|
void |
countObsoleteDb(BaseUtilizationTracker tracker,
long mapLnLsn)
Counts all active LSNs in a database as obsolete.
|
void |
dumpLog(java.lang.StringBuffer sb,
boolean verbose)
Write the object into the string buffer for log dumping.
|
java.lang.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.
|
void |
finishDeleteProcessing()
Release the INs for the deleted database, count all log entries for this
database as obsolete, delete the MapLN, and set the state to DELETED.
|
int |
getAdditionalTreeMemorySize()
Returns the tree memory size that should be added to MAPLN_OVERHEAD.
|
int |
getBinDeltaPercent() |
int |
getBinMaxDeltas() |
java.util.Comparator<byte[]> |
getBtreeComparator() |
boolean |
getBtreeComparatorByClass() |
EnvironmentImpl |
getDbEnvironment() |
DbFileSummaryMap |
getDbFileSummaries()
For unit testing.
|
DbFileSummary |
getDbFileSummary(java.lang.Long fileNum,
boolean willModify)
Returns the DbFileSummary for the given file, allocates it if
necessary and budgeted memory for any changes.
|
java.lang.String |
getDebugName() |
java.util.Comparator<byte[]> |
getDuplicateComparator() |
boolean |
getDuplicateComparatorByClass() |
DatabaseStats |
getEmptyStats() |
long |
getEofNodeId() |
DatabaseId |
getId() |
boolean |
getKeyPrefixing() |
int |
getLogSize()
This log entry type is configured to perform marshaling (getLogSize and
writeToLog) under the write log mutex.
|
java.lang.String |
getName() |
int |
getNodeMaxDupTreeEntries() |
int |
getNodeMaxEntries() |
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() |
long |
getTreeAdminMemory()
Figure out how much memory is used by the DbFileSummaryMap.
|
boolean |
getUtilizationRepairDone()
Is public for unit testing.
|
void |
handleClosed(boolean doSyncDw)
Called after a handle onto this DB is closed.
|
boolean |
hasOpenHandles()
Returns whether one or more handles are open.
|
static java.util.Comparator<byte[]> |
instantiateComparator(java.lang.Class<? extends java.util.Comparator<byte[]>> comparatorClass,
java.lang.String comparatorType)
Used both to read from the log and to validate a comparator when set in
DatabaseConfig.
|
static java.util.Comparator<byte[]> |
instantiateComparator(java.util.Comparator<byte[]> comparator,
java.lang.String comparatorType)
Used 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 |
isDeleted() |
boolean |
isDeleteFinished() |
boolean |
isDirtyUtilization()
Returns whether this database has new (unflushed) utilization info.
|
boolean |
isDurableDeferredWrite() |
boolean |
isInUse()
Returns whether this DB is in use and cannot be evicted.
|
boolean |
isReplicated() |
boolean |
isTemporary() |
static boolean |
isTemporary(byte flagVal) |
boolean |
isTransactional() |
boolean |
logicalEquals(Loggable other) |
static byte[] |
objectToBytes(java.lang.Object obj,
java.lang.String comparatorType)
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(java.nio.ByteBuffer itemBuffer,
byte entryVersion)
Initialize this object from the data in itemBuf.
|
void |
releaseTreeAdminMemory()
Update memory budgets when this databaseImpl is closed and will never be
accessed again or when it is still open when its owning MapLN will be
garbage collected, due to eviction or recovery.
|
boolean |
removeDbFileSummary(java.lang.Long fileNum)
Removes the DbFileSummary for the given file.
|
void |
removeReferringHandle(Database db)
Decrement the reference count.
|
boolean |
setBtreeComparator(java.util.Comparator<byte[]> comparator,
boolean byClassName)
Set the btree comparison function for this database.
|
void |
setDebugDatabaseName(java.lang.String debugName) |
void |
setDeferredWrite(boolean durableDeferredWrite)
Sets the deferred write property for the first opened handle.
|
void |
setDirtyUtilization()
Sets utilization dirty in order to force the MapLN to be flushed later.
|
boolean |
setDuplicateComparator(java.util.Comparator<byte[]> comparator,
boolean byClassName)
Set the duplicate comparison function for this database.
|
void |
setEnvironmentImpl(EnvironmentImpl envImpl)
Set the db environment after reading in the DatabaseImpl from the log.
|
void |
setKeyPrefixing() |
void |
setPendingDeletedHook(TestHook hook) |
void |
setSortedDuplicates() |
void |
setTransactional(boolean transactional)
Sets the transactional property for the first opened handle.
|
void |
startAndFinishDelete()
Perform the entire two-step database deletion.
|
void |
startDeleteProcessing()
The delete cleanup is starting.
|
DatabaseStats |
stat(StatsConfig config) |
void |
sync(boolean flushLog)
Flush all dirty nodes for this database to disk.
|
boolean |
unknownReplicated() |
boolean |
verify(VerifyConfig config,
DatabaseStats emptyStats) |
void |
writeToLog(java.nio.ByteBuffer logBuffer)
Serialize this object into the buffer.
|
public static boolean forceTreeWalkForTruncateAndRemove
public DatabaseImpl(java.lang.String dbName, DatabaseId id, EnvironmentImpl envImpl, DatabaseConfig dbConfig) throws DatabaseException
DatabaseException
public DatabaseImpl() throws DatabaseException
DatabaseException
public void setDebugDatabaseName(java.lang.String debugName)
public java.lang.String getDebugName()
public void setPendingDeletedHook(TestHook hook)
public DatabaseImpl cloneDatabase()
public Tree getTree()
public DatabaseId getId()
public long getEofNodeId()
public boolean isTransactional()
public void setTransactional(boolean transactional)
public boolean isTemporary()
public static boolean isTemporary(byte flagVal)
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 getKeyPrefixing()
public void setKeyPrefixing()
public void clearKeyPrefixing()
public boolean isReplicated()
public boolean unknownReplicated()
public boolean getUtilizationRepairDone()
public void clearUtilizationRepairDone()
public int getNodeMaxEntries()
public int getNodeMaxDupTreeEntries()
public int getAdditionalTreeMemorySize()
public boolean setDuplicateComparator(java.util.Comparator<byte[]> comparator, boolean byClassName) throws DatabaseException
duplicateComparator
- - The Duplicate Comparison function.DatabaseException
public boolean setBtreeComparator(java.util.Comparator<byte[]> comparator, boolean byClassName) throws DatabaseException
btreeComparator
- - The btree Comparison function.DatabaseException
public java.util.Comparator<byte[]> getBtreeComparator()
public java.util.Comparator<byte[]> getDuplicateComparator()
public boolean getBtreeComparatorByClass()
public boolean getDuplicateComparatorByClass()
public void setEnvironmentImpl(EnvironmentImpl envImpl) throws DatabaseException
DatabaseException
public EnvironmentImpl getDbEnvironment()
public boolean hasOpenHandles()
public void addReferringHandle(Database db)
public void removeReferringHandle(Database db)
public void handleClosed(boolean doSyncDw) throws DatabaseException
DatabaseException
public long getTreeAdminMemory()
public void releaseTreeAdminMemory()
public boolean isInUse()
public void sync(boolean flushLog) throws DatabaseException
DatabaseException
public Database findPrimaryDatabase() throws DatabaseException
DatabaseException
public java.lang.String getName() throws DatabaseException
DatabaseException
public DbFileSummary getDbFileSummary(java.lang.Long fileNum, boolean willModify)
Must be called under the log write latch.
willModify
- if true, the caller will modify the utilization info.public boolean removeDbFileSummary(java.lang.Long fileNum)
Must be called under the log write latch.
public DbFileSummaryMap getDbFileSummaries()
public boolean isDirtyUtilization()
public void setDirtyUtilization()
public boolean isCheckpointNeeded()
public boolean isDeleted()
public boolean isDeleteFinished()
public void startDeleteProcessing()
public void startAndFinishDelete() throws DatabaseException
DatabaseException
public void finishDeleteProcessing() throws DatabaseException
DatabaseException
public void checkIsDeleted(java.lang.String operation) throws DatabaseException
DatabaseException
public void countObsoleteDb(BaseUtilizationTracker tracker, long mapLnLsn)
mapLnLsn
- is the LSN of the MapLN when called via recovery,
otherwise is NULL_LSN.
Must be called under the log write latch or during recovery.
public DatabaseStats stat(StatsConfig config) throws DatabaseException
DatabaseException
public boolean verify(VerifyConfig config, DatabaseStats emptyStats) throws DatabaseException
DatabaseException
public DatabaseStats getEmptyStats()
public PreloadStats preload(PreloadConfig config) throws DatabaseException
DatabaseException
public long count() throws DatabaseException
DatabaseException
public java.lang.String dumpString(int nSpaces)
public int getLogSize()
getLogSize
in interface Loggable
Loggable.getLogSize()
public void writeToLog(java.nio.ByteBuffer logBuffer)
Loggable
writeToLog
in interface Loggable
logBuffer
- is the destination bufferLoggable.writeToLog(java.nio.ByteBuffer)
public void readFromLog(java.nio.ByteBuffer itemBuffer, byte entryVersion) throws LogException
Loggable
readFromLog
in interface Loggable
LogException
Loggable.readFromLog(java.nio.ByteBuffer, byte)
public void dumpLog(java.lang.StringBuffer sb, boolean verbose)
Loggable
dumpLog
in interface Loggable
sb
- destination string bufferverbose
- if true, dump the full, verbose versionLoggable.dumpLog(java.lang.StringBuffer, boolean)
public long getTransactionId()
getTransactionId
in interface Loggable
Loggable.getTransactionId()
public boolean logicalEquals(Loggable other)
logicalEquals
in interface Loggable
Always return false, this item should never be compared.
public static java.util.Comparator<byte[]> instantiateComparator(java.lang.Class<? extends java.util.Comparator<byte[]>> comparatorClass, java.lang.String comparatorType) throws LogException
LogException
public static java.util.Comparator<byte[]> instantiateComparator(java.util.Comparator<byte[]> comparator, java.lang.String comparatorType) throws DatabaseException
DatabaseException
public static byte[] objectToBytes(java.lang.Object obj, java.lang.String comparatorType) throws LogException
LogException
public static java.util.Comparator<byte[]> bytesToComparator(byte[] comparatorBytes, java.lang.String comparatorType) throws LogException, java.lang.ClassNotFoundException
LogException
java.lang.ClassNotFoundException
public int getBinDeltaPercent()
public int getBinMaxDeltas()
public ReplicationContext getRepContext()