This is an automated email from the ASF dual-hosted git repository.

style95 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new 3753daf  finish/failed uncompleted transaction (#5138)
3753daf is described below

commit 3753daf0e0c3d237c05ff4668e2f4c5f45d7dcb9
Author: jiangpch <[email protected]>
AuthorDate: Thu Sep 30 17:22:37 2021 +0800

    finish/failed uncompleted transaction (#5138)
---
 .../elasticsearch/ElasticSearchActivationStore.scala | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git 
a/common/scala/src/main/scala/org/apache/openwhisk/core/database/elasticsearch/ElasticSearchActivationStore.scala
 
b/common/scala/src/main/scala/org/apache/openwhisk/core/database/elasticsearch/ElasticSearchActivationStore.scala
index 654cc69..39f5a0c 100644
--- 
a/common/scala/src/main/scala/org/apache/openwhisk/core/database/elasticsearch/ElasticSearchActivationStore.scala
+++ 
b/common/scala/src/main/scala/org/apache/openwhisk/core/database/elasticsearch/ElasticSearchActivationStore.scala
@@ -142,11 +142,22 @@ class ElasticSearchActivationStore(
       .map { res =>
         if (res.status == StatusCodes.OK.intValue || res.status == 
StatusCodes.Created.intValue) {
           res.result.items.map { bulkRes =>
-            if (bulkRes.status == StatusCodes.OK.intValue || bulkRes.status == 
StatusCodes.Created.intValue)
+            if (bulkRes.status == StatusCodes.OK.intValue || bulkRes.status == 
StatusCodes.Created.intValue) {
+              transid
+                .finished(
+                  this,
+                  start,
+                  s"[PUT] 'activations' completed document: '${bulkRes.id}', 
response: '${DocInfo(bulkRes.id)}'")
               Right(DocInfo(bulkRes.id))
-            else
+            } else {
+              transid.failed(
+                this,
+                start,
+                s"'activations' failed to put documents, http status: 
'${bulkRes.status}'",
+                ErrorLevel)
               Left(PutException(
                 s"Unexpected error: ${bulkRes.error.map(e => 
s"${e.`type`}:${e.reason}").getOrElse("unknown")}, code: ${bulkRes.status} on 
'bulk_put'"))
+            }
           }
         } else {
           transid.failed(
@@ -193,7 +204,10 @@ class ElasticSearchActivationStore(
           throw GetException("Unexpected http response code: " + res.status)
         }
       } recoverWith {
-      case _: DeserializationException => throw 
DocumentUnreadable(Messages.corruptedEntity)
+      case _: DeserializationException =>
+        transid
+          .finished(this, start, s"[GET] 'activations' failed to get document: 
'$activationId'; failed to deserialize")
+        throw DocumentUnreadable(Messages.corruptedEntity)
     }
 
     reportFailure(

Reply via email to