From 51b9ba90335acd3b99dd97418711f3ad6d162d79 Mon Sep 17 00:00:00 2001
From: abobrov <abobrov@localhost>
Date: Sat, 25 Aug 2007 22:32:55 +0000
Subject: [PATCH] - [Issue 2030] new configuration attribute to enforce entry compression:   allow for backend-compact-encoding property, enabled by default.

---
 opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/FileSystemEntryCacheConfiguration.xml |   32 ++++++++++++++++++++++++++++++++
 opendj-sdk/opends/src/server/org/opends/server/extensions/FileSystemEntryCache.java                |   12 +++++++++---
 opendj-sdk/opends/resource/schema/02-config.ldif                                                   |    5 +++--
 3 files changed, 44 insertions(+), 5 deletions(-)

diff --git a/opendj-sdk/opends/resource/schema/02-config.ldif b/opendj-sdk/opends/resource/schema/02-config.ldif
index 617b7e0..288c1e5 100644
--- a/opendj-sdk/opends/resource/schema/02-config.ldif
+++ b/opendj-sdk/opends/resource/schema/02-config.ldif
@@ -2140,8 +2140,9 @@
   SUP ds-cfg-entry-cache STRUCTURAL MAY ( ds-cfg-max-entries $
   ds-cfg-max-memory-size $ ds-cfg-lock-timeout $ ds-cfg-exclude-filter $
   ds-cfg-include-filter $ ds-cfg-cache-directory $ ds-cfg-cache-type $
-  ds-cfg-persistent-cache $ ds-cfg-database-cache-percent $
-  ds-cfg-database-cache-size ) X-ORIGIN 'OpenDS Directory Server' )
+  ds-cfg-persistent-cache $ ds-cfg-backend-compact-encoding $
+  ds-cfg-database-cache-percent $ ds-cfg-database-cache-size )
+  X-ORIGIN 'OpenDS Directory Server' )
 objectClasses: ( 1.3.6.1.4.1.26027.1.2.114 NAME 'ds-cfg-plugin-root'
   SUP top AUXILIARY MAY ( ds-cfg-plugin-order-startup $
   ds-cfg-plugin-order-shutdown $ ds-cfg-plugin-order-post-connect $
diff --git a/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/FileSystemEntryCacheConfiguration.xml b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/FileSystemEntryCacheConfiguration.xml
index 25a628f..2bccdb9 100644
--- a/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/FileSystemEntryCacheConfiguration.xml
+++ b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/FileSystemEntryCacheConfiguration.xml
@@ -217,6 +217,38 @@
     </adm:profile>
   </adm:property>
 
+  <adm:property name="backend-compact-encoding">
+    <adm:synopsis>
+      Indicates whether the cache should use a compact form when encoding
+      cache entries by compressing the attribute descriptions and object
+      class sets. Note that compression does not preserve user-supplied
+      capitalization in the object class and attribute type names.
+    </adm:synopsis>
+    <adm:requires-admin-action>
+      <adm:none>
+        <adm:synopsis>
+          Changing this property will only affect the encoding of the cache
+          entries put in the cache after the change is made. It will not be
+          retroactively applied to existing cache entries.
+        </adm:synopsis>
+      </adm:none>
+    </adm:requires-admin-action>
+    <adm:default-behavior>
+      <adm:defined>
+        <adm:value>true</adm:value>
+      </adm:defined>
+    </adm:default-behavior>
+    <adm:syntax>
+      <adm:boolean/>
+    </adm:syntax>
+    <adm:profile name="ldap">
+      <ldap:attribute>
+        <ldap:oid>1.3.6.1.4.1.26027.1.1.471</ldap:oid>
+        <ldap:name>ds-cfg-backend-compact-encoding</ldap:name>
+      </ldap:attribute>
+    </adm:profile>
+  </adm:property>
+
   <adm:property name="database-cache-percent">
     <adm:synopsis>
       The maximum memory usage for the internal JE cache as a percentage
diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/FileSystemEntryCache.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/FileSystemEntryCache.java
index 380c4f5..a75f5c7 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/FileSystemEntryCache.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/FileSystemEntryCache.java
@@ -212,9 +212,8 @@
   private long persistentEntriesRestored = 0;
 
   // The configuration to use when encoding entries in the database.
-  // TODO: make compression feature configurable.
-  private static EntryEncodeConfig encodeConfig =
-      new EntryEncodeConfig(true, false, false);
+  private EntryEncodeConfig encodeConfig =
+    new EntryEncodeConfig(true, false, false);
 
   /**
    * Creates a new instance of this entry cache.
@@ -1212,6 +1211,7 @@
     int                   newJECachePercent;
     long                  newJECacheSize;
     boolean               newPersistentCache;
+    boolean               newCompactEncoding;
     String                newCacheType = DEFAULT_FSCACHE_TYPE;
     String                newCacheHome = DEFAULT_FSCACHE_HOME;
 
@@ -1238,6 +1238,9 @@
     // Check if this cache is persistent.
     newPersistentCache = configuration.isPersistentCache();
 
+    // Check if this cache should use compact encoding.
+    newCompactEncoding = configuration.isBackendCompactEncoding();
+
     switch (errorHandler.getConfigPhase())
     {
     case PHASE_INIT:
@@ -1331,6 +1334,9 @@
       maxAllowedMemory = newMaxAllowedMemory;
       persistentCache  = newPersistentCache;
 
+      encodeConfig     = new EntryEncodeConfig(true,
+        newCompactEncoding, newCompactEncoding);
+
       setLockTimeout(newLockTimeout);
       setIncludeFilters(newIncludeFilters);
       setExcludeFilters(newExcludeFilters);

--
Gitblit v1.10.0