summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorØyvind Grønnesby <ogr@ogr.no>2022-08-26 07:22:13 +0200
committerGitHub <noreply@github.com>2022-08-26 07:22:13 +0200
commit52014d87048b6baa378ee6f2981ac5eae041cfb9 (patch)
treef9fd9a70d4c8aab79d0638cefbbc258c29b030b0
parentdcb694fc47d4398e192637966262b82a7968a5fe (diff)
parent04ed754cad585dadb7433f9b945702dbdd02b6c0 (diff)
Merge pull request #23420 from vespa-engine/bratseth/quota
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/DeploymentQuotaCalculator.java7
-rw-r--r--jrt/src/com/yahoo/jrt/Acceptor.java4
-rw-r--r--jrt/src/com/yahoo/jrt/Transport.java6
-rw-r--r--jrt/src/com/yahoo/jrt/slobrok/api/Mirror.java5
4 files changed, 5 insertions, 17 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/DeploymentQuotaCalculator.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/DeploymentQuotaCalculator.java
index 30ec0e202a2..cde971b490a 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/DeploymentQuotaCalculator.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/DeploymentQuotaCalculator.java
@@ -33,9 +33,6 @@ public class DeploymentQuotaCalculator {
}
public static QuotaUsage calculateQuotaUsage(com.yahoo.vespa.hosted.controller.api.integration.configserver.Application application) {
- // the .max() resources are only specified when the user has specified a max. to make sure we enforce quotas
- // correctly we retrieve the maximum of .current() and .max() - otherwise we would keep adding 0s for those
- // that are not using autoscaling.
var quotaUsageRate = application.clusters().values().stream()
.filter(cluster -> ! cluster.type().equals(ClusterSpec.Type.admin))
.map(cluster -> largestQuotaUsage(cluster.current(), cluster.max()))
@@ -45,9 +42,7 @@ public class DeploymentQuotaCalculator {
}
private static ClusterResources largestQuotaUsage(ClusterResources a, ClusterResources b) {
- var usageA = a.nodes() * a.nodeResources().cost();
- var usageB = b.nodes() * b.nodeResources().cost();
- return usageA < usageB ? b : a;
+ return a.cost() > b.cost() ? a : b;
}
/** Just get the maximum quota we are allowed to use. */
diff --git a/jrt/src/com/yahoo/jrt/Acceptor.java b/jrt/src/com/yahoo/jrt/Acceptor.java
index d4bdb7007f1..14b35c5893f 100644
--- a/jrt/src/com/yahoo/jrt/Acceptor.java
+++ b/jrt/src/com/yahoo/jrt/Acceptor.java
@@ -85,8 +85,8 @@ public class Acceptor {
* is listening to. If this Acceptor is no longer listening (it has
* been shut down), null will be returned.
*
- * @return listening spec, or null if not listening.
- **/
+ * @return listening spec, or null if not listening
+ */
public Spec spec() {
if ( ! serverChannel.isOpen()) {
return null;
diff --git a/jrt/src/com/yahoo/jrt/Transport.java b/jrt/src/com/yahoo/jrt/Transport.java
index 871d0188691..e488998f055 100644
--- a/jrt/src/com/yahoo/jrt/Transport.java
+++ b/jrt/src/com/yahoo/jrt/Transport.java
@@ -79,11 +79,7 @@ public class Transport {
// Only for testing
public Transport() { this("default"); }
- /**
- * Select a random transport thread
- *
- * @return a random transport thread
- */
+ /** Selects and returns a random transport thread. */
public TransportThread selectThread() {
return threads.get(rnd.nextInt(threads.size()));
}
diff --git a/jrt/src/com/yahoo/jrt/slobrok/api/Mirror.java b/jrt/src/com/yahoo/jrt/slobrok/api/Mirror.java
index 778cb0455e8..dd2fd5a8242 100644
--- a/jrt/src/com/yahoo/jrt/slobrok/api/Mirror.java
+++ b/jrt/src/com/yahoo/jrt/slobrok/api/Mirror.java
@@ -1,8 +1,6 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jrt.slobrok.api;
-
-import com.yahoo.jrt.ErrorCode;
import com.yahoo.jrt.Int32Value;
import com.yahoo.jrt.Request;
import com.yahoo.jrt.RequestWaiter;
@@ -51,8 +49,7 @@ public class Mirror implements IMirror {
private Request req = null;
/**
- * Create a new MirrorAPI using the given Supervisor and slobrok
- * connect specs.
+ * Create a new MirrorAPI using the given Supervisor and slobrok connect specs.
*
* @param orb the Supervisor to use
* @param slobroks slobrok connect spec list