opendj3-server-dev/src/server/org/opends/server/backends/jeb/AttributeIndex.java
@@ -52,7 +52,6 @@ import org.opends.server.types.*; import org.opends.server.util.StaticUtils; import com.sleepycat.je.DatabaseEntry; import com.sleepycat.je.DatabaseException; import static org.opends.messages.JebMessages.*; @@ -113,9 +112,6 @@ * class in the SDK could implement the logic, I hope). */ /** A database key for the presence index. */ static final DatabaseEntry presenceKey = new DatabaseEntry("+".getBytes()); /** The entryContainer in which this attribute index resides. */ private final EntryContainer entryContainer; opendj3-server-dev/src/server/org/opends/server/backends/jeb/IndexQueryFactoryImpl.java
@@ -184,7 +184,7 @@ return new EntryIDSet(); } EntryIDSet entrySet = index.readKey(AttributeIndex.presenceKey, null, LockMode.DEFAULT); EntryIDSet entrySet = index.readKey(JEBUtils.presenceKey, null, LockMode.DEFAULT); if (debugMessage != null && !entrySet.isDefined()) { updateStatsUndefinedResults(debugMessage, index); opendj3-server-dev/src/server/org/opends/server/backends/jeb/JEBUtils.java
@@ -25,6 +25,7 @@ package org.opends.server.backends.jeb; import com.sleepycat.je.DatabaseConfig; import com.sleepycat.je.DatabaseEntry; import com.sleepycat.je.Environment; /** @@ -32,6 +33,9 @@ */ final class JEBUtils { /** A database key for the presence index. */ static final DatabaseEntry presenceKey = new DatabaseEntry(PresenceIndexer.presenceKeyBytes); private JEBUtils() { // Private for utility classes opendj3-server-dev/src/server/org/opends/server/backends/jeb/PresenceIndexer.java
@@ -26,6 +26,7 @@ */ package org.opends.server.backends.jeb; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; @@ -42,11 +43,13 @@ */ public class PresenceIndexer extends Indexer { /** The key bytes used for the presence index. */ static final byte[] presenceKeyBytes = "+".getBytes(); /** * The attribute type for which this instance will * generate index keys. */ /** The key bytes used for the presence index as a {@link ByteString}. */ static final ByteString presenceKey = ByteString.wrap(presenceKeyBytes); /** The attribute type for which this instance will generate index keys. */ private AttributeType attributeType; /** @@ -70,13 +73,12 @@ @Override public void indexEntry(Entry entry, Set<ByteString> keys, IndexingOptions options) { List<Attribute> attrList = entry.getAttribute(attributeType); List<Attribute> attrList = entry.getAttribute(attributeType); if (attrList != null) { if (!attrList.isEmpty()) { keys.add(getPresenceKeyData()); keys.add(presenceKey); } } } @@ -86,22 +88,7 @@ public void replaceEntry(Entry oldEntry, Entry newEntry, Map<ByteString, Boolean> modifiedKeys, IndexingOptions options) { List<Attribute> newAttributes = newEntry.getAttribute(attributeType, true); List<Attribute> oldAttributes = oldEntry.getAttribute(attributeType, true); if(oldAttributes == null) { if(newAttributes != null) { modifiedKeys.put(getPresenceKeyData(), true); } } else { if(newAttributes == null) { modifiedKeys.put(getPresenceKeyData(), false); } } modifyEntry(oldEntry, newEntry, Collections.<Modification>emptyList(), modifiedKeys, options); } /** {@inheritDoc} */ @@ -116,20 +103,15 @@ { if(newAttributes != null) { modifiedKeys.put(getPresenceKeyData(), true); modifiedKeys.put(presenceKey, true); } } else { if(newAttributes == null) { modifiedKeys.put(getPresenceKeyData(), false); modifiedKeys.put(presenceKey, false); } } } private ByteString getPresenceKeyData() { return ByteString.wrap(AttributeIndex.presenceKey.getData()); } } opendj3-server-dev/src/server/org/opends/server/backends/jeb/VerifyJob.java
@@ -1518,8 +1518,7 @@ if (presenceIndex != null) { DatabaseEntry presenceKey = AttributeIndex.presenceKey; verifyAttributeInIndex(presenceIndex, txn, presenceKey, entryID); verifyAttributeInIndex(presenceIndex, txn, JEBUtils.presenceKey, entryID); } final DatabaseEntry key = new DatabaseEntry(); opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/backends/jeb/TestBackendImpl.java
@@ -975,12 +975,12 @@ // This current entry in the DB shouldn't be in the presence titleIndex. addKeys = new HashSet<ByteString>(); addKeys.add(ByteString.wrap(AttributeIndex.presenceKey.getData())); addKeys.add(PresenceIndexer.presenceKey); assertIndexContainsID(addKeys, titleIndex.getPresenceIndex(), entryID, FALSE); // This current entry should be in the presence nameIndex. addKeys = new HashSet<ByteString>(); addKeys.add(ByteString.wrap(AttributeIndex.presenceKey.getData())); addKeys.add(PresenceIndexer.presenceKey); assertIndexContainsID(addKeys, nameIndex.getPresenceIndex(), entryID, TRUE); List<Control> noControls = new ArrayList<Control>(0);