summaryrefslogtreecommitdiffstats
path: root/configserver
diff options
context:
space:
mode:
authorjonmv <venstad@gmail.com>2022-12-07 13:08:29 +0100
committerjonmv <venstad@gmail.com>2022-12-07 13:08:29 +0100
commit529f447bbeaf707a4976b8ec9c45491278ec4857 (patch)
tree71a91dfe51a08fdbd7b768bfe3e5d35fa00afe24 /configserver
parent304816b9d4876fe33c66cdd8da4f084d32c8df67 (diff)
Store and display reindexing cause
Diffstat (limited to 'configserver')
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/application/ApplicationCuratorDatabase.java5
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/application/ApplicationReindexing.java22
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java3
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/response/ReindexingResponse.java1
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/ReindexingMaintainer.java5
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/application/ApplicationCuratorDatabaseTest.java8
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/application/ApplicationReindexingTest.java12
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java144
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/maintenance/ReindexingMaintainerTest.java24
9 files changed, 136 insertions, 88 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/application/ApplicationCuratorDatabase.java b/configserver/src/main/java/com/yahoo/vespa/config/server/application/ApplicationCuratorDatabase.java
index 34fe8a2159d..438ac7dc9a8 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/application/ApplicationCuratorDatabase.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/application/ApplicationCuratorDatabase.java
@@ -174,6 +174,7 @@ public class ApplicationCuratorDatabase {
private static final String GENERATION = "generation";
private static final String EPOCH_MILLIS = "epochMillis";
private static final String SPEED = "speed";
+ private static final String CAUSE = "cause";
private static byte[] toBytes(ApplicationReindexing reindexing) {
Cursor root = new Slime().setObject();
@@ -204,6 +205,7 @@ public class ApplicationCuratorDatabase {
private static void setStatus(Cursor statusObject, Status status) {
statusObject.setLong(EPOCH_MILLIS, status.ready().toEpochMilli());
statusObject.setDouble(SPEED, status.speed());
+ statusObject.setString(CAUSE, status.cause());
}
private static ApplicationReindexing fromBytes(byte[] data) {
@@ -225,7 +227,8 @@ public class ApplicationCuratorDatabase {
private static Status getStatus(Inspector statusObject) {
return new Status(Instant.ofEpochMilli(statusObject.field(EPOCH_MILLIS).asLong()),
- statusObject.field(SPEED).valid() ? statusObject.field(SPEED).asDouble() : 0.2);
+ statusObject.field(SPEED).valid() ? statusObject.field(SPEED).asDouble() : 0.2,
+ statusObject.field(CAUSE).asString());
}
}
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/application/ApplicationReindexing.java b/configserver/src/main/java/com/yahoo/vespa/config/server/application/ApplicationReindexing.java
index 19395b10b2b..f4e1918e6e3 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/application/ApplicationReindexing.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/application/ApplicationReindexing.java
@@ -2,6 +2,7 @@
package com.yahoo.vespa.config.server.application;
import com.yahoo.config.model.api.Reindexing;
+import com.yahoo.vespa.config.server.maintenance.ReindexingMaintainer;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
@@ -37,10 +38,10 @@ public class ApplicationReindexing implements Reindexing {
}
/** Returns a copy of this with reindexing for the given document type in the given cluster ready at the given instant. */
- public ApplicationReindexing withReady(String cluster, String documentType, Instant readyAt, double speed) {
+ public ApplicationReindexing withReady(String cluster, String documentType, Instant readyAt, double speed, String cause) {
Cluster current = clusters.getOrDefault(cluster, Cluster.empty());
Cluster modified = new Cluster(current.pending,
- with(documentType, new Status(readyAt, speed), current.ready));
+ with(documentType, new Status(readyAt, speed, cause), current.ready));
return new ApplicationReindexing(enabled, with(cluster, modified, clusters));
}
@@ -172,13 +173,17 @@ public class ApplicationReindexing implements Reindexing {
private final Instant ready;
private final double speed;
+ private final String cause;
- Status(Instant ready, double speed) {
+ Status(Instant ready, double speed, String cause) {
if (speed <= 0 || 10 < speed)
throw new IllegalArgumentException("Reindexing speed must be in (0, 10], but was " + speed);
this.ready = ready.truncatedTo(ChronoUnit.MILLIS);
this.speed = speed;
+ this.cause = cause.isBlank() ? speed < ReindexingMaintainer.SPEED ? "background reindexing, to account for changes in built-in linguistics components"
+ : "reindexing due to a schema change"
+ : cause;
}
@Override
@@ -190,21 +195,26 @@ public class ApplicationReindexing implements Reindexing {
}
@Override
+ public String cause() {
+ return cause;
+ }
+
+ @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Status status = (Status) o;
- return Double.compare(status.speed, speed) == 0 && ready.equals(status.ready);
+ return Double.compare(status.speed, speed) == 0 && ready.equals(status.ready) && cause.equals(status.cause);
}
@Override
public int hashCode() {
- return Objects.hash(ready, speed);
+ return Objects.hash(ready, speed, cause);
}
@Override
public String toString() {
- return "ready at " + ready + ", with relative speed " + speed;
+ return cause + ", ready at " + ready + ", with relative speed " + speed;
}
}
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java b/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java
index 8afffd93a29..4d28b58beb3 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java
@@ -252,6 +252,7 @@ public class ApplicationHandler extends HttpHandler {
Set<String> clusters = StringUtilities.split(request.getProperty("clusterId"));
Set<String> types = StringUtilities.split(request.getProperty("documentType"));
double speed = Double.parseDouble(Objects.requireNonNullElse(request.getProperty("speed"), "1"));
+ String cause = Objects.requireNonNullElse(request.getProperty("cause"), "reindexing for an unknown reason");
Map<String, Set<String>> reindexed = new TreeMap<>();
Instant now = applicationRepository.clock().instant();
@@ -267,7 +268,7 @@ public class ApplicationHandler extends HttpHandler {
String.join(", ", documentTypes.get(cluster)));
if ( ! indexedOnly || indexedDocumentTypes.get(cluster).contains(type)) {
- reindexing = reindexing.withReady(cluster, type, now, speed);
+ reindexing = reindexing.withReady(cluster, type, now, speed, cause);
reindexed.computeIfAbsent(cluster, __ -> new TreeSet<>()).add(type);
}
}
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/response/ReindexingResponse.java b/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/response/ReindexingResponse.java
index 1844b204a63..3ad09ea6345 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/response/ReindexingResponse.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/response/ReindexingResponse.java
@@ -40,6 +40,7 @@ public class ReindexingResponse extends JSONResponse {
private static void setStatus(Cursor object, ApplicationReindexing.Status readyStatus) {
object.setLong("readyMillis", readyStatus.ready().toEpochMilli());
object.setDouble("speed", readyStatus.speed());
+ object.setString("cause", readyStatus.cause());
}
private static void setStatus(Cursor object, ClusterReindexing.Status status) {
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/ReindexingMaintainer.java b/configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/ReindexingMaintainer.java
index 99c3ecae62a..05f3f2c6483 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/ReindexingMaintainer.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/ReindexingMaintainer.java
@@ -40,7 +40,8 @@ public class ReindexingMaintainer extends ConfigServerMaintainer {
private static final Duration timeout = Duration.ofSeconds(10);
/** Relative reindexing speed. */
- static final double SPEED = 1;
+ public static final double SPEED = 1;
+ static final String CAUSE = "reindexing due to a schema change";
private final ConfigConvergenceChecker convergence;
private final Clock clock;
@@ -96,7 +97,7 @@ public class ReindexingMaintainer extends ConfigServerMaintainer {
for (var cluster : reindexing.clusters().entrySet())
for (var pending : cluster.getValue().pending().entrySet())
if (pending.getValue() <= oldestGeneration.get()) {
- reindexing = reindexing.withReady(cluster.getKey(), pending.getKey(), now, SPEED)
+ reindexing = reindexing.withReady(cluster.getKey(), pending.getKey(), now, SPEED, CAUSE)
.withoutPending(cluster.getKey(), pending.getKey());
}
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/application/ApplicationCuratorDatabaseTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/application/ApplicationCuratorDatabaseTest.java
index eb66e7abd88..cbdb462c35e 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/application/ApplicationCuratorDatabaseTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/application/ApplicationCuratorDatabaseTest.java
@@ -9,6 +9,7 @@ import java.time.Instant;
import java.util.Optional;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
/**
* @author jonmv
@@ -23,8 +24,11 @@ public class ApplicationCuratorDatabaseTest {
assertEquals(Optional.empty(), db.readReindexingStatus(id));
ApplicationReindexing reindexing = ApplicationReindexing.empty()
- .withPending("one", "a", 10).withReady("two", "b", Instant.ofEpochMilli(2), 0.2)
- .withPending("two", "b", 20).withReady("one", "a", Instant.ofEpochMilli(1), 0.2).withReady("two", "c", Instant.ofEpochMilli(3), 0.2)
+ .withPending("one", "a", 10)
+ .withReady("two", "b", Instant.ofEpochMilli(2), 0.2, "test reindexing")
+ .withPending("two", "b", 20)
+ .withReady("one", "a", Instant.ofEpochMilli(1), 0.2, "test reindexing")
+ .withReady("two", "c", Instant.ofEpochMilli(3), 0.2, "test reindexing")
.enabled(false);
db.writeReindexingStatus(id, reindexing);
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/application/ApplicationReindexingTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/application/ApplicationReindexingTest.java
index 3a19cee6675..80ac28e9dbc 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/application/ApplicationReindexingTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/application/ApplicationReindexingTest.java
@@ -22,10 +22,10 @@ public class ApplicationReindexingTest {
public void test() {
ApplicationReindexing reindexing = ApplicationReindexing.empty()
.withPending("one", "a", 10)
- .withReady("two", "b", Instant.ofEpochMilli(2), 3)
+ .withReady("two", "b", Instant.ofEpochMilli(2), 3, "test reindexing")
.withPending("two", "b", 20)
- .withReady("one", "a", Instant.ofEpochMilli(1), 1)
- .withReady("two", "a", Instant.ofEpochMilli(3), 2)
+ .withReady("one", "a", Instant.ofEpochMilli(1), 1, "test reindexing")
+ .withReady("two", "a", Instant.ofEpochMilli(3), 2, "test reindexing")
.withoutPending("one", "a");
assertEquals(Instant.ofEpochMilli(1),
@@ -51,14 +51,14 @@ public class ApplicationReindexingTest {
assertEquals(Set.of("one", "two"),
reindexing.clusters().keySet());
- assertEquals(Map.of("a", new Status(Instant.ofEpochMilli(1), 1)),
+ assertEquals(Map.of("a", new Status(Instant.ofEpochMilli(1), 1, "test reindexing")),
reindexing.clusters().get("one").ready());
assertEquals(Map.of(),
reindexing.clusters().get("one").pending());
- assertEquals(Map.of("a", new Status(Instant.ofEpochMilli(3), 2),
- "b", new Status(Instant.ofEpochMilli(2), 3)),
+ assertEquals(Map.of("a", new Status(Instant.ofEpochMilli(3), 2, "test reindexing"),
+ "b", new Status(Instant.ofEpochMilli(2), 3, "test reindexing")),
reindexing.clusters().get("two").ready());
assertEquals(Map.of("b", 20L),
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java
index d543820fc68..b24d37f29fd 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java
@@ -241,37 +241,48 @@ public class ApplicationHandlerTest {
clock.advance(Duration.ofSeconds(1));
reindex(applicationId, "", "{\"message\":\"Reindexing document types [bar] in 'boo', [bar, bax, baz] in 'foo' of application default.default\"}");
- expected = expected.withReady("boo", "bar", clock.instant(), 1).withReady("foo", "bar", clock.instant(), 1).withReady("foo", "baz", clock.instant(), 1).withReady("foo", "bax", clock.instant(), 1);
+ expected = expected.withReady("boo", "bar", clock.instant(), 1, "reindexing for an unknown reason")
+ .withReady("foo", "bar", clock.instant(), 1, "reindexing for an unknown reason")
+ .withReady("foo", "baz", clock.instant(), 1, "reindexing for an unknown reason")
+ .withReady("foo", "bax", clock.instant(), 1, "reindexing for an unknown reason");
assertEquals(expected,
database.readReindexingStatus(applicationId).orElseThrow());
clock.advance(Duration.ofSeconds(1));
- reindex(applicationId, "?indexedOnly=true", "{\"message\":\"Reindexing document types [bar] in 'foo' of application default.default\"}");
- expected = expected.withReady("foo", "bar", clock.instant(), 1);
+ reindex(applicationId, "?indexedOnly=true&cause=test%20reindexing", "{\"message\":\"Reindexing document types [bar] in 'foo' of application default.default\"}");
+ expected = expected.withReady("foo", "bar", clock.instant(), 1, "test reindexing");
assertEquals(expected,
database.readReindexingStatus(applicationId).orElseThrow());
clock.advance(Duration.ofSeconds(1));
- expected = expected.withReady("boo", "bar", clock.instant(), 1).withReady("foo", "bar", clock.instant(), 1).withReady("foo", "baz", clock.instant(), 1).withReady("foo", "bax", clock.instant(), 1);
- reindex(applicationId, "?clusterId=", "{\"message\":\"Reindexing document types [bar] in 'boo', [bar, bax, baz] in 'foo' of application default.default\"}");
+ expected = expected.withReady("boo", "bar", clock.instant(), 1, "reindexing")
+ .withReady("foo", "bar", clock.instant(), 1, "reindexing")
+ .withReady("foo", "baz", clock.instant(), 1, "reindexing")
+ .withReady("foo", "bax", clock.instant(), 1, "reindexing");
+ reindex(applicationId, "?clusterId=&cause=reindexing", "{\"message\":\"Reindexing document types [bar] in 'boo', [bar, bax, baz] in 'foo' of application default.default\"}");
assertEquals(expected,
database.readReindexingStatus(applicationId).orElseThrow());
clock.advance(Duration.ofSeconds(1));
- expected = expected.withReady("boo", "bar", clock.instant(), 1).withReady("foo", "bar", clock.instant(), 1);
- reindex(applicationId, "?documentType=bar", "{\"message\":\"Reindexing document types [bar] in 'boo', [bar] in 'foo' of application default.default\"}");
+ expected = expected.withReady("boo", "bar", clock.instant(), 1, "reindexing")
+ .withReady("foo", "bar", clock.instant(), 1, "reindexing");
+ reindex(applicationId, "?documentType=bar&cause=reindexing", "{\"message\":\"Reindexing document types [bar] in 'boo', [bar] in 'foo' of application default.default\"}");
assertEquals(expected,
database.readReindexingStatus(applicationId).orElseThrow());
clock.advance(Duration.ofSeconds(1));
- reindex(applicationId, "?clusterId=foo,boo", "{\"message\":\"Reindexing document types [bar] in 'boo', [bar, bax, baz] in 'foo' of application default.default\"}");
- expected = expected.withReady("boo", "bar", clock.instant(), 1).withReady("foo", "bar", clock.instant(), 1).withReady("foo", "baz", clock.instant(), 1).withReady("foo", "bax", clock.instant(), 1);
+ reindex(applicationId, "?clusterId=foo,boo&cause=reindexing", "{\"message\":\"Reindexing document types [bar] in 'boo', [bar, bax, baz] in 'foo' of application default.default\"}");
+ expected = expected.withReady("boo", "bar", clock.instant(), 1, "reindexing")
+ .withReady("foo", "bar", clock.instant(), 1, "reindexing")
+ .withReady("foo", "baz", clock.instant(), 1, "reindexing")
+ .withReady("foo", "bax", clock.instant(), 1, "reindexing");
assertEquals(expected,
database.readReindexingStatus(applicationId).orElseThrow());
clock.advance(Duration.ofSeconds(1));
- reindex(applicationId, "?clusterId=foo&documentType=bar,baz&speed=0.1", "{\"message\":\"Reindexing document types [bar, baz] in 'foo' of application default.default\"}");
- expected = expected.withReady("foo", "bar", clock.instant(), 0.1).withReady("foo", "baz", clock.instant(), 0.1);
+ reindex(applicationId, "?clusterId=foo&documentType=bar,baz&speed=0.1&cause=reindexing", "{\"message\":\"Reindexing document types [bar, baz] in 'foo' of application default.default\"}");
+ expected = expected.withReady("foo", "bar", clock.instant(), 0.1, "reindexing")
+ .withReady("foo", "baz", clock.instant(), 0.1, "reindexing");
assertEquals(expected,
database.readReindexingStatus(applicationId).orElseThrow());
@@ -298,7 +309,8 @@ public class ApplicationHandlerTest {
" \"ready\": {" +
" \"bar\": {" +
" \"readyMillis\": " + (now - 1000) + ", " +
- " \"speed\": 1.0" +
+ " \"speed\": 1.0," +
+ " \"cause\": \"reindexing\"" +
" }" +
" }" +
" }," +
@@ -307,15 +319,18 @@ public class ApplicationHandlerTest {
" \"ready\": {" +
" \"bar\": {" +
" \"readyMillis\": " + now + ", " +
- " \"speed\": 0.1" +
+ " \"speed\": 0.1," +
+ " \"cause\": \"reindexing\"" +
" }," +
" \"bax\": {" +
" \"readyMillis\": " + (now - 1000) + ", " +
- " \"speed\": 1.0" +
+ " \"speed\": 1.0," +
+ " \"cause\": \"reindexing\"" +
" }," +
" \"baz\": {" +
" \"readyMillis\": " + now + ", " +
- " \"speed\": 0.1" +
+ " \"speed\": 0.1," +
+ " \"cause\": \"reindexing\"" +
" }" +
" }" +
" }" +
@@ -499,7 +514,7 @@ public class ApplicationHandlerTest {
public void testReindexingSerialization() throws IOException {
Instant now = Instant.ofEpochMilli(123456);
ApplicationReindexing applicationReindexing = ApplicationReindexing.empty()
- .withPending("foo", "bar", 123L).withReady("moo", "baz", now, 1);
+ .withPending("foo", "bar", 123L).withReady("moo", "baz", now, 1, "reindexing");
ClusterReindexing clusterReindexing = new ClusterReindexing(Map.of("bax", new Status(now, null, null, null, null),
"baz", new Status(now.plusSeconds(1),
now.plusSeconds(2),
@@ -514,53 +529,56 @@ public class ApplicationHandlerTest {
applicationReindexing,
Map.of("boo", clusterReindexing,
"moo", clusterReindexing))),
- "{\n" +
- " \"enabled\": true,\n" +
- " \"clusters\": {\n" +
- " \"boo\": {\n" +
- " \"pending\": {},\n" +
- " \"ready\": {\n" +
- " \"bar\": {},\n" +
- " \"bax\": {\n" +
- " \"startedMillis\": 123456\n" +
- " },\n" +
- " \"baz\": {\n" +
- " \"startedMillis\": 124456,\n" +
- " \"endedMillis\": 125456,\n" +
- " \"state\": \"failed\",\n" +
- " \"message\": \"message\",\n" +
- " \"progress\": 0.1\n" +
- " }\n" +
- " }\n" +
- " },\n" +
- " \"foo\": {\n" +
- " \"pending\": {\n" +
- " \"bar\": 123\n" +
- " },\n" +
- " \"ready\": {\n" +
- " \"bar\": {},\n" +
- " \"hax\": {}\n" +
- " }\n" +
- " },\n" +
- " \"moo\": {\n" +
- " \"pending\": {},\n" +
- " \"ready\": {\n" +
- " \"bax\": {\n" +
- " \"startedMillis\": 123456\n" +
- " },\n" +
- " \"baz\": {\n" +
- " \"readyMillis\": 123456,\n" +
- " \"speed\": 1.0,\n" +
- " \"startedMillis\": 124456,\n" +
- " \"endedMillis\": 125456,\n" +
- " \"state\": \"failed\",\n" +
- " \"message\": \"message\",\n" +
- " \"progress\": 0.1\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- "}\n");
+ """
+ {
+ "enabled": true,
+ "clusters": {
+ "boo": {
+ "pending": {},
+ "ready": {
+ "bar": {},
+ "bax": {
+ "startedMillis": 123456
+ },
+ "baz": {
+ "startedMillis": 124456,
+ "endedMillis": 125456,
+ "state": "failed",
+ "message": "message",
+ "progress": 0.1
+ }
+ }
+ },
+ "foo": {
+ "pending": {
+ "bar": 123
+ },
+ "ready": {
+ "bar": {},
+ "hax": {}
+ }
+ },
+ "moo": {
+ "pending": {},
+ "ready": {
+ "bax": {
+ "startedMillis": 123456
+ },
+ "baz": {
+ "readyMillis": 123456,
+ "speed": 1.0,
+ "cause": "reindexing",
+ "startedMillis": 124456,
+ "endedMillis": 125456,
+ "state": "failed",
+ "message": "message",
+ "progress": 0.1
+ }
+ }
+ }
+ }
+ }
+ """);
}
@Test
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/maintenance/ReindexingMaintainerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/maintenance/ReindexingMaintainerTest.java
index 26edc5d0f71..5a78d81e508 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/maintenance/ReindexingMaintainerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/maintenance/ReindexingMaintainerTest.java
@@ -8,6 +8,7 @@ import java.time.Instant;
import java.util.List;
import java.util.Map;
+import static com.yahoo.vespa.config.server.maintenance.ReindexingMaintainer.CAUSE;
import static com.yahoo.vespa.config.server.maintenance.ReindexingMaintainer.SPEED;
import static com.yahoo.vespa.config.server.maintenance.ReindexingMaintainer.withNewReady;
import static com.yahoo.vespa.config.server.maintenance.ReindexingMaintainer.withOnlyCurrentData;
@@ -22,7 +23,10 @@ public class ReindexingMaintainerTest {
public void testReadyComputation() {
ApplicationReindexing reindexing = ApplicationReindexing.empty()
.withPending("one", "a", 10)
- .withPending("two", "b", 20).withReady("one", "a", Instant.ofEpochMilli(3), SPEED).withReady("two", "b", Instant.ofEpochMilli(2), SPEED).withReady("two", "c", Instant.ofEpochMilli(3), SPEED);
+ .withPending("two", "b", 20)
+ .withReady("one", "a", Instant.ofEpochMilli(3), SPEED, CAUSE)
+ .withReady("two", "b", Instant.ofEpochMilli(2), SPEED, CAUSE)
+ .withReady("two", "c", Instant.ofEpochMilli(3), SPEED, CAUSE);
// Nothing happens without convergence.
assertEquals(reindexing,
@@ -31,13 +35,13 @@ public class ReindexingMaintainerTest {
// Status for (one, a) changes, but not (two, b).
Instant later = Instant.ofEpochMilli(3 << 10);
// Converged, no longer pending.
- assertEquals(reindexing.withoutPending("one", "a").withReady("one", "a", later, SPEED), // Converged, now ready.
+ assertEquals(reindexing.withoutPending("one", "a").withReady("one", "a", later, SPEED, CAUSE), // Converged, now ready.
withNewReady(reindexing, () -> 19L, later));
// Converged, no longer pending.
// Converged, no Longer pending.
- assertEquals(reindexing.withoutPending("one", "a").withReady("one", "a", later, SPEED)
- .withoutPending("two", "b").withReady("two", "b", later, SPEED),
+ assertEquals(reindexing.withoutPending("one", "a").withReady("one", "a", later, SPEED, CAUSE)
+ .withoutPending("two", "b").withReady("two", "b", later, SPEED, CAUSE),
withNewReady(reindexing, () -> 20L, later));
// Verify generation supplier isn't called when no pending document types.
@@ -50,7 +54,10 @@ public class ReindexingMaintainerTest {
public void testGarbageRemoval() {
ApplicationReindexing reindexing = ApplicationReindexing.empty()
.withPending("one", "a", 10)
- .withPending("two", "b", 20).withReady("one", "a", Instant.ofEpochMilli(3), SPEED).withReady("two", "b", Instant.ofEpochMilli(2), SPEED).withReady("two", "c", Instant.ofEpochMilli(3), SPEED);
+ .withPending("two", "b", 20)
+ .withReady("one", "a", Instant.ofEpochMilli(3), SPEED, CAUSE)
+ .withReady("two", "b", Instant.ofEpochMilli(2), SPEED, CAUSE)
+ .withReady("two", "c", Instant.ofEpochMilli(3), SPEED, CAUSE);
assertEquals(reindexing,
withOnlyCurrentData(reindexing, Map.of("one", List.of("a", "b", "c", "d"),
@@ -62,10 +69,13 @@ public class ReindexingMaintainerTest {
"two", List.of("b", "c"))));
assertEquals(ApplicationReindexing.empty()
- .withPending("two", "b", 20).withReady("two", "b", Instant.ofEpochMilli(2), SPEED),
+ .withPending("two", "b", 20).withReady("two", "b", Instant.ofEpochMilli(2), SPEED, CAUSE),
withOnlyCurrentData(reindexing, Map.of("two", List.of("a", "b"))));
- assertEquals(ApplicationReindexing.empty().withReady("one", "a", Instant.EPOCH, SPEED).without("one", "a").withReady("two", "c", Instant.ofEpochMilli(3), SPEED),
+ assertEquals(ApplicationReindexing.empty()
+ .withReady("one", "a", Instant.EPOCH, SPEED, CAUSE)
+ .without("one", "a")
+ .withReady("two", "c", Instant.ofEpochMilli(3), SPEED, CAUSE),
withOnlyCurrentData(reindexing, Map.of("one", List.of("c"),
"two", List.of("c"))));
}