From de037ad4b5e3b78a1ecc2f3e14fffc0a1d994bcb Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Mon, 14 Jun 2010 15:53:03 +0000 Subject: Add sync option to CheckpointCapability. --- .../com/amazon/carbonado/repo/sleepycat/BDBRepository.java | 13 +++++++++++++ .../carbonado/repo/sleepycat/CheckpointCapability.java | 10 ++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'src/main/java/com/amazon/carbonado') 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 extends AbstractRepository } } + public void sync() throws PersistException { + try { + env_sync(); + } catch (Exception e) { + throw toPersistException(e); + } + } + public Repository getRootRepository() { return mRootRef.get(); } @@ -652,6 +660,11 @@ abstract class BDBRepository extends AbstractRepository */ 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 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; } -- cgit v1.2.3