You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by gi...@git.apache.org on 2017/10/05 20:08:53 UTC

[GitHub] markusthoemmes commented on a change in pull request #2835: Move batching to CouchDbRestStore

markusthoemmes commented on a change in pull request #2835: Move batching to CouchDbRestStore
URL: https://github.com/apache/incubator-openwhisk/pull/2835#discussion_r143043516
 
 

 ##########
 File path: common/scala/src/main/scala/whisk/core/database/CouchDbRestStore.scala
 ##########
 @@ -110,6 +134,39 @@ class CouchDbRestStore[DocumentAbstraction <: DocumentSerializer](
         transid.failed(this, start, s"[PUT] '$dbName' internal error, failure: '${failure.getMessage}'", ErrorLevel))
   }
 
+  private def put(ds: Seq[JsObject])(
+    implicit transid: TransactionId): Future[Seq[Either[ArtifactStoreException, DocInfo]]] = {
+    val count = ds.size
+    val start = transid.started(this, LoggingMarkers.DATABASE_BULK_SAVE, s"'$dbName' saving $count documents")
+
+    val f = client.putDocs(ds).map {
+      _ match {
+        case Right(response) =>
+          transid.finished(this, start, s"'$dbName' completed $count documents")
+
+          response.convertTo[Seq[BulkEntityResult]].map { singleResult =>
+            singleResult.error
+              .map {
+                case "conflict" => Left(DocumentConflictException("conflict on 'bulk_put'"))
 
 Review comment:
   Nope, it's only a specific entity that fails. Behavior then is just like with any single request today.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services