opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DN2URI.java
@@ -27,6 +27,7 @@ package org.opends.server.backends.pluggable; import static org.opends.messages.BackendMessages.*; import static org.opends.server.backends.pluggable.DnKeyFormat.*; import static org.opends.server.util.ServerConstants.*; import java.util.ArrayList; @@ -585,18 +586,8 @@ * find subordinates of the base entry from the top of the tree downwards. */ ByteString baseDN = toKey(searchOp.getBaseDN()); ByteStringBuilder suffix = new ByteStringBuilder(baseDN.length() + 1); suffix.append(baseDN); ByteStringBuilder end = new ByteStringBuilder(suffix); /* * Set the ending value to a value of equal length but slightly * greater than the suffix. Since keys are compared in * reverse order we must set the first byte (the comma). * No possibility of overflow here. */ suffix.append((byte) 0x00); end.append((byte) 0x01); ByteStringBuilder suffix = beforeKey(baseDN); ByteStringBuilder end = afterKey(baseDN); try { opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DnKeyFormat.java
@@ -88,4 +88,20 @@ } return builder.toByteString(); } static ByteStringBuilder beforeKey(final ByteSequence key) { final ByteStringBuilder beforeKey = new ByteStringBuilder(key.length() + 1); beforeKey.append(key); beforeKey.append((byte) 0x00); return beforeKey; } static ByteStringBuilder afterKey(final ByteSequence key) { final ByteStringBuilder afterKey = new ByteStringBuilder(key.length() + 1); afterKey.append(key); afterKey.append((byte) 0x01); return afterKey; } } opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java
@@ -29,9 +29,9 @@ import static org.forgerock.util.Utils.*; import static org.opends.messages.BackendMessages.*; import static org.opends.server.backends.pluggable.DnKeyFormat.*; import static org.opends.server.backends.pluggable.EntryIDSet.*; import static org.opends.server.backends.pluggable.IndexFilter.*; import static org.opends.server.backends.pluggable.DnKeyFormat.*; import static org.opends.server.backends.pluggable.VLVIndex.*; import static org.opends.server.core.DirectoryServer.*; import static org.opends.server.protocols.ldap.LDAPResultCode.*; @@ -1156,17 +1156,8 @@ * "ou=people,dc=example,dc=com". */ ByteString baseDNKey = dnToDNKey(aBaseDN, this.baseDN.size()); ByteStringBuilder suffix = copyOf(baseDNKey); ByteStringBuilder end = copyOf(baseDNKey); /* * Set the ending value to a value of equal length but slightly * greater than the suffix. Since keys are compared in * reverse order we must set the first byte (the comma). * No possibility of overflow here. */ suffix.append((byte) 0x00); end.append((byte) 0x01); ByteStringBuilder suffix = beforeKey(baseDNKey); ByteStringBuilder end = afterKey(baseDNKey); // Set the starting value. ByteSequence begin; @@ -1621,15 +1612,8 @@ * downwards. */ ByteString entryDNKey = dnToDNKey(entryDN, baseDN.size()); ByteStringBuilder suffix = copyOf(entryDNKey); ByteStringBuilder end = copyOf(entryDNKey); /* * Set the ending value to a value of equal length but slightly * greater than the suffix. */ suffix.append((byte) 0x00); end.append((byte) 0x01); ByteStringBuilder suffix = beforeKey(entryDNKey); ByteStringBuilder end = afterKey(entryDNKey); int subordinateEntriesDeleted = 0; @@ -1738,13 +1722,6 @@ } } private ByteStringBuilder copyOf(ByteString bs) { ByteStringBuilder newBS = new ByteStringBuilder(bs.length() + 1); newBS.append(bs); return newBS; } private void deleteEntry(WriteableTransaction txn, IndexBuffer indexBuffer, boolean manageDsaIT, @@ -2192,15 +2169,8 @@ * downwards. */ ByteString currentDNKey = dnToDNKey(currentDN, baseDN.size()); ByteStringBuilder suffix = copyOf(currentDNKey); ByteStringBuilder end = copyOf(currentDNKey); /* * Set the ending value to a value of equal length but slightly * greater than the suffix. */ suffix.append((byte) 0x00); end.append((byte) 0x01); ByteStringBuilder suffix = beforeKey(currentDNKey); ByteStringBuilder end = afterKey(currentDNKey); Cursor<ByteString, ByteString> cursor = txn.openCursor(dn2id.getName()); try opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Importer.java
@@ -28,6 +28,7 @@ import static org.opends.messages.BackendMessages.*; import static org.opends.server.admin.std.meta.BackendIndexCfgDefn.IndexType.*; import static org.opends.server.backends.pluggable.DnKeyFormat.*; import static org.opends.server.backends.pluggable.EntryIDSet.*; import static org.opends.server.backends.pluggable.SuffixContainer.*; import static org.opends.server.util.DynamicConstants.*; @@ -1214,11 +1215,12 @@ boolean success = cursor.positionToKeyOrNext(key); if (success && key.equals(cursor.getKey())) { // This is the base entry for a branch that was excluded in the // import so we must migrate all entries in this branch over to // the new entry container. ByteStringBuilder end = new ByteStringBuilder(key.length() + 1); end.append((byte) 0x01); /* * This is the base entry for a branch that was excluded in the * import so we must migrate all entries in this branch over to * the new entry container. */ ByteStringBuilder end = afterKey(key); while (success && ByteSequence.COMPARATOR.compare(key, end) < 0 @@ -1287,21 +1289,16 @@ } else { // This is the base entry for a branch that will be included // in the import so we don't want to copy the branch to the // new entry container. /* * This is the base entry for a branch that will be included * in the import so we do not want to copy the branch to the * new entry container. */ /* * Advance the cursor to next entry at the same level in the DIT * skipping all the entries in this branch. Set the next * starting value to a value of equal length but slightly * greater than the previous DN. Since keys are compared in * reverse order we must set the first byte (the comma). No * possibility of overflow here. * skipping all the entries in this branch. */ ByteStringBuilder begin = new ByteStringBuilder(key.length() + 1); begin.append(key); begin.append((byte) 0x01); ByteStringBuilder begin = afterKey(key); success = cursor.positionToKeyOrNext(begin); } } @@ -1335,9 +1332,7 @@ } } /** * Task to perform append/replace processing. */ /** Task to perform append/replace processing. */ private class AppendReplaceTask extends ImportTask { public AppendReplaceTask(final Storage storage)