From 36a0eff3016b9a79eaab3e1aed8b1d17b7f799c2 Mon Sep 17 00:00:00 2001
From: abobrov <abobrov@localhost>
Date: Tue, 05 Jun 2007 15:14:44 +0000
Subject: [PATCH] [Issue 1117] Create an entry cache backed by DB+tmpfs
---
opends/src/server/org/opends/server/core/DirectoryServer.java | 53 ++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 48 insertions(+), 5 deletions(-)
diff --git a/opends/src/server/org/opends/server/core/DirectoryServer.java b/opends/src/server/org/opends/server/core/DirectoryServer.java
index 68c80a8..4735728 100644
--- a/opends/src/server/org/opends/server/core/DirectoryServer.java
+++ b/opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -540,6 +540,11 @@
// The set of backends registered with the server.
private TreeMap<String,Backend> backends;
+ // The mapping between backends and their unique indentifiers for their
+ // offline state, representing either checksum or other unique value to
+ // be used for detecting any offline modifications to a given backend.
+ private ConcurrentHashMap<String,Long> offlineBackendsStateIDs;
+
// The set of supported controls registered with the Directory Server.
private TreeSet<String> supportedControls;
@@ -662,6 +667,8 @@
directoryServer.monitorProviders =
new ConcurrentHashMap<String,MonitorProvider>();
directoryServer.backends = new TreeMap<String,Backend>();
+ directoryServer.offlineBackendsStateIDs =
+ new ConcurrentHashMap<String,Long>();
directoryServer.backendInitializationListeners =
new CopyOnWriteArraySet<BackendInitializationListener>();
directoryServer.baseDNs = new TreeMap<DN,Backend>();
@@ -1060,11 +1067,6 @@
initializeAlertHandlers();
- // Initialize the entry cache.
- entryCacheConfigManager = new EntryCacheConfigManager();
- entryCacheConfigManager.initializeEntryCache();
-
-
// Initialize the key manager provider.
keyManagerProviderConfigManager = new KeyManagerProviderConfigManager();
keyManagerProviderConfigManager.initializeKeyManagerProviders();
@@ -1099,6 +1101,13 @@
// Initialize all the backends and their associated suffixes.
initializeBackends();
+ // Initialize the entry cache.
+ entryCacheConfigManager = new EntryCacheConfigManager();
+ entryCacheConfigManager.initializeEntryCache();
+
+ // Reset the map as we can no longer guarantee offline state.
+ directoryServer.offlineBackendsStateIDs.clear();
+
// Register the supported controls and supported features.
initializeSupportedControls();
initializeSupportedFeatures();
@@ -6018,6 +6027,37 @@
/**
+ * 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.
@@ -8111,6 +8151,9 @@
}
}
+ // Finalize the entry cache.
+ DirectoryServer.getEntryCache().finalizeEntryCache();
+
// Release the exclusive lock for the Directory Server process.
String lockFile = LockFileManager.getServerLockFileName();
try
--
Gitblit v1.10.0