public class DbTree extends java.lang.Object implements Loggable
| Modifier and Type | Field and Description |
|---|---|
static DatabaseId |
ID_DB_ID |
static DatabaseId |
NAME_DB_ID |
static int |
NEG_DB_ID_START |
static java.lang.String |
REP_OPERATIONS_NAME |
static java.lang.String |
UTILIZATION_DB_NAME |
static java.lang.String |
VLSN_MAP_DB_NAME |
| Constructor and Description |
|---|
DbTree()
Create a dbTree from the log.
|
DbTree(EnvironmentImpl env,
boolean replicationIntended)
Create a new dbTree for a new environment.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Release resources and update memory budget.
|
DatabaseImpl |
createClientDb(Locker locker,
java.lang.String databaseName,
DatabaseConfig dbConfig,
NameLN replicatedLN,
ReplicationContext repContext)
Create a replicated database on this client node.
|
DatabaseImpl |
createDb(Locker locker,
java.lang.String databaseName,
DatabaseConfig dbConfig,
Database databaseHandle)
Creates a new database object given a database name.
|
DatabaseImpl |
createInternalDb(Locker locker,
java.lang.String databaseName,
DatabaseConfig dbConfig)
Create a database for internal use that will never be replicated.
|
void |
dbRemove(Locker locker,
java.lang.String databaseName,
DatabaseId checkId)
Remove the database by deleting the nameLN.
|
boolean |
dbRename(Locker locker,
java.lang.String databaseName,
java.lang.String newName)
Return true if the operation succeeded, false otherwise.
|
(package private) void |
deleteMapLN(DatabaseId id) |
void |
dump()
For debugging.
|
void |
dumpLog(java.lang.StringBuffer sb,
boolean verbose)
Write the object into the string buffer for log dumping.
|
(package private) java.lang.String |
dumpString(int nSpaces) |
DatabaseImpl |
getDb(DatabaseId dbId)
Get a database object based on an id only.
|
DatabaseImpl |
getDb(DatabaseId dbId,
long lockTimeout)
Get a database object based on an id only.
|
DatabaseImpl |
getDb(DatabaseId dbId,
long lockTimeout,
java.util.Map<DatabaseId,DatabaseImpl> dbCache)
Get a database object based on an id only, caching the id-db mapping in
the given map.
|
DatabaseImpl |
getDb(DatabaseId dbId,
long lockTimeout,
java.lang.String dbNameIfAvailable)
Get a database object based on an id only.
|
DatabaseImpl |
getDb(Locker nameLocker,
java.lang.String databaseName,
Database databaseHandle)
Get a database object given a database name.
|
java.lang.String |
getDbName(DatabaseId id)
Return the database name for a given db.
|
java.util.List<java.lang.String> |
getDbNames() |
java.util.Map<DatabaseId,java.lang.String> |
getDbNamesAndIds() |
int |
getHighestLevel() |
int |
getHighestLevel(DatabaseImpl dbImpl) |
java.util.List<java.lang.String> |
getInternalDbNames()
Return a list of the names of internally used databases.
|
java.util.List<java.lang.String> |
getInternalNoLookupDbNames()
Return a list of the names of internally used databases that
don't get looked up through the naming tree.
|
int |
getLastLocalDbId()
The last allocated local and replicated db ids are used for ckpts.
|
int |
getLastReplicatedDbId() |
int |
getLogSize() |
long |
getTransactionId() |
(package private) long |
getTreeAdminMemory() |
(package private) void |
initExistingEnvironment(EnvironmentImpl envImpl,
boolean replicationIntended)
Initialize the db tree during recovery, after instantiating the tree
from the log.
|
static boolean |
isReservedDbName(java.lang.String name)
Returns true if the name is a reserved JE database name.
|
boolean |
logicalEquals(Loggable other) |
void |
modifyDbRoot(DatabaseImpl db)
Write the MapLN to disk.
|
void |
modifyDbRoot(DatabaseImpl db,
long ifBeforeLsn,
boolean mustExist)
Write a MapLN to the log in order to:
- propagate a root change
- save per-db utilization information
- save database config information.
|
void |
optionalModifyDbRoot(DatabaseImpl db)
Check deferred write settings before writing the MapLN.
|
void |
readFromLog(java.nio.ByteBuffer itemBuffer,
byte entryVersion)
Initialize this object from the data in itemBuf.
|
void |
rebuildINListMapDb()
Rebuild the IN list after recovery.
|
void |
releaseDb(DatabaseImpl db)
Decrements the use count of the given DB, allowing it to be evicted if
the use count reaches zero.
|
void |
releaseDbs(java.util.Map<DatabaseId,DatabaseImpl> dbCache)
Calls releaseDb for all DBs in the given map of DatabaseId to
DatabaseImpl.
|
void |
setLastDbId(int lastReplicatedDbId,
int lastLocalDbId)
Initialize the db ids, from recovery.
|
java.lang.String |
toString() |
long |
truncate(Locker locker,
java.lang.String databaseName,
boolean returnCount)
To truncate, remove the database named by databaseName and
create a new database in its place.
|
void |
updateFromReplay(DatabaseId replayDbId) |
boolean |
verify(VerifyConfig config,
java.io.PrintStream out) |
void |
writeToLog(java.nio.ByteBuffer logBuffer)
This log entry type is configured to perform marshaling (getLogSize and
writeToLog) under the write log mutex.
|
public static final DatabaseId ID_DB_ID
public static final DatabaseId NAME_DB_ID
public static final java.lang.String UTILIZATION_DB_NAME
public static final java.lang.String REP_OPERATIONS_NAME
public static final java.lang.String VLSN_MAP_DB_NAME
public static final int NEG_DB_ID_START
public DbTree()
throws DatabaseException
DatabaseExceptionpublic DbTree(EnvironmentImpl env, boolean replicationIntended) throws DatabaseException
DatabaseExceptionpublic int getLastLocalDbId()
public int getLastReplicatedDbId()
public void setLastDbId(int lastReplicatedDbId,
int lastLocalDbId)
public void updateFromReplay(DatabaseId replayDbId)
void initExistingEnvironment(EnvironmentImpl envImpl, boolean replicationIntended) throws DatabaseException
DatabaseExceptionpublic DatabaseImpl createDb(Locker locker, java.lang.String databaseName, DatabaseConfig dbConfig, Database databaseHandle) throws DatabaseException
DatabaseExceptionpublic DatabaseImpl createInternalDb(Locker locker, java.lang.String databaseName, DatabaseConfig dbConfig) throws DatabaseException
DatabaseExceptionpublic DatabaseImpl createClientDb(Locker locker, java.lang.String databaseName, DatabaseConfig dbConfig, NameLN replicatedLN, ReplicationContext repContext) throws DatabaseException
DatabaseExceptionpublic void optionalModifyDbRoot(DatabaseImpl db) throws DatabaseException
db - the database represented by this MapLNDatabaseExceptionpublic void modifyDbRoot(DatabaseImpl db) throws DatabaseException
db - the database represented by this MapLNDatabaseExceptionpublic void modifyDbRoot(DatabaseImpl db, long ifBeforeLsn, boolean mustExist) throws DatabaseException
db - the database whose root is held by this MapLNifBeforeLsn - if argument is not NULL_LSN, only do the write if
this MapLN's current LSN is before isBeforeLSN.if - true, throw DatabaseException if the DB does not exist; if
false, silently do nothing.DatabaseExceptionpublic boolean dbRename(Locker locker, java.lang.String databaseName, java.lang.String newName) throws DatabaseException
DatabaseExceptionpublic void dbRemove(Locker locker, java.lang.String databaseName, DatabaseId checkId) throws DatabaseException
DatabaseExceptionpublic long truncate(Locker locker, java.lang.String databaseName, boolean returnCount) throws DatabaseException
returnCount - if true, must return the count of records in the
database, which can be an expensive option.DatabaseExceptionvoid deleteMapLN(DatabaseId id) throws DatabaseException
DatabaseExceptionpublic DatabaseImpl getDb(Locker nameLocker, java.lang.String databaseName, Database databaseHandle) throws DatabaseException
nameLocker - is used to access the NameLN. As always, a NullTxn
is used to access the MapLN.databaseName - target databaseDatabaseExceptionpublic DatabaseImpl getDb(DatabaseId dbId) throws DatabaseException
DatabaseExceptionpublic DatabaseImpl getDb(DatabaseId dbId, long lockTimeout) throws DatabaseException
DatabaseExceptionpublic DatabaseImpl getDb(DatabaseId dbId, long lockTimeout, java.util.Map<DatabaseId,DatabaseImpl> dbCache) throws DatabaseException
DatabaseExceptionpublic DatabaseImpl getDb(DatabaseId dbId, long lockTimeout, java.lang.String dbNameIfAvailable) throws DatabaseException
DatabaseExceptionpublic void releaseDb(DatabaseImpl db)
public void releaseDbs(java.util.Map<DatabaseId,DatabaseImpl> dbCache)
public void rebuildINListMapDb()
throws DatabaseException
DatabaseExceptionpublic boolean verify(VerifyConfig config, java.io.PrintStream out) throws DatabaseException
DatabaseExceptionpublic java.lang.String getDbName(DatabaseId id) throws DatabaseException
DatabaseExceptionpublic java.util.Map<DatabaseId,java.lang.String> getDbNamesAndIds() throws DatabaseException
DatabaseExceptionpublic java.util.List<java.lang.String> getDbNames()
throws DatabaseException
DatabaseExceptionpublic java.util.List<java.lang.String> getInternalNoLookupDbNames()
public java.util.List<java.lang.String> getInternalDbNames()
public static boolean isReservedDbName(java.lang.String name)
public int getHighestLevel()
throws DatabaseException
DatabaseExceptionpublic int getHighestLevel(DatabaseImpl dbImpl) throws DatabaseException
DatabaseExceptionpublic void close()
long getTreeAdminMemory()
public int getLogSize()
getLogSize in interface LoggableLoggable.getLogSize()public void writeToLog(java.nio.ByteBuffer logBuffer)
writeToLog in interface LoggablelogBuffer - is the destination bufferLoggable.writeToLog(java.nio.ByteBuffer)public void readFromLog(java.nio.ByteBuffer itemBuffer,
byte entryVersion)
throws LogException
LoggablereadFromLog in interface LoggableLogExceptionLoggable.readFromLog(java.nio.ByteBuffer, byte)public void dumpLog(java.lang.StringBuffer sb,
boolean verbose)
LoggabledumpLog in interface Loggablesb - destination string bufferverbose - if true, dump the full, verbose versionLoggable.dumpLog(java.lang.StringBuffer, 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.java.lang.String dumpString(int nSpaces)
public java.lang.String toString()
toString in class java.lang.Objectpublic void dump()
throws DatabaseException
DatabaseExceptionCopyright (c) 2004,2008 Oracle. All rights reserved.