opendj-sdk/opendj3-server-dev/resource/config/config.ldif
@@ -557,15 +557,6 @@ ds-cfg-cache-level: 2 ds-cfg-java-class: org.opends.server.extensions.SoftReferenceEntryCache dn: cn=File System,cn=Entry Caches,cn=config objectClass: top objectClass: ds-cfg-entry-cache objectClass: ds-cfg-file-system-entry-cache cn: File System ds-cfg-enabled: false ds-cfg-cache-level: 3 ds-cfg-java-class: org.opends.server.extensions.FileSystemEntryCache dn: cn=Extended Operations,cn=config objectClass: top objectClass: ds-cfg-branch opendj-sdk/opendj3-server-dev/src/admin/defn/org/opends/server/admin/std/FileSystemEntryCacheConfiguration.xml
File was deleted opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/jeb/BackendImpl.java
@@ -27,16 +27,12 @@ package org.opends.server.backends.jeb; import java.io.File; import java.io.FileInputStream; import java.io.FilenameFilter; import java.io.IOException; import java.util.*; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.logging.Level; import java.util.zip.Adler32; import java.util.zip.CheckedInputStream; import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.slf4j.LocalizedLogger; @@ -153,50 +149,6 @@ } } /** * This method will attempt to checksum the current JE db environment by * computing the Adler-32 checksum on the latest JE log file available. * * @return The checksum of JE db environment or zero if checksum failed. */ private long checksumDbEnv() { File parentDirectory = getFileForPath(cfg.getDBDirectory()); File backendDirectory = new File(parentDirectory, cfg.getBackendId()); List<File> jdbFiles = new ArrayList<File>(); if(backendDirectory.isDirectory()) { jdbFiles = Arrays.asList(backendDirectory.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.endsWith(".jdb"); } })); } if ( !jdbFiles.isEmpty() ) { Collections.sort(jdbFiles, Collections.reverseOrder()); FileInputStream fis = null; try { fis = new FileInputStream(jdbFiles.get(0).toString()); CheckedInputStream cis = new CheckedInputStream(fis, new Adler32()); byte[] tempBuf = new byte[8192]; while (cis.read(tempBuf) >= 0) { } return cis.getChecksum().getValue(); } catch (Exception e) { logger.traceException(e); } finally { close(fis); } } return 0; } /** {@inheritDoc} */ @Override public void configureBackend(LocalDBBackendCfg cfg) throws ConfigException @@ -212,9 +164,6 @@ public void initializeBackend() throws ConfigException, InitializationException { // Checksum this db environment and register its offline state id/checksum. DirectoryServer.registerOfflineBackendStateID(getBackendID(), checksumDbEnv()); if (mustOpenRootContainer()) { rootContainer = initializeRootContainer(parseConfigEntry(cfg)); @@ -310,8 +259,6 @@ logger.error(ERR_JEB_DATABASE_EXCEPTION, e.getMessage()); } // Checksum this db environment and register its offline state id/checksum. DirectoryServer.registerOfflineBackendStateID(getBackendID(), checksumDbEnv()); DirectoryServer.deregisterAlertGenerator(this); // Make sure the thread counts are zero for next initialization. opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/BackendImpl.java
@@ -27,15 +27,11 @@ package org.opends.server.backends.pluggable; import java.io.File; import java.io.FileInputStream; import java.io.FilenameFilter; import java.io.IOException; import java.util.*; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.logging.Level; import java.util.zip.Adler32; import java.util.zip.CheckedInputStream; import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.slf4j.LocalizedLogger; @@ -67,8 +63,8 @@ * 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<LocalDBBackendCfg> implements ConfigurationChangeListener<LocalDBBackendCfg>, AlertGenerator, DiskSpaceMonitorHandler { private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); @@ -130,50 +126,6 @@ } } /** * This method will attempt to checksum the current JE db environment by * computing the Adler-32 checksum on the latest JE log file available. * * @return The checksum of JE db environment or zero if checksum failed. */ private long checksumDbEnv() { File parentDirectory = getFileForPath(cfg.getDBDirectory()); File backendDirectory = new File(parentDirectory, cfg.getBackendId()); List<File> jdbFiles = new ArrayList<File>(); if(backendDirectory.isDirectory()) { jdbFiles = Arrays.asList(backendDirectory.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.endsWith(".jdb"); } })); } if ( !jdbFiles.isEmpty() ) { Collections.sort(jdbFiles, Collections.reverseOrder()); FileInputStream fis = null; try { fis = new FileInputStream(jdbFiles.get(0).toString()); CheckedInputStream cis = new CheckedInputStream(fis, new Adler32()); byte[] tempBuf = new byte[8192]; while (cis.read(tempBuf) >= 0) { } return cis.getChecksum().getValue(); } catch (Exception e) { logger.traceException(e); } finally { close(fis); } } return 0; } /** {@inheritDoc} */ @Override public void configureBackend(LocalDBBackendCfg cfg) throws ConfigException @@ -189,9 +141,6 @@ public void initializeBackend() throws ConfigException, InitializationException { // Checksum this db environment and register its offline state id/checksum. DirectoryServer.registerOfflineBackendStateID(getBackendID(), checksumDbEnv()); if (mustOpenRootContainer()) { rootContainer = initializeRootContainer(); @@ -285,8 +234,6 @@ logger.error(ERR_JEB_DATABASE_EXCEPTION, e.getMessage()); } // Checksum this db environment and register its offline state id/checksum. DirectoryServer.registerOfflineBackendStateID(getBackendID(), checksumDbEnv()); DirectoryServer.deregisterAlertGenerator(this); // Make sure the thread counts are zero for next initialization. opendj-sdk/opendj3-server-dev/src/server/org/opends/server/core/DirectoryServer.java
@@ -775,13 +775,6 @@ /** The set of backends registered with the server. */ private TreeMap<String, Backend<?>> backends; /** * The mapping between backends and their unique identifiers for their offline * state, representing either checksum or other unique value to be used for * detecting any offline modifications to a given backend. */ private ConcurrentMap<String, Long> offlineBackendsStateIDs; /** The set of supported controls registered with the Directory Server. */ private final TreeSet<String> supportedControls = new TreeSet<String>(Arrays.asList( OID_LDAP_ASSERTION, @@ -1088,8 +1081,6 @@ new ConcurrentHashMap<String, MonitorProvider<? extends MonitorProviderCfg>>(); directoryServer.backends = new TreeMap<String, Backend<?>>(); directoryServer.offlineBackendsStateIDs = new ConcurrentHashMap<String,Long>(); directoryServer.backendInitializationListeners = new CopyOnWriteArraySet<BackendInitializationListener>(); directoryServer.baseDnRegistry = new BaseDnRegistry(); @@ -1555,9 +1546,6 @@ // If not then stick with default entry cache initialized earlier. entryCacheConfigManager.initializeEntryCache(); // Reset the map as we can no longer guarantee offline state. directoryServer.offlineBackendsStateIDs.clear(); initializeExtendedOperations(); initializeSASLMechanisms(); @@ -5191,37 +5179,6 @@ /** * This method returns a map that contains a unique offline state id, * such as checksum, for every server backend that has registered one. * * @return <CODE>Map</CODE> backend to checksum map for offline state. */ public static Map<String,Long> getOfflineBackendsStateIDs() { return Collections.unmodifiableMap(directoryServer.offlineBackendsStateIDs); } /** * This method allows any server backend to register its unique offline * state, such as checksum, in a global map other server components can * access to determine if any changes were made to given backend while * offline. * * @param backend As returned by <CODE>getBackendID()</CODE> method. * * @param id Unique offline state identifier such as checksum. */ public static void registerOfflineBackendStateID(String backend, long id) { // Zero means failed checksum so just skip it. if (id != 0) { directoryServer.offlineBackendsStateIDs.put(backend, id); } } /** * Retrieves the entire set of base DNs registered with the Directory Server, * mapped from the base DN to the backend responsible for that base DN. The * same backend may be present multiple times, mapped from different base DNs. opendj-sdk/opendj3-server-dev/src/server/org/opends/server/extensions/FileSystemEntryCache.java
File was deleted opendj-sdk/opendj3-server-dev/src/server/org/opends/server/extensions/FileSystemEntryCacheIndex.java
File was deleted opendj-sdk/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/extensions/DefaultEntryCacheTestCase.java
@@ -28,7 +28,6 @@ import java.io.File; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.SortedMap; @@ -38,7 +37,6 @@ import org.testng.annotations.BeforeClass; import org.opends.server.admin.std.meta.*; import org.opends.server.admin.std.server.EntryCacheCfg; import org.opends.server.admin.std.server.FileSystemEntryCacheCfg; import org.opends.server.api.Backend; import org.opends.server.api.EntryCache; import org.opends.server.core.DirectoryServer; @@ -63,12 +61,10 @@ // Entry cache implementations participating in this test. private SoftReferenceEntryCache softRefCache = null; private FIFOEntryCache fifoCache = null; private FileSystemEntryCache fsCache = null; // ... and their configuration entries. Entry cacheSoftReferenceConfigEntry = null; Entry cacheFIFOConfigEntry = null; Entry cacheFSConfigEntry = null; // The entry cache order map sorted by the cache level. private SortedMap<Integer, EntryCache<? extends EntryCacheCfg>> @@ -78,7 +74,6 @@ // Dummy test entries for each participating implementation. private ArrayList<Entry> testSoftRefEntriesList = null; private ArrayList<Entry> testFIFOEntriesList = null; private ArrayList<Entry> testFSEntriesList = null; /** * Initialize the entry cache test. @@ -127,32 +122,11 @@ "ds-cfg-enabled: true", "ds-cfg-include-filter: uid=fifo*", "ds-cfg-include-filter: uid=test2*", "ds-cfg-exclude-filter: uid=test0*"); "ds-cfg-include-filter: uid=test0*"); fifoCache.initializeEntryCache(AdminTestCaseUtils.getConfiguration( FIFOEntryCacheCfgDefn.getInstance(), cacheFIFOConfigEntry)); cacheOrderMap.put(2, fifoCache); File cacheDirectory = TestCaseUtils.createTemporaryDirectory("opendj-test"); fsCache = new FileSystemEntryCache(); cacheFSConfigEntry = TestCaseUtils.makeEntry( "dn: cn=File System,cn=Entry Caches,cn=config", "objectClass: ds-cfg-file-system-entry-cache", "objectClass: ds-cfg-entry-cache", "objectClass: top", "cn: File System", "ds-cfg-cache-level: 3", "ds-cfg-java-class: " + "org.opends.server.extensions.FileSystemEntryCache", "ds-cfg-enabled: true", "ds-cfg-include-filter: uid=fs*", "ds-cfg-include-filter: uid=test3*", "ds-cfg-include-filter: uid=test0*", "ds-cfg-cache-directory: " + cacheDirectory.getAbsolutePath()); fsCache.initializeEntryCache(AdminTestCaseUtils.getConfiguration( FileSystemEntryCacheCfgDefn.getInstance(), cacheFSConfigEntry)); cacheOrderMap.put(3, fsCache); // Plug all cache implementations into default entry cache. final Method[] defaultCacheMethods = super.cache.getClass().getDeclaredMethods(); @@ -220,18 +194,6 @@ "uid: fifo" + Integer.toString(i) + ".user" + Integer.toString(i)) ); } testFSEntriesList = new ArrayList<Entry>(super.NUMTESTENTRIES); for(int i = 0; i < super.NUMTESTENTRIES; i++ ) { testFSEntriesList.add(TestCaseUtils.makeEntry( "dn: uid=fs" + Integer.toString(i) + ".user" + Integer.toString(i) + ",ou=test" + Integer.toString(i) + ",o=test", "objectClass: person", "objectClass: inetorgperson", "objectClass: top", "objectClass: organizationalperson", "uid: fs" + Integer.toString(i) + ".user" + Integer.toString(i)) ); } // Force GC to make sure we have enough memory for // the cache capping constraints to work properly. @@ -267,12 +229,6 @@ for (EntryCache<?> entryCache : cacheOrderMap.values()) { entryCache.finalizeEntryCache(); } // Remove default FS cache JE environment. FileSystemEntryCacheCfg config = (FileSystemEntryCacheCfg) AdminTestCaseUtils.getConfiguration(EntryCacheCfgDefn.getInstance(), cacheFSConfigEntry); TestCaseUtils.deleteDirectory(new File(config.getCacheDirectory())); } @@ -455,7 +411,6 @@ for (int i = 0; i < NUMTESTENTRIES; i++) { super.cache.putEntry(testSoftRefEntriesList.get(i), b, i); super.cache.putEntry(testFIFOEntriesList.get(i), b, i); super.cache.putEntry(testFSEntriesList.get(i), b, i); } // Ensure all test entries are available via default cache. @@ -472,12 +427,6 @@ testFIFOEntriesList.get(0).getName() + " in the cache. Cache contents:" + ServerConstants.EOL + cache.toVerboseString()); assertNotNull(super.cache.getEntry( testFSEntriesList.get(0).getName()), "Expected to find " + testFSEntriesList.get(0).getName() + " in the cache. Cache contents:" + ServerConstants.EOL + cache.toVerboseString()); } // Ensure all test entries landed on their levels. @@ -494,12 +443,6 @@ testFIFOEntriesList.get(0).getName() + " in the cache. Cache contents:" + ServerConstants.EOL + cache.toVerboseString()); assertNotNull(fsCache.getEntry( testFSEntriesList.get(0).getName()), "Expected to find " + testFSEntriesList.get(0).getName() + " in the cache. Cache contents:" + ServerConstants.EOL + cache.toVerboseString()); } // Clear the cache so that other tests can start from scratch. opendj-sdk/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/extensions/FileSystemEntryCacheTestCase.java
File was deleted opendj-sdk/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/extensions/PreloadEntryCacheTestCase.java
@@ -37,7 +37,6 @@ import org.testng.annotations.BeforeClass; import org.opends.server.admin.std.meta.*; import org.opends.server.admin.std.server.EntryCacheCfg; import org.opends.server.admin.std.server.FileSystemEntryCacheCfg; import org.opends.server.api.Backend; import org.opends.server.core.DirectoryServer; import org.opends.server.types.Entry; @@ -81,7 +80,6 @@ * @throws Exception If an unexpected problem occurs. */ @BeforeClass() @SuppressWarnings("unchecked") public void preloadEntryCacheTestInit() throws Exception { @@ -100,14 +98,14 @@ // Configure the entry cache, use FileSystemEntryCache. Entry cacheConfigEntry = TestCaseUtils.makeEntry( "dn: cn=File System,cn=Entry Caches,cn=config", "objectClass: ds-cfg-file-system-entry-cache", "dn: cn=Soft Reference,cn=Entry Caches,cn=config", "objectClass: ds-cfg-soft-reference-entry-cache", "objectClass: ds-cfg-entry-cache", "objectClass: top", "cn: File System", "cn: Soft Reference", "ds-cfg-cache-level: 1", "ds-cfg-java-class: " + "org.opends.server.extensions.FileSystemEntryCache", "org.opends.server.extensions.SoftReferenceEntryCache", "ds-cfg-enabled: true"); configuration = AdminTestCaseUtils.getConfiguration( EntryCacheCfgDefn.getInstance(), cacheConfigEntry); @@ -225,11 +223,6 @@ // Sanity in-core restart. TestCaseUtils.restartServer(); // Remove default FS cache JE environment. FileSystemEntryCacheCfg config = (FileSystemEntryCacheCfg) configuration; TestCaseUtils.deleteDirectory(new File(config.getCacheDirectory())); }