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

Jean-Noel Rouvignac
16.29.2015 73f5d0855f8fc31259e770cdad089612e77a6383
Remove dead code.

Removed rebuildRunning fields + setters because they were actually never written to.
8 files modified
171 ■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/AttributeIndex.java 13 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/Index.java 53 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/NullIndex.java 7 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/VLVIndex.java 14 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/AttributeIndex.java 15 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Index.java 49 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/NullIndex.java 8 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VLVIndex.java 12 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/AttributeIndex.java
@@ -907,19 +907,6 @@
  }
  /**
   * Set the rebuild status of this index.
   * @param rebuildRunning True if a rebuild process on this index
   *                       is running or False otherwise.
   */
  public synchronized void setRebuildStatus(boolean rebuildRunning)
  {
    for (Index index : nameToIndexes.values())
    {
      index.setRebuildStatus(rebuildRunning);
    }
  }
  /**
   * Get the JE database name prefix for indexes in this attribute index.
   *
   * @return JE database name for this database container.
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/Index.java
@@ -93,15 +93,6 @@
   */
  private boolean trusted;
  /**
   * A flag to indicate if a rebuild process is running on this index.
   * During the rebuild process, we assume that no entryIDSets are
   * accurate and return an undefined set on all read operations.
   * However all write operations will succeed. The rebuildRunning
   * flag overrides all behaviors of the trusted flag.
   */
  private boolean rebuildRunning;
  private final ImportIDSet newImportIDSet;
  /**
@@ -282,14 +273,14 @@
          }
        }
      }
      else
      else if (trusted)
      {
        if (deletedIDs != null && trusted && !rebuildRunning)
        if (deletedIDs != null)
        {
          logIndexCorruptError(txn, key);
        }
        if ((rebuildRunning || trusted) && isNotNullOrEmpty(addedIDs))
        if (isNotNullOrEmpty(addedIDs))
        {
          data.setData(addedIDs.toDatabase());
@@ -344,20 +335,20 @@
        return delete(txn, key);
      }
    }
    else
    else if (trusted)
    {
      if (deletedIDs != null && trusted && !rebuildRunning)
      if (deletedIDs != null)
      {
        logIndexCorruptError(txn, key);
      }
      if ((rebuildRunning || trusted) && isNotNullOrEmpty(addedIDs))
      if (isNotNullOrEmpty(addedIDs))
      {
        data.setData(addedIDs.toDatabase());
        return insert(txn, key, data);
      }
      return OperationStatus.SUCCESS;
    }
    return OperationStatus.SUCCESS;
  }
  private EntryIDSet computeEntryIDList(DatabaseEntry key, DatabaseEntry data, EntryIDSet deletedIDs,
@@ -474,11 +465,6 @@
  public ConditionResult containsID(Transaction txn, DatabaseEntry key, EntryID entryID)
       throws DatabaseException
  {
    if(rebuildRunning)
    {
      return ConditionResult.UNDEFINED;
    }
    DatabaseEntry data = new DatabaseEntry();
    OperationStatus status = read(txn, key, data, LockMode.DEFAULT);
@@ -511,11 +497,6 @@
   */
  public EntryIDSet readKey(DatabaseEntry key, Transaction txn, LockMode lockMode)
  {
    if(rebuildRunning)
    {
      return new EntryIDSet();
    }
    try
    {
      DatabaseEntry data = new DatabaseEntry();
@@ -594,11 +575,8 @@
  public EntryIDSet readRange(byte[] lower, byte[] upper,
                               boolean lowerIncluded, boolean upperIncluded)
  {
    LockMode lockMode = LockMode.DEFAULT;
    // If this index is not trusted, then just return an undefined
    // id set.
    if(rebuildRunning || !trusted)
    // If this index is not trusted, then just return an undefined id set.
    if (!trusted)
    {
      return new EntryIDSet();
    }
@@ -607,6 +585,7 @@
    {
      // Total number of IDs found so far.
      int totalIDCount = 0;
      LockMode lockMode = LockMode.DEFAULT;
      DatabaseEntry data = new DatabaseEntry();
      DatabaseEntry key;
@@ -841,17 +820,7 @@
   */
  public synchronized boolean isRebuildRunning()
  {
    return rebuildRunning;
  }
  /**
   * Set the rebuild status of this index.
   * @param rebuildRunning True if a rebuild process on this index
   *                       is running or False otherwise.
   */
  public synchronized void setRebuildStatus(boolean rebuildRunning)
  {
    this.rebuildRunning = rebuildRunning;
    return false; // FIXME inline?
  }
  /**
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/NullIndex.java
@@ -190,13 +190,6 @@
  /** {@inheritDoc} */
  @Override
  public void setRebuildStatus(boolean rebuildRunning)
  {
    // Do nothing.
  }
  /** {@inheritDoc} */
  @Override
  public boolean getMaintainCount()
  {
    return false;
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/VLVIndex.java
@@ -100,8 +100,6 @@
   * with the entries database.
   */
  private boolean trusted;
  /** A flag to indicate if a rebuild process is running on this vlvIndex. */
  private boolean rebuildRunning;
  /** The VLV vlvIndex configuration. */
  private LocalDBVLVIndexCfg config;
@@ -739,7 +737,7 @@
                             StringBuilder debugBuilder)
      throws DirectoryException, DatabaseException
  {
    if (!trusted || rebuildRunning
    if (!trusted
        || !searchOperation.getBaseDN().equals(baseDN)
        || !searchOperation.getScope().equals(scope)
        || !searchOperation.getFilter().equals(filter)
@@ -1066,16 +1064,6 @@
  }
  /**
   * Set the rebuild status of this vlvIndex.
   * @param rebuildRunning True if a rebuild process on this vlvIndex
   *                       is running or False otherwise.
   */
  public synchronized void setRebuildStatus(boolean rebuildRunning)
  {
    this.rebuildRunning = rebuildRunning;
  }
  /**
   * Gets the values to sort on from the entry.
   *
   * @param entry The entry to get the values from.
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/AttributeIndex.java
@@ -28,9 +28,9 @@
package org.opends.server.backends.pluggable;
import static org.opends.messages.JebMessages.*;
import static org.opends.server.backends.pluggable.EntryIDSet.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import static org.opends.server.backends.pluggable.EntryIDSet.newUndefinedSet;
import java.io.Closeable;
import java.util.*;
@@ -882,19 +882,6 @@
  }
  /**
   * Set the rebuild status of this index.
   * @param rebuildRunning True if a rebuild process on this index
   *                       is running or False otherwise.
   */
  public synchronized void setRebuildStatus(boolean rebuildRunning)
  {
    for (Index index : nameToIndexes.values())
    {
      index.setRebuildStatus(rebuildRunning);
    }
  }
  /**
   * Get the JE database name prefix for indexes in this attribute index.
   *
   * @return JE database name for this database container.
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Index.java
@@ -26,12 +26,8 @@
 */
package org.opends.server.backends.pluggable;
import static org.opends.messages.JebMessages.ERR_JEB_INDEX_CORRUPT_REQUIRES_REBUILD;
import static org.opends.server.backends.pluggable.EntryIDSet.newDefinedSet;
import static org.opends.server.backends.pluggable.EntryIDSet.newSetFromBytes;
import static org.opends.server.backends.pluggable.EntryIDSet.newSetFromUnion;
import static org.opends.server.backends.pluggable.EntryIDSet.newUndefinedSetWithSize;
import static org.opends.server.backends.pluggable.EntryIDSet.newUndefinedSet;
import static org.opends.messages.JebMessages.*;
import static org.opends.server.backends.pluggable.EntryIDSet.*;
import java.util.ArrayList;
import java.util.HashSet;
@@ -101,15 +97,6 @@
   */
  private boolean trusted;
  /**
   * A flag to indicate if a rebuild process is running on this index.
   * During the rebuild process, we assume that no entryIDSets are
   * accurate and return an undefined set on all read operations.
   * However all write operations will succeed. The rebuildRunning
   * flag overrides all behaviors of the trusted flag.
   */
  private boolean rebuildRunning;
  private final ImportIDSet newImportIDSet;
  /**
@@ -257,15 +244,14 @@
          updateKeyWithRMW(txn, key, deletedIDs, addedIDs);
        } // else the record exists but we've hit all IDs.
      }
      else
      else if (trusted)
      {
        if (deletedIDs != null && trusted && !rebuildRunning)
        if (deletedIDs != null)
        {
          logIndexCorruptError(txn, key);
        }
        if ((rebuildRunning || trusted)
            && isNotNullOrEmpty(addedIDs)
        if (isNotNullOrEmpty(addedIDs)
            && !txn.putIfAbsent(getName(), key, addedIDs.toByteString()))
        {
          updateKeyWithRMW(txn, key, deletedIDs, addedIDs);
@@ -304,14 +290,14 @@
        txn.delete(getName(), key);
      }
    }
    else
    else if (trusted)
    {
      if (deletedIDs != null && trusted && !rebuildRunning)
      if (deletedIDs != null)
      {
        logIndexCorruptError(txn, key);
      }
      if ((rebuildRunning || trusted) && isNotNullOrEmpty(addedIDs))
      if (isNotNullOrEmpty(addedIDs))
      {
        txn.putIfAbsent(getName(), key, addedIDs.toByteString());
      }
@@ -422,11 +408,6 @@
  ConditionResult containsID(ReadableStorage txn, ByteString key, EntryID entryID)
       throws StorageRuntimeException
  {
    if(rebuildRunning)
    {
      return ConditionResult.UNDEFINED;
    }
    ByteString value = txn.read(getName(), key);
    if (value != null)
    {
@@ -449,11 +430,6 @@
  EntryIDSet read(ReadableStorage txn, ByteSequence key)
  {
    if(rebuildRunning)
    {
      return newUndefinedSet();
    }
    try
    {
      ByteString value = txn.read(getName(), key);
@@ -504,7 +480,7 @@
      ByteSequence lower, ByteSequence upper, boolean lowerIncluded, boolean upperIncluded)
  {
    // If this index is not trusted, then just return an undefined id set.
    if(rebuildRunning || !trusted)
    if (!trusted)
    {
      return newUndefinedSet();
    }
@@ -665,12 +641,7 @@
  synchronized boolean isRebuildRunning()
  {
    return rebuildRunning;
  }
  synchronized void setRebuildStatus(boolean rebuildRunning)
  {
    this.rebuildRunning = rebuildRunning;
    return false; // FIXME inline?
  }
  boolean getMaintainCount()
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/NullIndex.java
@@ -24,7 +24,7 @@
 */
package org.opends.server.backends.pluggable;
import static org.opends.server.backends.pluggable.EntryIDSet.newUndefinedSet;
import static org.opends.server.backends.pluggable.EntryIDSet.*;
import java.util.List;
import java.util.Set;
@@ -146,12 +146,6 @@
  }
  @Override
  void setRebuildStatus(boolean rebuildRunning)
  {
    // Do nothing.
  }
  @Override
  boolean getMaintainCount()
  {
    return false;
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VLVIndex.java
@@ -27,8 +27,8 @@
package org.opends.server.backends.pluggable;
import static org.opends.messages.JebMessages.*;
import static org.opends.server.backends.pluggable.EntryIDSet.*;
import static org.opends.server.util.StaticUtils.*;
import static org.opends.server.backends.pluggable.EntryIDSet.newDefinedSet;
import java.io.Closeable;
import java.util.Iterator;
@@ -943,16 +943,6 @@
  }
  /**
   * Set the rebuild status of this vlvIndex.
   * @param rebuildRunning True if a rebuild process on this vlvIndex
   *                       is running or False otherwise.
   */
  public synchronized void setRebuildStatus(boolean rebuildRunning)
  {
    this.rebuildRunning = rebuildRunning;
  }
  /**
   * Gets the values to sort on from the entry.
   *
   * @param entry The entry to get the values from.