From 6aa5f59a010aa47be15e4b09b435bf88a310a6a7 Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Mon, 02 Jul 2012 16:25:43 +0000
Subject: [PATCH] Fix OPENDJ-528: rebuild-index doesn't rebuild properly DN2ID after an upgrade from OpenDS 2.2. Delete the index instead of truncating it. This forces the index to update the comparator method to match the newest code.

---
 opends/src/server/org/opends/server/backends/jeb/EntryContainer.java |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/opends/src/server/org/opends/server/backends/jeb/EntryContainer.java b/opends/src/server/org/opends/server/backends/jeb/EntryContainer.java
index 77c46fb..4ae2ee0 100644
--- a/opends/src/server/org/opends/server/backends/jeb/EntryContainer.java
+++ b/opends/src/server/org/opends/server/backends/jeb/EntryContainer.java
@@ -302,7 +302,7 @@
   }
 
   /**
-   * This class is responsible for managing the configuraiton for VLV indexes
+   * This class is responsible for managing the configuration for VLV indexes
    * used within this entry container.
    */
   public class VLVJEIndexCfgManager implements
@@ -3997,13 +3997,11 @@
    * Clear the contents for a database from disk.
    *
    * @param database The database to clear.
-   * @return The number of records deleted.
    * @throws DatabaseException if a JE database error occurs.
    */
-  public long clearDatabase(DatabaseContainer database)
+  public void clearDatabase(DatabaseContainer database)
   throws DatabaseException
   {
-    long count = 0;
     database.close();
     try
     {
@@ -4012,7 +4010,7 @@
         Transaction txn = beginTransaction();
         try
         {
-          count = env.truncateDatabase(txn, database.getName(), true);
+          env.removeDatabase(txn, database.getName());
           transactionCommit(txn);
         }
         catch(DatabaseException de)
@@ -4023,7 +4021,7 @@
       }
       else
       {
-        count = env.truncateDatabase(null, database.getName(), true);
+        env.removeDatabase(null, database.getName());
       }
     }
     finally
@@ -4032,10 +4030,8 @@
     }
     if(debugEnabled())
     {
-      TRACER.debugVerbose("Cleared %d existing records from the " +
-          "database %s", count, database.getName());
+      TRACER.debugVerbose("Cleared the database %s", database.getName());
     }
-    return count;
   }
 
   /**

--
Gitblit v1.10.0