You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ra...@apache.org on 2018/12/05 20:49:52 UTC
[incubator-openwhisk] branch master updated: Make query limits
configurable (#4157)
This is an automated email from the ASF dual-hosted git repository.
rabbah pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git
The following commit(s) were added to refs/heads/master by this push:
new ec36051 Make query limits configurable (#4157)
ec36051 is described below
commit ec36051479a06b574ccd2547e7fd07319ad33071
Author: Chetan Mehrotra <ch...@apache.org>
AuthorDate: Thu Dec 6 02:19:46 2018 +0530
Make query limits configurable (#4157)
---
common/scala/src/main/resources/application.conf | 5 +++++
.../main/scala/org/apache/openwhisk/core/WhiskConfig.scala | 1 +
.../org/apache/openwhisk/core/entitlement/Collection.scala | 11 +++++++----
3 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/common/scala/src/main/resources/application.conf b/common/scala/src/main/resources/application.conf
index 622070c..60117ea 100644
--- a/common/scala/src/main/resources/application.conf
+++ b/common/scala/src/main/resources/application.conf
@@ -234,6 +234,11 @@ whisk {
std = 1
}
+ query-limit {
+ max-list-limit = 200 # max number of entities that can be requested from a collection on a list operation
+ default-list-limit = 30 # default limit on number of entities returned from a collection on a list operation
+ }
+
mesos {
master-url = "http://localhost:5050" //your mesos master
master-public-url = "http://localhost:5050" // if mesos-link-log-message == true, this link will be included with the static log message (may or may not be different from master-url)
diff --git a/common/scala/src/main/scala/org/apache/openwhisk/core/WhiskConfig.scala b/common/scala/src/main/scala/org/apache/openwhisk/core/WhiskConfig.scala
index 6e95202..019f37f 100644
--- a/common/scala/src/main/scala/org/apache/openwhisk/core/WhiskConfig.scala
+++ b/common/scala/src/main/scala/org/apache/openwhisk/core/WhiskConfig.scala
@@ -238,5 +238,6 @@ object ConfigKeys {
val containerProxyTimeouts = s"$containerProxy.timeouts"
val s3 = "whisk.s3"
+ val query = "whisk.query-limit"
}
diff --git a/core/controller/src/main/scala/org/apache/openwhisk/core/entitlement/Collection.scala b/core/controller/src/main/scala/org/apache/openwhisk/core/entitlement/Collection.scala
index 0e40624..6828c90 100644
--- a/core/controller/src/main/scala/org/apache/openwhisk/core/entitlement/Collection.scala
+++ b/core/controller/src/main/scala/org/apache/openwhisk/core/entitlement/Collection.scala
@@ -21,15 +21,14 @@ import org.apache.openwhisk.core.entitlement.Privilege._
import scala.concurrent.ExecutionContext
import scala.concurrent.Future
-
import akka.http.scaladsl.model.HttpMethod
import akka.http.scaladsl.model.HttpMethods.DELETE
import akka.http.scaladsl.model.HttpMethods.GET
import akka.http.scaladsl.model.HttpMethods.POST
import akka.http.scaladsl.model.HttpMethods.PUT
-
import org.apache.openwhisk.common.Logging
import org.apache.openwhisk.common.TransactionId
+import org.apache.openwhisk.core.ConfigKeys
import org.apache.openwhisk.core.entity.Identity
import org.apache.openwhisk.core.entity.WhiskAction
import org.apache.openwhisk.core.entity.WhiskActivation
@@ -37,6 +36,7 @@ import org.apache.openwhisk.core.entity.WhiskPackage
import org.apache.openwhisk.core.entity.WhiskRule
import org.apache.openwhisk.core.entity.WhiskTrigger
import org.apache.openwhisk.core.entity.types.EntityStore
+import pureconfig._
/**
* A collection encapsulates the name of a collection and implicit rights when subject
@@ -109,9 +109,12 @@ protected[core] case class Collection protected (val path: String,
/** An enumeration of known collections. */
protected[core] object Collection {
+ private case class QueryLimit(maxListLimit: Int, defaultListLimit: Int)
+ private val queryLimit = loadConfigOrThrow[QueryLimit](ConfigKeys.query)
+
/** Number of records allowed per query. */
- protected[core] val DEFAULT_LIST_LIMIT = 30
- protected[core] val MAX_LIST_LIMIT = 200
+ protected[core] val DEFAULT_LIST_LIMIT = queryLimit.defaultListLimit
+ protected[core] val MAX_LIST_LIMIT = queryLimit.maxListLimit
protected[core] val DEFAULT_SKIP_LIMIT = 0
protected[core] val ACTIONS = WhiskAction.collectionName