From 8ac57ee1cd50fcc3d02b36bea4ab1335924f1d7a Mon Sep 17 00:00:00 2001
From: Yannick Lecaillez <yannick.lecaillez@forgerock.com>
Date: Mon, 18 May 2015 13:52:40 +0000
Subject: [PATCH] OPENDJ-1864: Ordering matching rules should reuse equality indexes where possible

---
 opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java |   21 ++++-----------------
 1 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java
index f9c80b7..54f6eff 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java
@@ -195,17 +195,7 @@
     {
       try
       {
-        // FIXME this should be a read operation, but I cannot change it
-        // because of AttributeIndex ctor.
-        storage.write(new WriteOperation()
-        {
-          @Override
-          public void run(WriteableTransaction txn) throws Exception
-          {
-            //Try creating all the indexes before confirming they are valid ones.
-            new AttributeIndex(cfg, state, EntryContainer.this, txn);
-          }
-        });
+        new AttributeIndex(cfg, state, EntryContainer.this);
         return true;
       }
       catch(Exception e)
@@ -222,12 +212,12 @@
       final ConfigChangeResult ccr = new ConfigChangeResult();
       try
       {
+        final AttributeIndex index = new AttributeIndex(cfg, state, EntryContainer.this);
         storage.write(new WriteOperation()
         {
           @Override
           public void run(WriteableTransaction txn) throws Exception
           {
-            final AttributeIndex index = new AttributeIndex(cfg, state, EntryContainer.this, txn);
             index.open(txn);
             if (!index.isTrusted())
             {
@@ -496,7 +486,7 @@
       {
         BackendIndexCfg indexCfg = config.getBackendIndex(idx);
 
-        AttributeIndex index = new AttributeIndex(indexCfg, state, this, txn);
+        final AttributeIndex index = new AttributeIndex(indexCfg, state, this);
         index.open(txn);
         if(!index.isTrusted())
         {
@@ -2194,8 +2184,7 @@
                 }
 
                 // Move this entry.
-                removeSubordinateEntry(txn, buffer, oldSuperiorDN, oldID, newID, oldEntry, newDN, isApexEntryMoved,
-                    modifyDNOperation, current);
+                removeSubordinateEntry(txn, buffer, oldID, newID, oldEntry, newDN, modifyDNOperation, current);
                 current = current.next;
 
                 if (modifyDNOperation != null)
@@ -2364,10 +2353,8 @@
   }
 
   private void removeSubordinateEntry(WriteableTransaction txn, IndexBuffer buffer,
-      DN oldSuperiorDN,
       EntryID oldID, EntryID newID,
       Entry oldEntry, DN newDN,
-      boolean isApexEntryMoved,
       ModifyDNOperation modifyDNOperation,
       MovedEntry tail)
   throws DirectoryException, StorageRuntimeException

--
Gitblit v1.10.0