aboutsummaryrefslogtreecommitdiffstats
path: root/vespaclient-container-plugin
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2021-12-22 13:45:35 +0100
committerJon Marius Venstad <venstad@gmail.com>2021-12-22 13:45:35 +0100
commit3681a41fbe88c3b4961a74d1318f77cc59c1c670 (patch)
treece4661268c86c928c4187153363f048b0d13dab1 /vespaclient-container-plugin
parent0184d40ba703ca87d967a8d53d751afd352f3a47 (diff)
Revert "Merge pull request #20617 from vespa-engine/revert-20616-jonmv/filter-when-create-true"
This reverts commit 2fd7739b9fa7ce3283d1485dae3726c8e8ec882b, reversing changes made to 7ef261d471f4a11651811957b2f24bb7e0bcf4d5.
Diffstat (limited to 'vespaclient-container-plugin')
-rw-r--r--vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java5
-rw-r--r--vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/FeedReplyReader.java5
2 files changed, 7 insertions, 3 deletions
diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java
index 2a7e69a0bf4..3eac4ff5c5d 100644
--- a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java
+++ b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java
@@ -468,7 +468,7 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler {
DocumentOperationParameters parameters = parametersFromRequest(request, ROUTE)
.withResponseHandler(response -> {
outstanding.decrementAndGet();
- updateUpdateMetrics(response.outcome());
+ updateUpdateMetrics(response.outcome(), update.getCreateIfNonExistent());
handleFeedOperation(path, handler, response);
});
return () -> dispatchOperation(() -> asyncSession.update(update, parameters));
@@ -1047,7 +1047,8 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler {
}
}
- private void updateUpdateMetrics(Outcome outcome) {
+ private void updateUpdateMetrics(Outcome outcome, boolean create) {
+ if (create && outcome == Outcome.NOT_FOUND) outcome = Outcome.SUCCESS; // >_<
switch (outcome) {
case SUCCESS: metric.add(MetricNames.SUCCEEDED, 1, null); break;
case NOT_FOUND: metric.add(MetricNames.NOT_FOUND, 1, null); break;
diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/FeedReplyReader.java b/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/FeedReplyReader.java
index b71b5d79520..3762d52ba19 100644
--- a/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/FeedReplyReader.java
+++ b/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/FeedReplyReader.java
@@ -2,6 +2,7 @@
package com.yahoo.vespa.http.server;
import com.yahoo.documentapi.messagebus.protocol.DocumentProtocol;
+import com.yahoo.documentapi.messagebus.protocol.UpdateDocumentMessage;
import com.yahoo.documentapi.messagebus.protocol.UpdateDocumentReply;
import com.yahoo.documentapi.metrics.DocumentApiMetrics;
import com.yahoo.documentapi.metrics.DocumentOperationStatus;
@@ -68,7 +69,9 @@ public class FeedReplyReader implements ReplyHandler {
}
private static boolean updateNotFound(Reply reply) {
- return reply instanceof UpdateDocumentReply && ! ((UpdateDocumentReply) reply).wasFound();
+ return reply instanceof UpdateDocumentReply
+ && ! ((UpdateDocumentReply) reply).wasFound()
+ && ! ((UpdateDocumentMessage) reply.getMessage()).getDocumentUpdate().getCreateIfNonExistent();
}
private void enqueue(ReplyContext context, String message, ErrorCode status, boolean isConditionNotMet, Trace trace) {