String path = DbEnvironment.getDataHome().concat(File.separator).concat(filename);
return new File(path).delete();
}
private void recoverWhenServerStart(boolean needRecovery) throws ChaiDBException {
TransactionRecover txnRecover;
if (needRecovery) {
System.out.println("[" + new Date().toString() + "] Database is recovering from an inconsistent status...");
// It is NOT a real sys error, just to make message about
// "begin recovery" visible even at the default log level.
// This is a request from Sequoia.
log.info("Begin normal recovery...");
long begin = System.currentTimeMillis();
txnRecover = Db.getTxnManager().setRecover(TransactionRecover.NORMAL_RECOVER);
try {
txnRecover.doRecover();
long end = System.currentTimeMillis();
System.out.println("[" + new Date().toString() + "] Recovery finished in " + ((end - begin) / 1000) + " seconds.");
log.info("Success of normal recovery!!!");
} catch (ChaiDBException e) {
System.out.println("[" + new Date().toString() + "] Failure to do recovery!!! Please refer to log file for more information.");