diff options
author | Martin Polden <mpolden@mpolden.no> | 2022-10-05 16:21:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-05 16:21:57 +0200 |
commit | 24c70d22397fad2c2d5d2e8b45d7da664283fd85 (patch) | |
tree | 502de41321b49ddcff26015d31d94975295001e2 /configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java | |
parent | 70bc66e4cc74f00e528b945fc90786defd2eb88f (diff) | |
parent | ed0e57ad7344a61894bc679bdd87f03e3eb53f17 (diff) |
Merge pull request #24315 from vespa-engine/mpolden/unavailable-reindexing-statusv8.64.13
Return 409 if reindexing status is unavailable
Diffstat (limited to 'configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java')
-rw-r--r-- | configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java | 16 |
1 files changed, 13 insertions, 3 deletions
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 fc33830e707..8afffd93a29 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 @@ -24,12 +24,15 @@ import com.yahoo.slime.Cursor; import com.yahoo.slime.SlimeUtils; import com.yahoo.text.StringUtilities; import com.yahoo.vespa.config.server.ApplicationRepository; +import com.yahoo.vespa.config.server.application.ApplicationReindexing; +import com.yahoo.vespa.config.server.application.ClusterReindexing; import com.yahoo.vespa.config.server.application.ConfigConvergenceChecker; import com.yahoo.vespa.config.server.http.ContentHandler; import com.yahoo.vespa.config.server.http.ContentRequest; import com.yahoo.vespa.config.server.http.HttpHandler; import com.yahoo.vespa.config.server.http.JSONResponse; import com.yahoo.vespa.config.server.http.NotFoundException; +import com.yahoo.vespa.config.server.http.ReindexingStatusException; import com.yahoo.vespa.config.server.http.v2.request.ApplicationContentRequest; import com.yahoo.vespa.config.server.http.v2.response.ApplicationSuspendedResponse; import com.yahoo.vespa.config.server.http.v2.response.DeleteApplicationResponse; @@ -39,6 +42,7 @@ import com.yahoo.vespa.config.server.http.v2.response.ReindexingResponse; import com.yahoo.vespa.config.server.tenant.Tenant; import java.io.IOException; +import java.io.UncheckedIOException; import java.net.URI; import java.time.Duration; import java.time.Instant; @@ -296,9 +300,15 @@ public class ApplicationHandler extends HttpHandler { if (tenant == null) throw new NotFoundException("Tenant '" + applicationId.tenant().value() + "' not found"); - return new ReindexingResponse(getActiveModelOrThrow(applicationId).documentTypesByCluster(), - applicationRepository.getReindexing(applicationId), - applicationRepository.getClusterReindexingStatus(applicationId)); + try { + Map<String, Set<String>> documentTypes = getActiveModelOrThrow(applicationId).documentTypesByCluster(); + ApplicationReindexing reindexing = applicationRepository.getReindexing(applicationId); + Map<String, ClusterReindexing> clusters = applicationRepository.getClusterReindexingStatus(applicationId); + return new ReindexingResponse(documentTypes, reindexing, clusters); + } catch (UncheckedIOException e) { + throw new ReindexingStatusException("Reindexing status for '" + applicationId + + "' is currently unavailable"); + } } private HttpResponse restart(ApplicationId applicationId, HttpRequest request) { |