From b5e5492791ccbcd7688138222788e26a5500a10e Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Wed, 17 Dec 2014 23:37:46 +0000
Subject: [PATCH] OPENDJ-1602 (CR-5566) New pluggable storage based backend
---
/dev/null | 594 -------------------------
opendj-sdk/opendj3-server-dev/src/admin/defn/org/opends/server/admin/std/PersistitBackendConfiguration.xml | 534 +++++++++++++++++++++++
opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/BackendImpl.java | 32
opendj-sdk/opendj3-server-dev/src/admin/messages/PersistitBackendCfgDefn.properties | 55 ++
opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/persistit/PersistItStorage.java | 31
opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/spi/Storage.java | 7
opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/RootContainer.java | 26
opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/EntryContainer.java | 40
opendj-sdk/opendj3-server-dev/resource/schema/02-config.ldif | 19
9 files changed, 675 insertions(+), 663 deletions(-)
diff --git a/opendj-sdk/opendj3-server-dev/resource/schema/02-config.ldif b/opendj-sdk/opendj3-server-dev/resource/schema/02-config.ldif
index f75575d..7cb557a 100644
--- a/opendj-sdk/opendj3-server-dev/resource/schema/02-config.ldif
+++ b/opendj-sdk/opendj3-server-dev/resource/schema/02-config.ldif
@@ -5750,3 +5750,22 @@
SUP ds-cfg-password-storage-scheme
STRUCTURAL
X-ORIGIN 'OpenDJ Directory Server' )
+objectClasses: ( 1.3.6.1.4.1.36733.2.1.2.22
+ NAME 'ds-cfg-persistit-backend'
+ SUP ds-cfg-backend
+ STRUCTURAL
+ MUST ds-cfg-db-directory
+ MAY ( ds-cfg-index-entry-limit $
+ ds-cfg-preload-time-limit $
+ ds-cfg-entries-compressed $
+ ds-cfg-compact-encoding $
+ ds-cfg-index-filter-analyzer-enabled $
+ ds-cfg-index-filter-analyzer-max-filters $
+ ds-cfg-subordinate-indexes-enabled $
+ ds-cfg-db-directory-permissions $
+ ds-cfg-db-cache-percent $
+ ds-cfg-db-cache-size $
+ ds-cfg-db-txn-no-sync $
+ ds-cfg-disk-full-threshold $
+ ds-cfg-disk-low-threshold )
+ X-ORIGIN 'OpenDJ Directory Server' )
diff --git a/opendj-sdk/opendj3-server-dev/src/admin/defn/org/opends/server/admin/std/PersistitBackendConfiguration.xml b/opendj-sdk/opendj3-server-dev/src/admin/defn/org/opends/server/admin/std/PersistitBackendConfiguration.xml
new file mode 100644
index 0000000..cfb52c5
--- /dev/null
+++ b/opendj-sdk/opendj3-server-dev/src/admin/defn/org/opends/server/admin/std/PersistitBackendConfiguration.xml
@@ -0,0 +1,534 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ! 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 2014 ForgeRock AS.
+ ! -->
+<adm:managed-object name="persistit-backend"
+ plural-name="persistit-backends" package="org.opends.server.admin.std"
+ extends="backend" xmlns:adm="http://www.opends.org/admin"
+ xmlns:ldap="http://www.opends.org/admin-ldap"
+ xmlns:cli="http://www.opends.org/admin-cli">
+ <adm:synopsis>
+ A <adm:user-friendly-name/> stores application
+ data in a Persistit database.
+ </adm:synopsis>
+ <adm:profile name="ldap">
+ <ldap:object-class>
+ <ldap:name>ds-cfg-persistit-backend</ldap:name>
+ <ldap:superior>ds-cfg-backend</ldap:superior>
+ </ldap:object-class>
+ </adm:profile>
+ <adm:relation name="backend-index" managed-object-name="local-db-index">
+ <adm:one-to-many naming-property="attribute" plural-name="backend-indexes">
+ <adm:default-managed-object name="aci">
+ <adm:property name="index-type">
+ <adm:value>presence</adm:value>
+ </adm:property>
+ <adm:property name="attribute">
+ <adm:value>aci</adm:value>
+ </adm:property>
+ </adm:default-managed-object>
+ <adm:default-managed-object name="entryUUID">
+ <adm:property name="index-type">
+ <adm:value>equality</adm:value>
+ </adm:property>
+ <adm:property name="attribute">
+ <adm:value>entryUUID</adm:value>
+ </adm:property>
+ </adm:default-managed-object>
+ <adm:default-managed-object name="objectClass">
+ <adm:property name="index-type">
+ <adm:value>equality</adm:value>
+ </adm:property>
+ <adm:property name="attribute">
+ <adm:value>objectClass</adm:value>
+ </adm:property>
+ </adm:default-managed-object>
+ <adm:default-managed-object name="ds-sync-hist">
+ <adm:property name="index-type">
+ <adm:value>ordering</adm:value>
+ </adm:property>
+ <adm:property name="attribute">
+ <adm:value>ds-sync-hist</adm:value>
+ </adm:property>
+ </adm:default-managed-object>
+ <adm:default-managed-object name="ds-sync-conflict">
+ <adm:property name="index-type">
+ <adm:value>equality</adm:value>
+ </adm:property>
+ <adm:property name="attribute">
+ <adm:value>ds-sync-conflict</adm:value>
+ </adm:property>
+ </adm:default-managed-object>
+ </adm:one-to-many>
+ <adm:profile name="ldap">
+ <ldap:rdn-sequence>cn=Index</ldap:rdn-sequence>
+ </adm:profile>
+ <adm:profile name="cli">
+ <cli:relation>
+ <cli:default-property name="index-type" />
+ <cli:default-property name="index-entry-limit" />
+ <cli:default-property name="index-extensible-matching-rule" />
+ </cli:relation>
+ </adm:profile>
+ </adm:relation>
+ <adm:relation name="backend-vlv-index" managed-object-name="local-db-vlv-index">
+ <adm:one-to-many naming-property="name" plural-name="backend-vlv-indexes"/>
+ <adm:profile name="ldap">
+ <ldap:rdn-sequence>cn=VLV Index</ldap:rdn-sequence>
+ </adm:profile>
+ <adm:profile name="cli">
+ <cli:relation>
+ <cli:default-property name="base-dn" />
+ <cli:default-property name="scope" />
+ <cli:default-property name="filter" />
+ <cli:default-property name="sort-order" />
+ </cli:relation>
+ </adm:profile>
+ </adm:relation>
+ <adm:property-override name="writability-mode">
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>enabled</adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ </adm:property-override>
+ <adm:property name="compact-encoding">
+ <adm:synopsis>
+ Indicates whether the backend should use a compact form when
+ encoding entries by compressing the attribute descriptions and
+ object class sets.
+ </adm:synopsis>
+ <adm:description>
+ Note that this property applies only to the entries themselves and
+ does not impact the index data.
+ </adm:description>
+ <adm:requires-admin-action>
+ <adm:none>
+ <adm:synopsis>
+ Changes to this setting take effect only for writes that
+ occur after the change is made. It is not retroactively
+ applied to existing data.
+ </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:name>ds-cfg-compact-encoding</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="entries-compressed" advanced="true">
+ <adm:synopsis>
+ Indicates whether the backend should attempt to compress entries
+ before storing them in the database.
+ </adm:synopsis>
+ <adm:description>
+ Note that this property applies only to the entries themselves and
+ does not impact the index data. Further, the effectiveness of the
+ compression is based on the type of data contained in the
+ entry.
+ </adm:description>
+ <adm:requires-admin-action>
+ <adm:none>
+ <adm:synopsis>
+ Changes to this setting take effect only for writes that
+ occur after the change is made. It is not retroactively
+ applied to existing data.
+ </adm:synopsis>
+ </adm:none>
+ </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-entries-compressed</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="index-entry-limit">
+ <adm:synopsis>
+ Specifies the maximum number of entries that is allowed to
+ match a given index key before that particular index key is no
+ longer maintained.
+ </adm:synopsis>
+ <adm:description>
+ This property is analogous to the ALL IDs threshold in the Sun
+ Java System Directory Server. Note that this is the default limit
+ for the backend, and it may be overridden on a per-attribute
+ basis.A value of 0 means there is no limit.
+ </adm:description>
+ <adm:requires-admin-action>
+ <adm:none>
+ <adm:synopsis>
+ If any index keys have already reached this limit, indexes
+ need to be rebuilt before they are allowed to use the
+ new limit.
+ </adm:synopsis>
+ </adm:none>
+ </adm:requires-admin-action>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>4000</adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:integer lower-limit="0" upper-limit="2147483647" />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:name>ds-cfg-index-entry-limit</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="preload-time-limit" advanced="true">
+ <adm:synopsis>
+ Specifies the length of time that the backend is allowed to
+ spend "pre-loading" data when it is initialized.
+ </adm:synopsis>
+ <adm:description>
+ The pre-load process is used to pre-populate the database
+ cache, so that it can be more quickly available when the server is
+ processing requests. A duration of zero means there is no
+ pre-load.
+ </adm:description>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>0s</adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:duration base-unit="ms" lower-limit="0" upper-limit="2147483647" />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:name>ds-cfg-preload-time-limit</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="index-filter-analyzer-enabled" advanced="true">
+ <adm:synopsis>
+ Indicates whether to gather statistical information about the search
+ filters processed by the directory server while evaluating the usage of
+ indexes.
+ </adm:synopsis>
+ <adm:description>
+ Analyzing indexes requires gathering search filter usage patterns from
+ user requests, especially for values as specified in the filters and
+ subsequently looking the status of those values into the index files.
+ When a search requests is processed, internal or user generated, a
+ first phase uses indexes to find potential entries to be returned.
+ Depending on the search filter, if the index of one of the specified
+ attributes matches too many entries (exceeds the index entry limit),
+ the search becomes non-indexed. In any case, all entries thus
+ gathered (or the entire DIT) are matched against the filter for
+ actually returning the search result.
+ </adm:description>
+ <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-index-filter-analyzer-enabled</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="index-filter-analyzer-max-filters" advanced="true">
+ <adm:synopsis>
+ The maximum number of search filter statistics to keep.
+ </adm:synopsis>
+ <adm:description>
+ When the maximum number of search filter is reached, the least used one
+ will be deleted.
+ </adm:description>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>25</adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:integer lower-limit="1" />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:name>ds-cfg-index-filter-analyzer-max-filters</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="subordinate-indexes-enabled" advanced="true">
+ <adm:synopsis>
+ Indicates whether id2children and id2subtree indexes should be used for
+ this backend. These indexes are used for constraining filtered searches
+ to the search request's scope as well as for generating values for the
+ hasSubordinates and numSubordinates virtual attributes.
+ </adm:synopsis>
+ <adm:description>
+ Subordinate indexing is enabled by default and should only be disabled
+ for specialized use cases. A typical use case is where the backend is
+ to be subjected to heavy add/delete load beneath the same parent entry
+ such as when used as a session database. Disabling the subordinate
+ indexes means that the numSubordinates and hasSubordinates virtual
+ attributes will not be supported.
+ </adm:description>
+ <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:name>ds-cfg-subordinate-indexes-enabled</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property-override name="java-class" advanced="true">
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>
+ org.opends.server.backends.pluggable.BackendImpl
+ </adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ </adm:property-override>
+ <adm:property name="db-directory" mandatory="true">
+ <adm:TODO>Default this to the db/backend-id</adm:TODO>
+ <adm:synopsis>
+ Specifies the path to the filesystem directory that is used
+ to hold the Persistit database files containing the
+ data for this backend.
+ </adm:synopsis>
+ <adm:description>
+ The path may be either an absolute path or a path relative to the
+ directory containing the base of the <adm:product-name /> directory server
+ installation. The path may be any valid directory path in which
+ the server has appropriate permissions to read and write files and
+ has sufficient space to hold the database contents.
+ </adm:description>
+ <adm:requires-admin-action>
+ <adm:component-restart />
+ </adm:requires-admin-action>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>db</adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:string />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:name>ds-cfg-db-directory</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="db-directory-permissions" advanced="true">
+ <adm:synopsis>
+ Specifies the permissions that should be applied to the directory
+ containing the server database files.
+ </adm:synopsis>
+ <adm:description>
+ They should be expressed as three-digit octal values, which is the
+ traditional representation for UNIX file permissions. The three
+ digits represent the permissions that are available for the
+ directory's owner, group members, and other users (in that order),
+ and each digit is the octal representation of the read, write, and
+ execute bits. Note that this only impacts permissions on the
+ database directory and not on the files written into that
+ directory. On UNIX systems, the user's umask controls
+ permissions given to the database files.
+ </adm:description>
+ <adm:requires-admin-action>
+ <adm:server-restart />
+ </adm:requires-admin-action>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>700</adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:string>
+ <adm:pattern>
+ <adm:regex>^7[0-7][0-7]$</adm:regex>
+ <adm:usage>MODE</adm:usage>
+ <adm:synopsis>
+ Any octal value between 700 and 777 (the owner must always
+ have read, write, and execute permissions on the directory).
+ </adm:synopsis>
+ </adm:pattern>
+ </adm:string>
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:name>ds-cfg-db-directory-permissions</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="db-cache-percent">
+ <adm:synopsis>
+ Specifies the percentage of JVM memory to allocate to the database cache.
+ </adm:synopsis>
+ <adm:description>
+ Specifies the percentage of memory available to the JVM that
+ should be used for caching database contents. Note that this is
+ only used if the value of the db-cache-size property is set to
+ "0 MB". Otherwise, the value of that property is used instead
+ to control the cache size configuration.
+ </adm:description>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>50</adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:integer lower-limit="1" upper-limit="90" />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:name>ds-cfg-db-cache-percent</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="db-cache-size">
+ <adm:synopsis>
+ The amount of JVM memory to allocate to the database cache.
+ </adm:synopsis>
+ <adm:description>
+ Specifies the amount of memory that should be used for caching
+ database contents. A value of "0 MB" indicates that the
+ db-cache-percent property should be used instead to specify the
+ cache size.
+ </adm:description>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>0 MB</adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:size lower-limit="0 MB" />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:name>ds-cfg-db-cache-size</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="db-txn-no-sync" advanced="true">
+ <adm:synopsis>
+ Indicates whether database writes should be primarily written to
+ an internal buffer but not immediately written to disk.
+ </adm:synopsis>
+ <adm:description>
+ Setting the value of this configuration attribute to "true" may
+ improve write performance but could cause the most
+ recent changes to be lost if the <adm:product-name /> directory server or the
+ underlying JVM exits abnormally, or if an OS or hardware failure
+ occurs (a behavior similar to running with transaction durability
+ disabled in the Sun Java System Directory Server).
+ </adm:description>
+ <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-db-txn-no-sync</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="disk-low-threshold" advanced="true">
+ <adm:synopsis>
+ Low disk threshold to limit database updates
+ </adm:synopsis>
+ <adm:description>
+ Specifies the "low" free space on the disk. When the available
+ free space on the disk used by this database instance falls below the
+ value specified, protocol updates on this database are permitted only
+ by a user with the BYPASS_LOCKDOWN privilege.
+ </adm:description>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>200 megabytes</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-disk-low-threshold</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="disk-full-threshold" advanced="true">
+ <adm:synopsis>
+ Full disk threshold to limit database updates
+ </adm:synopsis>
+ <adm:description>
+ When the available free space on the disk used by this database
+ instance falls below the value specified, no updates
+ are permitted and the server returns an UNWILLING_TO_PERFORM error.
+ Updates are allowed again as soon as free space rises above the
+ threshold.
+ </adm:description>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>100 megabytes</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-disk-full-threshold</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+</adm:managed-object>
diff --git a/opendj-sdk/opendj3-server-dev/src/admin/messages/PersistitBackendCfgDefn.properties b/opendj-sdk/opendj3-server-dev/src/admin/messages/PersistitBackendCfgDefn.properties
new file mode 100644
index 0000000..a4fee5a
--- /dev/null
+++ b/opendj-sdk/opendj3-server-dev/src/admin/messages/PersistitBackendCfgDefn.properties
@@ -0,0 +1,55 @@
+user-friendly-name=Persistit Backend
+user-friendly-plural-name=Persistit Backends
+synopsis=A Persistit Backend stores application data in a Persistit database.
+property.backend-id.synopsis=Specifies a name to identify the associated backend.
+property.backend-id.description=The name must be unique among all backends in the server. The backend ID may not be altered after the backend is created in the server.
+property.base-dn.synopsis=Specifies the base DN(s) for the data that the backend handles.
+property.base-dn.description=A single backend may be responsible for one or more base DNs. Note that no two backends may have the same base DN although one backend may have a base DN that is below a base DN provided by another backend (similar to the use of sub-suffixes in the Sun Java System Directory Server). If any of the base DNs is subordinate to a base DN for another backend, then all base DNs for that backend must be subordinate to that same base DN.
+property.base-dn.requires-admin-action.synopsis=No administrative action is required by default although some action may be required on a per-backend basis before the new base DN may be used.
+property.compact-encoding.synopsis=Indicates whether the backend should use a compact form when encoding entries by compressing the attribute descriptions and object class sets.
+property.compact-encoding.description=Note that this property applies only to the entries themselves and does not impact the index data.
+property.compact-encoding.requires-admin-action.synopsis=Changes to this setting take effect only for writes that occur after the change is made. It is not retroactively applied to existing data.
+property.db-cache-percent.synopsis=Specifies the percentage of JVM memory to allocate to the database cache.
+property.db-cache-percent.description=Specifies the percentage of memory available to the JVM that should be used for caching database contents. Note that this is only used if the value of the db-cache-size property is set to "0 MB". Otherwise, the value of that property is used instead to control the cache size configuration.
+property.db-cache-size.synopsis=The amount of JVM memory to allocate to the database cache.
+property.db-cache-size.description=Specifies the amount of memory that should be used for caching database contents. A value of "0 MB" indicates that the db-cache-percent property should be used instead to specify the cache size.
+property.db-directory.synopsis=Specifies the path to the filesystem directory that is used to hold the Persistit database files containing the data for this backend.
+property.db-directory.description=The path may be either an absolute path or a path relative to the directory containing the base of the OpenDJ directory server installation. The path may be any valid directory path in which the server has appropriate permissions to read and write files and has sufficient space to hold the database contents.
+property.db-directory-permissions.synopsis=Specifies the permissions that should be applied to the directory containing the server database files.
+property.db-directory-permissions.description=They should be expressed as three-digit octal values, which is the traditional representation for UNIX file permissions. The three digits represent the permissions that are available for the directory's owner, group members, and other users (in that order), and each digit is the octal representation of the read, write, and execute bits. Note that this only impacts permissions on the database directory and not on the files written into that directory. On UNIX systems, the user's umask controls permissions given to the database files.
+property.db-directory-permissions.syntax.string.pattern.synopsis=Any octal value between 700 and 777 (the owner must always have read, write, and execute permissions on the directory).
+property.db-txn-no-sync.synopsis=Indicates whether database writes should be primarily written to an internal buffer but not immediately written to disk.
+property.db-txn-no-sync.description=Setting the value of this configuration attribute to "true" may improve write performance but could cause the most recent changes to be lost if the OpenDJ directory server or the underlying JVM exits abnormally, or if an OS or hardware failure occurs (a behavior similar to running with transaction durability disabled in the Sun Java System Directory Server).
+property.disk-full-threshold.synopsis=Full disk threshold to limit database updates
+property.disk-full-threshold.description=When the available free space on the disk used by this database instance falls below the value specified, no updates are permitted and the server returns an UNWILLING_TO_PERFORM error. Updates are allowed again as soon as free space rises above the threshold.
+property.disk-low-threshold.synopsis=Low disk threshold to limit database updates
+property.disk-low-threshold.description=Specifies the "low" free space on the disk. When the available free space on the disk used by this database instance falls below the value specified, protocol updates on this database are permitted only by a user with the BYPASS_LOCKDOWN privilege.
+property.enabled.synopsis=Indicates whether the backend is enabled in the server.
+property.enabled.description=If a backend is not enabled, then its contents are not accessible when processing operations.
+property.entries-compressed.synopsis=Indicates whether the backend should attempt to compress entries before storing them in the database.
+property.entries-compressed.description=Note that this property applies only to the entries themselves and does not impact the index data. Further, the effectiveness of the compression is based on the type of data contained in the entry.
+property.entries-compressed.requires-admin-action.synopsis=Changes to this setting take effect only for writes that occur after the change is made. It is not retroactively applied to existing data.
+property.index-entry-limit.synopsis=Specifies the maximum number of entries that is allowed to match a given index key before that particular index key is no longer maintained.
+property.index-entry-limit.description=This property is analogous to the ALL IDs threshold in the Sun Java System Directory Server. Note that this is the default limit for the backend, and it may be overridden on a per-attribute basis.A value of 0 means there is no limit.
+property.index-entry-limit.requires-admin-action.synopsis=If any index keys have already reached this limit, indexes need to be rebuilt before they are allowed to use the new limit.
+property.index-filter-analyzer-enabled.synopsis=Indicates whether to gather statistical information about the search filters processed by the directory server while evaluating the usage of indexes.
+property.index-filter-analyzer-enabled.description=Analyzing indexes requires gathering search filter usage patterns from user requests, especially for values as specified in the filters and subsequently looking the status of those values into the index files. When a search requests is processed, internal or user generated, a first phase uses indexes to find potential entries to be returned. Depending on the search filter, if the index of one of the specified attributes matches too many entries (exceeds the index entry limit), the search becomes non-indexed. In any case, all entries thus gathered (or the entire DIT) are matched against the filter for actually returning the search result.
+property.index-filter-analyzer-max-filters.synopsis=The maximum number of search filter statistics to keep.
+property.index-filter-analyzer-max-filters.description=When the maximum number of search filter is reached, the least used one will be deleted.
+property.java-class.synopsis=Specifies the fully-qualified name of the Java class that provides the backend implementation.
+property.preload-time-limit.synopsis=Specifies the length of time that the backend is allowed to spend "pre-loading" data when it is initialized.
+property.preload-time-limit.description=The pre-load process is used to pre-populate the database cache, so that it can be more quickly available when the server is processing requests. A duration of zero means there is no pre-load.
+property.subordinate-indexes-enabled.synopsis=Indicates whether id2children and id2subtree indexes should be used for this backend. These indexes are used for constraining filtered searches to the search request's scope as well as for generating values for the hasSubordinates and numSubordinates virtual attributes.
+property.subordinate-indexes-enabled.description=Subordinate indexing is enabled by default and should only be disabled for specialized use cases. A typical use case is where the backend is to be subjected to heavy add/delete load beneath the same parent entry such as when used as a session database. Disabling the subordinate indexes means that the numSubordinates and hasSubordinates virtual attributes will not be supported.
+property.writability-mode.synopsis=Specifies the behavior that the backend should use when processing write operations.
+property.writability-mode.syntax.enumeration.value.disabled.synopsis=Causes all write attempts to fail.
+property.writability-mode.syntax.enumeration.value.enabled.synopsis=Allows write operations to be performed in that backend (if the requested operation is valid, the user has permission to perform the operation, the backend supports that type of write operation, and the global writability-mode property is also enabled).
+property.writability-mode.syntax.enumeration.value.internal-only.synopsis=Causes external write attempts to fail but allows writes by replication and internal operations.
+relation.backend-index.user-friendly-name=Backend Index
+relation.backend-index.user-friendly-plural-name=Backend Indexes
+relation.backend-index.synopsis=Local DB Indexes are used to store information that makes it possible to locate entries very quickly when processing search operations.
+relation.backend-index.description=Indexing is performed on a per-attribute level and different types of indexing may be performed for different kinds of attributes, based on how they are expected to be accessed during search operations.
+relation.backend-vlv-index.user-friendly-name=Backend VLV Index
+relation.backend-vlv-index.user-friendly-plural-name=Backend VLV Indexes
+relation.backend-vlv-index.synopsis=Local DB VLV Indexes are used to store information about a specific search request that makes it possible to efficiently process them using the VLV control.
+relation.backend-vlv-index.description=A VLV index effectively notifies the server that a virtual list view, with specific query and sort parameters, will be performed. This index also allows the server to collect and maintain the information required to make using the virtual list view faster.
diff --git a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/persistit/PersistItStorage.java b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/persistit/PersistItStorage.java
index a0f6c42..c8e8195 100644
--- a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/persistit/PersistItStorage.java
+++ b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/persistit/PersistItStorage.java
@@ -26,6 +26,10 @@
package org.opends.server.backends.persistit;
+
+
+import static org.opends.server.util.StaticUtils.getFileForPath;
+
import java.io.File;
import java.util.HashMap;
import java.util.Map;
@@ -37,6 +41,7 @@
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.admin.std.server.LocalDBBackendCfg;
+import org.opends.server.admin.std.server.PersistitBackendCfg;
import org.opends.server.backends.pluggable.spi.Cursor;
import org.opends.server.backends.pluggable.spi.Importer;
import org.opends.server.backends.pluggable.spi.ReadOperation;
@@ -172,7 +177,7 @@
throw new StorageRuntimeException(e);
}
}
-
+
@Override
public void update(TreeName treeName, ByteSequence key, UpdateFunction f)
{
@@ -329,23 +334,25 @@
}
}
- private final File backendDirectory;
- private final LocalDBBackendCfg config;
+
+
+ private File backendDirectory;
+ private PersistitBackendCfg config;
private Persistit db;
private final ConcurrentMap<TreeName, Volume> volumes = new ConcurrentHashMap<TreeName, Volume>();
private Properties properties;
- public PersistItStorage(File backendDirectory, LocalDBBackendCfg config) {
- this.backendDirectory = backendDirectory;
- this.config = config;
- }
-
private Volume getVolume(TreeName treeName) {
return volumes.get(treeName.getSuffix());
}
@Override
- public void initialize(Map<String, String> options) {
+ public void initialize(PersistitBackendCfg cfg)
+ {
+ this.config = cfg;
+ this.backendDirectory = new File(getFileForPath(config.getDBDirectory()),
+ config.getBackendId());
+
properties = new Properties();
properties.setProperty("datapath", backendDirectory.toString());
properties.setProperty("logpath", backendDirectory.toString());
@@ -362,12 +369,6 @@
+ ",extensionSize:1M"
+ ",maximumSize:10G");
}
-
- if (options != null) {
- for (Entry<String, String> entry : options.entrySet()) {
- properties.setProperty(entry.getKey(), entry.getValue());
- }
- }
}
/**
diff --git a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/BackendImpl.java b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/BackendImpl.java
index 1a54c7c..08458fe 100644
--- a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/BackendImpl.java
+++ b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/BackendImpl.java
@@ -31,7 +31,6 @@
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
-import java.util.logging.Level;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
@@ -41,7 +40,7 @@
import org.forgerock.util.Reject;
import org.opends.server.admin.server.ConfigurationChangeListener;
import org.opends.server.admin.std.meta.LocalDBIndexCfgDefn;
-import org.opends.server.admin.std.server.LocalDBBackendCfg;
+import org.opends.server.admin.std.server.PersistitBackendCfg;
import org.opends.server.api.AlertGenerator;
import org.opends.server.api.Backend;
import org.opends.server.api.DiskSpaceMonitorHandler;
@@ -63,14 +62,14 @@
* This is an implementation of a Directory Server Backend which stores entries
* locally in a Berkeley DB JE database.
*/
-public class BackendImpl extends Backend<LocalDBBackendCfg> implements
- ConfigurationChangeListener<LocalDBBackendCfg>, AlertGenerator,
+public class BackendImpl extends Backend<PersistitBackendCfg> implements
+ ConfigurationChangeListener<PersistitBackendCfg>, AlertGenerator,
DiskSpaceMonitorHandler
{
private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
- /** The configuration of this JE backend. */
- private LocalDBBackendCfg cfg;
+ /** The configuration of this backend. */
+ private PersistitBackendCfg cfg;
/** The root JE container to use for this backend. */
private RootContainer rootContainer;
@@ -128,7 +127,7 @@
/** {@inheritDoc} */
@Override
- public void configureBackend(LocalDBBackendCfg cfg) throws ConfigException
+ public void configureBackend(PersistitBackendCfg cfg) throws ConfigException
{
Reject.ifNull(cfg);
@@ -191,7 +190,7 @@
//Register as an AlertGenerator.
DirectoryServer.registerAlertGenerator(this);
// Register this backend as a change listener.
- cfg.addLocalDBChangeListener(this);
+ cfg.addPersistitChangeListener(this);
}
/** {@inheritDoc} */
@@ -199,7 +198,7 @@
public void finalizeBackend()
{
super.finalizeBackend();
- cfg.removeLocalDBChangeListener(this);
+ cfg.removePersistitChangeListener(this);
// Deregister our base DNs.
for (DN dn : rootContainer.getBaseDNs())
@@ -793,7 +792,7 @@
/** {@inheritDoc} */
@Override
- public boolean isConfigurationAcceptable(LocalDBBackendCfg config,
+ public boolean isConfigurationAcceptable(PersistitBackendCfg config,
List<LocalizableMessage> unacceptableReasons)
{
return isConfigurationChangeAcceptable(config, unacceptableReasons);
@@ -804,24 +803,17 @@
/** {@inheritDoc} */
@Override
public boolean isConfigurationChangeAcceptable(
- LocalDBBackendCfg cfg,
+ PersistitBackendCfg cfg,
List<LocalizableMessage> unacceptableReasons)
{
- // Make sure that the logging level value is acceptable.
- try {
- Level.parse(cfg.getDBLoggingLevel());
- return true;
- } catch (Exception e) {
- unacceptableReasons.add(ERR_JEB_INVALID_LOGGING_LEVEL.get(cfg.getDBLoggingLevel(), cfg.dn()));
- return false;
- }
+ return true;
}
/** {@inheritDoc} */
@Override
- public ConfigChangeResult applyConfigurationChange(final LocalDBBackendCfg newCfg)
+ public ConfigChangeResult applyConfigurationChange(final PersistitBackendCfg newCfg)
{
final ConfigChangeResult ccr = new ConfigChangeResult();
try
diff --git a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/ConfigurableEnvironment.java b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/ConfigurableEnvironment.java
deleted file mode 100644
index 7baa2bf..0000000
--- a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/ConfigurableEnvironment.java
+++ /dev/null
@@ -1,594 +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 2006-2010 Sun Microsystems, Inc.
- * Portions Copyright 2010-2014 ForgeRock AS.
- */
-package org.opends.server.backends.pluggable;
-
-import java.lang.reflect.Method;
-import java.math.BigInteger;
-import java.util.*;
-import java.util.concurrent.TimeUnit;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.i18n.slf4j.LocalizedLogger;
-import org.opends.server.admin.BooleanPropertyDefinition;
-import org.opends.server.admin.DurationPropertyDefinition;
-import org.opends.server.admin.PropertyDefinition;
-import org.opends.server.admin.std.meta.LocalDBBackendCfgDefn;
-import org.opends.server.admin.std.server.LocalDBBackendCfg;
-import org.opends.server.config.ConfigConstants;
-import org.forgerock.opendj.config.server.ConfigException;
-
-
-
-
-import static com.sleepycat.je.EnvironmentConfig.*;
-
-import static org.opends.messages.BackendMessages.*;
-import static org.opends.messages.ConfigMessages.*;
-import static org.opends.messages.JebMessages.*;
-
-/**
- * This class maps JE properties to configuration attributes.
- */
-public class ConfigurableEnvironment
-{
- private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
-
- /**
- * The name of the attribute which configures the database cache size as a
- * percentage of Java VM heap size.
- */
- public static final String ATTR_DATABASE_CACHE_PERCENT =
- ConfigConstants.NAME_PREFIX_CFG + "db-cache-percent";
-
- /**
- * The name of the attribute which configures the database cache size as an
- * approximate number of bytes.
- */
- public static final String ATTR_DATABASE_CACHE_SIZE =
- ConfigConstants.NAME_PREFIX_CFG + "db-cache-size";
-
- /**
- * The name of the attribute which configures whether data updated by a
- * database transaction is forced to disk.
- */
- public static final String ATTR_DATABASE_TXN_NO_SYNC =
- ConfigConstants.NAME_PREFIX_CFG + "db-txn-no-sync";
-
- /**
- * The name of the attribute which configures whether data updated by a
- * database transaction is written from the Java VM to the O/S.
- */
- public static final String ATTR_DATABASE_TXN_WRITE_NO_SYNC =
- ConfigConstants.NAME_PREFIX_CFG + "db-txn-write-no-sync";
-
- /**
- * The name of the attribute which configures whether the database background
- * cleaner thread runs.
- */
- public static final String ATTR_DATABASE_RUN_CLEANER =
- ConfigConstants.NAME_PREFIX_CFG + "db-run-cleaner";
-
- /**
- * The name of the attribute which configures the minimum percentage of log
- * space that must be used in log files.
- */
- public static final String ATTR_CLEANER_MIN_UTILIZATION =
- ConfigConstants.NAME_PREFIX_CFG + "db-cleaner-min-utilization";
-
- /**
- * The name of the attribute which configures the maximum size of each
- * individual JE log file, in bytes.
- */
- public static final String ATTR_DATABASE_LOG_FILE_MAX =
- ConfigConstants.NAME_PREFIX_CFG + "db-log-file-max";
-
- /**
- * The name of the attribute which configures the database cache eviction
- * algorithm.
- */
- public static final String ATTR_EVICTOR_LRU_ONLY =
- ConfigConstants.NAME_PREFIX_CFG + "db-evictor-lru-only";
-
- /**
- * The name of the attribute which configures the number of nodes in one scan
- * of the database cache evictor.
- */
- public static final String ATTR_EVICTOR_NODES_PER_SCAN =
- ConfigConstants.NAME_PREFIX_CFG + "db-evictor-nodes-per-scan";
-
- /**
- * The name of the attribute which configures the minimum number of threads
- * of the database cache evictor pool.
- */
- public static final String ATTR_EVICTOR_CORE_THREADS =
- ConfigConstants.NAME_PREFIX_CFG + "db-evictor-core-threads";
- /**
- * The name of the attribute which configures the maximum number of threads
- * of the database cache evictor pool.
- */
- public static final String ATTR_EVICTOR_MAX_THREADS =
- ConfigConstants.NAME_PREFIX_CFG + "db-evictor-max-threads";
-
- /**
- * The name of the attribute which configures the time excess threads
- * of the database cache evictor pool are kept alive.
- */
- public static final String ATTR_EVICTOR_KEEP_ALIVE =
- ConfigConstants.NAME_PREFIX_CFG + "db-evictor-keep-alive";
-
- /**
- * The name of the attribute which configures whether the logging file
- * handler will be on or off.
- */
- public static final String ATTR_LOGGING_FILE_HANDLER_ON =
- ConfigConstants.NAME_PREFIX_CFG + "db-logging-file-handler-on";
-
-
- /**
- * The name of the attribute which configures the trace logging message level.
- */
- public static final String ATTR_LOGGING_LEVEL =
- ConfigConstants.NAME_PREFIX_CFG + "db-logging-level";
-
-
- /**
- * The name of the attribute which configures how many bytes are written to
- * the log before the checkpointer runs.
- */
- public static final String ATTR_CHECKPOINTER_BYTES_INTERVAL =
- ConfigConstants.NAME_PREFIX_CFG + "db-checkpointer-bytes-interval";
-
-
- /**
- * The name of the attribute which configures the amount of time between
- * runs of the checkpointer.
- */
- public static final String ATTR_CHECKPOINTER_WAKEUP_INTERVAL =
- ConfigConstants.NAME_PREFIX_CFG +
- "db-checkpointer-wakeup-interval";
-
-
- /**
- * The name of the attribute which configures the number of lock tables.
- */
- public static final String ATTR_NUM_LOCK_TABLES =
- ConfigConstants.NAME_PREFIX_CFG + "db-num-lock-tables";
-
-
- /**
- * The name of the attribute which configures the number threads
- * allocated by the cleaner for log file processing.
- */
- public static final String ATTR_NUM_CLEANER_THREADS =
- ConfigConstants.NAME_PREFIX_CFG + "db-num-cleaner-threads";
-
- /**
- * The name of the attribute which configures the size of the file
- * handle cache.
- */
- public static final String ATTR_LOG_FILECACHE_SIZE =
- ConfigConstants.NAME_PREFIX_CFG + "db-log-filecache-size";
-
-
- /**
- * The name of the attribute which may specify any native JE properties.
- */
- public static final String ATTR_JE_PROPERTY =
- ConfigConstants.NAME_PREFIX_CFG + "je-property";
-
-
- /**
- * A map of JE property names to the corresponding configuration attribute.
- */
- private static HashMap<String, String> attrMap =
- new HashMap<String, String>();
-
- /**
- * A map of configuration attribute names to the corresponding configuration
- * object getter method.
- */
- private static HashMap<String,Method> methodMap =
- new HashMap<String, Method>();
-
- /**
- * A map of configuration attribute names to the corresponding configuration
- * PropertyDefinition.
- */
- private static HashMap<String,PropertyDefinition> defnMap =
- new HashMap<String, PropertyDefinition>();
-
-
- // Pulled from resource/admin/ABBREVIATIONS.xsl. db is mose common.
- private static final List<String> ABBREVIATIONS = Arrays.asList(new String[]
- {"aci", "ip", "ssl", "dn", "rdn", "jmx", "smtp", "http",
- "https", "ldap", "ldaps", "ldif", "jdbc", "tcp", "tls",
- "pkcs11", "sasl", "gssapi", "md5", "je", "dse", "fifo",
- "vlv", "uuid", "md5", "sha1", "sha256", "sha384", "sha512",
- "tls", "db"});
-
- /*
- * e.g. db-cache-percent -> DBCachePercent
- */
- private static String propNametoCamlCase(String hyphenated)
- {
- String[] components = hyphenated.split("\\-");
- StringBuilder buffer = new StringBuilder();
- for (String component: components) {
- if (ABBREVIATIONS.contains(component)) {
- buffer.append(component.toUpperCase());
- } else {
- buffer.append(component.substring(0, 1).toUpperCase() +
- component.substring(1));
- }
- }
- return buffer.toString();
- }
-
-
- /**
- * Register a JE property and its corresponding configuration attribute.
- *
- * @param propertyName The name of the JE property to be registered.
- * @param attrName The name of the configuration attribute associated
- * with the property.
- * @throws Exception If there is an error in the attribute name.
- */
- private static void registerProp(String propertyName, String attrName)
- throws Exception
- {
- // Strip off NAME_PREFIX_CFG.
- String baseName = attrName.substring(7);
-
- String methodBaseName = propNametoCamlCase(baseName);
-
- Class<LocalDBBackendCfg> configClass = LocalDBBackendCfg.class;
- LocalDBBackendCfgDefn defn = LocalDBBackendCfgDefn.getInstance();
- Class<? extends LocalDBBackendCfgDefn> defClass = defn.getClass();
-
- PropertyDefinition propDefn =
- (PropertyDefinition)defClass.getMethod("get" + methodBaseName +
- "PropertyDefinition").invoke(defn);
-
- String methodName;
- if (propDefn instanceof BooleanPropertyDefinition)
- {
- methodName = "is" + methodBaseName;
- }
- else
- {
- methodName = "get" + methodBaseName;
- }
-
- defnMap.put(attrName, propDefn);
- methodMap.put(attrName, configClass.getMethod(methodName));
- attrMap.put(propertyName, attrName);
- }
-
-
- /**
- * Get the name of the configuration attribute associated with a JE property.
- * @param jeProperty The name of the JE property.
- * @return The name of the associated configuration attribute.
- */
- public static String getAttributeForProperty(String jeProperty)
- {
- return attrMap.get(jeProperty);
- }
-
- /**
- * Get the value of a JE property that is mapped to a configuration attribute.
- * @param cfg The configuration containing the property values.
- * @param attrName The conriguration attribute type name.
- * @return The string value of the JE property.
- */
- private static String getPropertyValue(LocalDBBackendCfg cfg, String attrName)
- {
- try
- {
- PropertyDefinition propDefn = defnMap.get(attrName);
- Method method = methodMap.get(attrName);
-
- if (propDefn instanceof DurationPropertyDefinition)
- {
- Long value = (Long)method.invoke(cfg);
-
- // JE durations are in microseconds so we must convert.
- DurationPropertyDefinition durationPropDefn =
- (DurationPropertyDefinition)propDefn;
- value = 1000*durationPropDefn.getBaseUnit().toMilliSeconds(value);
-
- return String.valueOf(value);
- }
- else
- {
- Object value = method.invoke(cfg);
-
- if (attrName.equals(ATTR_NUM_CLEANER_THREADS) && value == null)
- {
- // Automatically choose based on the number of processors. We will use
- // similar heuristics to those used to define the default number of
- // worker threads.
- int cpus = Runtime.getRuntime().availableProcessors();
- value = Integer.valueOf(Math.max(24, cpus * 2));
-
- logger.debug(INFO_ERGONOMIC_SIZING_OF_JE_CLEANER_THREADS,
- cfg.dn().rdn().getAttributeValue(0), (Number) value);
- }
- else if (attrName.equals(ATTR_NUM_LOCK_TABLES)
- && value == null)
- {
- // Automatically choose based on the number of processors.
- // We'll assume that the user has also allowed automatic
- // configuration of cleaners and workers.
- int cpus = Runtime.getRuntime().availableProcessors();
- int cleaners = Math.max(24, cpus * 2);
- int workers = Math.max(24, cpus * 2);
- BigInteger tmp = BigInteger.valueOf((cleaners + workers) * 2);
- value = tmp.nextProbablePrime();
-
- logger.debug(INFO_ERGONOMIC_SIZING_OF_JE_LOCK_TABLES, cfg.dn().rdn().getAttributeValue(0), (Number) value);
- }
-
- return String.valueOf(value);
- }
- }
- catch (Exception e)
- {
- logger.traceException(e);
- return "";
- }
- }
-
-
-
- static
- {
- // Register the parameters that have JE property names.
- try
- {
- registerProp("je.maxMemoryPercent", ATTR_DATABASE_CACHE_PERCENT);
- registerProp("je.maxMemory", ATTR_DATABASE_CACHE_SIZE);
- registerProp("je.cleaner.minUtilization", ATTR_CLEANER_MIN_UTILIZATION);
- registerProp("je.env.runCleaner", ATTR_DATABASE_RUN_CLEANER);
- registerProp("je.evictor.lruOnly", ATTR_EVICTOR_LRU_ONLY);
- registerProp("je.evictor.nodesPerScan", ATTR_EVICTOR_NODES_PER_SCAN);
- registerProp("je.evictor.coreThreads", ATTR_EVICTOR_CORE_THREADS);
- registerProp("je.evictor.maxThreads", ATTR_EVICTOR_MAX_THREADS);
- registerProp("je.evictor.keepAlive", ATTR_EVICTOR_KEEP_ALIVE);
- registerProp("je.log.fileMax", ATTR_DATABASE_LOG_FILE_MAX);
- registerProp("je.checkpointer.bytesInterval",
- ATTR_CHECKPOINTER_BYTES_INTERVAL);
- registerProp("je.checkpointer.wakeupInterval",
- ATTR_CHECKPOINTER_WAKEUP_INTERVAL);
- registerProp("je.lock.nLockTables", ATTR_NUM_LOCK_TABLES);
- registerProp("je.cleaner.threads", ATTR_NUM_CLEANER_THREADS);
- registerProp("je.log.fileCacheSize", ATTR_LOG_FILECACHE_SIZE);
- }
- catch (Exception e)
- {
- logger.traceException(e);
- }
- }
-
-
-
- /**
- * Create a JE environment configuration with default values.
- *
- * @return A JE environment config containing default values.
- */
- public static EnvironmentConfig defaultConfig()
- {
- EnvironmentConfig envConfig = new EnvironmentConfig();
-
- envConfig.setTransactional(true);
- envConfig.setAllowCreate(true);
-
- // "je.env.sharedLatches" is "true" by default since JE #12136 (3.3.62?)
-
- // This parameter was set to false while diagnosing a Berkeley DB JE bug.
- // Normally cleansed log files are deleted, but if this is set false
- // they are instead renamed from .jdb to .del.
- envConfig.setConfigParam(CLEANER_EXPUNGE, "true");
-
- // Under heavy write load the check point can fall behind causing
- // uncontrolled DB growth over time. This parameter makes the out of
- // the box configuration more robust at the cost of a slight
- // reduction in maximum write throughput. Experiments have shown
- // that response time predictability is not impacted negatively.
- envConfig.setConfigParam(CHECKPOINTER_HIGH_PRIORITY, "true");
-
- // If the JVM is reasonably large then we can safely default to
- // bigger read buffers. This will result in more scalable checkpointer
- // and cleaner performance.
- if (Runtime.getRuntime().maxMemory() > 256 * 1024 * 1024)
- {
- envConfig.setConfigParam(CLEANER_LOOK_AHEAD_CACHE_SIZE,
- String.valueOf(2 * 1024 * 1024));
- envConfig.setConfigParam(LOG_ITERATOR_READ_SIZE,
- String.valueOf(2 * 1024 * 1024));
- envConfig.setConfigParam(LOG_FAULT_READ_SIZE, String.valueOf(4 * 1024));
- }
-
- // Disable lock timeouts, meaning that no lock wait
- // timelimit is enforced and a deadlocked operation
- // will block indefinitely.
- envConfig.setLockTimeout(0, TimeUnit.MICROSECONDS);
-
- return envConfig;
- }
-
-
-
- /**
- * Parse a configuration associated with a JE environment and create an
- * environment config from it.
- *
- * @param cfg The configuration to be parsed.
- * @return An environment config instance corresponding to the config entry.
- * @throws ConfigException If there is an error in the provided configuration
- * entry.
- */
- public static EnvironmentConfig parseConfigEntry(LocalDBBackendCfg cfg)
- throws ConfigException
- {
- // See if the db cache size setting is valid.
- if(cfg.getDBCacheSize() != 0)
- {
- if (MemoryBudget.getRuntimeMaxMemory() < cfg.getDBCacheSize()) {
- throw new ConfigException(
- ERR_CONFIG_JEB_CACHE_SIZE_GREATER_THAN_JVM_HEAP.get(
- cfg.getDBCacheSize(), MemoryBudget.getRuntimeMaxMemory()));
- }
- if (cfg.getDBCacheSize() < MemoryBudget.MIN_MAX_MEMORY_SIZE) {
- throw new ConfigException(
- ERR_CONFIG_JEB_CACHE_SIZE_TOO_SMALL.get(
- cfg.getDBCacheSize(), MemoryBudget.MIN_MAX_MEMORY_SIZE));
- }
- }
-
- EnvironmentConfig envConfig = defaultConfig();
-
- // Durability settings.
- if (cfg.isDBTxnNoSync() && cfg.isDBTxnWriteNoSync())
- {
- throw new ConfigException(
- ERR_CONFIG_JEB_DURABILITY_CONFLICT.get());
- }
- if (cfg.isDBTxnNoSync())
- {
- envConfig.setDurability(Durability.COMMIT_NO_SYNC);
- }
- if (cfg.isDBTxnWriteNoSync())
- {
- envConfig.setDurability(Durability.COMMIT_WRITE_NO_SYNC);
- }
-
- // Iterate through the config attributes associated with a JE property.
- for (Map.Entry<String, String> mapEntry : attrMap.entrySet())
- {
- String jeProperty = mapEntry.getKey();
- String attrName = mapEntry.getValue();
-
- String value = getPropertyValue(cfg, attrName);
- envConfig.setConfigParam(jeProperty, value);
- }
-
- // Set logging and file handler levels.
- Logger parent = Logger.getLogger("com.sleepycat.je");
- try
- {
- parent.setLevel(Level.parse(cfg.getDBLoggingLevel()));
- }
- catch (Exception e)
- {
- throw new ConfigException(ERR_JEB_INVALID_LOGGING_LEVEL.get(cfg.getDBLoggingLevel(), cfg.dn()));
- }
-
- final Level level = cfg.isDBLoggingFileHandlerOn() ? Level.ALL : Level.OFF;
- envConfig.setConfigParam(FILE_LOGGING_LEVEL, level.getName());
-
- // See if there are any native JE properties specified in the config
- // and if so try to parse, evaluate and set them.
- return setJEProperties(envConfig, cfg.getJEProperty(), attrMap);
- }
-
-
-
- /**
- * Parse, validate and set native JE environment properties for
- * a given environment config.
- *
- * @param envConfig The JE environment config for which to set
- * the properties.
- * @param jeProperties The JE environment properties to parse,
- * validate and set.
- * @param configAttrMap Component supported JE properties to
- * their configuration attributes map.
- * @return An environment config instance with given properties
- * set.
- * @throws ConfigException If there is an error while parsing,
- * validating and setting any of the properties provided.
- */
- public static EnvironmentConfig setJEProperties(EnvironmentConfig envConfig,
- SortedSet<String> jeProperties, HashMap<String, String> configAttrMap)
- throws ConfigException
- {
- if (jeProperties.isEmpty()) {
- // return default config.
- return envConfig;
- }
-
- // Set to catch duplicate properties.
- HashSet<String> uniqueJEProperties = new HashSet<String>();
-
- // Iterate through the config values associated with a JE property.
- for (String jeEntry : jeProperties)
- {
- StringTokenizer st = new StringTokenizer(jeEntry, "=");
- if (st.countTokens() == 2) {
- String jePropertyName = st.nextToken();
- String jePropertyValue = st.nextToken();
- // Check if it is a duplicate.
- if (uniqueJEProperties.contains(jePropertyName)) {
- LocalizableMessage message = ERR_CONFIG_JE_DUPLICATE_PROPERTY.get(
- jePropertyName);
- throw new ConfigException(message);
- }
- // Set JE property.
- try {
- envConfig.setConfigParam(jePropertyName, jePropertyValue);
- // If this property shadows an existing config attribute.
- if (configAttrMap.containsKey(jePropertyName)) {
- LocalizableMessage message = ERR_CONFIG_JE_PROPERTY_SHADOWS_CONFIG.get(
- jePropertyName, attrMap.get(jePropertyName));
- throw new ConfigException(message);
- }
- // Add this property to unique set.
- uniqueJEProperties.add(jePropertyName);
- } catch(IllegalArgumentException e) {
- logger.traceException(e);
- LocalizableMessage message =
- ERR_CONFIG_JE_PROPERTY_INVALID.get(
- jeEntry, e.getMessage());
- throw new ConfigException(message, e.getCause());
- }
- } else {
- LocalizableMessage message =
- ERR_CONFIG_JE_PROPERTY_INVALID_FORM.get(jeEntry);
- throw new ConfigException(message);
- }
- }
-
- return envConfig;
- }
-
-
-
-}
diff --git a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/EntryContainer.java b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/EntryContainer.java
index b9900fd..5ac171a 100644
--- a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/EntryContainer.java
+++ b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/EntryContainer.java
@@ -49,9 +49,9 @@
import org.opends.server.admin.server.ConfigurationAddListener;
import org.opends.server.admin.server.ConfigurationChangeListener;
import org.opends.server.admin.server.ConfigurationDeleteListener;
-import org.opends.server.admin.std.server.LocalDBBackendCfg;
import org.opends.server.admin.std.server.LocalDBIndexCfg;
import org.opends.server.admin.std.server.LocalDBVLVIndexCfg;
+import org.opends.server.admin.std.server.PersistitBackendCfg;
import org.opends.server.api.Backend;
import org.opends.server.api.ClientConnection;
import org.opends.server.api.EntryCache;
@@ -108,7 +108,7 @@
* the guts of the backend API methods for LDAP operations.
*/
public class EntryContainer
- implements SuffixContainer, ConfigurationChangeListener<LocalDBBackendCfg>
+ implements SuffixContainer, ConfigurationChangeListener<PersistitBackendCfg>
{
private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
@@ -140,7 +140,7 @@
private final DN baseDN;
/** The backend configuration. */
- private LocalDBBackendCfg config;
+ private PersistitBackendCfg config;
/** The JE database environment. */
private final Storage storage;
@@ -441,7 +441,7 @@
* @throws ConfigException if a configuration related error occurs.
*/
public EntryContainer(DN baseDN, TreeName databasePrefix, Backend<?> backend,
- LocalDBBackendCfg config, Storage env, RootContainer rootContainer)
+ PersistitBackendCfg config, Storage env, RootContainer rootContainer)
throws ConfigException
{
this.backend = backend;
@@ -451,15 +451,15 @@
this.rootContainer = rootContainer;
this.databasePrefix = databasePrefix;
- config.addLocalDBChangeListener(this);
+ config.addPersistitChangeListener(this);
attributeJEIndexCfgManager = new AttributeJEIndexCfgManager();
- config.addLocalDBIndexAddListener(attributeJEIndexCfgManager);
- config.addLocalDBIndexDeleteListener(attributeJEIndexCfgManager);
+ config.addBackendIndexAddListener(attributeJEIndexCfgManager);
+ config.addBackendIndexDeleteListener(attributeJEIndexCfgManager);
vlvJEIndexCfgManager = new VLVJEIndexCfgManager();
- config.addLocalDBVLVIndexAddListener(vlvJEIndexCfgManager);
- config.addLocalDBVLVIndexDeleteListener(vlvJEIndexCfgManager);
+ config.addBackendVLVIndexAddListener(vlvJEIndexCfgManager);
+ config.addBackendVLVIndexDeleteListener(vlvJEIndexCfgManager);
}
/**
@@ -511,9 +511,9 @@
dn2uri = new DN2URI(databasePrefix.child(REFERRAL_DATABASE_NAME), storage, this);
dn2uri.open(txn);
- for (String idx : config.listLocalDBIndexes())
+ for (String idx : config.listBackendIndexes())
{
- LocalDBIndexCfg indexCfg = config.getLocalDBIndex(idx);
+ LocalDBIndexCfg indexCfg = config.getBackendIndex(idx);
AttributeIndex index = new AttributeIndex(indexCfg, this, txn);
index.open(txn);
@@ -524,9 +524,9 @@
attrIndexMap.put(indexCfg.getAttribute(), index);
}
- for(String idx : config.listLocalDBVLVIndexes())
+ for (String idx : config.listBackendVLVIndexes())
{
- LocalDBVLVIndexCfg vlvIndexCfg = config.getLocalDBVLVIndex(idx);
+ LocalDBVLVIndexCfg vlvIndexCfg = config.getBackendVLVIndex(idx);
VLVIndex vlvIndex = new VLVIndex(vlvIndexCfg, state, storage, this, txn);
vlvIndex.open(txn);
@@ -571,11 +571,11 @@
}
// Deregister any listeners.
- config.removeLocalDBChangeListener(this);
- config.removeLocalDBIndexAddListener(attributeJEIndexCfgManager);
- config.removeLocalDBIndexDeleteListener(attributeJEIndexCfgManager);
- config.removeLocalDBVLVIndexAddListener(vlvJEIndexCfgManager);
- config.removeLocalDBVLVIndexDeleteListener(vlvJEIndexCfgManager);
+ config.removePersistitChangeListener(this);
+ config.removeBackendIndexAddListener(attributeJEIndexCfgManager);
+ config.removeBackendIndexDeleteListener(attributeJEIndexCfgManager);
+ config.removeBackendVLVIndexAddListener(vlvJEIndexCfgManager);
+ config.removeBackendVLVIndexDeleteListener(vlvJEIndexCfgManager);
}
/**
@@ -3018,7 +3018,7 @@
/** {@inheritDoc} */
@Override
public boolean isConfigurationChangeAcceptable(
- LocalDBBackendCfg cfg, List<LocalizableMessage> unacceptableReasons)
+ PersistitBackendCfg cfg, List<LocalizableMessage> unacceptableReasons)
{
// This is always true because only all config attributes used
// by the entry container should be validated by the admin framework.
@@ -3027,7 +3027,7 @@
/** {@inheritDoc} */
@Override
- public ConfigChangeResult applyConfigurationChange(final LocalDBBackendCfg cfg)
+ public ConfigChangeResult applyConfigurationChange(final PersistitBackendCfg cfg)
{
final ConfigChangeResult ccr = new ConfigChangeResult();
diff --git a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/RootContainer.java b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/RootContainer.java
index eabe69f..543344e 100644
--- a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/RootContainer.java
+++ b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/RootContainer.java
@@ -36,7 +36,7 @@
import org.forgerock.opendj.config.server.ConfigException;
import org.opends.messages.UtilityMessages;
import org.opends.server.admin.server.ConfigurationChangeListener;
-import org.opends.server.admin.std.server.LocalDBBackendCfg;
+import org.opends.server.admin.std.server.PersistitBackendCfg;
import org.opends.server.api.Backend;
import org.opends.server.api.CompressedSchema;
import org.opends.server.backends.persistit.PersistItStorage;
@@ -74,7 +74,7 @@
* of the entry containers.
*/
public class RootContainer
- implements ConfigurationChangeListener<LocalDBBackendCfg>
+ implements ConfigurationChangeListener<PersistitBackendCfg>
{
private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
@@ -82,7 +82,7 @@
private PersistItStorage storage; // FIXME JNR do not hardcode here
/** The backend configuration. */
- private LocalDBBackendCfg config;
+ private PersistitBackendCfg config;
/** The backend to which this entry root container belongs. */
private final Backend<?> backend;
@@ -112,7 +112,7 @@
* @param backend A reference to the JE back end that is creating this
* root container.
*/
- public RootContainer(Backend<?> backend, LocalDBBackendCfg config)
+ public RootContainer(Backend<?> backend, PersistitBackendCfg config)
{
this.backend = backend;
this.config = config;
@@ -122,7 +122,7 @@
getMonitorProvider().enableFilterUseStats(config.isIndexFilterAnalyzerEnabled());
getMonitorProvider().setMaxEntries(config.getIndexFilterAnalyzerMaxFilters());
- config.addLocalDBChangeListener(this);
+ config.addPersistitChangeListener(this);
}
PersistItStorage getStorage()
@@ -322,11 +322,11 @@
}
}
- storage = new PersistItStorage(backendDirectory, config);
compressedSchema = new DefaultCompressedSchema();
try
{
- storage.initialize(null);
+ storage = new PersistItStorage();
+ storage.initialize(config);
storage.open();
storage.write(new WriteOperation()
{
@@ -552,7 +552,7 @@
// FIXME JNR call close() for a DB stored compressed schema
// compressedSchema.close();
- config.removeLocalDBChangeListener(this);
+ config.removePersistitChangeListener(this);
if (storage != null)
{
@@ -604,12 +604,14 @@
return ec;
}
+
+
/**
* Get the backend configuration used by this root container.
*
- * @return The JE backend configuration used by this root container.
+ * @return The backend configuration used by this root container.
*/
- public LocalDBBackendCfg getConfiguration()
+ public PersistitBackendCfg getConfiguration()
{
return config;
}
@@ -687,7 +689,7 @@
/** {@inheritDoc} */
@Override
public boolean isConfigurationChangeAcceptable(
- LocalDBBackendCfg cfg,
+ PersistitBackendCfg cfg,
List<LocalizableMessage> unacceptableReasons)
{
boolean acceptable = true;
@@ -755,7 +757,7 @@
/** {@inheritDoc} */
@Override
- public ConfigChangeResult applyConfigurationChange(LocalDBBackendCfg cfg)
+ public ConfigChangeResult applyConfigurationChange(PersistitBackendCfg cfg)
{
final ConfigChangeResult ccr = new ConfigChangeResult();
diff --git a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/spi/Storage.java b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/spi/Storage.java
index d954134..443ed38 100644
--- a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/spi/Storage.java
+++ b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/spi/Storage.java
@@ -27,11 +27,14 @@
package org.opends.server.backends.pluggable.spi;
import java.io.Closeable;
-import java.util.Map;
+
+import org.opends.server.admin.std.server.PersistitBackendCfg;
+
+
public interface Storage extends Closeable
{
- void initialize(Map<String, String> options) throws Exception;
+ void initialize(PersistitBackendCfg cfg) throws Exception;
Importer startImport() throws Exception;
--
Gitblit v1.10.0