From 8c2de84b13737083305368f82cdaec45c0164836 Mon Sep 17 00:00:00 2001
From: abobrov <abobrov@localhost>
Date: Sun, 15 Mar 2009 15:37:31 +0000
Subject: [PATCH] - [Issue 3837] subtree ldapsearch return the same result twice : fix base entry processing on indexed search.
---
opends/src/server/org/opends/server/backends/ndb/EntryContainer.java | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/opends/src/server/org/opends/server/backends/ndb/EntryContainer.java b/opends/src/server/org/opends/server/backends/ndb/EntryContainer.java
index d197de7..5c74632 100644
--- a/opends/src/server/org/opends/server/backends/ndb/EntryContainer.java
+++ b/opends/src/server/org/opends/server/backends/ndb/EntryContainer.java
@@ -313,6 +313,7 @@
AbstractTransaction txn = new AbstractTransaction(rootContainer);
try {
// Fetch the base entry.
+ long baseEntryID = 0;
Entry baseEntry = null;
baseEntry = dn2id.get(txn, baseDN, NdbOperation.LockMode.LM_Read);
@@ -327,6 +328,8 @@
message, matchedDN, null);
}
+ baseEntryID = (Long) baseEntry.getAttachment();
+
if (!manageDsaIT) {
checkTargetForReferral(baseEntry, searchScope);
}
@@ -346,17 +349,21 @@
indexFilter.scan();
try {
- long eid = indexFilter.getNext();
-
- while (eid != 0) {
+ long eid = 0;
+ while ((eid = indexFilter.getNext()) != 0) {
if (lookthroughLimit > 0 && lookthroughCount > lookthroughLimit) {
- //Lookthrough limit exceeded
+ // Lookthrough limit exceeded
searchOperation.setResultCode(ResultCode.ADMIN_LIMIT_EXCEEDED);
searchOperation.appendErrorMessage(
NOTE_NDB_LOOKTHROUGH_LIMIT_EXCEEDED.get(lookthroughLimit));
return;
}
+ // Skip over base entry.
+ if (eid == baseEntryID) {
+ continue;
+ }
+
// Fetch the candidate entry from the database.
Entry entry = null;
AbstractTransaction subTxn = new AbstractTransaction(rootContainer);
@@ -430,9 +437,6 @@
}
searchOperation.checkIfCanceled(false);
-
- // Move to the next record.
- eid = indexFilter.getNext();
}
} finally {
indexFilter.close();
@@ -497,7 +501,7 @@
while (result != null) {
if (lookthroughLimit > 0 && lookthroughCount > lookthroughLimit) {
- //Lookthrough limit exceeded
+ // Lookthrough limit exceeded
searchOperation.setResultCode(ResultCode.ADMIN_LIMIT_EXCEEDED);
searchOperation.appendErrorMessage(
NOTE_NDB_LOOKTHROUGH_LIMIT_EXCEEDED.get(lookthroughLimit));
--
Gitblit v1.10.0