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/DefaultIndex.java |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DefaultIndex.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DefaultIndex.java
index c6b4272..a516ddf 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DefaultIndex.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DefaultIndex.java
@@ -64,7 +64,9 @@
 
   private final State state;
 
-  private final EntryIDSetCodec codec;
+  private final EntryContainer entryContainer;
+
+  private EntryIDSetCodec codec;
 
   /**
    * A flag to indicate if this index should be trusted to be consistent with the entries tree.
@@ -84,23 +86,26 @@
    *          The state tree to persist index state info.
    * @param indexEntryLimit
    *          The configured limit on the number of entry IDs that may be indexed by one key.
-   * @param txn
-   *          a non null transaction
    * @param entryContainer
    *          The entryContainer holding this index.
    * @throws StorageRuntimeException
    *           If an error occurs in the storage.
    */
-  DefaultIndex(TreeName name, State state, int indexEntryLimit, WriteableTransaction txn, EntryContainer entryContainer)
+  DefaultIndex(TreeName name, State state, int indexEntryLimit, EntryContainer entryContainer)
       throws StorageRuntimeException
   {
     super(name);
     this.indexEntryLimit = indexEntryLimit;
     this.state = state;
+    this.entryContainer = entryContainer;
+  }
 
+  @Override
+  final void open0(WriteableTransaction txn)
+  {
     final EnumSet<IndexFlag> flags = state.getIndexFlags(txn, getName());
-    this.codec = flags.contains(COMPACTED) ? CODEC_V2 : CODEC_V1;
-    this.trusted = flags.contains(TRUSTED);
+    codec = flags.contains(COMPACTED) ? CODEC_V2 : CODEC_V1;
+    trusted = flags.contains(TRUSTED);
     if (!trusted && entryContainer.getHighestEntryID(txn).longValue() == 0)
     {
       // If there are no entries in the entry container then there

--
Gitblit v1.10.0