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

fanningpj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko-persistence-jdbc.git


The following commit(s) were added to refs/heads/main by this push:
     new 737e6e5  Implement Durable State handling with MySQL (#174) (#366)
737e6e5 is described below

commit 737e6e57b61f13f14a969235b132034e6f19c2be
Author: Marco Paggioro <[email protected]>
AuthorDate: Thu Nov 20 13:37:01 2025 +0100

    Implement Durable State handling with MySQL (#174) (#366)
    
    * Implement Durable State handling with MySQL (#174)
    
    * Aligned SQL to other queries
    
    * Add (selectable) explicit select for global offset in MySQL Durable State 
implementation and tests
    
    * Less DB locking: from REPLACE to INSERT
    
    * Fix tests: `StateSpecBase` was not dropping DB schema on `afterAll`
    
    * Fix typo + Parametric column + Tests
    
    * Rename `offset` column to `current_offset` in MySQL durable state schema 
to avoid conflicts
    
    ---------
    
    Co-authored-by: PJ Fanning <[email protected]>
---
 core/src/main/resources/reference.conf             |  8 ++++
 .../resources/schema/mysql/mysql-create-schema.sql | 23 +++++++++++
 .../resources/schema/mysql/mysql-drop-schema.sql   |  2 +
 .../jdbc/config/PekkoPersistenceConfig.scala       |  4 ++
 .../jdbc/state/DurableStateQueries.scala           | 29 ++++++++++---
 .../jdbc/state/SequenceNextValUpdater.scala        | 17 ++++++++
 core/src/test/resources/mysql-application.conf     |  7 ++--
 ...conf => mysql-explicit-select-application.conf} | 25 ++++++-----
 .../resources/mysql-shared-db-application.conf     |  8 ++--
 ...sql-shared-db-explicit-select-application.conf} | 26 +++++++-----
 .../jdbc/state/scaladsl/JdbcDurableStateSpec.scala |  7 ++--
 .../jdbc/state/scaladsl/StateSpecBase.scala        | 10 ++---
 .../pekko/persistence/jdbc/util/DropCreate.scala   | 11 ++++-
 docs/src/main/paradox/configuration.md             |  2 +-
 .../DurableStateSequenceActorTest.scala            | 14 ++++++-
 .../MySQLDurableStateStorePluginSpec.scala         | 46 +++++++++++++++++++++
 .../MySQLScalaJdbcDurableStateStoreQueryTest.scala | 48 ++++++++++++++++++++++
 17 files changed, 240 insertions(+), 47 deletions(-)

diff --git a/core/src/main/resources/reference.conf 
b/core/src/main/resources/reference.conf
index aebde02..665f900 100644
--- a/core/src/main/resources/reference.conf
+++ b/core/src/main/resources/reference.conf
@@ -550,6 +550,10 @@ jdbc-durable-state-store {
       tableName = "durable_state"
       # Only used with MariaDB
       globalOffsetSequenceName = "durable_state_global_offset_seq"
+      # Only used with MySQL
+      useExplicitSelectForGlobalOffset = false
+      # Only used with MySQL
+      globalOffsetTableName = "durable_state_global_offset"
       # Keep blank for MySQL and MariaDB
       schemaName = ""
       columnNames {
@@ -561,6 +565,10 @@ jdbc-durable-state-store {
         stateSerManifest = "state_serial_manifest"
         tag = "tag"
         stateTimestamp = "state_timestamp"
+        # Only used with MySQL
+        globalOffsetSingleton = "singleton"
+        # Only used with MySQL
+        globalOffsetValue = "current_offset"
       }
     }
   }
diff --git a/core/src/main/resources/schema/mysql/mysql-create-schema.sql 
b/core/src/main/resources/schema/mysql/mysql-create-schema.sql
index 5c57be2..3e4d778 100644
--- a/core/src/main/resources/schema/mysql/mysql-create-schema.sql
+++ b/core/src/main/resources/schema/mysql/mysql-create-schema.sql
@@ -36,3 +36,26 @@ CREATE TABLE IF NOT EXISTS snapshot (
     meta_ser_manifest TEXT,
     meta_payload BLOB,
   PRIMARY KEY (persistence_id, sequence_number));
+
+CREATE TABLE IF NOT EXISTS durable_state
+(
+    global_offset         SERIAL,
+    persistence_id        VARCHAR(255) NOT NULL,
+    revision              BIGINT       NOT NULL,
+    state_payload         BLOB         NOT NULL,
+    state_serial_id       INTEGER      NOT NULL,
+    state_serial_manifest VARCHAR(255),
+    tag                   VARCHAR(255),
+    state_timestamp       BIGINT       NOT NULL,
+    PRIMARY KEY (persistence_id)
+);
+CREATE INDEX state_tag_idx on durable_state (tag);
+CREATE INDEX state_global_offset_idx on durable_state (global_offset);
+
+CREATE TABLE durable_state_global_offset
+(
+    singleton      TINYINT NOT NULL,
+    current_offset BIGINT UNSIGNED NOT NULL UNIQUE,
+    PRIMARY KEY (singleton)
+);
+INSERT INTO durable_state_global_offset (singleton, current_offset) VALUES (0, 
0);
diff --git a/core/src/main/resources/schema/mysql/mysql-drop-schema.sql 
b/core/src/main/resources/schema/mysql/mysql-drop-schema.sql
index 750504e..787143b 100644
--- a/core/src/main/resources/schema/mysql/mysql-drop-schema.sql
+++ b/core/src/main/resources/schema/mysql/mysql-drop-schema.sql
@@ -1,3 +1,5 @@
 DROP TABLE IF EXISTS event_tag;
 DROP TABLE IF EXISTS event_journal;
 DROP TABLE IF EXISTS snapshot;
+DROP TABLE IF EXISTS durable_state;
+DROP TABLE IF EXISTS durable_state_global_offset;
diff --git 
a/core/src/main/scala/org/apache/pekko/persistence/jdbc/config/PekkoPersistenceConfig.scala
 
b/core/src/main/scala/org/apache/pekko/persistence/jdbc/config/PekkoPersistenceConfig.scala
index 91fa3c1..71b5ceb 100644
--- 
a/core/src/main/scala/org/apache/pekko/persistence/jdbc/config/PekkoPersistenceConfig.scala
+++ 
b/core/src/main/scala/org/apache/pekko/persistence/jdbc/config/PekkoPersistenceConfig.scala
@@ -212,12 +212,16 @@ class DurableStateTableColumnNames(config: Config) {
   val stateSerManifest: String = cfg.getString("stateSerManifest")
   val tag: String = cfg.getString("tag")
   val stateTimestamp: String = cfg.getString("stateTimestamp")
+  val globalOffsetSingleton: String = cfg.getString("globalOffsetSingleton")
+  val globalOffsetValue: String = cfg.getString("globalOffsetValue")
 }
 
 class DurableStateTableConfiguration(config: Config) {
   private val cfg = config.getConfig("tables.durable_state")
   val tableName: String = cfg.getString("tableName")
+  val globalOffsetTableName: String = cfg.getString("globalOffsetTableName")
   val globalOffsetSequenceName: String = 
cfg.getString("globalOffsetSequenceName")
+  val useExplicitSelectForGlobalOffset: Boolean = 
cfg.getBoolean("useExplicitSelectForGlobalOffset")
   val refreshInterval: FiniteDuration = 
config.asFiniteDuration("refreshInterval")
   val batchSize: Int = config.getInt("batchSize")
   val schemaName: Option[String] = cfg.asStringOption("schemaName")
diff --git 
a/core/src/main/scala/org/apache/pekko/persistence/jdbc/state/DurableStateQueries.scala
 
b/core/src/main/scala/org/apache/pekko/persistence/jdbc/state/DurableStateQueries.scala
index e65222a..b434610 100644
--- 
a/core/src/main/scala/org/apache/pekko/persistence/jdbc/state/DurableStateQueries.scala
+++ 
b/core/src/main/scala/org/apache/pekko/persistence/jdbc/state/DurableStateQueries.scala
@@ -19,7 +19,15 @@ import pekko.annotation.InternalApi
 import pekko.persistence.jdbc.config.DurableStateTableConfiguration
 import pekko.persistence.jdbc.db.MariaDBProfile
 
-import slick.jdbc.{ H2Profile, JdbcProfile, OracleProfile, PostgresProfile, 
SQLServerProfile, SetParameter }
+import slick.jdbc.{
+  H2Profile,
+  JdbcProfile,
+  MySQLProfile,
+  OracleProfile,
+  PostgresProfile,
+  SQLServerProfile,
+  SetParameter
+}
 
 /**
  * INTERNAL API
@@ -36,10 +44,9 @@ import slick.jdbc.{ H2Profile, JdbcProfile, OracleProfile, 
PostgresProfile, SQLS
     case PostgresProfile  => new PostgresSequenceNextValUpdater(profile, 
durableStateTableCfg)
     case SQLServerProfile => new SqlServerSequenceNextValUpdater(profile, 
durableStateTableCfg)
     case OracleProfile    => new OracleSequenceNextValUpdater(profile, 
durableStateTableCfg)
+    case MySQLProfile     => new MySQLSequenceNextValUpdater(profile, 
durableStateTableCfg)
     case MariaDBProfile   => new MariaDBSequenceNextValUpdater(profile, 
durableStateTableCfg)
-    // TODO https://github.com/apache/pekko-persistence-jdbc/issues/174
-    // case MySQLProfile     => new MySQLSequenceNextValUpdater(profile, 
durableStateTableCfg)
-    case _ => throw new UnsupportedOperationException(s"Unsupported 
JdbcProfile <$profile> for durableState.")
+    case _                => throw new 
UnsupportedOperationException(s"Unsupported JdbcProfile <$profile> for 
durableState.")
   }
 
   implicit val uuidSetter: SetParameter[Array[Byte]] = 
SetParameter[Array[Byte]] { case (bytes, params) =>
@@ -89,7 +96,19 @@ import slick.jdbc.{ H2Profile, JdbcProfile, OracleProfile, 
PostgresProfile, SQLS
         """
   }
 
-  private[jdbc] def getSequenceNextValueExpr() = 
sequenceNextValUpdater.getSequenceNextValueExpr()
+  private def updateDbGlobalOffsetTable() =
+    sqlu"""UPDATE #${durableStateTableCfg.globalOffsetTableName}
+           SET #${durableStateTableCfg.columnNames.globalOffsetValue} = 
LAST_INSERT_ID(#${durableStateTableCfg.columnNames.globalOffsetValue} + 1)
+           WHERE #${durableStateTableCfg.columnNames.globalOffsetSingleton} = 
0"""
+
+  private[jdbc] def getSequenceNextValueExpr() = profile match {
+    case MySQLProfile =>
+      updateDbGlobalOffsetTable()
+        .andThen(sequenceNextValUpdater.getSequenceNextValueExpr())
+        .transactionally
+    case _ =>
+      sequenceNextValUpdater.getSequenceNextValueExpr()
+  }
 
   def deleteFromDb(persistenceId: String) = {
     durableStateTable.filter(_.persistenceId === persistenceId).delete
diff --git 
a/core/src/main/scala/org/apache/pekko/persistence/jdbc/state/SequenceNextValUpdater.scala
 
b/core/src/main/scala/org/apache/pekko/persistence/jdbc/state/SequenceNextValUpdater.scala
index 70c8125..9521390 100644
--- 
a/core/src/main/scala/org/apache/pekko/persistence/jdbc/state/SequenceNextValUpdater.scala
+++ 
b/core/src/main/scala/org/apache/pekko/persistence/jdbc/state/SequenceNextValUpdater.scala
@@ -90,6 +90,23 @@ import slick.sql.SqlStreamingAction
       String]
 }
 
+/**
+ * INTERNAL API
+ */
+@InternalApi private[jdbc] final class MySQLSequenceNextValUpdater(profile: 
JdbcProfile,
+    durableStateTableCfg: DurableStateTableConfiguration)
+    extends SequenceNextValUpdater {
+
+  import profile.api._
+
+  def getSequenceNextValueExpr() = if 
(durableStateTableCfg.useExplicitSelectForGlobalOffset) {
+    sql"""SELECT #${durableStateTableCfg.columnNames.globalOffsetValue} FROM 
#${durableStateTableCfg.globalOffsetTableName}""".as[
+      String]
+  } else {
+    sql"""SELECT LAST_INSERT_ID()""".as[String]
+  }
+}
+
 /**
  * INTERNAL API
  */
diff --git a/core/src/test/resources/mysql-application.conf 
b/core/src/test/resources/mysql-application.conf
index df632ca..81c4915 100644
--- a/core/src/test/resources/mysql-application.conf
+++ b/core/src/test/resources/mysql-application.conf
@@ -44,11 +44,10 @@ jdbc-read-journal {
   slick = ${slick}
 }
 
-# TODO https://github.com/apache/pekko-persistence-jdbc/issues/174
 # the pekko-persistence-jdbc provider in use for durable state store
-#jdbc-durable-state-store {
-#  slick = ${slick}
-#}
+jdbc-durable-state-store {
+  slick = ${slick}
+}
 
 slick {
   profile = "slick.jdbc.MySQLProfile$"
diff --git a/core/src/test/resources/mysql-application.conf 
b/core/src/test/resources/mysql-explicit-select-application.conf
similarity index 75%
copy from core/src/test/resources/mysql-application.conf
copy to core/src/test/resources/mysql-explicit-select-application.conf
index df632ca..0e25837 100644
--- a/core/src/test/resources/mysql-application.conf
+++ b/core/src/test/resources/mysql-explicit-select-application.conf
@@ -1,10 +1,11 @@
-# Copyright 2016 Dennis Vriend
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
 #
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
+#    http://www.apache.org/licenses/LICENSE-2.0
 #
 # Unless required by applicable law or agreed to in writing, software
 # distributed under the License is distributed on an "AS IS" BASIS,
@@ -44,11 +45,15 @@ jdbc-read-journal {
   slick = ${slick}
 }
 
-# TODO https://github.com/apache/pekko-persistence-jdbc/issues/174
 # the pekko-persistence-jdbc provider in use for durable state store
-#jdbc-durable-state-store {
-#  slick = ${slick}
-#}
+jdbc-durable-state-store {
+  slick = ${slick}
+  tables {
+    durable_state {
+      useExplicitSelectForGlobalOffset = true
+    }
+  }
+}
 
 slick {
   profile = "slick.jdbc.MySQLProfile$"
diff --git a/core/src/test/resources/mysql-shared-db-application.conf 
b/core/src/test/resources/mysql-shared-db-application.conf
index 26efd4e..e032777 100644
--- a/core/src/test/resources/mysql-shared-db-application.conf
+++ b/core/src/test/resources/mysql-shared-db-application.conf
@@ -62,9 +62,7 @@ jdbc-read-journal {
   use-shared-db = "slick"
 }
 
-# TODO https://github.com/apache/pekko-persistence-jdbc/issues/174
 # the pekko-persistence-jdbc provider in use for durable state store
-#jdbc-durable-state-store {
-#  use-shared-db = "slick"
-#}
-
+jdbc-durable-state-store {
+  use-shared-db = "slick"
+}
diff --git a/core/src/test/resources/mysql-shared-db-application.conf 
b/core/src/test/resources/mysql-shared-db-explicit-select-application.conf
similarity index 76%
copy from core/src/test/resources/mysql-shared-db-application.conf
copy to core/src/test/resources/mysql-shared-db-explicit-select-application.conf
index 26efd4e..b124877 100644
--- a/core/src/test/resources/mysql-shared-db-application.conf
+++ b/core/src/test/resources/mysql-shared-db-explicit-select-application.conf
@@ -1,10 +1,11 @@
-# Copyright 2016 Dennis Vriend
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
 #
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
+#    http://www.apache.org/licenses/LICENSE-2.0
 #
 # Unless required by applicable law or agreed to in writing, software
 # distributed under the License is distributed on an "AS IS" BASIS,
@@ -62,9 +63,12 @@ jdbc-read-journal {
   use-shared-db = "slick"
 }
 
-# TODO https://github.com/apache/pekko-persistence-jdbc/issues/174
 # the pekko-persistence-jdbc provider in use for durable state store
-#jdbc-durable-state-store {
-#  use-shared-db = "slick"
-#}
-
+jdbc-durable-state-store {
+  use-shared-db = "slick"
+  tables {
+    durable_state {
+      useExplicitSelectForGlobalOffset = true
+    }
+  }
+}
diff --git 
a/core/src/test/scala/org/apache/pekko/persistence/jdbc/state/scaladsl/JdbcDurableStateSpec.scala
 
b/core/src/test/scala/org/apache/pekko/persistence/jdbc/state/scaladsl/JdbcDurableStateSpec.scala
index f4b9d7a..119b1e8 100644
--- 
a/core/src/test/scala/org/apache/pekko/persistence/jdbc/state/scaladsl/JdbcDurableStateSpec.scala
+++ 
b/core/src/test/scala/org/apache/pekko/persistence/jdbc/state/scaladsl/JdbcDurableStateSpec.scala
@@ -19,7 +19,7 @@ import org.apache.pekko
 import pekko.actor._
 import pekko.persistence.jdbc.state.{ MyPayload, OffsetSyntax }
 import OffsetSyntax._
-import pekko.persistence.jdbc.testkit.internal.{ H2, MariaDB, Oracle, 
Postgres, SchemaType, SqlServer }
+import pekko.persistence.jdbc.testkit.internal.{ H2, MariaDB, MySQL, Oracle, 
Postgres, SchemaType, SqlServer }
 import pekko.persistence.query.{ NoOffset, Offset, Sequence, 
UpdatedDurableState }
 import pekko.stream.scaladsl.Sink
 import org.scalatest.time.{ Millis, Seconds, Span }
@@ -83,9 +83,8 @@ abstract class JdbcDurableStateSpec(config: Config, 
schemaType: SchemaType) exte
             e shouldBe 
a[org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException]
           case Postgres =>
             e shouldBe a[org.postgresql.util.PSQLException]
-          // TODO https://github.com/apache/pekko-persistence-jdbc/issues/174
-          // case MySQL =>
-          //  e shouldBe a[java.sql.SQLIntegrityConstraintViolationException]
+          case MySQL =>
+            e shouldBe a[java.sql.SQLIntegrityConstraintViolationException]
           case MariaDB =>
             e shouldBe a[java.sql.SQLIntegrityConstraintViolationException]
           case Oracle =>
diff --git 
a/core/src/test/scala/org/apache/pekko/persistence/jdbc/state/scaladsl/StateSpecBase.scala
 
b/core/src/test/scala/org/apache/pekko/persistence/jdbc/state/scaladsl/StateSpecBase.scala
index fe8198d..b8b1ebc 100644
--- 
a/core/src/test/scala/org/apache/pekko/persistence/jdbc/state/scaladsl/StateSpecBase.scala
+++ 
b/core/src/test/scala/org/apache/pekko/persistence/jdbc/state/scaladsl/StateSpecBase.scala
@@ -27,7 +27,7 @@ import org.apache.pekko
 import pekko.actor._
 import pekko.persistence.jdbc.db.SlickDatabase
 import pekko.persistence.jdbc.config._
-import pekko.persistence.jdbc.testkit.internal.{ H2, MariaDB, Oracle, 
Postgres, SchemaType, SqlServer }
+import pekko.persistence.jdbc.testkit.internal.{ H2, MariaDB, MySQL, Oracle, 
Postgres, SchemaType, SqlServer }
 import pekko.persistence.jdbc.util.DropCreate
 import pekko.serialization.SerializationExtension
 import pekko.util.Timeout
@@ -47,10 +47,9 @@ abstract class StateSpecBase(val config: Config, schemaType: 
SchemaType)
   implicit lazy val e: ExecutionContext = system.dispatcher
 
   private[jdbc] def schemaTypeToProfile(s: SchemaType) = s match {
-    case H2       => slick.jdbc.H2Profile
-    case Postgres => slick.jdbc.PostgresProfile
-    // TODO https://github.com/apache/pekko-persistence-jdbc/issues/174
-    // case MySQL     => slick.jdbc.MySQLProfile
+    case H2        => slick.jdbc.H2Profile
+    case Postgres  => slick.jdbc.PostgresProfile
+    case MySQL     => slick.jdbc.MySQLProfile
     case MariaDB   => org.apache.pekko.persistence.jdbc.db.MariaDBProfile
     case SqlServer => slick.jdbc.SQLServerProfile
     case Oracle    => slick.jdbc.OracleProfile
@@ -133,6 +132,7 @@ abstract class StateSpecBase(val config: Config, 
schemaType: SchemaType)
   }
 
   override def afterAll(): Unit = {
+    drop(schemaType)
     db.close()
     system.terminate().futureValue
   }
diff --git 
a/core/src/test/scala/org/apache/pekko/persistence/jdbc/util/DropCreate.scala 
b/core/src/test/scala/org/apache/pekko/persistence/jdbc/util/DropCreate.scala
index 7f63eab..09b55b6 100644
--- 
a/core/src/test/scala/org/apache/pekko/persistence/jdbc/util/DropCreate.scala
+++ 
b/core/src/test/scala/org/apache/pekko/persistence/jdbc/util/DropCreate.scala
@@ -37,13 +37,22 @@ private[jdbc] trait DropCreate {
 
   def newDao: Boolean = !SchemaUtilsImpl.legacy("jdbc-journal", config)
 
+  /**
+   * INTERNAL API
+   */
+  @InternalApi
+  private[jdbc] def drop(schemaType: SchemaType): Unit = {
+    // blocking call, usually done in our before test methods
+    SchemaUtilsImpl.dropWithSlick(schemaType, logger, db, !newDao)
+  }
+
   /**
    * INTERNAL API
    */
   @InternalApi
   private[jdbc] def dropAndCreate(schemaType: SchemaType): Unit = {
     // blocking calls, usually done in our before test methods
-    SchemaUtilsImpl.dropWithSlick(schemaType, logger, db, !newDao)
+    drop(schemaType)
     SchemaUtilsImpl.createWithSlick(schemaType, logger, db, !newDao)
   }
 
diff --git a/docs/src/main/paradox/configuration.md 
b/docs/src/main/paradox/configuration.md
index c26a131..76b9238 100644
--- a/docs/src/main/paradox/configuration.md
+++ b/docs/src/main/paradox/configuration.md
@@ -6,7 +6,7 @@ Configure `pekko-persistence`:
 
 - instruct Apache Pekko persistence to use the `jdbc-journal` plugin,
 - instruct Apache Pekko persistence to use the `jdbc-snapshot-store` plugin,
-- instruct Apache Pekko persistence to use the `jdbc-durable-state-store` 
plugin (No MySQL support)
+- instruct Apache Pekko persistence to use the `jdbc-durable-state-store` 
plugin
 
 Configure `slick`:
 
diff --git 
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/DurableStateSequenceActorTest.scala
 
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/DurableStateSequenceActorTest.scala
index a62684e..6cea79c 100644
--- 
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/DurableStateSequenceActorTest.scala
+++ 
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/DurableStateSequenceActorTest.scala
@@ -22,7 +22,7 @@ package org.apache.pekko.persistence.jdbc.integration
 import com.typesafe.config.ConfigFactory
 import org.apache.pekko.actor.ActorSystem
 import 
org.apache.pekko.persistence.jdbc.state.scaladsl.DurableStateSequenceActorTest
-import org.apache.pekko.persistence.jdbc.testkit.internal.{ MariaDB, Oracle, 
Postgres, SqlServer }
+import org.apache.pekko.persistence.jdbc.testkit.internal.{ MariaDB, MySQL, 
Oracle, Postgres, SqlServer }
 
 class OracleDurableStateSequenceActorTest
     extends 
DurableStateSequenceActorTest(ConfigFactory.load("oracle-application.conf"), 
Oracle) {
@@ -42,6 +42,18 @@ class PostgresDurableStateSequenceActorTest
     ActorSystem("test", config.withFallback(customSerializers))
 }
 
+class MySQLDurableStateSequenceActorTest
+    extends 
DurableStateSequenceActorTest(ConfigFactory.load("mysql-application.conf"), 
MySQL) {
+  implicit lazy val system: ActorSystem =
+    ActorSystem("test", config.withFallback(customSerializers))
+}
+
+class MySQLDurableStateSequenceExplicitSelectActorTest
+    extends 
DurableStateSequenceActorTest(ConfigFactory.load("mysql-explicit-select-application.conf"),
 MySQL) {
+  implicit lazy val system: ActorSystem =
+    ActorSystem("test", config.withFallback(customSerializers))
+}
+
 class MariaDBDurableStateSequenceActorTest
     extends 
DurableStateSequenceActorTest(ConfigFactory.load("mariadb-application.conf"), 
MariaDB) {
   implicit lazy val system: ActorSystem =
diff --git 
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/MySQLDurableStateStorePluginSpec.scala
 
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/MySQLDurableStateStorePluginSpec.scala
new file mode 100644
index 0000000..e0af3b7
--- /dev/null
+++ 
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/MySQLDurableStateStorePluginSpec.scala
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.pekko.persistence.jdbc.integration
+
+import com.typesafe.config.ConfigFactory
+import org.apache.pekko.persistence.jdbc.state.scaladsl.{
+  DurableStateStorePluginSpec,
+  DurableStateStoreSchemaPluginSpec
+}
+import slick.jdbc.MySQLProfile
+
+class MySQLDurableStateStorePluginSpec
+    extends 
DurableStateStorePluginSpec(ConfigFactory.load("mysql-application.conf"), 
MySQLProfile) {}
+
+class MySQLDurableStateStorePluginSharedSpec
+    extends 
DurableStateStorePluginSpec(ConfigFactory.load("mysql-shared-db-application.conf"),
 MySQLProfile) {}
+
+class MySQLDurableStateStorePluginExplicitSelectSpec
+    extends 
DurableStateStorePluginSpec(ConfigFactory.load("mysql-explicit-select-application.conf"),
 MySQLProfile) {}
+
+class MySQLDurableStateStorePluginSharedExplicitSelectSpec
+    extends 
DurableStateStorePluginSpec(ConfigFactory.load("mysql-shared-db-explicit-select-application.conf"),
+      MySQLProfile) {}
+
+class MySQLDurableStateStorePluginSchemaSpec
+    extends 
DurableStateStoreSchemaPluginSpec(ConfigFactory.load("mysql-application.conf"),
+      MySQLProfile) {}
+
+class MySQLDurableStateStorePluginSchemaExplicitSelectSpec
+    extends 
DurableStateStoreSchemaPluginSpec(ConfigFactory.load("mysql-explicit-select-application.conf"),
+      MySQLProfile) {}
diff --git 
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/MySQLScalaJdbcDurableStateStoreQueryTest.scala
 
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/MySQLScalaJdbcDurableStateStoreQueryTest.scala
new file mode 100644
index 0000000..47b7797
--- /dev/null
+++ 
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/MySQLScalaJdbcDurableStateStoreQueryTest.scala
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.pekko.persistence.jdbc.integration
+
+import com.typesafe.config.ConfigFactory
+import org.apache.pekko
+import pekko.actor.ActorSystem
+import pekko.persistence.jdbc.state.scaladsl.JdbcDurableStateSpec
+import pekko.persistence.jdbc.testkit.internal.MySQL
+
+class MySQLScalaJdbcDurableStateStoreQuerySharedTest
+    extends 
JdbcDurableStateSpec(ConfigFactory.load("mysql-shared-db-application.conf"), 
MySQL) {
+  implicit lazy val system: ActorSystem =
+    ActorSystem("JdbcDurableStateSpec", config.withFallback(customSerializers))
+}
+
+class MySQLScalaJdbcDurableStateStoreQueryTest
+    extends JdbcDurableStateSpec(ConfigFactory.load("mysql-application.conf"), 
MySQL) {
+  implicit lazy val system: ActorSystem =
+    ActorSystem("JdbcDurableStateSpec", config.withFallback(customSerializers))
+}
+
+class MySQLScalaJdbcDurableStateStoreQueryExplicitSelectSharedTest
+    extends 
JdbcDurableStateSpec(ConfigFactory.load("mysql-shared-db-explicit-select-application.conf"),
 MySQL) {
+  implicit lazy val system: ActorSystem =
+    ActorSystem("JdbcDurableStateSpec", config.withFallback(customSerializers))
+}
+
+class MySQLScalaJdbcDurableStateStoreQueryExplicitSelectTest
+    extends 
JdbcDurableStateSpec(ConfigFactory.load("mysql-explicit-select-application.conf"),
 MySQL) {
+  implicit lazy val system: ActorSystem =
+    ActorSystem("JdbcDurableStateSpec", config.withFallback(customSerializers))
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to