(EnvironmentParams.ENV_RUN_CLEANER.getName(), "false");
}
recoveryStart = System.currentTimeMillis();
Environment env =
new Environment(new File(envHome), envConfig);
CheckpointConfig forceConfig = new CheckpointConfig();
forceConfig.setForce(true);
Thread statsPrinter = null;
if (printStats) {
statsPrinter = new StatsPrinter(env);
statsPrinter.start();
}
boolean promptForShutdown = false;
actionStart = System.currentTimeMillis();
switch(doAction) {
case BATCH_CLEAN:
/* Since this is batch cleaning, repeat until no progress. */
while (true) {
int nFiles = env.cleanLog();
System.out.println("Files cleaned: " + nFiles);
if (nFiles == 0) {
break;
}
}
env.checkpoint(forceConfig);
break;
case COMPRESS:
env.compress();
break;
case CHECKPOINT:
env.checkpoint(forceConfig);
break;
case EVICT:
preload(env, dbName);
break;
case REMOVEDB:
removeAndClean(env, dbName, false);
break;
case REMOVEDB_AND_CLEAN:
removeAndClean(env, dbName, true);
break;
case ACTIVATE_CLEANER_THREADS:
EnvironmentImpl envImpl =
DbInternal.getEnvironmentImpl(env);
envImpl.getCleaner().wakeup();
promptForShutdown = true;
break;
case VERIFY_UTILIZATION:
EnvironmentImpl envImpl2 =
DbInternal.getEnvironmentImpl(env);
VerifyUtils. verifyUtilization
(envImpl2,
true, // expectAccurateObsoleteLNCount
true, // expectAccurateObsoleteLNSize
true); // expectAccurateDbUtilization
break;
}
actionEnd = System.currentTimeMillis();
if (promptForShutdown) {
/*
* If the requested action is a daemon driven one, we don't
* want the main thread to shutdown the environment until we
* say we're ready
*/
waitForShutdown();
}
if (statsPrinter != null) {
statsPrinter.interrupt();
statsPrinter.join();
}
env.close();
} catch (Exception e) {
e.printStackTrace();
System.out.println(e.getMessage());
usage();
System.exit(1);