diff options
author | Brian S. O'Neill <bronee@gmail.com> | 2010-06-14 15:53:03 +0000 |
---|---|---|
committer | Brian S. O'Neill <bronee@gmail.com> | 2010-06-14 15:53:03 +0000 |
commit | de037ad4b5e3b78a1ecc2f3e14fffc0a1d994bcb (patch) | |
tree | f9da05f1dbd94d52e99f783453686d154a3daa18 /src/main/java/com/amazon/carbonado | |
parent | a8b0ca6059e125ebc34411b90768c672250392f3 (diff) |
Add sync option to CheckpointCapability.
Diffstat (limited to 'src/main/java/com/amazon/carbonado')
-rw-r--r-- | src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java | 13 | ||||
-rw-r--r-- | src/main/java/com/amazon/carbonado/repo/sleepycat/CheckpointCapability.java | 10 |
2 files changed, 21 insertions, 2 deletions
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 baaddf3..b423ab9 100644 --- a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java +++ b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java @@ -331,6 +331,14 @@ abstract class BDBRepository<Txn> extends AbstractRepository<Txn> }
}
+ public void sync() throws PersistException {
+ try {
+ env_sync();
+ } catch (Exception e) {
+ throw toPersistException(e);
+ }
+ }
+
public Repository getRootRepository() {
return mRootRef.get();
}
@@ -653,6 +661,11 @@ abstract class BDBRepository<Txn> extends AbstractRepository<Txn> abstract void env_checkpoint() throws Exception;
/**
+ * Synchronously flush changes to stable storage.
+ */
+ abstract void env_sync() throws Exception;
+
+ /**
* @param kBytes run checkpoint if at least this many kilobytes in log
* @param minutes run checkpoint if at least this many minutes passed since
* last checkpoint
diff --git a/src/main/java/com/amazon/carbonado/repo/sleepycat/CheckpointCapability.java b/src/main/java/com/amazon/carbonado/repo/sleepycat/CheckpointCapability.java index 354655e..f27d6e3 100644 --- a/src/main/java/com/amazon/carbonado/repo/sleepycat/CheckpointCapability.java +++ b/src/main/java/com/amazon/carbonado/repo/sleepycat/CheckpointCapability.java @@ -54,8 +54,14 @@ public interface CheckpointCapability extends Capability { * disabled. If a checkpoint is in progress, then this method will block
* until it is finished, and then run another checkpoint. This method does
* not return until the requested checkpoint has finished.
- *
- * @throws PersistDeniedException if disabled during a hot backup
*/
void forceCheckpoint() throws PersistException;
+
+ /**
+ * Synchronously flushes changes to stable storage, which is cheaper than
+ * performing a checkpoint.
+ *
+ * @since 1.2.2
+ */
+ void sync() throws PersistException;
}
|