isReadOnly =
configManager.getBoolean(EnvironmentParams.ENV_RDONLY);
fileManager = new FileManager(this, envHome, isReadOnly);
if (!envConfig.getAllowCreate() && !fileManager.filesExist()) {
throw new DatabaseException
("Enviroment creation isn't allowed, " +
" but there is no pre-existing " +
" environment in " + envHome);
}
if (getConfigManager().
getBoolean(EnvironmentParams.ENV_FAIR_LATCHES)) {
logManager = new LatchedLogManager(this, isReadOnly);
} else {
logManager = new SyncedLogManager(this, isReadOnly);
}
inMemoryINs = new INList(this);
txnManager = new TxnManager(this);
/*
* Create the file utilization objects before creating the Cleaner
* or running recovery.
*/
utilizationTracker = new UtilizationTracker(this);
utilizationProfile =
new UtilizationProfile(this, utilizationTracker);
/*
* Daemons are always made here, but only started after recovery.
* We want them to exist so we can call them programatically even
* if the daemon thread is not started.
*/
createDaemons();
/*
* Recovery will recreate the dbMapTree from the log if it exists.
*/
dbMapTree = new DbTree(this);
referenceCount = 0;
triggerLatch = new SharedLatch(this, "TriggerLatch", this);
/*
* Do not do recovery and start daemons if this environment is for
* a utility.
*/
if (configManager.getBoolean(EnvironmentParams.ENV_RECOVERY)) {
/*
* Run recovery. Note that debug logging to the database log
* is disabled until recovery is finished.
*/
try {
RecoveryManager recoveryManager =
new RecoveryManager(this);
lastRecoveryInfo = recoveryManager.recover(isReadOnly);
} finally {
try {
/* Flush to get all exception tracing out to the log.*/
logManager.flush();
fileManager.clear();
} catch (IOException e) {
throw new DatabaseException(e.getMessage());
}
}
} else {
isReadOnly = true;
noComparators = true;