From bf7b61bf7e22fc0c1c0bf69255f44d0139c86937 Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Thu, 24 Aug 2006 15:50:33 +0000
Subject: [PATCH] Add a configuration option to limit the number of entries that will be checked for matches during a search operation. A value of -1 or 0 will remove the limit, like the behavior of DS 5 and 6. Changed the "unlimited" values of size and time limits to be consistent with the lookthrough limit (-1 or 0).
---
opends/src/server/org/opends/server/backends/jeb/EntryContainer.java | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/opends/src/server/org/opends/server/backends/jeb/EntryContainer.java b/opends/src/server/org/opends/server/backends/jeb/EntryContainer.java
index 30914af..6563d81 100644
--- a/opends/src/server/org/opends/server/backends/jeb/EntryContainer.java
+++ b/opends/src/server/org/opends/server/backends/jeb/EntryContainer.java
@@ -838,6 +838,10 @@
DatabaseEntry key = new DatabaseEntry(begin);
List<Lock> lockList = new ArrayList<Lock>(1);
+ int lookthroughCount = 0;
+ int lookthroughLimit =
+ searchOperation.getClientConnection().getLookthroughLimit();
+
try
{
Cursor cursor = dn2id.openCursor(null, null);
@@ -851,6 +855,15 @@
// Step forward until we pass the ending value.
while (status == OperationStatus.SUCCESS)
{
+ if(lookthroughLimit > 0 && lookthroughCount > lookthroughLimit)
+ {
+ //Lookthrough limit exceeded
+ searchOperation.setResultCode(ResultCode.ADMIN_LIMIT_EXCEEDED);
+ searchOperation.appendErrorMessage(
+ getMessage(MSGID_JEB_LOOKTHROUGH_LIMIT_EXCEEDED,
+ lookthroughLimit));
+ return;
+ }
int cmp = dn2idComparator.compare(key.getData(), end);
if (cmp >= 0)
{
@@ -901,6 +914,8 @@
// Process the candidate entry.
if (entry != null)
{
+ lookthroughCount++;
+
if (manageDsaIT || entry.getReferralURLs() == null)
{
// Filter the entry.
@@ -1023,6 +1038,18 @@
}
}
+ // Make sure the candidate list is smaller than the lookthrough limit
+ int lookthroughLimit =
+ searchOperation.getClientConnection().getLookthroughLimit();
+ if(lookthroughLimit > 0 && entryIDList.size() > lookthroughLimit)
+ {
+ //Lookthrough limit exceeded
+ searchOperation.setResultCode(ResultCode.ADMIN_LIMIT_EXCEEDED);
+ searchOperation.appendErrorMessage(
+ getMessage(MSGID_JEB_LOOKTHROUGH_LIMIT_EXCEEDED, lookthroughLimit));
+ continueSearch = false;
+ }
+
// Iterate through the index candidates.
if (continueSearch)
{
--
Gitblit v1.10.0