mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Jean-Noel Rouvignac
23.04.2015 53a75a371b76e4b7090dfa3c22b7d7fd3deb820a
In Importer.fillIndexKey(), the VLV code does not seem to be dependent on the AttributeIndex or AttributeType.
I moved this code out of this method and called it from methods at a higher level.


Importer.java:
In fillIndexKey(), extracted method processVLVIndexes() + moved its call site from there to parent methods also calling processIndexes().
1 files modified
28 ■■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Importer.java 28 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Importer.java
@@ -1503,6 +1503,7 @@
      {
        processIndexes(suffix, entry, entryID);
      }
      processVLVIndexes(suffix, entry, entryID);
      importCount.getAndIncrement();
    }
@@ -1511,8 +1512,7 @@
    {
      for (Map.Entry<AttributeType, AttributeIndex> mapEntry : suffix.getAttrIndexMap().entrySet())
      {
        AttributeType attributeType = mapEntry.getKey();
        fillIndexKey(suffix, mapEntry.getValue(), entry, attributeType, entryID);
        fillIndexKey(mapEntry.getValue(), entry, mapEntry.getKey(), entryID);
      }
    }
@@ -1601,6 +1601,7 @@
      processDN2ID(suffix, entryDN, entryID);
      processDN2URI(suffix, null, entry);
      processIndexes(suffix, entry, entryID);
      processVLVIndexes(suffix, entry, entryID);
      suffix.getID2Entry().put(txn, entryID, entry);
      importCount.getAndIncrement();
    }
@@ -1645,12 +1646,12 @@
        AttributeType attributeType = mapEntry.getKey();
        if (entry.hasAttribute(attributeType))
        {
          fillIndexKey(suffix, mapEntry.getValue(), entry, attributeType, entryID);
          fillIndexKey(mapEntry.getValue(), entry, attributeType, entryID);
        }
      }
    }
    void fillIndexKey(Suffix suffix, AttributeIndex attrIndex, Entry entry, AttributeType attrType, EntryID entryID)
    void fillIndexKey(AttributeIndex attrIndex, Entry entry, AttributeType attrType, EntryID entryID)
        throws InterruptedException, DirectoryException, StorageRuntimeException
    {
      final IndexingOptions options = attrIndex.getIndexingOptions();
@@ -1661,14 +1662,6 @@
      processAttribute(attrIndex.getOrderingIndex(), ImportIndexType.ORDERING, entry, attrType, entryID, options);
      processAttribute(attrIndex.getApproximateIndex(), ImportIndexType.APPROXIMATE, entry, attrType, entryID, options);
      final EntryContainer entryContainer = suffix.getEntryContainer();
      final IndexBuffer buffer = new IndexBuffer(entryContainer);
      for (VLVIndex vlvIdx : entryContainer.getVLVIndexes())
      {
        vlvIdx.addEntry(buffer, entryID, entry);
      }
      buffer.flush(txn);
      Map<String, Collection<Index>> extensibleMap = attrIndex.getExtensibleIndexes();
      if (!extensibleMap.isEmpty())
      {
@@ -1679,6 +1672,17 @@
      }
    }
    void processVLVIndexes(Suffix suffix, Entry entry, EntryID entryID) throws DirectoryException
    {
      final EntryContainer entryContainer = suffix.getEntryContainer();
      final IndexBuffer buffer = new IndexBuffer(entryContainer);
      for (VLVIndex vlvIdx : entryContainer.getVLVIndexes())
      {
        vlvIdx.addEntry(buffer, entryID, entry);
      }
      buffer.flush(txn);
    }
    private void processAttributes(Collection<Index> indexes, ImportIndexType indexType, Entry entry,
        AttributeType attributeType, EntryID entryID, IndexingOptions options) throws InterruptedException
    {