From ef115a28201f5ce47f6bbfaeb0596a6875594a0d Mon Sep 17 00:00:00 2001
From: abobrov <abobrov@localhost>
Date: Fri, 01 Feb 2008 01:13:11 +0000
Subject: [PATCH] - [Issue 2772] Report preload status   Log database cache preload status, progress and completion reports.

---
 opends/src/server/org/opends/server/backends/jeb/RootContainer.java |   47 +++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 43 insertions(+), 4 deletions(-)

diff --git a/opends/src/server/org/opends/server/backends/jeb/RootContainer.java b/opends/src/server/org/opends/server/backends/jeb/RootContainer.java
index c7489f3..bd539f5 100644
--- a/opends/src/server/org/opends/server/backends/jeb/RootContainer.java
+++ b/opends/src/server/org/opends/server/backends/jeb/RootContainer.java
@@ -402,12 +402,18 @@
       // is filled.
       try
       {
-        long timeEnd = System.currentTimeMillis() + timeLimit;
-
         // Configure preload of Leaf Nodes (LNs) containing the data values.
         PreloadConfig preloadConfig = new PreloadConfig();
         preloadConfig.setLoadLNs(true);
 
+        Message message =
+            NOTE_JEB_CACHE_PRELOAD_STARTED.get(backend.getBackendID());
+        logError(message);
+
+        boolean isInterrupted = false;
+
+        long timeEnd = System.currentTimeMillis() + timeLimit;
+
         for (DatabaseContainer db : dbList)
         {
           // Calculate the remaining time.
@@ -427,17 +433,44 @@
           }
 
           // Stop if the cache is full or the time limit has been exceeded.
-          if (preloadStats.getStatus() != PreloadStatus.SUCCESS)
+          PreloadStatus preloadStatus = preloadStats.getStatus();
+          if (preloadStatus != PreloadStatus.SUCCESS)
           {
+            if (preloadStatus == PreloadStatus.EXCEEDED_TIME) {
+              message =
+                NOTE_JEB_CACHE_PRELOAD_INTERRUPTED_BY_TIME.get(
+                backend.getBackendID(), db.getName());
+              logError(message);
+            } else if (preloadStatus == PreloadStatus.FILLED_CACHE) {
+              message =
+                NOTE_JEB_CACHE_PRELOAD_INTERRUPTED_BY_SIZE.get(
+                backend.getBackendID(), db.getName());
+              logError(message);
+            } else {
+              message =
+                NOTE_JEB_CACHE_PRELOAD_INTERRUPTED_UNKNOWN.get(
+                backend.getBackendID(), db.getName());
+              logError(message);
+            }
+
+            isInterrupted = true;
             break;
           }
+
+          message = NOTE_JEB_CACHE_DB_PRELOADED.get(db.getName());
+          logError(message);
+        }
+
+        if (!isInterrupted) {
+          message = NOTE_JEB_CACHE_PRELOAD_DONE.get(backend.getBackendID());
+          logError(message);
         }
 
         // Log an informational message about the size of the cache.
         EnvironmentStats stats = env.getStats(new StatsConfig());
         long total = stats.getCacheTotalBytes();
 
-        Message message =
+        message =
             NOTE_JEB_CACHE_SIZE_AFTER_PRELOAD.get(total / (1024 * 1024));
         logError(message);
       }
@@ -447,6 +480,12 @@
         {
           TRACER.debugCaught(DebugLogLevel.ERROR, e);
         }
+
+        Message message =
+          ERR_JEB_CACHE_PRELOAD.get(backend.getBackendID(),
+          (e.getCause() != null ? e.getCause().getMessage() :
+            stackTraceToSingleLineString(e)));
+        logError(message);
       }
     }
   }

--
Gitblit v1.10.0