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

boli
26.31.2007 f8ef0eed366445c5a341dbcc7882a7104c1cac1b
opends/src/server/org/opends/server/backends/jeb/IndexRebuildThread.java
@@ -76,11 +76,6 @@
  Index index = null;
  /**
   * Name of the indexType being rebuilt.
   */
  String indexName = null;
  /**
   * The ID2ENTRY database.
   */
  ID2Entry id2entry = null;
@@ -128,12 +123,11 @@
   */
  IndexRebuildThread(EntryContainer ec, IndexType index)
  {
    super("Index Rebuild Thread " + ec.getContainerName() + "_" +
    super("Index Rebuild Thread " + ec.getDatabasePrefix() + "_" +
        index.toString());
    this.ec = ec;
    this.indexType = index;
    this.id2entry = ec.getID2Entry();
    this.indexName = ec.getContainerName() + "_" +  index.toString();
  }
  /**
@@ -149,7 +143,6 @@
    this.indexType = IndexType.INDEX;
    this.index = index;
    this.id2entry = ec.getID2Entry();
    this.indexName = ec.getContainerName() + "_" +  index.toString();
  }
  /**
@@ -165,7 +158,6 @@
    this.indexType = IndexType.ATTRIBUTEINDEX;
    this.attrIndex = index;
    this.id2entry = ec.getID2Entry();
    this.indexName = ec.getContainerName() + "_" +  index.toString();
  }
  /**
@@ -213,25 +205,25 @@
    switch(indexType)
    {
      case DN2ID :
        ec.clearDatabase(null, ec.getDN2ID());
        ec.clearDatabase(ec.getDN2ID());
        break;
      case DN2URI :
        ec.clearDatabase(null, ec.getDN2URI());
        ec.clearDatabase(ec.getDN2URI());
        break;
      case ID2CHILDREN :
        ec.clearDatabase(null, ec.getID2Children());
        ec.clearDatabase(ec.getID2Children());
        ec.getID2Children().setRebuildStatus(true);
        break;
      case ID2SUBTREE :
        ec.clearDatabase(null, ec.getID2Subtree());
        ec.clearDatabase(ec.getID2Subtree());
        ec.getID2Subtree().setRebuildStatus(true);
        break;
      case ATTRIBUTEINDEX :
        ec.clearAttributeIndex(null, attrIndex);
        ec.clearAttributeIndex(attrIndex);
        attrIndex.setRebuildStatus(true);
        break;
      case INDEX :
        ec.clearDatabase(null, index);
        ec.clearDatabase(index);
        index.setRebuildStatus(true);
    }
  }
@@ -278,12 +270,6 @@
    try
    {
      totalEntries = getTotalEntries();
      if(debugEnabled())
      {
        TRACER.debugInfo("Initiating rebuild of the %s indexType/database",
                         indexName);
        TRACER.debugVerbose("%d entries will be rebuilt", totalEntries);
      }
      switch(indexType)
      {
@@ -329,6 +315,14 @@
  {
    DN2ID dn2id = ec.getDN2ID();
    if(debugEnabled())
    {
      TRACER.debugInfo("Initiating rebuild of the %s database",
                       dn2id.getName());
      TRACER.debugVerbose("%d entries will be rebuilt", totalEntries);
    }
    //Iterate through the id2entry database and insert associated dn2id
    //records.
    Cursor cursor = id2entry.openCursor(null, null);
@@ -379,7 +373,7 @@
          skippedEntries++;
          int    msgID   = MSGID_JEB_REBUILD_INSERT_ENTRY_FAILED;
          String message = getMessage(msgID, indexName,
          String message = getMessage(msgID, dn2id.getName(),
                                      stackTraceToSingleLineString(e));
          logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.MILD_ERROR,
                   message, msgID);
@@ -406,6 +400,14 @@
  {
    DN2URI dn2uri = ec.getDN2URI();
    if(debugEnabled())
    {
      TRACER.debugInfo("Initiating rebuild of the %s database",
                       dn2uri.getName());
      TRACER.debugVerbose("%d entries will be rebuilt", totalEntries);
    }
    //Iterate through the id2entry database and insert associated dn2uri
    //records.
    Cursor cursor = id2entry.openCursor(null, null);
@@ -457,7 +459,7 @@
          skippedEntries++;
          int    msgID   = MSGID_JEB_REBUILD_INSERT_ENTRY_FAILED;
          String message = getMessage(msgID, indexName,
          String message = getMessage(msgID, dn2uri.getName(),
                                      stackTraceToSingleLineString(e));
          logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.MILD_ERROR,
                   message, msgID);
@@ -485,6 +487,14 @@
  {
    Index id2children = ec.getID2Children();
    if(debugEnabled())
    {
      TRACER.debugInfo("Initiating rebuild of the %s index",
                       id2children.getName());
      TRACER.debugVerbose("%d entries will be rebuilt", totalEntries);
    }
    DN2ID dn2id = ec.getDN2ID();
    DN2URI dn2uri = ec.getDN2URI();
@@ -559,7 +569,7 @@
          skippedEntries++;
          int    msgID   = MSGID_JEB_REBUILD_INSERT_ENTRY_FAILED;
          String message = getMessage(msgID, indexName,
          String message = getMessage(msgID, id2children.getName(),
                                      stackTraceToSingleLineString(e));
          logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.MILD_ERROR,
                   message, msgID);
@@ -589,6 +599,14 @@
  {
    Index id2subtree = ec.getID2Subtree();
    if(debugEnabled())
    {
      TRACER.debugInfo("Initiating rebuild of the %s index",
                       id2subtree.getName());
      TRACER.debugVerbose("%d entries will be rebuilt", totalEntries);
    }
    DN2ID dn2id = ec.getDN2ID();
    DN2URI dn2uri = ec.getDN2URI();
@@ -693,7 +711,7 @@
          skippedEntries++;
          int    msgID   = MSGID_JEB_REBUILD_INSERT_ENTRY_FAILED;
          String message = getMessage(msgID, indexName,
          String message = getMessage(msgID, id2subtree.getName(),
                                      stackTraceToSingleLineString(e));
          logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.MILD_ERROR,
                   message, msgID);
@@ -722,6 +740,12 @@
  private void rebuildAttributeIndex(AttributeIndex index)
      throws DatabaseException
  {
    if(debugEnabled())
    {
      TRACER.debugInfo("Initiating rebuild of the %s index",
                       index.getName());
      TRACER.debugVerbose("%d entries will be rebuilt", totalEntries);
    }
    //Iterate through the id2entry database and insert associated indexType
    //records.
@@ -770,7 +794,7 @@
          skippedEntries++;
          int    msgID   = MSGID_JEB_REBUILD_INSERT_ENTRY_FAILED;
          String message = getMessage(msgID, indexName,
          String message = getMessage(msgID, index.getName(),
                                      stackTraceToSingleLineString(e));
          logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.MILD_ERROR,
                   message, msgID);
@@ -799,6 +823,12 @@
  private void rebuildAttributeIndex(Index index)
      throws DatabaseException
  {
    if(debugEnabled())
    {
      TRACER.debugInfo("Initiating rebuild of the %s attribute index",
                       index.getName());
      TRACER.debugVerbose("%d entries will be rebuilt", totalEntries);
    }
    //Iterate through the id2entry database and insert associated indexType
    //records.
@@ -847,7 +877,7 @@
          skippedEntries++;
          int    msgID   = MSGID_JEB_REBUILD_INSERT_ENTRY_FAILED;
          String message = getMessage(msgID, indexName,
          String message = getMessage(msgID, index.getName(),
                                      stackTraceToSingleLineString(e));
          logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.MILD_ERROR,
                   message, msgID);