aboutsummaryrefslogtreecommitdiffstats
path: root/node-repository/src/main/java/com/yahoo
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2021-02-18 17:58:46 +0100
committerJon Bratseth <bratseth@gmail.com>2021-02-18 17:58:46 +0100
commit79d9ae7cc3eb7052cce5e40ea83874d312cf5012 (patch)
tree965cd6af495fc5cf12193fc20ef032f2ea222126 /node-repository/src/main/java/com/yahoo
parentb6416d4e35daf38d15e038c0ac3d47b84ff38436 (diff)
Better names
Diffstat (limited to 'node-repository/src/main/java/com/yahoo')
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/applications/Status.java32
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ResourceTarget.java4
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/ApplicationSerializer.java12
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/ApplicationPatcher.java39
4 files changed, 28 insertions, 59 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/applications/Status.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/applications/Status.java
index 7871c5f7ed2..ace05d85bbd 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/applications/Status.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/applications/Status.java
@@ -10,40 +10,40 @@ import java.util.Objects;
*/
public class Status {
- private final double currentTrafficFraction;
- private final double maxTrafficFraction;
+ private final double currentReadShare;
+ private final double maxReadShare;
/** Do not use */
- public Status(double currentTrafficFraction, double maxTrafficFraction) {
- this.currentTrafficFraction = currentTrafficFraction;
- this.maxTrafficFraction = maxTrafficFraction;
+ public Status(double currentReadShare, double maxReadShare) {
+ this.currentReadShare = currentReadShare;
+ this.maxReadShare = maxReadShare;
}
- public Status withCurrentTrafficFraction(double currentTrafficFraction) {
- return new Status(currentTrafficFraction, maxTrafficFraction);
+ public Status withCurrentReadShare(double currentReadShare) {
+ return new Status(currentReadShare, maxReadShare);
}
/**
* Returns the current fraction of the global traffic to this application that is received by the
* deployment in this zone.
*/
- public double currentTrafficFraction() { return currentTrafficFraction; }
+ public double currentReadShare() { return currentReadShare; }
- public Status withMaxTrafficFraction(double maxTrafficFraction) {
- return new Status(currentTrafficFraction, maxTrafficFraction);
+ public Status withMaxReadShare(double maxReadShare) {
+ return new Status(currentReadShare, maxReadShare);
}
/**
* Returns an estimate of the max fraction of the global traffic to this application that may possibly
* be received by the deployment in this zone.
*/
- public double maxTrafficFraction() { return maxTrafficFraction; }
+ public double maxReadShare() { return maxReadShare; }
public static Status initial() { return new Status(0, 0); }
@Override
public int hashCode() {
- return Objects.hash(currentTrafficFraction, maxTrafficFraction);
+ return Objects.hash(currentReadShare, maxReadShare);
}
@Override
@@ -51,16 +51,16 @@ public class Status {
if (o == this) return true;
if ( ! (o instanceof Status)) return false;
Status other = (Status)o;
- if ( other.currentTrafficFraction != this.currentTrafficFraction) return false;
- if ( other.maxTrafficFraction != this.maxTrafficFraction) return false;
+ if ( other.currentReadShare != this.currentReadShare) return false;
+ if ( other.maxReadShare != this.maxReadShare) return false;
return true;
}
@Override
public String toString() {
return "application status: [" +
- "currentTrafficFraction: " + currentTrafficFraction + ", " +
- "maxTrafficFraction: " + maxTrafficFraction +
+ "currentReadShare: " + currentReadShare + ", " +
+ "maxReadShare: " + maxReadShare +
"]";
}
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ResourceTarget.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ResourceTarget.java
index 90e15bdb12e..a2fbeb3b710 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ResourceTarget.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ResourceTarget.java
@@ -66,10 +66,10 @@ public class ResourceTarget {
/** Ideal cpu load must take the application traffic fraction into account */
private static double idealCpuLoad(Application application) {
double trafficFactor;
- if (application.status().maxTrafficFraction() == 0) // No traffic fraction data
+ if (application.status().maxReadShare() == 0) // No traffic fraction data
trafficFactor = 0.5; // assume we currently get half of the global share of traffic
else
- trafficFactor = application.status().currentTrafficFraction() / application.status().maxTrafficFraction();
+ trafficFactor = application.status().currentReadShare() / application.status().maxReadShare();
if (trafficFactor < 0.5) // The expectation that we have almost no load with almost no queries is incorrect due
trafficFactor = 0.5; // to write traffic; once that is separated we can lower this threshold (but not to 0)
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/ApplicationSerializer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/ApplicationSerializer.java
index f72522544c6..c8b928779b9 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/ApplicationSerializer.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/ApplicationSerializer.java
@@ -40,8 +40,8 @@ public class ApplicationSerializer {
private static final String idKey = "id";
private static final String statusKey = "status";
- private static final String currentTrafficFractionKey = "currentTrafficFraction";
- private static final String maxTrafficFractionKey = "maxTrafficFraction";
+ private static final String currentReadShareKey = "currentReadShare";
+ private static final String maxReadShareKey = "maxReadShare";
private static final String clustersKey = "clusters";
private static final String exclusiveKey = "exclusive";
@@ -91,14 +91,14 @@ public class ApplicationSerializer {
}
private static void toSlime(Status status, Cursor statusObject) {
- statusObject.setDouble(currentTrafficFractionKey, status.currentTrafficFraction());
- statusObject.setDouble(maxTrafficFractionKey, status.maxTrafficFraction());
+ statusObject.setDouble(currentReadShareKey, status.currentReadShare());
+ statusObject.setDouble(maxReadShareKey, status.maxReadShare());
}
private static Status statusFromSlime(Inspector statusObject) {
if ( ! statusObject.valid()) return Status.initial(); // TODO: Remove this line after March 2021
- return new Status(statusObject.field(currentTrafficFractionKey).asDouble(),
- statusObject.field(maxTrafficFractionKey).asDouble());
+ return new Status(statusObject.field(currentReadShareKey).asDouble(),
+ statusObject.field(maxReadShareKey).asDouble());
}
private static void clustersToSlime(Collection<Cluster> clusters, Cursor clustersObject) {
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/ApplicationPatcher.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/ApplicationPatcher.java
index 5b23caa783d..771b570a4fd 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/ApplicationPatcher.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/ApplicationPatcher.java
@@ -1,49 +1,18 @@
// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.provision.restapi;
-import com.google.common.base.Suppliers;
-import com.yahoo.component.Version;
import com.yahoo.config.provision.ApplicationId;
-import com.yahoo.config.provision.DockerImage;
-import com.yahoo.config.provision.NodeFlavors;
-import com.yahoo.config.provision.NodeResources;
-import com.yahoo.config.provision.TenantName;
import com.yahoo.io.IOUtils;
import com.yahoo.slime.Inspector;
-import com.yahoo.slime.ObjectTraverser;
import com.yahoo.slime.SlimeUtils;
import com.yahoo.slime.Type;
import com.yahoo.transaction.Mutex;
-import com.yahoo.vespa.hosted.provision.LockedNodeList;
-import com.yahoo.vespa.hosted.provision.Node;
-import com.yahoo.vespa.hosted.provision.NodeMutex;
import com.yahoo.vespa.hosted.provision.NodeRepository;
import com.yahoo.vespa.hosted.provision.applications.Application;
-import com.yahoo.vespa.hosted.provision.node.Address;
-import com.yahoo.vespa.hosted.provision.node.Agent;
-import com.yahoo.vespa.hosted.provision.node.Allocation;
-import com.yahoo.vespa.hosted.provision.node.IP;
-import com.yahoo.vespa.hosted.provision.node.Report;
-import com.yahoo.vespa.hosted.provision.node.Reports;
import java.io.IOException;
import java.io.InputStream;
import java.io.UncheckedIOException;
-import java.time.Clock;
-import java.time.Instant;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.stream.Collectors;
-
-import static com.yahoo.config.provision.NodeResources.DiskSpeed.fast;
-import static com.yahoo.config.provision.NodeResources.DiskSpeed.slow;
-import static com.yahoo.config.provision.NodeResources.StorageType.local;
-import static com.yahoo.config.provision.NodeResources.StorageType.remote;
/**
* A class which can take a partial JSON node/v2 application JSON structure and apply it to an application object.
@@ -92,10 +61,10 @@ public class ApplicationPatcher implements AutoCloseable {
private Application applyField(Application application, String name, Inspector value, Inspector root) {
switch (name) {
- case "currentTrafficFraction" :
- return application.with(application.status().withCurrentTrafficFraction(asDouble(value)));
- case "maxTrafficFraction" :
- return application.with(application.status().withMaxTrafficFraction(asDouble(value)));
+ case "currentReadShare" :
+ return application.with(application.status().withCurrentReadShare(asDouble(value)));
+ case "maxReadShare" :
+ return application.with(application.status().withMaxReadShare(asDouble(value)));
default :
throw new IllegalArgumentException("Could not apply field '" + name + "' on an application: No such modifiable field");
}