From d12cc90fc15f432f43abc394b4090f9b4f7b2a03 Mon Sep 17 00:00:00 2001
From: Fabio Pistolesi <fabio.pistolesi@forgerock.com>
Date: Mon, 11 May 2015 16:48:09 +0000
Subject: [PATCH] OPENDJ-1869 CR-6727 Fix NPE in EntryCachePreloader.EntryCacheCollector
---
opendj-server-legacy/src/admin/messages/GlobalCfgDefn_zh_CN.properties | 1
opendj-server-legacy/src/main/docbkx/admin-guide/chap-tuning.xml | 21 --
opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java | 2
opendj-server-legacy/tests/unit-tests-testng/resource/config-small.ldif | 3
opendj-server-legacy/src/main/java/org/opends/server/backends/RootDSEBackend.java | 6
opendj-server-legacy/src/admin/messages/GlobalCfgDefn_es.properties | 1
opendj-server-legacy/src/main/java/org/opends/server/backends/MonitorBackend.java | 7
opendj-server-legacy/src/main/java/org/opends/server/backends/ChangelogBackend.java | 7
opendj-server-legacy/src/main/java/org/opends/server/backends/MemoryBackend.java | 6
opendj-server-legacy/resource/schema/02-config.ldif | 7
opendj-server-legacy/src/admin/messages/GlobalCfgDefn_ko.properties | 1
opendj-server-legacy/src/admin/messages/GlobalCfgDefn_zh_TW.properties | 1
opendj-server-legacy/src/admin/messages/GlobalCfgDefn.properties | 1
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/PluggableBackendImplTestCase.java | 16 -
opendj-server-legacy/resource/config/config.ldif | 1
opendj-server-legacy/src/main/java/org/opends/server/backends/LDIFBackend.java | 6
opendj-maven-plugin/src/main/resources/config/xml/org/forgerock/opendj/server/config/GlobalConfiguration.xml | 23 --
opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java | 6
opendj-server-legacy/src/main/java/org/opends/server/backends/BackupBackend.java | 6
opendj-server-legacy/src/admin/messages/GlobalCfgDefn_ja.properties | 1
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ReadOnlyConfigFileHandler.java | 6
opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskBackend.java | 7
opendj-server-legacy/src/admin/messages/GlobalCfgDefn_fr.properties | 1
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/BackendImpl.java | 8 -
opendj-server-legacy/src/main/java/org/opends/server/backends/NullBackend.java | 6
opendj-server-legacy/src/main/java/org/opends/server/core/EntryCacheConfigManager.java | 24 ---
opendj-server-legacy/src/main/java/org/opends/server/api/Backend.java | 14 -
/dev/null | 248 -------------------------------
opendj-server-legacy/src/admin/messages/GlobalCfgDefn_de.properties | 1
opendj-server-legacy/src/main/java/org/opends/server/extensions/ConfigFileHandler.java | 6
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/BackendImpl.java | 9 -
opendj-server-legacy/src/main/java/org/opends/server/backends/TrustStoreBackend.java | 6
32 files changed, 5 insertions(+), 454 deletions(-)
diff --git a/opendj-maven-plugin/src/main/resources/config/xml/org/forgerock/opendj/server/config/GlobalConfiguration.xml b/opendj-maven-plugin/src/main/resources/config/xml/org/forgerock/opendj/server/config/GlobalConfiguration.xml
index 5b82a43..09f9252 100644
--- a/opendj-maven-plugin/src/main/resources/config/xml/org/forgerock/opendj/server/config/GlobalConfiguration.xml
+++ b/opendj-maven-plugin/src/main/resources/config/xml/org/forgerock/opendj/server/config/GlobalConfiguration.xml
@@ -23,7 +23,7 @@
!
!
! Copyright 2007-2010 Sun Microsystems, Inc.
- ! Portions Copyright 2011-2014 ForgeRock AS
+ ! Portions Copyright 2011-2015 ForgeRock AS
! -->
<adm:managed-object name="global" plural-name="globals"
package="org.forgerock.opendj.server.config"
@@ -799,27 +799,6 @@
</ldap:attribute>
</adm:profile>
</adm:property>
- <adm:property name="entry-cache-preload" mandatory="false">
- <adm:synopsis>
- Indicates whether or not to preload the entry cache on startup.
- </adm:synopsis>
- <adm:requires-admin-action>
- <adm:server-restart />
- </adm:requires-admin-action>
- <adm:default-behavior>
- <adm:defined>
- <adm:value>false</adm:value>
- </adm:defined>
- </adm:default-behavior>
- <adm:syntax>
- <adm:boolean />
- </adm:syntax>
- <adm:profile name="ldap">
- <ldap:attribute>
- <ldap:name>ds-cfg-entry-cache-preload</ldap:name>
- </ldap:attribute>
- </adm:profile>
- </adm:property>
<adm:property name="max-allowed-client-connections">
<adm:synopsis>
Specifies the maximum number of client connections that may be
diff --git a/opendj-server-legacy/resource/config/config.ldif b/opendj-server-legacy/resource/config/config.ldif
index 48bfeb9..1375b38 100644
--- a/opendj-server-legacy/resource/config/config.ldif
+++ b/opendj-server-legacy/resource/config/config.ldif
@@ -51,7 +51,6 @@
ds-cfg-idle-time-limit: 0 seconds
ds-cfg-save-config-on-successful-startup: true
ds-cfg-etime-resolution: milliseconds
-ds-cfg-entry-cache-preload: false
ds-cfg-max-allowed-client-connections: 0
ds-cfg-max-psearches: -1
ds-cfg-allowed-task: org.opends.server.tasks.AddSchemaFileTask
diff --git a/opendj-server-legacy/resource/schema/02-config.ldif b/opendj-server-legacy/resource/schema/02-config.ldif
index bf239ae..8aed135 100644
--- a/opendj-server-legacy/resource/schema/02-config.ldif
+++ b/opendj-server-legacy/resource/schema/02-config.ldif
@@ -2577,12 +2577,6 @@
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
SINGLE-VALUE
X-ORIGIN 'OpenDS Directory Server' )
-attributeTypes: ( 1.3.6.1.4.1.26027.1.1.446
- NAME 'ds-cfg-entry-cache-preload'
- EQUALITY booleanMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
- SINGLE-VALUE
- X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.447
NAME 'ds-cfg-num-update-replay-threads'
EQUALITY integerMatch
@@ -4245,7 +4239,6 @@
ds-cfg-workflow-configuration-mode $
ds-cfg-save-config-on-successful-startup $
ds-cfg-etime-resolution $
- ds-cfg-entry-cache-preload $
ds-cfg-max-allowed-client-connections $
ds-cfg-max-psearches $
ds-cfg-max-internal-buffer-size )
diff --git a/opendj-server-legacy/src/admin/messages/GlobalCfgDefn.properties b/opendj-server-legacy/src/admin/messages/GlobalCfgDefn.properties
index ab1e2ea..c8eb9c9 100644
--- a/opendj-server-legacy/src/admin/messages/GlobalCfgDefn.properties
+++ b/opendj-server-legacy/src/admin/messages/GlobalCfgDefn.properties
@@ -40,7 +40,6 @@
property.disabled-privilege.syntax.enumeration.value.subentry-write.synopsis=Allows the associated user to perform LDAP subentry write operations.
property.disabled-privilege.syntax.enumeration.value.unindexed-search.synopsis=Allows the user to request that the server process a search that cannot be optimized using server indexes.
property.disabled-privilege.syntax.enumeration.value.update-schema.synopsis=Allows the user to make changes to the server schema.
-property.entry-cache-preload.synopsis=Indicates whether or not to preload the entry cache on startup.
property.etime-resolution.synopsis=Specifies the resolution to use for operation elapsed processing time (etime) measurements.
property.etime-resolution.syntax.enumeration.value.milliseconds.synopsis=Use millisecond resolution.
property.etime-resolution.syntax.enumeration.value.nanoseconds.synopsis=Use nanosecond resolution.
diff --git a/opendj-server-legacy/src/admin/messages/GlobalCfgDefn_de.properties b/opendj-server-legacy/src/admin/messages/GlobalCfgDefn_de.properties
index 926e785..f42cd13 100644
--- a/opendj-server-legacy/src/admin/messages/GlobalCfgDefn_de.properties
+++ b/opendj-server-legacy/src/admin/messages/GlobalCfgDefn_de.properties
@@ -37,7 +37,6 @@
property.disabled-privilege.syntax.enumeration.value.server-shutdown.synopsis=Erlaubt dem Benutzer, vom Server Herunterfahren anzufordern.
property.disabled-privilege.syntax.enumeration.value.unindexed-search.synopsis=Erlaubt dem Benutzer vom Server das Verarbeiten einer Suche anzufordern, die nicht mithilfe von Serverindizes optimiert werden kann.
property.disabled-privilege.syntax.enumeration.value.update-schema.synopsis=Erlaubt dem Benutzer, \u00c4nderungen am Serverschema vorzunehmen.
-property.entry-cache-preload.synopsis=Gibt an, ob der Eintragscache beim Start vorab geladen werden soll.
property.etime-resolution.synopsis=Gibt die Aufl\u00f6sung f\u00fcr Messungen der verstrichenen Vorgangsverarbeitungszeit (etime) an.
property.etime-resolution.syntax.enumeration.value.milliseconds.synopsis=Millisekundenaufl\u00f6sung verwenden.
property.etime-resolution.syntax.enumeration.value.nanoseconds.synopsis=Nanosekundenaufl\u00f6sung verwenden.
diff --git a/opendj-server-legacy/src/admin/messages/GlobalCfgDefn_es.properties b/opendj-server-legacy/src/admin/messages/GlobalCfgDefn_es.properties
index 321d548..b1932bd 100644
--- a/opendj-server-legacy/src/admin/messages/GlobalCfgDefn_es.properties
+++ b/opendj-server-legacy/src/admin/messages/GlobalCfgDefn_es.properties
@@ -37,7 +37,6 @@
property.disabled-privilege.syntax.enumeration.value.server-shutdown.synopsis=Permite al usuario solicitar el cierre del servidor.
property.disabled-privilege.syntax.enumeration.value.unindexed-search.synopsis=Permite al usuario solicitar el procesamiento por parte del servidor de una b\u00fasqueda que no se optimice mediante \u00edndices de b\u00fasqueda.
property.disabled-privilege.syntax.enumeration.value.update-schema.synopsis=Permite al usuario realizar cambios en el esquema del servidor.
-property.entry-cache-preload.synopsis=Indica si se ha cargado previamente la cach\u00e9 de entrada durante el inicio.
property.etime-resolution.synopsis=Especifica la resoluci\u00f3n que se utilizar\u00e1 para las mediciones de tiempo de procesamiento de operaciones transcurrido ("etime").
property.etime-resolution.syntax.enumeration.value.milliseconds.synopsis=Utilizar una resoluci\u00f3n de milisegundos.
property.etime-resolution.syntax.enumeration.value.nanoseconds.synopsis=Utilizar una resoluci\u00f3n de nanosegundos.
diff --git a/opendj-server-legacy/src/admin/messages/GlobalCfgDefn_fr.properties b/opendj-server-legacy/src/admin/messages/GlobalCfgDefn_fr.properties
index c96b70f..499d76a 100644
--- a/opendj-server-legacy/src/admin/messages/GlobalCfgDefn_fr.properties
+++ b/opendj-server-legacy/src/admin/messages/GlobalCfgDefn_fr.properties
@@ -37,7 +37,6 @@
property.disabled-privilege.syntax.enumeration.value.server-shutdown.synopsis=Autorise l'utilisateur \u00e0 demander la fermeture du serveur.
property.disabled-privilege.syntax.enumeration.value.unindexed-search.synopsis=Autorise l'utilisateur \u00e0 demander que le serveur traite une recherche qui ne peut \u00eatre optimis\u00e9e en utilisant des index de serveur.
property.disabled-privilege.syntax.enumeration.value.update-schema.synopsis=Autorise un utilisateur \u00e0 faire des modifications \u00e0 un sch\u00e9ma de serveur.
-property.entry-cache-preload.synopsis=Indique s'il faut (ou non) pr\u00e9charger le cache d'entr\u00e9e au d\u00e9marrage.
property.etime-resolution.synopsis=Sp\u00e9cifie la r\u00e9solution \u00e0 utiliser pour des mesures de temps de traitement \u00e9coul\u00e9 (etime) pour une op\u00e9ration.
property.etime-resolution.syntax.enumeration.value.milliseconds.synopsis=Utiliser la r\u00e9solution en millisecondes.
property.etime-resolution.syntax.enumeration.value.nanoseconds.synopsis=Utiliser la r\u00e9solution en nanosecondes.
diff --git a/opendj-server-legacy/src/admin/messages/GlobalCfgDefn_ja.properties b/opendj-server-legacy/src/admin/messages/GlobalCfgDefn_ja.properties
index df440af..1c8b833 100644
--- a/opendj-server-legacy/src/admin/messages/GlobalCfgDefn_ja.properties
+++ b/opendj-server-legacy/src/admin/messages/GlobalCfgDefn_ja.properties
@@ -37,7 +37,6 @@
property.disabled-privilege.syntax.enumeration.value.server-shutdown.synopsis=\u30b5\u30fc\u30d0\u30fc\u304c\u30b7\u30e3\u30c3\u30c8\u30c0\u30a6\u30f3\u3059\u308b\u3088\u3046\u306b\u30e6\u30fc\u30b6\u30fc\u304c\u8981\u6c42\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002
property.disabled-privilege.syntax.enumeration.value.unindexed-search.synopsis=\u30b5\u30fc\u30d0\u30fc\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u4f7f\u7528\u3057\u3066\u6700\u9069\u5316\u3067\u304d\u306a\u3044\u691c\u7d22\u3092\u30b5\u30fc\u30d0\u30fc\u304c\u51e6\u7406\u3059\u308b\u3088\u3046\u306b\u30e6\u30fc\u30b6\u30fc\u304c\u8981\u6c42\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002
property.disabled-privilege.syntax.enumeration.value.update-schema.synopsis=\u30e6\u30fc\u30b6\u30fc\u304c\u30b5\u30fc\u30d0\u30fc\u30b9\u30ad\u30fc\u30de\u3092\u5909\u66f4\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002
-property.entry-cache-preload.synopsis=\u8d77\u52d5\u6642\u306b\u30a8\u30f3\u30c8\u30ea\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u30d7\u30ea\u30ed\u30fc\u30c9\u3059\u308b\u304b\u3069\u3046\u304b\u3092\u793a\u3057\u307e\u3059\u3002
property.etime-resolution.synopsis=\u64cd\u4f5c\u306e\u51e6\u7406\u7d4c\u904e\u6642\u9593 (etime) \u306e\u6e2c\u5b9a\u306b\u4f7f\u7528\u3059\u308b\u89e3\u50cf\u5ea6\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002
property.etime-resolution.syntax.enumeration.value.milliseconds.synopsis=\u30df\u30ea\u79d2\u306e\u89e3\u50cf\u5ea6\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002
property.etime-resolution.syntax.enumeration.value.nanoseconds.synopsis=\u30ca\u30ce\u79d2\u306e\u89e3\u50cf\u5ea6\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002
diff --git a/opendj-server-legacy/src/admin/messages/GlobalCfgDefn_ko.properties b/opendj-server-legacy/src/admin/messages/GlobalCfgDefn_ko.properties
index c468bded..7394b7c 100644
--- a/opendj-server-legacy/src/admin/messages/GlobalCfgDefn_ko.properties
+++ b/opendj-server-legacy/src/admin/messages/GlobalCfgDefn_ko.properties
@@ -35,7 +35,6 @@
property.disabled-privilege.syntax.enumeration.value.server-shutdown.synopsis=Allows the user to request that the server shut down.
property.disabled-privilege.syntax.enumeration.value.unindexed-search.synopsis=Allows the user to request that the server process a search that cannot be optimized using server indexes.
property.disabled-privilege.syntax.enumeration.value.update-schema.synopsis=Allows the user to make changes to the server schema.
-property.entry-cache-preload.synopsis=Indicates whether or not to preload the entry cache on startup.
property.etime-resolution.synopsis=Specifies the resolution to use for operation elapsed processing time (etime) measurements.
property.etime-resolution.syntax.enumeration.value.milliseconds.synopsis=Use millisecond resolution.
property.etime-resolution.syntax.enumeration.value.nanoseconds.synopsis=Use nanosecond resolution.
diff --git a/opendj-server-legacy/src/admin/messages/GlobalCfgDefn_zh_CN.properties b/opendj-server-legacy/src/admin/messages/GlobalCfgDefn_zh_CN.properties
index 2654ff3..6e83634 100644
--- a/opendj-server-legacy/src/admin/messages/GlobalCfgDefn_zh_CN.properties
+++ b/opendj-server-legacy/src/admin/messages/GlobalCfgDefn_zh_CN.properties
@@ -37,7 +37,6 @@
property.disabled-privilege.syntax.enumeration.value.server-shutdown.synopsis=\u5141\u8bb8\u7528\u6237\u8bf7\u6c42\u5173\u95ed\u670d\u52a1\u5668\u3002
property.disabled-privilege.syntax.enumeration.value.unindexed-search.synopsis=\u5141\u8bb8\u7528\u6237\u8bf7\u6c42\u670d\u52a1\u5668\u5904\u7406\u65e0\u6cd5\u4f7f\u7528\u670d\u52a1\u5668\u7d22\u5f15\u4f18\u5316\u7684\u641c\u7d22\u3002
property.disabled-privilege.syntax.enumeration.value.update-schema.synopsis=\u5141\u8bb8\u7528\u6237\u5bf9\u670d\u52a1\u5668\u6a21\u5f0f\u8fdb\u884c\u66f4\u6539\u3002
-property.entry-cache-preload.synopsis=\u6307\u793a\u662f\u5426\u5728\u542f\u52a8\u65f6\u9884\u52a0\u8f7d\u6761\u76ee\u9ad8\u901f\u7f13\u5b58\u3002
property.etime-resolution.synopsis=\u6307\u5b9a\u7528\u4e8e\u64cd\u4f5c\u5b9e\u8017\u5904\u7406\u65f6\u95f4 (etime) \u6d4b\u91cf\u7684\u5206\u8fa8\u7387\u3002
property.etime-resolution.syntax.enumeration.value.milliseconds.synopsis=\u4f7f\u7528\u6beb\u79d2\u5206\u8fa8\u7387\u3002
property.etime-resolution.syntax.enumeration.value.nanoseconds.synopsis=\u4f7f\u7528\u7eb3\u79d2\u5206\u8fa8\u7387\u3002
diff --git a/opendj-server-legacy/src/admin/messages/GlobalCfgDefn_zh_TW.properties b/opendj-server-legacy/src/admin/messages/GlobalCfgDefn_zh_TW.properties
index c468bded..7394b7c 100644
--- a/opendj-server-legacy/src/admin/messages/GlobalCfgDefn_zh_TW.properties
+++ b/opendj-server-legacy/src/admin/messages/GlobalCfgDefn_zh_TW.properties
@@ -35,7 +35,6 @@
property.disabled-privilege.syntax.enumeration.value.server-shutdown.synopsis=Allows the user to request that the server shut down.
property.disabled-privilege.syntax.enumeration.value.unindexed-search.synopsis=Allows the user to request that the server process a search that cannot be optimized using server indexes.
property.disabled-privilege.syntax.enumeration.value.update-schema.synopsis=Allows the user to make changes to the server schema.
-property.entry-cache-preload.synopsis=Indicates whether or not to preload the entry cache on startup.
property.etime-resolution.synopsis=Specifies the resolution to use for operation elapsed processing time (etime) measurements.
property.etime-resolution.syntax.enumeration.value.milliseconds.synopsis=Use millisecond resolution.
property.etime-resolution.syntax.enumeration.value.nanoseconds.synopsis=Use nanosecond resolution.
diff --git a/opendj-server-legacy/src/main/docbkx/admin-guide/chap-tuning.xml b/opendj-server-legacy/src/main/docbkx/admin-guide/chap-tuning.xml
index 2aaf68a..6ea8f2b 100644
--- a/opendj-server-legacy/src/main/docbkx/admin-guide/chap-tuning.xml
+++ b/opendj-server-legacy/src/main/docbkx/admin-guide/chap-tuning.xml
@@ -546,27 +546,6 @@
--no-prompt</userinput>
</screen>
- <para>
- You can use the global setting,
- <link
- xlink:show="new"
- xlink:href="${configRefBase}global.html#entry-cache-preload"
- ><literal>entry-cache-preload</literal></link>,
- to force OpenDJ to load the entry cache as part of server startup.
- </para>
-
- <screen>
-$ <userinput>dsconfig \
- set-global-configuration-prop \
- --port 4444 \
- --hostname opendj.example.com \
- --bindDN "cn=Directory Manager" \
- --bindPassword password \
- --set entry-cache-preload:true \
- --no-prompt</userinput>
- </screen>
-
- <para>By default, OpenDJ does not pre-load the entry cache.</para>
</section>
<section xml:id="perf-logging">
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ReadOnlyConfigFileHandler.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ReadOnlyConfigFileHandler.java
index a8e56b8..6c5bf87 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ReadOnlyConfigFileHandler.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ReadOnlyConfigFileHandler.java
@@ -403,12 +403,6 @@
/** {@inheritDoc} */
@Override
- public void preloadEntryCache() throws UnsupportedOperationException
- {
- }
-
- /** {@inheritDoc} */
- @Override
public void removeBackup(BackupDirectory backupDirectory, String backupID)
throws DirectoryException
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/api/Backend.java b/opendj-server-legacy/src/main/java/org/opends/server/api/Backend.java
index 46896fa..7ba233b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/api/Backend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/api/Backend.java
@@ -211,20 +211,6 @@
public abstract DN[] getBaseDNs();
/**
- * Attempts to pre-load all the entries stored within this backend
- * into the entry cache. Note that the caller must ensure that the
- * backend stays in read-only state until this method returns as
- * no entry locking is performed during this operation. Also note
- * that any backend implementing this method should implement pre-
- * load progress reporting and error handling specific to its own
- * implementation.
- *
- * @throws UnsupportedOperationException if backend does not
- * support this operation.
- */
- public abstract void preloadEntryCache() throws UnsupportedOperationException;
-
- /**
* Indicates whether search operations which target the specified
* attribute in the indicated manner would be considered indexed
* in this backend. The operation should be considered indexed only
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/BackupBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/BackupBackend.java
index 3151938..5f792e3 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/BackupBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/BackupBackend.java
@@ -1016,10 +1016,4 @@
ByteString attrValue = ByteString.valueOf(rdnStringValue);
return parentDN.child(RDN.create(rdnAttrType, attrValue));
}
-
- /** {@inheritDoc} */
- @Override
- public void preloadEntryCache() throws UnsupportedOperationException {
- throw new UnsupportedOperationException("Operation not supported.");
- }
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/ChangelogBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/ChangelogBackend.java
index 382406c..76239e3 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/ChangelogBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/ChangelogBackend.java
@@ -326,13 +326,6 @@
/** {@inheritDoc} */
@Override
- public void preloadEntryCache() throws UnsupportedOperationException
- {
- throw new UnsupportedOperationException("Operation not supported.");
- }
-
- /** {@inheritDoc} */
- @Override
public boolean isIndexed(final AttributeType attributeType, final IndexType indexType)
{
return true;
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/LDIFBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/LDIFBackend.java
index 8232acf..7ac2573 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/LDIFBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/LDIFBackend.java
@@ -1330,10 +1330,4 @@
return alerts;
}
-
- /** {@inheritDoc} */
- @Override
- public void preloadEntryCache() throws UnsupportedOperationException {
- throw new UnsupportedOperationException("Operation not supported.");
- }
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/MemoryBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/MemoryBackend.java
index b85555f..398e8c7 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/MemoryBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/MemoryBackend.java
@@ -776,10 +776,4 @@
LocalizableMessage message = ERR_MEMORYBACKEND_BACKUP_RESTORE_NOT_SUPPORTED.get();
throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message);
}
-
- /** {@inheritDoc} */
- @Override
- public void preloadEntryCache() throws UnsupportedOperationException {
- throw new UnsupportedOperationException("Operation not supported.");
- }
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/MonitorBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/MonitorBackend.java
index a9358e6..0cf1b91 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/MonitorBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/MonitorBackend.java
@@ -494,13 +494,6 @@
/** {@inheritDoc} */
@Override
- public void preloadEntryCache() throws UnsupportedOperationException
- {
- throw new UnsupportedOperationException("Operation not supported.");
- }
-
- /** {@inheritDoc} */
- @Override
public void removeBackup(final BackupDirectory backupDirectory,
final String backupID) throws DirectoryException
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/NullBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/NullBackend.java
index 79f42ae..c460aab 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/NullBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/NullBackend.java
@@ -493,10 +493,4 @@
LocalizableMessage message = LocalizableMessage.raw("The null backend does not support restore operation");
throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message);
}
-
- /** {@inheritDoc} */
- @Override
- public void preloadEntryCache() throws UnsupportedOperationException {
- throw new UnsupportedOperationException("Operation not supported.");
- }
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/RootDSEBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/RootDSEBackend.java
index 0c3e804..e3f1387 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/RootDSEBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/RootDSEBackend.java
@@ -1128,10 +1128,4 @@
return ccr;
}
-
- /** {@inheritDoc} */
- @Override
- public void preloadEntryCache() throws UnsupportedOperationException {
- throw new UnsupportedOperationException("Operation not supported.");
- }
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
index 27a0116..e40aeb1 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
@@ -4169,12 +4169,6 @@
/** {@inheritDoc} */
@Override
- public void preloadEntryCache() throws UnsupportedOperationException {
- throw new UnsupportedOperationException("Operation not supported.");
- }
-
- /** {@inheritDoc} */
- @Override
public File getDirectory()
{
return new File(SchemaConfigManager.getSchemaDirectoryPath());
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/TrustStoreBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/TrustStoreBackend.java
index f22549d..69e304d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/TrustStoreBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/TrustStoreBackend.java
@@ -1530,11 +1530,5 @@
}
}
-
- /** {@inheritDoc} */
- @Override
- public void preloadEntryCache() throws UnsupportedOperationException {
- throw new UnsupportedOperationException("Operation not supported.");
- }
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/BackendImpl.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/BackendImpl.java
index 12413f6..2b201b0 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/BackendImpl.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/BackendImpl.java
@@ -1418,14 +1418,6 @@
/** {@inheritDoc} */
@Override
- public void preloadEntryCache() throws
- UnsupportedOperationException {
- EntryCachePreloader preloader = new EntryCachePreloader(this);
- preloader.preload();
- }
-
- /** {@inheritDoc} */
- @Override
public void diskLowThresholdReached(File directory, long thresholdInBytes) {
storageStatus = StorageStatus.lockedDown(
WARN_DISK_SPACE_LOW_THRESHOLD_CROSSED.get(directory.getFreeSpace(), directory.getAbsolutePath(),
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/EntryCachePreloader.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/EntryCachePreloader.java
deleted file mode 100644
index 50d6d4b..0000000
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/EntryCachePreloader.java
+++ /dev/null
@@ -1,377 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Copyright 2008 Sun Microsystems, Inc.
- * Portions Copyright 2014-2015 ForgeRock AS
- */
-package org.opends.server.backends.jeb;
-
-import com.sleepycat.je.*;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicLong;
-
-import org.forgerock.i18n.slf4j.LocalizedLogger;
-import org.forgerock.opendj.ldap.ByteString;
-import org.opends.server.api.DirectoryThread;
-import org.opends.server.core.DirectoryServer;
-import org.opends.server.types.Entry;
-
-
-import static org.opends.messages.ExtensionMessages.*;
-import static org.opends.server.util.StaticUtils.*;
-
-/**
- * This class defines a utility that will be used to pre-load the Directory
- * Server entry cache. Pre-loader is multi-threaded and consist of the
- * following threads:
- *
- * - The Arbiter thread which monitors overall pre-load progress and manages
- * pre-load worker threads by adding or removing them as deemed necessary.
- *
- * - The Collector thread which collects all entries stored within the
- * backend and places them to a blocking queue workers consume from.
- *
- * - Worker threads which are responsible for monitoring the collector feed
- * and processing the actual entries for cache storage.
- *
- * This implementation is self-adjusting to any system workload and does not
- * require any configuration parameters to optimize for initial system
- * resources availability and/or any subsequent fluctuations.
- */
-class EntryCachePreloader
-{
- private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
-
- /**
- * BackendImpl object.
- */
- private BackendImpl jeb;
-
- /**
- * Interrupt flag for the arbiter to terminate worker threads.
- */
- private AtomicBoolean interruptFlag = new AtomicBoolean(false);
-
- /**
- * Processed entries counter.
- */
- private AtomicLong processedEntries = new AtomicLong(0);
-
- /**
- * Progress report resolution.
- */
- private static final long progressInterval = 5000;
-
- /**
- * Default resolution time.
- */
- public static final long
- PRELOAD_DEFAULT_SLEEP_TIME = 10000;
-
- /**
- * Effective synchronization time.
- */
- private static long syncSleepTime;
-
- /**
- * Default queue capacity.
- */
- public static final int
- PRELOAD_DEFAULT_QUEUE_CAPACITY = 128;
-
- /**
- * Effective queue capacity.
- */
- private static int queueCapacity;
-
- /**
- * Worker threads.
- */
- private List<Thread> preloadThreads =
- Collections.synchronizedList(
- new LinkedList<Thread>());
-
- /**
- * Collector thread.
- */
- private EntryCacheCollector collector =
- new EntryCacheCollector();
-
- /**
- * This queue is for workers to take from.
- */
- private LinkedBlockingQueue<PreloadEntry> entryQueue;
-
- /**
- * The number of bytes in a megabyte.
- */
- private static final int bytesPerMegabyte = 1024*1024;
-
- /**
- * Constructs the Entry Cache Pre-loader for
- * a given JEB implementation instance.
- *
- * @param jeb The JEB instance to pre-load.
- */
- public EntryCachePreloader(BackendImpl jeb) {
- // These should not be exposed as configuration
- // parameters and are only useful for testing.
- syncSleepTime = Long.getLong(
- "org.opends.server.entrycache.preload.sleep",
- PRELOAD_DEFAULT_SLEEP_TIME);
- queueCapacity = Integer.getInteger(
- "org.opends.server.entrycache.preload.queue",
- PRELOAD_DEFAULT_QUEUE_CAPACITY);
- entryQueue =
- new LinkedBlockingQueue<PreloadEntry>(
- queueCapacity);
- this.jeb = jeb;
- }
-
- /**
- * The Arbiter thread.
- */
- protected void preload()
- {
- logger.info(NOTE_CACHE_PRELOAD_PROGRESS_START, jeb.getBackendID());
- // Start collector thread first.
- collector.start();
- // Kick off a single worker.
- EntryCachePreloadWorker singleWorkerThread =
- new EntryCachePreloadWorker();
- singleWorkerThread.start();
- preloadThreads.add(singleWorkerThread);
- // Progress report timer task.
- Timer timer = new Timer();
- TimerTask progressTask = new TimerTask() {
- /** Persistent state restore progress report. */
- @Override
- public void run() {
- if (processedEntries.get() > 0) {
- long freeMemory =
- Runtime.getRuntime().freeMemory() / bytesPerMegabyte;
- logger.info(NOTE_CACHE_PRELOAD_PROGRESS_REPORT, jeb.getBackendID(), processedEntries.get(), freeMemory);
- }
- }
- };
- timer.scheduleAtFixedRate(progressTask, progressInterval,
- progressInterval);
- // Cycle to monitor progress and adjust workers.
- long processedEntriesCycle = 0;
- long processedEntriesDelta = 0;
- long processedEntriesDeltaLow = 0;
- long processedEntriesDeltaHigh = 0;
- long lastKnownProcessedEntries = 0;
- try {
- while (!entryQueue.isEmpty() || collector.isAlive()) {
-
- Thread.sleep(syncSleepTime);
-
- processedEntriesCycle = processedEntries.get();
- processedEntriesDelta =
- processedEntriesCycle - lastKnownProcessedEntries;
- lastKnownProcessedEntries = processedEntriesCycle;
- // Spawn another worker if scaling up.
- if (processedEntriesDelta > processedEntriesDeltaHigh) {
- processedEntriesDeltaLow = processedEntriesDeltaHigh;
- processedEntriesDeltaHigh = processedEntriesDelta;
- EntryCachePreloadWorker workerThread =
- new EntryCachePreloadWorker();
- workerThread.start();
- preloadThreads.add(workerThread);
- }
- // Interrupt random worker if scaling down.
- if (processedEntriesDelta < processedEntriesDeltaLow) {
- processedEntriesDeltaHigh = processedEntriesDeltaLow;
- processedEntriesDeltaLow = processedEntriesDelta;
- // Leave at least one worker to progress.
- if (preloadThreads.size() > 1) {
- interruptFlag.set(true);
- }
- }
- }
- // Join the collector.
- if (collector.isAlive()) {
- collector.join();
- }
- // Join all spawned workers.
- for (Thread workerThread : preloadThreads) {
- if (workerThread.isAlive()) {
- workerThread.join();
- }
- }
- // Cancel progress report task and report done.
- timer.cancel();
- logger.info(NOTE_CACHE_PRELOAD_PROGRESS_DONE, jeb.getBackendID(), processedEntries.get());
- } catch (InterruptedException ex) {
- logger.traceException(ex);
- // Interrupt the collector.
- collector.interrupt();
- // Interrupt all preload threads.
- for (Thread thread : preloadThreads) {
- thread.interrupt();
- }
- logger.warn(WARN_CACHE_PRELOAD_INTERRUPTED, jeb.getBackendID());
- } finally {
- // Kill the timer task.
- timer.cancel();
- }
- }
-
- /**
- * The worker thread.
- */
- private class EntryCachePreloadWorker extends DirectoryThread {
- public EntryCachePreloadWorker() {
- super("Entry Cache Preload Worker");
- }
- @Override
- public void run() {
- while (!entryQueue.isEmpty() || collector.isAlive()) {
- // Check if interrupted.
- if (Thread.interrupted()) {
- return;
- }
- // Check for scaling down interruption.
- if (interruptFlag.compareAndSet(true, false)) {
- preloadThreads.remove(Thread.currentThread());
- break;
- }
- // Dequeue the next entry.
- try {
- PreloadEntry preloadEntry = entryQueue.poll();
- if (preloadEntry == null) {
- continue;
- }
- long entryID =
- JebFormat.entryIDFromDatabase(preloadEntry.entryIDBytes);
- Entry entry =
- ID2Entry.entryFromDatabase(ByteString.wrap(preloadEntry.entryBytes),
- jeb.getRootContainer().getCompressedSchema());
- try {
- // Even if the entry does not end up in the cache its still
- // treated as a processed entry anyways.
- DirectoryServer.getEntryCache().putEntry(entry, jeb, entryID);
- processedEntries.getAndIncrement();
- } catch (Exception ex) {
- logger.traceException(ex);
- logger.error(ERR_CACHE_PRELOAD_ENTRY_FAILED, entry.getName(),
- (ex.getCause() != null ? ex.getCause().getMessage() :
- stackTraceToSingleLineString(ex)));
- }
- } catch (Exception ex) {
- break;
- }
- }
- }
- }
-
- /**
- * The Collector thread.
- */
- private class EntryCacheCollector extends DirectoryThread {
- public EntryCacheCollector() {
- super("Entry Cache Preload Collector");
- }
- @Override
- public void run() {
- Cursor cursor = null;
- ID2Entry id2entry = null;
- DatabaseEntry key = new DatabaseEntry();
- DatabaseEntry data = new DatabaseEntry();
- Collection<EntryContainer> entryContainers =
- jeb.getRootContainer().getEntryContainers();
- Iterator<EntryContainer> ecIterator =
- entryContainers.iterator();
- OperationStatus status = OperationStatus.SUCCESS;
-
- try {
- while (status == OperationStatus.SUCCESS) {
- // Check if interrupted.
- if (Thread.interrupted()) {
- return;
- }
- try {
- if (cursor == null) {
- if (ecIterator.hasNext()) {
- id2entry = ecIterator.next().getID2Entry();
- } else {
- break;
- }
- if (id2entry != null) {
- cursor = id2entry.openCursor(null, new CursorConfig());
- } else {
- continue;
- }
- }
- // BUG cursor might be null ? If not why testing below ?
- status = cursor.getNext(key, data, LockMode.DEFAULT);
- if (status != OperationStatus.SUCCESS) {
- // Reset cursor and continue.
- close(cursor);
- status = OperationStatus.SUCCESS;
- cursor = null;
- } else {
- entryQueue.put(new PreloadEntry(data.getData(), key.getData()));
- }
- } catch (InterruptedException e) {
- return;
- } catch (Exception e) {
- logger.traceException(e);
- }
- }
- } finally {
- close(cursor);
- }
- }
- }
-
- /**
- * This inner class represents pre-load entry object.
- */
- private class PreloadEntry {
-
- /** Encoded Entry. */
- public byte[] entryBytes;
-
- /** Encoded EntryID. */
- public byte[] entryIDBytes;
-
- /**
- * Default constructor.
- */
- public PreloadEntry(byte[] entryBytes, byte[] entryIDBytes) {
- this.entryBytes = entryBytes;
- this.entryIDBytes = entryIDBytes;
- }
- }
-}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/BackendImpl.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/BackendImpl.java
index 542f92d..054786a 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/BackendImpl.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/BackendImpl.java
@@ -187,6 +187,7 @@
}
}
+ // Register a monitor provider for the environment.
rootContainerMonitor = rootContainer.getMonitorProvider();
DirectoryServer.registerMonitorProvider(rootContainerMonitor);
@@ -1009,14 +1010,6 @@
}
}
- /** {@inheritDoc} */
- @Override
- public void preloadEntryCache() throws UnsupportedOperationException
- {
- EntryCachePreloader preloader = new EntryCachePreloader(this);
- preloader.preload();
- }
-
Storage getStorage()
{
return storage;
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryCachePreloader.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryCachePreloader.java
deleted file mode 100644
index e34aef6..0000000
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryCachePreloader.java
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Copyright 2008 Sun Microsystems, Inc.
- * Portions Copyright 2014-2015 ForgeRock AS
- */
-package org.opends.server.backends.pluggable;
-
-import static org.opends.messages.ExtensionMessages.*;
-import static org.opends.server.util.StaticUtils.*;
-
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicLong;
-
-import org.forgerock.i18n.slf4j.LocalizedLogger;
-import org.forgerock.opendj.ldap.ByteString;
-import org.opends.server.api.DirectoryThread;
-import org.opends.server.backends.pluggable.spi.Cursor;
-import org.opends.server.core.DirectoryServer;
-import org.opends.server.types.Entry;
-
-/**
- * This class defines a utility that will be used to pre-load the Directory
- * Server entry cache. Pre-loader is multi-threaded and consist of the
- * following threads:
- *
- * - The Arbiter thread which monitors overall pre-load progress and manages
- * pre-load worker threads by adding or removing them as deemed necessary.
- *
- * - The Collector thread which collects all entries stored within the
- * backend and places them to a blocking queue workers consume from.
- *
- * - Worker threads which are responsible for monitoring the collector feed
- * and processing the actual entries for cache storage.
- *
- * This implementation is self-adjusting to any system workload and does not
- * require any configuration parameters to optimize for initial system
- * resources availability and/or any subsequent fluctuations.
- */
-class EntryCachePreloader
-{
- private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
-
- /** BackendImpl object. */
- private final BackendImpl<?> backend;
-
- /** Interrupt flag for the arbiter to terminate worker threads. */
- private final AtomicBoolean interruptFlag = new AtomicBoolean(false);
- /** Processed entries counter. */
- private final AtomicLong processedEntries = new AtomicLong(0);
-
- /** Progress report resolution. */
- private static final long progressInterval = 5000;
- /** Default resolution time. */
- private static final long PRELOAD_DEFAULT_SLEEP_TIME = 10000;
- /** Effective synchronization time. */
- private static long syncSleepTime;
- /** Default queue capacity. */
- private static final int PRELOAD_DEFAULT_QUEUE_CAPACITY = 128;
- /** Effective queue capacity. */
- private static int queueCapacity;
-
- /** Worker threads. */
- private final List<Thread> preloadThreads = Collections.synchronizedList(new LinkedList<Thread>());
- /** Collector thread. */
- private final EntryCacheCollector collector = new EntryCacheCollector();
- /** This queue is for workers to take from. */
- private final LinkedBlockingQueue<PreloadEntry> entryQueue;
- /** The number of bytes in a megabyte. */
- private static final int bytesPerMegabyte = 1024*1024;
-
- /**
- * Constructs the Entry Cache Pre-loader for a given backend implementation instance.
- *
- * @param backend
- * The backend instance to pre-load.
- */
- public EntryCachePreloader(BackendImpl<?> backend)
- {
- // These should not be exposed as configuration
- // parameters and are only useful for testing.
- syncSleepTime = Long.getLong("org.opends.server.entrycache.preload.sleep", PRELOAD_DEFAULT_SLEEP_TIME);
- queueCapacity = Integer.getInteger("org.opends.server.entrycache.preload.queue", PRELOAD_DEFAULT_QUEUE_CAPACITY);
- entryQueue = new LinkedBlockingQueue<PreloadEntry>(queueCapacity);
- this.backend = backend;
- }
-
- /**
- * The Arbiter thread.
- */
- protected void preload()
- {
- logger.info(NOTE_CACHE_PRELOAD_PROGRESS_START, backend.getBackendID());
- // Start collector thread first.
- collector.start();
- // Kick off a single worker.
- EntryCachePreloadWorker singleWorkerThread =
- new EntryCachePreloadWorker();
- singleWorkerThread.start();
- preloadThreads.add(singleWorkerThread);
- // Progress report timer task.
- Timer timer = new Timer();
- TimerTask progressTask = new TimerTask() {
- /** Persistent state restore progress report. */
- @Override
- public void run() {
- if (processedEntries.get() > 0) {
- long freeMemory =
- Runtime.getRuntime().freeMemory() / bytesPerMegabyte;
- logger.info(NOTE_CACHE_PRELOAD_PROGRESS_REPORT, backend.getBackendID(), processedEntries.get(), freeMemory);
- }
- }
- };
- timer.scheduleAtFixedRate(progressTask, progressInterval,
- progressInterval);
- // Cycle to monitor progress and adjust workers.
- long processedEntriesCycle = 0;
- long processedEntriesDelta = 0;
- long processedEntriesDeltaLow = 0;
- long processedEntriesDeltaHigh = 0;
- long lastKnownProcessedEntries = 0;
- try {
- while (!entryQueue.isEmpty() || collector.isAlive()) {
-
- Thread.sleep(syncSleepTime);
-
- processedEntriesCycle = processedEntries.get();
- processedEntriesDelta =
- processedEntriesCycle - lastKnownProcessedEntries;
- lastKnownProcessedEntries = processedEntriesCycle;
- // Spawn another worker if scaling up.
- if (processedEntriesDelta > processedEntriesDeltaHigh) {
- processedEntriesDeltaLow = processedEntriesDeltaHigh;
- processedEntriesDeltaHigh = processedEntriesDelta;
- EntryCachePreloadWorker workerThread =
- new EntryCachePreloadWorker();
- workerThread.start();
- preloadThreads.add(workerThread);
- }
- // Interrupt random worker if scaling down.
- if (processedEntriesDelta < processedEntriesDeltaLow) {
- processedEntriesDeltaHigh = processedEntriesDeltaLow;
- processedEntriesDeltaLow = processedEntriesDelta;
- // Leave at least one worker to progress.
- if (preloadThreads.size() > 1) {
- interruptFlag.set(true);
- }
- }
- }
- // Join the collector.
- if (collector.isAlive()) {
- collector.join();
- }
- // Join all spawned workers.
- for (Thread workerThread : preloadThreads) {
- if (workerThread.isAlive()) {
- workerThread.join();
- }
- }
- // Cancel progress report task and report done.
- timer.cancel();
- logger.info(NOTE_CACHE_PRELOAD_PROGRESS_DONE, backend.getBackendID(), processedEntries.get());
- } catch (InterruptedException ex) {
- logger.traceException(ex);
- // Interrupt the collector.
- collector.interrupt();
- // Interrupt all preload threads.
- for (Thread thread : preloadThreads) {
- thread.interrupt();
- }
- logger.warn(WARN_CACHE_PRELOAD_INTERRUPTED, backend.getBackendID());
- } finally {
- // Kill the timer task.
- timer.cancel();
- }
- }
-
- /**
- * The worker thread.
- */
- private class EntryCachePreloadWorker extends DirectoryThread {
- public EntryCachePreloadWorker() {
- super("Entry Cache Preload Worker");
- }
- @Override
- public void run() {
- while (!entryQueue.isEmpty() || collector.isAlive()) {
- // Check if interrupted.
- if (Thread.interrupted()) {
- return;
- }
- // Check for scaling down interruption.
- if (interruptFlag.compareAndSet(true, false)) {
- preloadThreads.remove(Thread.currentThread());
- break;
- }
- // Dequeue the next entry.
- try {
- PreloadEntry preloadEntry = entryQueue.poll();
- if (preloadEntry == null) {
- continue;
- }
- long entryID = preloadEntry.entryIDBytes.toLong();
- Entry entry =
- ID2Entry.entryFromDatabase(preloadEntry.entryBytes,
- backend.getRootContainer().getCompressedSchema());
- try {
- // Even if the entry does not end up in the cache its still
- // treated as a processed entry anyways.
- DirectoryServer.getEntryCache().putEntry(entry, backend, entryID);
- processedEntries.getAndIncrement();
- } catch (Exception ex) {
- logger.traceException(ex);
- logger.error(ERR_CACHE_PRELOAD_ENTRY_FAILED, entry.getName(),
- (ex.getCause() != null ? ex.getCause().getMessage() :
- stackTraceToSingleLineString(ex)));
- }
- } catch (Exception ex) {
- break;
- }
- }
- }
- }
-
- /**
- * The Collector thread.
- */
- private class EntryCacheCollector extends DirectoryThread {
- public EntryCacheCollector() {
- super("Entry Cache Preload Collector");
- }
- @Override
- public void run() {
- Cursor<ByteString, ByteString> cursor = null;
- ID2Entry id2entry = null;
- RootContainer rootContainer = backend.getRootContainer();
- Iterator<EntryContainer> ecIterator = rootContainer.getEntryContainers().iterator();
-
- // FIXME: this loop needs fixing.
- boolean success = false;
-
- try {
- while (success) {
- // Check if interrupted.
- if (Thread.interrupted()) {
- return;
- }
- try {
- if (cursor == null) {
- if (!ecIterator.hasNext()) {
- break;
- }
- id2entry = ecIterator.next().getID2Entry();
- if (id2entry == null) {
- continue;
- }
- // FIXME: "null" should be a transaction.
- // cursor = null.openCursor(id2entry.getName());
- }
- // BUG cursor might be null ? If not why testing below ?
- success = cursor.next();
- if (!success) {
- // Reset cursor and continue.
- close(cursor);
- success = true;
- cursor = null;
- } else {
- entryQueue.put(new PreloadEntry(cursor.getValue(), cursor.getKey()));
- }
- } catch (InterruptedException e) {
- return;
- } catch (Exception e) {
- logger.traceException(e);
- }
- }
- } finally {
- close(cursor);
- }
- }
- }
-
- /** This inner class represents pre-load entry object. */
- private static final class PreloadEntry {
-
- /** Encoded Entry. */
- private ByteString entryBytes;
- /** Encoded EntryID. */
- private ByteString entryIDBytes;
-
- /** Default constructor. */
- private PreloadEntry(ByteString entryBytes, ByteString entryIDBytes)
- {
- this.entryBytes = entryBytes;
- this.entryIDBytes = entryIDBytes;
- }
- }
-}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskBackend.java
index 519fe71..ac91490 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskBackend.java
@@ -1445,13 +1445,6 @@
/** {@inheritDoc} */
@Override
- public void preloadEntryCache() throws UnsupportedOperationException
- {
- throw new UnsupportedOperationException("Operation not supported.");
- }
-
- /** {@inheritDoc} */
- @Override
public File getDirectory()
{
return getFileForPath(taskBackingFile).getParentFile();
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java b/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
index 5df10af..61b0672 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
@@ -5064,7 +5064,7 @@
*/
public static Map<String, Backend> getBackends()
{
- return (Map) directoryServer.backends;
+ return new TreeMap<String, Backend>(directoryServer.backends);
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/core/EntryCacheConfigManager.java b/opendj-server-legacy/src/main/java/org/opends/server/core/EntryCacheConfigManager.java
index 0b1ee20..367d1a9 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/core/EntryCacheConfigManager.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/core/EntryCacheConfigManager.java
@@ -41,7 +41,6 @@
import org.opends.server.admin.std.server.EntryCacheCfg;
import org.opends.server.admin.std.server.EntryCacheMonitorProviderCfg;
import org.opends.server.admin.std.server.RootCfg;
-import org.opends.server.api.Backend;
import org.opends.server.api.EntryCache;
import org.opends.server.config.ConfigConstants;
import org.opends.server.config.ConfigEntry;
@@ -53,7 +52,6 @@
import org.opends.server.types.InitializationException;
import static org.opends.messages.ConfigMessages.*;
-import static org.opends.messages.ExtensionMessages.*;
import static org.opends.server.util.StaticUtils.*;
/**
@@ -207,28 +205,6 @@
}
}
}
-
- // If requested preload the entry cache.
- if (rootConfiguration.getGlobalConfiguration().isEntryCachePreload() &&
- !cacheOrderMap.isEmpty()) {
- // Preload from every active public backend.
- Map<DN, Backend> baseDNMap =
- DirectoryServer.getPublicNamingContexts();
- Set<Backend> proccessedBackends = new HashSet<Backend>();
- for (Backend backend : baseDNMap.values()) {
- if (!proccessedBackends.contains(backend)) {
- proccessedBackends.add(backend);
- try {
- backend.preloadEntryCache();
- } catch (UnsupportedOperationException ex) {
- // Some backend implementations might not support entry
- // cache preload. Log a warning and continue.
- logger.warn(WARN_CACHE_PRELOAD_BACKEND_FAILED, backend.getBackendID());
- continue;
- }
- }
- }
- }
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/ConfigFileHandler.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/ConfigFileHandler.java
index e89e878..1730ca1 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/ConfigFileHandler.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/ConfigFileHandler.java
@@ -2052,12 +2052,6 @@
/** {@inheritDoc} */
@Override
- public void preloadEntryCache() throws UnsupportedOperationException {
- throw new UnsupportedOperationException("Operation not supported.");
- }
-
- /** {@inheritDoc} */
- @Override
public File getDirectory()
{
return getConfigFileInBackendContext().getParentFile();
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/PluggableBackendImplTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/PluggableBackendImplTestCase.java
index 0f0310a..d8d04c9 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/PluggableBackendImplTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/PluggableBackendImplTestCase.java
@@ -861,21 +861,7 @@
assertEquals(backend.getNumberOfChildren(testBaseDN.child(DN.valueOf("ou=People"))), ldifNumberOfEntries - 2, "Not enough entries in DIT.");
}
- @Test(dependsOnMethods = {"testImportLDIF"})
- public void testPreloadEntryCache()
- {
- // There is no backend.isPreloadSupported(), so try and if it fails, just let it go.
- try
- {
- backend.preloadEntryCache();
- }
- catch (UnsupportedOperationException uoe)
- {
- Reporter.log("Skipping unsupported Cache Preload", true);
- }
- }
-
- @Test(dependsOnMethods = "testPreloadEntryCache")
+ @Test(dependsOnMethods = "testImportLDIF")
public void testBackup() throws Exception
{
assertEquals(backend.supports(BackendOperation.BACKUP), true, "Skip Backup");
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/PreloadEntryCacheTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/PreloadEntryCacheTestCase.java
deleted file mode 100644
index 1a0ae22..0000000
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/PreloadEntryCacheTestCase.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Copyright 2008 Sun Microsystems, Inc.
- * Portions Copyright 2014-2015 ForgeRock AS
- */
-package org.opends.server.extensions;
-
-
-
-import java.io.File;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import org.opends.server.TestCaseUtils;
-import org.opends.server.admin.server.AdminTestCaseUtils;
-import org.testng.annotations.BeforeClass;
-import org.opends.server.admin.std.meta.*;
-import org.opends.server.admin.std.server.EntryCacheCfg;
-import org.opends.server.api.Backend;
-import org.opends.server.core.DirectoryServer;
-import org.opends.server.types.Entry;
-import org.opends.server.util.ServerConstants;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.Test;
-import static org.testng.Assert.*;
-
-
-
-/**
- * The entry cache pre-load test class.
- */
-@Test(groups = { "entrycache", "slow" }, sequential=true)
-public class PreloadEntryCacheTestCase
- extends ExtensionsTestCase
-{
- /**
- * Number of unique dummy test entries.
- */
- protected int NUMTESTENTRIES = 1000;
-
- /**
- * Dummy test entries.
- */
- protected ArrayList<Entry> testEntriesList;
-
- /**
- * Entry cache configuration instance.
- */
- protected EntryCacheCfg configuration;
-
- /**
- * Temporary folder to setup dummy JE backend environment in.
- */
- private File jeBackendTempDir;
-
- /**
- * Initialize the entry cache pre-load test.
- *
- * @throws Exception If an unexpected problem occurs.
- */
- @BeforeClass
- public void preloadEntryCacheTestInit()
- throws Exception
- {
- // Ensure that the server is running.
- TestCaseUtils.startServer();
-
- // Make sure JE directory exist.
- jeBackendTempDir = TestCaseUtils.createTemporaryDirectory("db-cachetest");
- String jeDir = jeBackendTempDir.getAbsolutePath();
-
- // Create dummy JE backend for this test.
- TestCaseUtils.dsconfig("create-backend", "--backend-name", "cacheTest",
- "--type", "local-db", "--set", "db-directory:" + jeDir, "--set",
- "base-dn:o=cachetest", "--set", "writability-mode:enabled", "--set",
- "enabled:true");
-
- // Configure the entry cache, use FileSystemEntryCache.
- Entry cacheConfigEntry = TestCaseUtils.makeEntry(
- "dn: cn=Soft Reference,cn=Entry Caches,cn=config",
- "objectClass: ds-cfg-soft-reference-entry-cache",
- "objectClass: ds-cfg-entry-cache",
- "objectClass: top",
- "cn: Soft Reference",
- "ds-cfg-cache-level: 1",
- "ds-cfg-java-class: " +
- "org.opends.server.extensions.SoftReferenceEntryCache",
- "ds-cfg-enabled: true");
- configuration = AdminTestCaseUtils.getConfiguration(
- EntryCacheCfgDefn.getInstance(), cacheConfigEntry);
-
- // Make parent entry.
- Entry parentEntry = TestCaseUtils.makeEntry(
- "dn: o=cachetest",
- "o: cachetest",
- "objectClass: top",
- "objectClass: organization");
- TestCaseUtils.addEntry(parentEntry);
-
- // Make some dummy test entries.
- testEntriesList = new ArrayList<Entry>(NUMTESTENTRIES);
- for(int i = 0; i < NUMTESTENTRIES; i++ ) {
- Entry testEntry = TestCaseUtils.makeEntry(
- "dn: uid=test" + i + ".user" + i + ",o=cachetest",
- "objectClass: person",
- "objectClass: inetorgperson",
- "objectClass: top",
- "objectClass: organizationalperson",
- "postalAddress: somewhere in Testville" + i,
- "street: Under Construction Street" + i,
- "l: Testcounty" + i,
- "st: Teststate" + i,
- "telephoneNumber: +878 8378 8378" + i,
- "mobile: +878 8378 8378" + i,
- "homePhone: +878 8378 8378" + i,
- "pager: +878 8378 8378" + i,
- "mail: test" + i + ".user" + i + "@testdomain.net",
- "postalCode: 8378" + i,
- "userPassword: testpassword" + i,
- "description: description for Test" + i + "User" + i,
- "cn: Test" + i + "User" + i,
- "sn: User" + i,
- "givenName: Test" + i,
- "initials: TST" + i,
- "employeeNumber: 8378" + i,
- "uid: test" + i + ".user" + i
- );
- testEntriesList.add(testEntry);
- TestCaseUtils.addEntry(testEntry);
- }
-
- // Initialize the cache reflecting on DirectoryServer
- // and EntryCacheConfigManager.
- final Field[] directoryFields =
- DirectoryServer.class.getDeclaredFields();
- for (int i = 0; i < directoryFields.length; ++i) {
- if (directoryFields[i].getName().equals("entryCacheConfigManager")) {
- directoryFields[i].setAccessible(true);
- final Method[] cacheManagerMethods =
- directoryFields[i].getType().getDeclaredMethods();
- for (int j = 0; j < cacheManagerMethods.length; ++j) {
- if (cacheManagerMethods[j].getName().equals(
- "loadAndInstallEntryCache")) {
- cacheManagerMethods[j].setAccessible(true);
- cacheManagerMethods[j].invoke(directoryFields[i].get(
- DirectoryServer.getInstance()),
- configuration.getJavaClass(), configuration);
- }
- }
- }
- }
-
- // Attempt to force GC to possibly free some memory.
- System.gc();
- }
-
-
-
- /**
- * Tests the entry cache pre-load.
- */
- @Test
- public void testEntryCachePreload()
- throws Exception
- {
- // Make sure the entry cache is empty.
- assertNull(toVerboseString(),
- "Expected empty cache. " + "Cache contents:" + ServerConstants.EOL +
- toVerboseString());
-
- // Preload.
- Backend backend = DirectoryServer.getBackend("cacheTest");
- backend.preloadEntryCache();
-
- // Check that all test entries are preloaded.
- for(int i = 0; i < NUMTESTENTRIES; i++ ) {
- assertNotNull(DirectoryServer.getEntryCache().getEntry(
- testEntriesList.get(i).getName()), "Expected to find " +
- testEntriesList.get(i).getName() +
- " in the cache. Cache contents:" +
- ServerConstants.EOL + toVerboseString());
- }
- }
-
-
-
- /**
- * Finalize the entry cache pre-load test.
- *
- * @throws Exception If an unexpected problem occurs.
- */
- @AfterClass
- public void preloadEntryCacheTestFini()
- throws Exception
- {
- // Dummy JE backend cleanup.
- TestCaseUtils.dsconfig("delete-backend", "--backend-name", "cacheTest");
- TestCaseUtils.deleteDirectory(jeBackendTempDir);
-
- // Sanity in-core restart.
- TestCaseUtils.restartServer();
- }
-
-
-
- /**
- * Reflection of the toVerboseString implementation method.
- */
- protected String toVerboseString()
- throws Exception
- {
- final Method[] cacheMethods =
- DirectoryServer.getEntryCache().getClass().getDeclaredMethods();
-
- for (int i = 0; i < cacheMethods.length; ++i) {
- if (cacheMethods[i].getName().equals("toVerboseString")) {
- cacheMethods[i].setAccessible(true);
- Object verboseString =
- cacheMethods[i].invoke(DirectoryServer.getEntryCache(),
- (Object[]) null);
- return (String) verboseString;
- }
- }
-
- return null;
- }
-}
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/config-small.ldif b/opendj-server-legacy/tests/unit-tests-testng/resource/config-small.ldif
index 0989922..3dd77d6 100644
--- a/opendj-server-legacy/tests/unit-tests-testng/resource/config-small.ldif
+++ b/opendj-server-legacy/tests/unit-tests-testng/resource/config-small.ldif
@@ -20,7 +20,7 @@
# CDDL HEADER END
#
# Copyright 2006-2010 Sun Microsystems, Inc.
-# Portions Copyright 2010-2014 ForgeRock AS.
+# Portions Copyright 2010-2015 ForgeRock AS.
# Portions Copyright 2012-2014 Manuel Gaupp
#
#
@@ -51,7 +51,6 @@
ds-cfg-idle-time-limit: 0 seconds
ds-cfg-save-config-on-successful-startup: true
ds-cfg-etime-resolution: milliseconds
-ds-cfg-entry-cache-preload: false
ds-cfg-max-allowed-client-connections: 0
ds-cfg-max-psearches: -1
ds-cfg-allowed-task: org.opends.server.tasks.AddSchemaFileTask
--
Gitblit v1.10.0