You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by bd...@apache.org on 2023/05/04 18:24:57 UTC

[openwhisk] branch master updated: use compatibility serializer for future message forma… (#5389)

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

bdoyle 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 be8ac2037 use compatibility serializer for future message forma… (#5389)
be8ac2037 is described below

commit be8ac20372fe44ed226c758b71dce510a4227cc8
Author: Brendan Doyle <bd...@gmail.com>
AuthorDate: Thu May 4 11:24:49 2023 -0700

    use compatibility serializer for future message forma… (#5389)
    
    * update kryo and use compatibility serializer for future message format changes
    
    * revert kryo major upgrade
    
    ---------
    
    Co-authored-by: Brendan Doyle <br...@qualtrics.com>
---
 core/scheduler/src/main/resources/application.conf                | 2 ++
 .../scala/org/apache/openwhisk/core/scheduler/Scheduler.scala     | 8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/core/scheduler/src/main/resources/application.conf b/core/scheduler/src/main/resources/application.conf
index f04d2888f..2856c84e3 100644
--- a/core/scheduler/src/main/resources/application.conf
+++ b/core/scheduler/src/main/resources/application.conf
@@ -53,6 +53,8 @@ akka {
   }
 }
 
+akka-kryo-serialization.kryo-initializer = "org.apache.openwhisk.core.scheduler.CompatibleKryoInitializer"
+
 whisk {
   cluster {
     use-cluster-bootstrap: false
diff --git a/core/scheduler/src/main/scala/org/apache/openwhisk/core/scheduler/Scheduler.scala b/core/scheduler/src/main/scala/org/apache/openwhisk/core/scheduler/Scheduler.scala
index 392cbf2f8..701b392b2 100644
--- a/core/scheduler/src/main/scala/org/apache/openwhisk/core/scheduler/Scheduler.scala
+++ b/core/scheduler/src/main/scala/org/apache/openwhisk/core/scheduler/Scheduler.scala
@@ -26,6 +26,8 @@ import akka.management.cluster.bootstrap.ClusterBootstrap
 import akka.pattern.ask
 import akka.util.Timeout
 import com.typesafe.config.ConfigValueFactory
+import io.altoo.akka.serialization.kryo.DefaultKryoInitializer
+import io.altoo.akka.serialization.kryo.serializer.scala.ScalaKryo
 import kamon.Kamon
 import org.apache.openwhisk.common.Https.HttpsConfig
 import org.apache.openwhisk.common._
@@ -425,3 +427,9 @@ case class SchedulingConfig(staleThreshold: FiniteDuration,
                             dropInterval: FiniteDuration,
                             allowOverProvisionBeforeThrottle: Boolean,
                             namespaceOverProvisionBeforeThrottleRatio: Double)
+
+class CompatibleKryoInitializer extends DefaultKryoInitializer {
+  override def preInit(kryo: ScalaKryo): Unit = {
+    kryo.setDefaultSerializer(classOf[com.esotericsoftware.kryo.serializers.CompatibleFieldSerializer[_]])
+  }
+}