From ae9863bf787a34a276b4118239ea1946e1abc679 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Thu, 7 Jan 2010 00:10:17 +0000 Subject: Add option to keep old transaction log files. --- .../carbonado/repo/sleepycat/BDBRepository.java | 2 ++ .../repo/sleepycat/BDBRepositoryBuilder.java | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) (limited to 'src/main/java/com/amazon/carbonado/repo/sleepycat') diff --git a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java index 28fc347..dabb4fb 100644 --- a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java +++ b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java @@ -112,6 +112,7 @@ abstract class BDBRepository extends AbstractRepository private final Map, Integer> mDatabasePageSizes; final boolean mRunCheckpointer; + final boolean mKeepOldLogFiles; final boolean mRunDeadlockDetector; final File mDataHome; @@ -155,6 +156,7 @@ abstract class BDBRepository extends AbstractRepository mTxnMgr = new BDBTransactionManager(mExTransformer, this); mRunCheckpointer = !builder.getReadOnly() && builder.getRunCheckpointer(); + mKeepOldLogFiles = builder.getKeepOldLogFiles(); mRunDeadlockDetector = builder.getRunDeadlockDetector(); mStorableCodecFactory = builder.getStorableCodecFactory(); mPreShutdownHook = builder.getPreShutdownHook(); diff --git a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java index 0beea65..f3c80ae 100644 --- a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java +++ b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java @@ -108,6 +108,7 @@ public class BDBRepositoryBuilder extends AbstractRepositoryBuilder { private int mCheckpointInterval = DEFAULT_CHECKPOINT_INTERVAL; private int mCheckpointThresholdKB = 1024; private int mCheckpointThresholdMinutes = 5; + private boolean mKeepOldLogFiles; private boolean mRunDeadlockDetector = true; private Boolean mChecksumEnabled; private Object mInitialEnvConfig = null; @@ -741,6 +742,24 @@ public class BDBRepositoryBuilder extends AbstractRepositoryBuilder { return mCheckpointThresholdMinutes; } + /** + * By default, transaction log files are deleted when no longer needed. + * Keeping log files can be used for incremental backups or for diagnosing + * problems. If using BDB-JE, old log files are renamed with a ".del" + * extension. If using BDB-core, the db_archive utility is required for + * identifying old log files. + */ + public void setKeepOldLogFiles(boolean keep) { + mKeepOldLogFiles = keep; + } + + /** + * Returns false by default. + */ + public boolean getKeepOldLogFiles() { + return mKeepOldLogFiles; + } + /** * Disable automatic deadlock detection of database if another thread is * responsible for that. -- cgit v1.2.3