From b09d699e28b94d80406c4de4c931b61462eabede Mon Sep 17 00:00:00 2001
From: Yannick Lecaillez <yannick.lecaillez@forgerock.com>
Date: Fri, 12 Jun 2015 15:37:17 +0000
Subject: [PATCH] OPENDJ-2136: Add a configuration option for checkpoint interval in PDB

---
 opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pdb/PDBStorage.java                                |    1 +
 opendj-sdk/opendj-maven-plugin/src/main/resources/config/xml/org/forgerock/opendj/server/config/PDBBackendConfiguration.xml |   25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/opendj-sdk/opendj-maven-plugin/src/main/resources/config/xml/org/forgerock/opendj/server/config/PDBBackendConfiguration.xml b/opendj-sdk/opendj-maven-plugin/src/main/resources/config/xml/org/forgerock/opendj/server/config/PDBBackendConfiguration.xml
index aaca5fd..b032638 100644
--- a/opendj-sdk/opendj-maven-plugin/src/main/resources/config/xml/org/forgerock/opendj/server/config/PDBBackendConfiguration.xml
+++ b/opendj-sdk/opendj-maven-plugin/src/main/resources/config/xml/org/forgerock/opendj/server/config/PDBBackendConfiguration.xml
@@ -246,4 +246,29 @@
           </ldap:attribute>
       </adm:profile>
   </adm:property>
+  <adm:property name="db-checkpoint-interval" advanced="true">
+  	  <adm:synopsis>
+        Checkpoint interval in seconds
+      </adm:synopsis>
+      <adm:description>
+        This setting controls the elapsed time between attempts to write 
+        a checkpoint to the journal. A longer interval allows more updates
+        to accumulate in buffers before they are required to be written to
+        disk, but also potentially causes recovery from an abrupt termination
+        (crash) to take more time.
+      </adm:description>
+      <adm:default-behavior>
+          <adm:defined>
+              <adm:value>15</adm:value>
+          </adm:defined>
+      </adm:default-behavior>
+      <adm:syntax>
+          <adm:size lower-limit="0" />
+      </adm:syntax>
+      <adm:profile name="ldap">
+          <ldap:attribute>
+              <ldap:name>ds-cfg-db-checkpoint-interval</ldap:name>
+          </ldap:attribute>
+      </adm:profile>
+  </adm:property>
 </adm:managed-object>
diff --git a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pdb/PDBStorage.java b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pdb/PDBStorage.java
index 9c3fd88..0fc0fa9 100644
--- a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pdb/PDBStorage.java
+++ b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pdb/PDBStorage.java
@@ -693,6 +693,7 @@
     final Configuration dbCfg = new Configuration();
     dbCfg.setLogFile(new File(backendDirectory, VOLUME_NAME + ".log").getPath());
     dbCfg.setJournalPath(new File(backendDirectory, JOURNAL_NAME).getPath());
+    dbCfg.setCheckpointInterval(config.getDBCheckpointInterval());
     dbCfg.setVolumeList(asList(new VolumeSpecification(new File(backendDirectory, VOLUME_NAME).getPath(), null,
         BUFFER_SIZE, 4096, Long.MAX_VALUE / BUFFER_SIZE, 2048, true, false, false)));
     final BufferPoolConfiguration bufferPoolCfg = getBufferPoolCfg(dbCfg);

--
Gitblit v1.10.0