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 88e4b2c Implement MariaDB DBMS (#364) (#365)
88e4b2c is described below
commit 88e4b2c0aed72bb1df8ef7c51edc64faf35ff7c5
Author: Marco Paggioro <[email protected]>
AuthorDate: Fri Nov 14 23:33:40 2025 +0100
Implement MariaDB DBMS (#364) (#365)
* Implement MariaDB DBMS (#364)
* Fix MariaDBProfile header
* Add Apache License header to mariadb-cli.sh
* Remove redundant `org.apache.` package prefix from MariaDBProfile import
* Reorder MariaDBProfile import for consistency
* Fix missing newline at end of SQL file
* Use consistent grammar for exception type checks in JdbcDurableStateSpec
* Add error handling for unsupported schema types in SchemaUtilsImpl
---------
Co-authored-by: PJ Fanning <[email protected]>
---
.github/workflows/mariadb-tests.yml | 60 ++++++++++++++++++
core/src/main/resources/reference.conf | 11 ++++
.../schema/mariadb/mariadb-create-schema.sql | 65 +++++++++++++++++++
.../schema/mariadb/mariadb-drop-schema.sql | 5 ++
.../jdbc/config/PekkoPersistenceConfig.scala | 1 +
.../pekko/persistence/jdbc/db/MariaDBProfile.scala | 24 +++++++
.../jdbc/state/DurableStateQueries.scala | 2 +
.../jdbc/state/SequenceNextValUpdater.scala | 13 ++++
.../jdbc/testkit/internal/SchemaType.scala | 5 ++
.../jdbc/testkit/internal/SchemaUtilsImpl.scala | 31 +++++----
core/src/test/resources/mariadb-application.conf | 69 ++++++++++++++++++++
.../resources/mariadb-shared-db-application.conf | 73 ++++++++++++++++++++++
.../persistence/jdbc/query/QueryTestSpec.scala | 21 +++++++
.../scaladsl/DurableStateStorePluginSpec.scala | 22 ++++---
.../jdbc/state/scaladsl/JdbcDurableStateSpec.scala | 14 +++--
.../jdbc/state/scaladsl/StateSpecBase.scala | 3 +-
docs/src/main/paradox/configuration.md | 10 +++
.../jdbc/integration/AllPersistenceIdsTest.scala | 3 +
.../CurrentEventsByPersistenceIdTest.scala | 5 ++
.../jdbc/integration/CurrentEventsByTagTest.scala | 5 ++
...astKnownSequenceNumberByPersistenceIdTest.scala | 5 ++
.../integration/CurrentPersistenceIdsTest.scala | 5 ++
.../DurableStateSequenceActorTest.scala | 8 ++-
.../jdbc/integration/EventAdapterTest.scala | 3 +
.../integration/EventsByPersistenceIdTest.scala | 4 ++
.../jdbc/integration/EventsByTagTest.scala | 3 +
.../jdbc/integration/HardDeleteQueryTest.scala | 3 +
.../jdbc/integration/JdbcJournalPerfSpec.scala | 14 +++--
.../jdbc/integration/JdbcJournalSpec.scala | 6 +-
.../jdbc/integration/JdbcSnapshotStoreSpec.scala | 5 +-
.../JournalDaoStreamMessagesMemoryTest.scala | 5 ++
.../integration/JournalSequenceActorTest.scala | 5 ++
.../integration/LimitWindowingStreamTest.scala | 12 +++-
.../MariaDBDurableStateStorePluginSpec.scala | 32 ++++++++++
...ariaDBScalaJdbcDurableStateStoreQueryTest.scala | 29 +++++++++
project/Dependencies.scala | 1 +
scripts/docker-compose.yml | 9 +++
scripts/launch-all.sh | 3 +-
scripts/launch-mariadb.sh | 38 +++++++++++
scripts/mariadb-cli.sh | 20 ++++++
40 files changed, 614 insertions(+), 38 deletions(-)
diff --git a/.github/workflows/mariadb-tests.yml
b/.github/workflows/mariadb-tests.yml
new file mode 100644
index 0000000..679bc2c
--- /dev/null
+++ b/.github/workflows/mariadb-tests.yml
@@ -0,0 +1,60 @@
+name: MariaDB Integration Tests
+
+permissions: {}
+
+on:
+ pull_request:
+ push:
+ branches:
+ - main
+ tags-ignore: [ v.* ]
+
+jobs:
+ integration-test:
+ name: Integration Tests
+ runs-on: ubuntu-22.04
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - { name: "MariaDB", extraOpts: '' }
+ - { name: "MariaDB (old dao)", extraOpts: '
-Djdbc-journal.dao=org.apache.pekko.persistence.jdbc.journal.dao.legacy.ByteArrayJournalDao
-Djdbc-snapshot-store.dao=org.apache.pekko.persistence.jdbc.snapshot.dao.legacy.ByteArraySnapshotDao
-Djdbc-read-journal.dao=org.apache.pekko.persistence.jdbc.query.dao.legacy.ByteArrayReadJournalDao'
}
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #
v5.0.0
+ with:
+ fetch-depth: 0
+ fetch-tags: true
+
+ - name: Checkout GitHub merge
+ if: github.event.pull_request
+ run: |-
+ git fetch origin pull/${{ github.event.pull_request.number
}}/merge:scratch
+ git checkout scratch
+
+ - name: Setup Java 17
+ uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 #
v5.0.0
+ with:
+ distribution: temurin
+ java-version: 17
+
+ - name: Install sbt
+ uses: sbt/setup-sbt@17575ea4e18dd928fe5968dbe32294b97923d65b # v1.1.13
+
+ - name: Cache Coursier cache
+ uses: coursier/cache-action@4e2615869d13561d626ed48655e1a39e5b192b3c #
6.4.7
+
+ - name: Start docker
+ run: ./scripts/launch-mariadb.sh
+
+ - name: Run Integration tests for ${{ matrix.name }}
+ run: sbt ++2.13 "integration/testOnly
org.apache.pekko.persistence.jdbc.integration.MariaDB*" ${{ matrix.extraOpts }}
+
+ - name: Run Migrator Integration tests for ${{ matrix.name }}
+ if: matrix.name == 'MariaDB'
+ run: sbt ++2.13 "migratorIntegration/testOnly
org.apache.pekko.persistence.jdbc.migrator.integration.MariaDB*" ${{
matrix.extraOpts }}
+
+ - name: Print logs on failure
+ if: ${{ failure() }}
+ run: find . -name "*.log" -exec ./scripts/cat-log.sh {} \;
diff --git a/core/src/main/resources/reference.conf
b/core/src/main/resources/reference.conf
index 3026393..a75c4ff 100644
--- a/core/src/main/resources/reference.conf
+++ b/core/src/main/resources/reference.conf
@@ -125,6 +125,7 @@ jdbc-journal {
event_journal {
tableName = "event_journal"
+ # Keep blank for MySQL and MariaDB
schemaName = ""
columnNames {
@@ -146,6 +147,7 @@ jdbc-journal {
event_tag {
tableName = "event_tag"
+ # Keep blank for MySQL and MariaDB
schemaName = ""
columnNames {
@@ -198,6 +200,7 @@ jdbc-journal {
# - slick.jdbc.H2Profile$
# - slick.jdbc.SQLServerProfile$
# - slick.jdbc.OracleProfile$
+ # - org.apache.pekko.persistence.jdbc.db.MariaDBProfile$
# (uncomment and set the property below to match your needs)
# profile = "slick.jdbc.PostgresProfile$"
@@ -272,6 +275,7 @@ jdbc-snapshot-store {
tables {
legacy_snapshot {
tableName = "snapshot"
+ # Keep blank for MySQL and MariaDB
schemaName = ""
columnNames {
persistenceId = "persistence_id"
@@ -283,6 +287,7 @@ jdbc-snapshot-store {
snapshot {
tableName = "snapshot"
+ # Keep blank for MySQL and MariaDB
schemaName = ""
columnNames {
persistenceId = "persistence_id"
@@ -324,6 +329,7 @@ jdbc-snapshot-store {
# - slick.jdbc.H2Profile$
# - slick.jdbc.SQLServerProfile$
# - slick.jdbc.OracleProfile$
+ # - org.apache.pekko.persistence.jdbc.db.MariaDBProfile$
# (uncomment and set the property below to match your needs)
# profile = "slick.jdbc.PostgresProfile$"
@@ -459,6 +465,7 @@ jdbc-read-journal {
# - slick.jdbc.H2Profile$
# - slick.jdbc.SQLServerProfile$
# - slick.jdbc.OracleProfile$
+ # - org.apache.pekko.persistence.jdbc.db.MariaDBProfile$
# (uncomment and set the property below to match your needs)
# profile = "slick.jdbc.PostgresProfile$"
@@ -541,6 +548,9 @@ jdbc-durable-state-store {
## these values you may need to edit some source code
## https://github.com/akka/akka-persistence-jdbc/issues/573
tableName = "durable_state"
+ # Only used with MariaDB
+ globalOffsetSequenceName = "durable_state_global_offset_seq"
+ # Keep blank for MySQL and MariaDB
schemaName = ""
columnNames {
globalOffset = "global_offset"
@@ -584,6 +594,7 @@ jdbc-durable-state-store {
# - slick.jdbc.H2Profile$
# - slick.jdbc.SQLServerProfile$
# - slick.jdbc.OracleProfile$
+ # - org.apache.pekko.persistence.jdbc.db.MariaDBProfile$
# (uncomment and set the property below to match your needs)
# profile = "slick.jdbc.PostgresProfile$"
diff --git a/core/src/main/resources/schema/mariadb/mariadb-create-schema.sql
b/core/src/main/resources/schema/mariadb/mariadb-create-schema.sql
new file mode 100644
index 0000000..8f40592
--- /dev/null
+++ b/core/src/main/resources/schema/mariadb/mariadb-create-schema.sql
@@ -0,0 +1,65 @@
+CREATE TABLE IF NOT EXISTS event_journal
+(
+ ordering SERIAL,
+ deleted BOOLEAN DEFAULT false NOT NULL,
+ persistence_id VARCHAR(255) NOT NULL,
+ sequence_number BIGINT NOT NULL,
+ writer TEXT NOT NULL,
+ write_timestamp BIGINT NOT NULL,
+ adapter_manifest TEXT NOT NULL,
+ event_payload BLOB NOT NULL,
+ event_ser_id INTEGER NOT NULL,
+ event_ser_manifest TEXT NOT NULL,
+ meta_payload BLOB,
+ meta_ser_id INTEGER,
+ meta_ser_manifest TEXT,
+ PRIMARY KEY (persistence_id, sequence_number)
+);
+
+CREATE UNIQUE INDEX event_journal_ordering_idx ON event_journal (ordering);
+
+CREATE TABLE IF NOT EXISTS event_tag
+(
+ event_id BIGINT UNSIGNED NOT NULL,
+ tag VARCHAR(255) NOT NULL,
+ PRIMARY KEY (event_id, tag),
+ FOREIGN KEY (event_id)
+ REFERENCES event_journal (ordering)
+ ON DELETE CASCADE
+);
+
+CREATE TABLE IF NOT EXISTS snapshot
+(
+ persistence_id VARCHAR(255) NOT NULL,
+ sequence_number BIGINT NOT NULL,
+ created BIGINT NOT NULL,
+ snapshot_ser_id INTEGER NOT NULL,
+ snapshot_ser_manifest TEXT NOT NULL,
+ snapshot_payload BLOB NOT NULL,
+ meta_ser_id INTEGER,
+ 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 SEQUENCE IF NOT EXISTS durable_state_global_offset_seq
+ INCREMENT BY 1
+ MINVALUE 1
+ NO MAXVALUE
+ START 1
+ CACHE 1;
diff --git a/core/src/main/resources/schema/mariadb/mariadb-drop-schema.sql
b/core/src/main/resources/schema/mariadb/mariadb-drop-schema.sql
new file mode 100644
index 0000000..98eab91
--- /dev/null
+++ b/core/src/main/resources/schema/mariadb/mariadb-drop-schema.sql
@@ -0,0 +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 SEQUENCE IF EXISTS durable_state_global_offset_seq;
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 8946445..91fa3c1 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
@@ -217,6 +217,7 @@ class DurableStateTableColumnNames(config: Config) {
class DurableStateTableConfiguration(config: Config) {
private val cfg = config.getConfig("tables.durable_state")
val tableName: String = cfg.getString("tableName")
+ val globalOffsetSequenceName: String =
cfg.getString("globalOffsetSequenceName")
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/db/MariaDBProfile.scala
b/core/src/main/scala/org/apache/pekko/persistence/jdbc/db/MariaDBProfile.scala
new file mode 100644
index 0000000..1282e22
--- /dev/null
+++
b/core/src/main/scala/org/apache/pekko/persistence/jdbc/db/MariaDBProfile.scala
@@ -0,0 +1,24 @@
+/*
+ * 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.db
+
+import slick.jdbc.MySQLProfile
+
+trait MariaDBProfile extends MySQLProfile
+
+object MariaDBProfile extends MariaDBProfile
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 bc4e266..e65222a 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
@@ -17,6 +17,7 @@ package org.apache.pekko.persistence.jdbc.state
import org.apache.pekko
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 }
@@ -35,6 +36,7 @@ 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 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.")
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 e2e8676..70c8125 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
@@ -89,3 +89,16 @@ import slick.sql.SqlStreamingAction
.globalOffset}_SEQ.nextval FROM DUAL""".as[
String]
}
+
+/**
+ * INTERNAL API
+ */
+@InternalApi private[jdbc] final class MariaDBSequenceNextValUpdater(profile:
JdbcProfile,
+ durableStateTableCfg: DurableStateTableConfiguration)
+ extends SequenceNextValUpdater {
+
+ import profile.api._
+
+ def getSequenceNextValueExpr() =
+ sql"""SELECT NEXT VALUE FOR
#${durableStateTableCfg.globalOffsetSequenceName}""".as[String]
+}
diff --git
a/core/src/main/scala/org/apache/pekko/persistence/jdbc/testkit/internal/SchemaType.scala
b/core/src/main/scala/org/apache/pekko/persistence/jdbc/testkit/internal/SchemaType.scala
index 2efe5a1..e2d57f3 100644
---
a/core/src/main/scala/org/apache/pekko/persistence/jdbc/testkit/internal/SchemaType.scala
+++
b/core/src/main/scala/org/apache/pekko/persistence/jdbc/testkit/internal/SchemaType.scala
@@ -36,6 +36,11 @@ import org.apache.pekko.annotation.InternalApi
*/
@InternalApi private[jdbc] case object MySQL extends SchemaType
+/**
+ * INTERNAL API
+ */
+@InternalApi private[jdbc] case object MariaDB extends SchemaType
+
/**
* INTERNAL API
*/
diff --git
a/core/src/main/scala/org/apache/pekko/persistence/jdbc/testkit/internal/SchemaUtilsImpl.scala
b/core/src/main/scala/org/apache/pekko/persistence/jdbc/testkit/internal/SchemaUtilsImpl.scala
index 409aa22..2f2a527 100644
---
a/core/src/main/scala/org/apache/pekko/persistence/jdbc/testkit/internal/SchemaUtilsImpl.scala
+++
b/core/src/main/scala/org/apache/pekko/persistence/jdbc/testkit/internal/SchemaUtilsImpl.scala
@@ -15,15 +15,13 @@
package org.apache.pekko.persistence.jdbc.testkit.internal
import java.sql.Statement
-
import scala.concurrent.Future
import org.apache.pekko
import pekko.Done
import pekko.actor.ClassicActorSystemProvider
import pekko.annotation.InternalApi
import pekko.dispatch.Dispatchers
-import pekko.persistence.jdbc.db.SlickDatabase
-import pekko.persistence.jdbc.db.SlickExtension
+import pekko.persistence.jdbc.db.{ MariaDBProfile, SlickDatabase,
SlickExtension }
import com.typesafe.config.Config
import org.slf4j.Logger
import slick.jdbc.H2Profile
@@ -158,22 +156,28 @@ private[jdbc] object SchemaUtilsImpl {
private def dropScriptFor(schemaType: SchemaType, legacy: Boolean): (String,
String) = {
val suffix = if (legacy) "-legacy" else ""
schemaType match {
- case Postgres => (s"schema/postgres/postgres-drop-schema$suffix.sql",
";")
- case MySQL => (s"schema/mysql/mysql-drop-schema$suffix.sql", ";")
- case Oracle => (s"schema/oracle/oracle-drop-schema$suffix.sql", "/")
- case SqlServer => (s"schema/sqlserver/sqlserver-drop-schema$suffix.sql",
";")
- case H2 => (s"schema/h2/h2-drop-schema$suffix.sql", ";")
+ case Postgres =>
(s"schema/postgres/postgres-drop-schema$suffix.sql", ";")
+ case MySQL => (s"schema/mysql/mysql-drop-schema$suffix.sql",
";")
+ case MariaDB if legacy => throw new IllegalArgumentException(s"Invalid
legacy schema request for $schemaType")
+ case MariaDB =>
(s"schema/mariadb/mariadb-drop-schema$suffix.sql", ";")
+ case Oracle =>
(s"schema/oracle/oracle-drop-schema$suffix.sql", "/")
+ case SqlServer =>
(s"schema/sqlserver/sqlserver-drop-schema$suffix.sql", ";")
+ case H2 => (s"schema/h2/h2-drop-schema$suffix.sql", ";")
+ case _ => throw new
UnsupportedOperationException(s"Unsupported schema request for $schemaType")
}
}
private def createScriptFor(schemaType: SchemaType, legacy: Boolean):
(String, String) = {
val suffix = if (legacy) "-legacy" else ""
schemaType match {
- case Postgres => (s"schema/postgres/postgres-create-schema$suffix.sql",
";")
- case MySQL => (s"schema/mysql/mysql-create-schema$suffix.sql", ";")
- case Oracle => (s"schema/oracle/oracle-create-schema$suffix.sql", "/")
- case SqlServer =>
(s"schema/sqlserver/sqlserver-create-schema$suffix.sql", ";")
- case H2 => (s"schema/h2/h2-create-schema$suffix.sql", ";")
+ case Postgres =>
(s"schema/postgres/postgres-create-schema$suffix.sql", ";")
+ case MySQL =>
(s"schema/mysql/mysql-create-schema$suffix.sql", ";")
+ case MariaDB if legacy => throw new IllegalArgumentException(s"Invalid
legacy schema request for $schemaType")
+ case MariaDB =>
(s"schema/mariadb/mariadb-create-schema$suffix.sql", ";")
+ case Oracle =>
(s"schema/oracle/oracle-create-schema$suffix.sql", "/")
+ case SqlServer =>
(s"schema/sqlserver/sqlserver-create-schema$suffix.sql", ";")
+ case H2 => (s"schema/h2/h2-create-schema$suffix.sql", ";")
+ case _ => throw new
UnsupportedOperationException(s"Unsupported schema request for $schemaType")
}
}
@@ -185,6 +189,7 @@ private[jdbc] object SchemaUtilsImpl {
profile match {
case PostgresProfile => Postgres
case MySQLProfile => MySQL
+ case MariaDBProfile => MariaDB
case OracleProfile => Oracle
case SQLServerProfile => SqlServer
case H2Profile => H2
diff --git a/core/src/test/resources/mariadb-application.conf
b/core/src/test/resources/mariadb-application.conf
new file mode 100644
index 0000000..f6305ce
--- /dev/null
+++ b/core/src/test/resources/mariadb-application.conf
@@ -0,0 +1,69 @@
+# Copyright 2016 Dennis Vriend
+#
+# 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
+#
+# 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.
+
+// general.conf is included only for shared settings used for the
pekko-persistence-jdbc tests
+include "general.conf"
+
+pekko {
+ persistence {
+ journal {
+ plugin = "jdbc-journal"
+ // Enable the line below to automatically start the journal when the
actorsystem is started
+ // auto-start-journals = ["jdbc-journal"]
+ }
+ snapshot-store {
+ plugin = "jdbc-snapshot-store"
+ // Enable the line below to automatically start the snapshot-store when
the actorsystem is started
+ // auto-start-snapshot-stores = ["jdbc-snapshot-store"]
+ }
+ state {
+ plugin = "jdbc-durable-state-store"
+ }
+ }
+}
+
+jdbc-journal {
+ slick = ${slick}
+}
+
+# the pekko-persistence-snapshot-store in use
+jdbc-snapshot-store {
+ slick = ${slick}
+}
+
+# the pekko-persistence-query provider in use
+jdbc-read-journal {
+ slick = ${slick}
+}
+
+# the pekko-persistence-jdbc provider in use for durable state store
+jdbc-durable-state-store {
+ slick = ${slick}
+}
+
+slick {
+ profile = "org.apache.pekko.persistence.jdbc.db.MariaDBProfile$"
+ db {
+ host = ${docker.host}
+ host = ${?DB_HOST}
+ # Be careful with the DB port! Default is 3306.
+ url =
"jdbc:mariadb://"${slick.db.host}":3307/mysql?cachePrepStmts=true&cacheCallableStmts=true&cacheServerConfiguration=true&useLocalSessionState=true&elideSetAutoCommits=true&alwaysSendSetIsolation=false&enableQueryTimeouts=false&connectionAttributes=none&verifyServerCertificate=false&useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&useLegacyDatetimeCode=false&serverTimezone=UTC&rewriteBatchedStatements=true"
+ user = "root"
+ password = "root"
+ driver = "org.mariadb.jdbc.Driver"
+ numThreads = 5
+ maxConnections = 5
+ minConnections = 1
+ }
+}
diff --git a/core/src/test/resources/mariadb-shared-db-application.conf
b/core/src/test/resources/mariadb-shared-db-application.conf
new file mode 100644
index 0000000..e9a7cfb
--- /dev/null
+++ b/core/src/test/resources/mariadb-shared-db-application.conf
@@ -0,0 +1,73 @@
+# Copyright 2016 Dennis Vriend
+#
+# 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
+#
+# 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.
+
+include "general.conf"
+
+pekko {
+ persistence {
+ journal {
+ plugin = "jdbc-journal"
+ // Enable the line below to automatically start the journal when the
actorsystem is started
+ // auto-start-journals = ["jdbc-journal"]
+ }
+ snapshot-store {
+ plugin = "jdbc-snapshot-store"
+ // Enable the line below to automatically start the snapshot-store when
the actorsystem is started
+ // auto-start-snapshot-stores = ["jdbc-snapshot-store"]
+ }
+ state {
+ plugin = "jdbc-durable-state-store"
+ }
+ }
+}
+
+pekko-persistence-jdbc {
+ shared-databases {
+ slick {
+ profile = "org.apache.pekko.persistence.jdbc.db.MariaDBProfile$"
+ db {
+ host = ${docker.host}
+ host = ${?DB_HOST}
+ # Be careful with the DB port! Default is 3306.
+ url =
"jdbc:mariadb://"${pekko-persistence-jdbc.shared-databases.slick.db.host}":3307/mysql?cachePrepStmts=true&cacheCallableStmts=true&cacheServerConfiguration=true&useLocalSessionState=true&elideSetAutoCommits=true&alwaysSendSetIsolation=false&enableQueryTimeouts=false&connectionAttributes=none&verifyServerCertificate=false&useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&useLegacyDatetimeCode=false&serverTimezone=UTC&rewriteBatchedStatements=true"
+ user = "root"
+ password = "root"
+ driver = "org.mariadb.jdbc.Driver"
+ numThreads = 5
+ maxConnections = 5
+ minConnections = 1
+ }
+ }
+ }
+}
+
+jdbc-journal {
+ use-shared-db = "slick"
+}
+
+# the pekko-persistence-snapshot-store in use
+jdbc-snapshot-store {
+ use-shared-db = "slick"
+}
+
+# the pekko-persistence-query provider in use
+jdbc-read-journal {
+ use-shared-db = "slick"
+}
+
+# the pekko-persistence-jdbc provider in use for durable state store
+jdbc-durable-state-store {
+ use-shared-db = "slick"
+}
+
diff --git
a/core/src/test/scala/org/apache/pekko/persistence/jdbc/query/QueryTestSpec.scala
b/core/src/test/scala/org/apache/pekko/persistence/jdbc/query/QueryTestSpec.scala
index 182cc71..6be55a7 100644
---
a/core/src/test/scala/org/apache/pekko/persistence/jdbc/query/QueryTestSpec.scala
+++
b/core/src/test/scala/org/apache/pekko/persistence/jdbc/query/QueryTestSpec.scala
@@ -396,6 +396,27 @@ trait MysqlCleaner extends QueryTestSpec {
}
}
+trait MariaDBCleaner extends QueryTestSpec {
+
+ def clearMariaDB(): Unit = {
+ withStatement { stmt =>
+ stmt.execute("SET FOREIGN_KEY_CHECKS = 0")
+ tables.foreach { name => stmt.executeUpdate(s"TRUNCATE $name") }
+ stmt.execute("SET FOREIGN_KEY_CHECKS = 1")
+ }
+ }
+
+ override def beforeAll(): Unit = {
+ dropAndCreate(MariaDB)
+ super.beforeAll()
+ }
+
+ override def beforeEach(): Unit = {
+ clearMariaDB()
+ super.beforeEach()
+ }
+}
+
trait OracleCleaner extends QueryTestSpec {
def clearOracle(): Unit = {
diff --git
a/core/src/test/scala/org/apache/pekko/persistence/jdbc/state/scaladsl/DurableStateStorePluginSpec.scala
b/core/src/test/scala/org/apache/pekko/persistence/jdbc/state/scaladsl/DurableStateStorePluginSpec.scala
index 33afb98..f3e818f 100644
---
a/core/src/test/scala/org/apache/pekko/persistence/jdbc/state/scaladsl/DurableStateStorePluginSpec.scala
+++
b/core/src/test/scala/org/apache/pekko/persistence/jdbc/state/scaladsl/DurableStateStorePluginSpec.scala
@@ -25,7 +25,7 @@ import org.scalatest.time.{ Millis, Seconds, Span }
import org.scalatest.wordspec.AnyWordSpecLike
import org.scalatest.BeforeAndAfterAll
import org.slf4j.LoggerFactory
-import slick.jdbc.{ H2Profile, JdbcProfile }
+import slick.jdbc.{ H2Profile, JdbcProfile, MySQLProfile }
import scala.concurrent.duration.DurationInt
@@ -69,15 +69,19 @@ abstract class DurableStateStoreSchemaPluginSpec(val
config: Config, profile: Jd
implicit val defaultPatience: PatienceConfig =
PatienceConfig(timeout = Span(60, Seconds), interval = Span(100, Millis))
- val customConfig: Config = ConfigFactory.parseString("""
- jdbc-durable-state-store {
- tables {
- durable_state {
- schemaName = "pekko"
+ val customConfig: Config = profile match {
+ case _: MySQLProfile => ConfigFactory.empty()
+ case _ =>
+ ConfigFactory.parseString("""
+ jdbc-durable-state-store {
+ tables {
+ durable_state {
+ schemaName = "pekko"
+ }
+ }
}
- }
- }
- """)
+ """)
+ }
implicit lazy val system: ExtendedActorSystem =
ActorSystem(
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 01681f4..f4b9d7a 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, Oracle, Postgres,
SchemaType, SqlServer }
+import pekko.persistence.jdbc.testkit.internal.{ H2, MariaDB, Oracle,
Postgres, SchemaType, SqlServer }
import pekko.persistence.query.{ NoOffset, Offset, Sequence,
UpdatedDurableState }
import pekko.stream.scaladsl.Sink
import org.scalatest.time.{ Millis, Seconds, Span }
@@ -80,16 +80,18 @@ abstract class JdbcDurableStateSpec(config: Config,
schemaType: SchemaType) exte
} { e =>
schemaType match {
case H2 =>
- e shouldBe
an[org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException]
+ e shouldBe
a[org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException]
case Postgres =>
- e shouldBe an[org.postgresql.util.PSQLException]
+ e shouldBe a[org.postgresql.util.PSQLException]
// TODO https://github.com/apache/pekko-persistence-jdbc/issues/174
// case MySQL =>
- // e shouldBe an[java.sql.SQLIntegrityConstraintViolationException]
+ // e shouldBe a[java.sql.SQLIntegrityConstraintViolationException]
+ case MariaDB =>
+ e shouldBe a[java.sql.SQLIntegrityConstraintViolationException]
case Oracle =>
- e shouldBe an[java.sql.SQLIntegrityConstraintViolationException]
+ e shouldBe a[java.sql.SQLIntegrityConstraintViolationException]
case SqlServer =>
- e shouldBe an[com.microsoft.sqlserver.jdbc.SQLServerException]
+ e shouldBe a[com.microsoft.sqlserver.jdbc.SQLServerException]
case _ => throw new UnsupportedOperationException(s"Unsupported
<$schemaType> for durableState.")
}
}
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 6d59329..fe8198d 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, Oracle, Postgres,
SchemaType, SqlServer }
+import pekko.persistence.jdbc.testkit.internal.{ H2, MariaDB, Oracle,
Postgres, SchemaType, SqlServer }
import pekko.persistence.jdbc.util.DropCreate
import pekko.serialization.SerializationExtension
import pekko.util.Timeout
@@ -51,6 +51,7 @@ abstract class StateSpecBase(val config: Config, schemaType:
SchemaType)
case Postgres => slick.jdbc.PostgresProfile
// TODO https://github.com/apache/pekko-persistence-jdbc/issues/174
// case MySQL => slick.jdbc.MySQLProfile
+ case MariaDB => org.apache.pekko.persistence.jdbc.db.MariaDBProfile
case SqlServer => slick.jdbc.SQLServerProfile
case Oracle => slick.jdbc.OracleProfile
case _ => throw new UnsupportedOperationException(s"Unsupported
<$s> for durableState.")
diff --git a/docs/src/main/paradox/configuration.md
b/docs/src/main/paradox/configuration.md
index fab0674..8d1b436 100644
--- a/docs/src/main/paradox/configuration.md
+++ b/docs/src/main/paradox/configuration.md
@@ -17,10 +17,14 @@ Configure `slick`:
- `slick.jdbc.OracleProfile$`
- `slick.jdbc.SQLServerProfile$`
+- The following custom slick profiles are available:
+ - `org.apache.pekko.persistence.jdbc.db.MariaDBProfile$`
+
## Database Schema
- @extref:[Postgres
Schema](github:/core/src/main/resources/schema/postgres/postgres-create-schema.sql)
- @extref:[MySQL
Schema](github:/core/src/main/resources/schema/mysql/mysql-create-schema.sql)
+- @extref:[MariaDB
Schema](github:/core/src/main/resources/schema/mariadb/mariadb-create-schema.sql)
- @extref:[H2
Schema](github:/core/src/main/resources/schema/h2/h2-create-schema.sql)
- @extref:[Oracle
Schema](github:/core/src/main/resources/schema/oracle/oracle-create-schema.sql)
- @extref:[SQL Server
Schema](github:/core/src/main/resources/schema/sqlserver/sqlserver-create-schema.sql)
@@ -64,6 +68,9 @@ Postgres
MySQL
: @@snip[MySQL](/core/src/test/resources/mysql-application.conf)
+MariaDB
+: @@snip[MariaDB](/core/src/test/resources/mariadb-application.conf)
+
H2
: @@snip[H2](/core/src/test/resources/h2-application.conf)
@@ -83,6 +90,9 @@ Postgres
MySQL
: @@snip[MySQL](/core/src/test/resources/mysql-shared-db-application.conf)
+MariaDB
+: @@snip[MariaDB](/core/src/test/resources/mariadb-shared-db-application.conf)
+
H2
: @@snip[H2](/core/src/test/resources/h2-shared-db-application.conf)
diff --git
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/AllPersistenceIdsTest.scala
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/AllPersistenceIdsTest.scala
index d1e5607..a910014 100644
---
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/AllPersistenceIdsTest.scala
+++
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/AllPersistenceIdsTest.scala
@@ -11,6 +11,7 @@ package org.apache.pekko.persistence.jdbc.integration
import org.apache.pekko.persistence.jdbc.query.{
AllPersistenceIdsTest,
+ MariaDBCleaner,
MysqlCleaner,
OracleCleaner,
PostgresCleaner,
@@ -21,6 +22,8 @@ class PostgresScalaAllPersistenceIdsTest extends
AllPersistenceIdsTest("postgres
class MySQLScalaAllPersistenceIdsTest extends
AllPersistenceIdsTest("mysql-application.conf") with MysqlCleaner
+class MariaDBScalaAllPersistenceIdsTest extends
AllPersistenceIdsTest("mariadb-application.conf") with MariaDBCleaner
+
class OracleScalaAllPersistenceIdsTest extends
AllPersistenceIdsTest("oracle-application.conf") with OracleCleaner
class SqlServerScalaAllPersistenceIdsTest
diff --git
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/CurrentEventsByPersistenceIdTest.scala
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/CurrentEventsByPersistenceIdTest.scala
index e6ad53b..d71c225 100644
---
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/CurrentEventsByPersistenceIdTest.scala
+++
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/CurrentEventsByPersistenceIdTest.scala
@@ -11,6 +11,7 @@ package org.apache.pekko.persistence.jdbc.integration
import org.apache.pekko.persistence.jdbc.query.{
CurrentEventsByPersistenceIdTest,
+ MariaDBCleaner,
MysqlCleaner,
OracleCleaner,
PostgresCleaner,
@@ -27,6 +28,10 @@ class MySQLScalaCurrentEventsByPersistenceIdTest
extends
CurrentEventsByPersistenceIdTest("mysql-shared-db-application.conf")
with MysqlCleaner
+class MariaDBScalaCurrentEventsByPersistenceIdTest
+ extends
CurrentEventsByPersistenceIdTest("mariadb-shared-db-application.conf")
+ with MariaDBCleaner
+
class OracleScalaCurrentEventsByPersistenceIdTest
extends
CurrentEventsByPersistenceIdTest("oracle-shared-db-application.conf")
with OracleCleaner
diff --git
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/CurrentEventsByTagTest.scala
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/CurrentEventsByTagTest.scala
index f1bebe1..76946d7 100644
---
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/CurrentEventsByTagTest.scala
+++
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/CurrentEventsByTagTest.scala
@@ -11,6 +11,7 @@ package org.apache.pekko.persistence.jdbc.integration
import org.apache.pekko.persistence.jdbc.query.{
CurrentEventsByTagTest,
+ MariaDBCleaner,
MysqlCleaner,
OracleCleaner,
PostgresCleaner,
@@ -27,6 +28,10 @@ class MySQLScalaCurrentEventsByTagTest
extends CurrentEventsByTagTest("mysql-shared-db-application.conf")
with MysqlCleaner
+class MariaDBScalaCurrentEventsByTagTest
+ extends CurrentEventsByTagTest("mariadb-shared-db-application.conf")
+ with MariaDBCleaner
+
class OracleScalaCurrentEventsByTagTest
extends CurrentEventsByTagTest("oracle-shared-db-application.conf")
with OracleCleaner
diff --git
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/CurrentLastKnownSequenceNumberByPersistenceIdTest.scala
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/CurrentLastKnownSequenceNumberByPersistenceIdTest.scala
index c0136c8..4f124f1 100644
---
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/CurrentLastKnownSequenceNumberByPersistenceIdTest.scala
+++
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/CurrentLastKnownSequenceNumberByPersistenceIdTest.scala
@@ -11,6 +11,7 @@ package org.apache.pekko.persistence.jdbc.integration
import org.apache.pekko.persistence.jdbc.query.{
CurrentLastSequenceNumberByPersistenceIdTest,
+ MariaDBCleaner,
MysqlCleaner,
OracleCleaner,
PostgresCleaner,
@@ -27,6 +28,10 @@ class MySQLScalaCurrentLastSequenceNumberByPersistenceIdTest
extends
CurrentLastSequenceNumberByPersistenceIdTest("mysql-shared-db-application.conf")
with MysqlCleaner
+class MariaDBScalaCurrentLastSequenceNumberByPersistenceIdTest
+ extends
CurrentLastSequenceNumberByPersistenceIdTest("mariadb-shared-db-application.conf")
+ with MariaDBCleaner
+
class OracleScalaCurrentLastSequenceNumberByPersistenceIdTest
extends
CurrentLastSequenceNumberByPersistenceIdTest("oracle-shared-db-application.conf")
with OracleCleaner
diff --git
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/CurrentPersistenceIdsTest.scala
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/CurrentPersistenceIdsTest.scala
index de106f4..baf2c07 100644
---
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/CurrentPersistenceIdsTest.scala
+++
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/CurrentPersistenceIdsTest.scala
@@ -11,6 +11,7 @@ package org.apache.pekko.persistence.jdbc.integration
import org.apache.pekko.persistence.jdbc.query.{
CurrentPersistenceIdsTest,
+ MariaDBCleaner,
MysqlCleaner,
OracleCleaner,
PostgresCleaner,
@@ -26,6 +27,10 @@ class MySQLScalaCurrentPersistenceIdsTest
extends CurrentPersistenceIdsTest("mysql-shared-db-application.conf")
with MysqlCleaner
+class MariaDBScalaCurrentPersistenceIdsTest
+ extends CurrentPersistenceIdsTest("mariadb-shared-db-application.conf")
+ with MariaDBCleaner
+
class OracleScalaCurrentPersistenceIdsTest
extends CurrentPersistenceIdsTest("oracle-shared-db-application.conf")
with OracleCleaner
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 1ed109d..a62684e 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.{ Oracle, Postgres,
SqlServer }
+import org.apache.pekko.persistence.jdbc.testkit.internal.{ MariaDB, Oracle,
Postgres, SqlServer }
class OracleDurableStateSequenceActorTest
extends
DurableStateSequenceActorTest(ConfigFactory.load("oracle-application.conf"),
Oracle) {
@@ -41,3 +41,9 @@ class PostgresDurableStateSequenceActorTest
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 =
+ ActorSystem("test", config.withFallback(customSerializers))
+}
diff --git
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/EventAdapterTest.scala
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/EventAdapterTest.scala
index e9aeb36..d6605b1 100644
---
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/EventAdapterTest.scala
+++
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/EventAdapterTest.scala
@@ -11,6 +11,7 @@ package org.apache.pekko.persistence.jdbc.integration
import org.apache.pekko.persistence.jdbc.query.{
EventAdapterTest,
+ MariaDBCleaner,
MysqlCleaner,
OracleCleaner,
PostgresCleaner,
@@ -21,6 +22,8 @@ class PostgresScalaEventAdapterTest extends
EventAdapterTest("postgres-applicati
class MySQLScalaEventAdapterTest extends
EventAdapterTest("mysql-application.conf") with MysqlCleaner
+class MariaDBScalaEventAdapterTest extends
EventAdapterTest("mariadb-application.conf") with MariaDBCleaner
+
class OracleScalaEventAdapterTest extends
EventAdapterTest("oracle-application.conf") with OracleCleaner
class SqlServerScalaEventAdapterTest extends
EventAdapterTest("sqlserver-application.conf") with SqlServerCleaner
diff --git
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/EventsByPersistenceIdTest.scala
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/EventsByPersistenceIdTest.scala
index 7cfd54f..0f5482e 100644
---
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/EventsByPersistenceIdTest.scala
+++
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/EventsByPersistenceIdTest.scala
@@ -11,6 +11,7 @@ package org.apache.pekko.persistence.jdbc.integration
import org.apache.pekko.persistence.jdbc.query.{
EventsByPersistenceIdTest,
+ MariaDBCleaner,
MysqlCleaner,
OracleCleaner,
PostgresCleaner,
@@ -23,6 +24,9 @@ class PostgresScalaEventsByPersistenceIdTest
class MySQLScalaEventsByPersistenceIdTest extends
EventsByPersistenceIdTest("mysql-application.conf") with MysqlCleaner
+class MariaDBScalaEventsByPersistenceIdTest extends
EventsByPersistenceIdTest("mariadb-application.conf")
+ with MariaDBCleaner
+
class OracleScalaEventsByPersistenceIdTest
extends EventsByPersistenceIdTest("oracle-application.conf")
with OracleCleaner
diff --git
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/EventsByTagTest.scala
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/EventsByTagTest.scala
index 340d012..877463f 100644
---
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/EventsByTagTest.scala
+++
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/EventsByTagTest.scala
@@ -11,6 +11,7 @@ package org.apache.pekko.persistence.jdbc.integration
import org.apache.pekko.persistence.jdbc.query.{
EventsByTagTest,
+ MariaDBCleaner,
MysqlCleaner,
OracleCleaner,
PostgresCleaner,
@@ -21,6 +22,8 @@ class PostgresScalaEventsByTagTest extends
EventsByTagTest("postgres-application
class MySQLScalaEventByTagTest extends
EventsByTagTest("mysql-application.conf") with MysqlCleaner
+class MariaDBScalaEventByTagTest extends
EventsByTagTest("mariadb-application.conf") with MariaDBCleaner
+
class OracleScalaEventByTagTest extends
EventsByTagTest("oracle-application.conf") with OracleCleaner {
override def timeoutMultiplier: Int = 4
}
diff --git
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/HardDeleteQueryTest.scala
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/HardDeleteQueryTest.scala
index feb528f..8b7e711 100644
---
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/HardDeleteQueryTest.scala
+++
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/HardDeleteQueryTest.scala
@@ -11,6 +11,7 @@ package org.apache.pekko.persistence.jdbc.integration
import org.apache.pekko.persistence.jdbc.query.{
HardDeleteQueryTest,
+ MariaDBCleaner,
MysqlCleaner,
OracleCleaner,
PostgresCleaner,
@@ -21,6 +22,8 @@ class PostgresHardDeleteQueryTest extends
HardDeleteQueryTest("postgres-applicat
class MySQLHardDeleteQueryTest extends
HardDeleteQueryTest("mysql-application.conf") with MysqlCleaner
+class MariaDBHardDeleteQueryTest extends
HardDeleteQueryTest("mariadb-application.conf") with MariaDBCleaner
+
class OracleHardDeleteQueryTest extends
HardDeleteQueryTest("oracle-application.conf") with OracleCleaner
class SqlServerHardDeleteQueryTest extends
HardDeleteQueryTest("sqlserver-application.conf") with SqlServerCleaner
diff --git
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/JdbcJournalPerfSpec.scala
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/JdbcJournalPerfSpec.scala
index 5beda86..f2920aa 100644
---
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/JdbcJournalPerfSpec.scala
+++
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/JdbcJournalPerfSpec.scala
@@ -11,10 +11,7 @@ package org.apache.pekko.persistence.jdbc.integration
import org.apache.pekko
import pekko.persistence.jdbc.journal.JdbcJournalPerfSpec
-import pekko.persistence.jdbc.testkit.internal.MySQL
-import pekko.persistence.jdbc.testkit.internal.Oracle
-import pekko.persistence.jdbc.testkit.internal.Postgres
-import pekko.persistence.jdbc.testkit.internal.SqlServer
+import pekko.persistence.jdbc.testkit.internal.{ MariaDB, MySQL, Oracle,
Postgres, SqlServer }
import com.typesafe.config.ConfigFactory
class PostgresJournalPerfSpec extends
JdbcJournalPerfSpec(ConfigFactory.load("postgres-application.conf"), Postgres) {
@@ -35,6 +32,15 @@ class MySQLJournalPerfSpecSharedDb
override def eventsCount: Int = 100
}
+class MariaDBJournalPerfSpec extends
JdbcJournalPerfSpec(ConfigFactory.load("mariadb-application.conf"), MariaDB) {
+ override def eventsCount: Int = 100
+}
+
+class MariaDBJournalPerfSpecSharedDb
+ extends
JdbcJournalPerfSpec(ConfigFactory.load("mariadb-shared-db-application.conf"),
MariaDB) {
+ override def eventsCount: Int = 100
+}
+
class OracleJournalPerfSpec extends
JdbcJournalPerfSpec(ConfigFactory.load("oracle-application.conf"), Oracle) {
override def eventsCount: Int = 100
}
diff --git
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/JdbcJournalSpec.scala
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/JdbcJournalSpec.scala
index c028ad4..2a574cb 100644
---
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/JdbcJournalSpec.scala
+++
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/JdbcJournalSpec.scala
@@ -11,7 +11,7 @@ package org.apache.pekko.persistence.jdbc.integration
import org.apache.pekko
import pekko.persistence.jdbc.journal.{ JdbcJournalSchemaSpec, JdbcJournalSpec
}
-import pekko.persistence.jdbc.testkit.internal.{ MySQL, Oracle, Postgres,
SqlServer }
+import pekko.persistence.jdbc.testkit.internal.{ MariaDB, MySQL, Oracle,
Postgres, SqlServer }
import com.typesafe.config.{ Config, ConfigFactory }
class PostgresJournalSpec extends
JdbcJournalSpec(ConfigFactory.load("postgres-application.conf"), Postgres)
@@ -37,6 +37,10 @@ class PostgresJournalSchemaSpec
class MySQLJournalSpec extends
JdbcJournalSpec(ConfigFactory.load("mysql-application.conf"), MySQL)
class MySQLJournalSpecSharedDb extends
JdbcJournalSpec(ConfigFactory.load("mysql-shared-db-application.conf"), MySQL)
+class MariaDBJournalSpec extends
JdbcJournalSpec(ConfigFactory.load("mariadb-application.conf"), MariaDB)
+class MariaDBJournalSpecSharedDb
+ extends
JdbcJournalSpec(ConfigFactory.load("mariadb-shared-db-application.conf"),
MariaDB)
+
class OracleJournalSpec extends
JdbcJournalSpec(ConfigFactory.load("oracle-application.conf"), Oracle)
class OracleJournalSpecSharedDb extends
JdbcJournalSpec(ConfigFactory.load("oracle-shared-db-application.conf"), Oracle)
diff --git
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/JdbcSnapshotStoreSpec.scala
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/JdbcSnapshotStoreSpec.scala
index e939f93..e66bb9c 100644
---
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/JdbcSnapshotStoreSpec.scala
+++
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/JdbcSnapshotStoreSpec.scala
@@ -11,7 +11,7 @@ package org.apache.pekko.persistence.jdbc.integration
import org.apache.pekko
import pekko.persistence.jdbc.snapshot.{ JdbcSnapshotStoreSchemaSpec,
JdbcSnapshotStoreSpec }
-import pekko.persistence.jdbc.testkit.internal.{ MySQL, Oracle, Postgres,
SqlServer }
+import pekko.persistence.jdbc.testkit.internal.{ MariaDB, MySQL, Oracle,
Postgres, SqlServer }
import com.typesafe.config.{ Config, ConfigFactory }
class PostgresSnapshotStoreSpec extends
JdbcSnapshotStoreSpec(ConfigFactory.load("postgres-application.conf"), Postgres)
@@ -35,6 +35,9 @@ class PostgresSnapshotStoreSchemaSpec
class MySQLSnapshotStoreSpec
extends
JdbcSnapshotStoreSpec(ConfigFactory.load("mysql-application.conf"), MySQL)
+class MariaDBSnapshotStoreSpec
+ extends
JdbcSnapshotStoreSpec(ConfigFactory.load("mariadb-application.conf"), MariaDB)
+
class OracleSnapshotStoreSpec
extends
JdbcSnapshotStoreSpec(ConfigFactory.load("oracle-application.conf"), Oracle)
diff --git
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/JournalDaoStreamMessagesMemoryTest.scala
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/JournalDaoStreamMessagesMemoryTest.scala
index fb6d5dc..d4335c9 100644
---
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/JournalDaoStreamMessagesMemoryTest.scala
+++
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/JournalDaoStreamMessagesMemoryTest.scala
@@ -11,6 +11,7 @@ package org.apache.pekko.persistence.jdbc.integration
import org.apache.pekko.persistence.jdbc.query.{
JournalDaoStreamMessagesMemoryTest,
+ MariaDBCleaner,
MysqlCleaner,
OracleCleaner,
PostgresCleaner,
@@ -25,6 +26,10 @@ class MySQLJournalDaoStreamMessagesMemoryTest
extends JournalDaoStreamMessagesMemoryTest("mysql-application.conf")
with MysqlCleaner
+class MariaDBJournalDaoStreamMessagesMemoryTest
+ extends JournalDaoStreamMessagesMemoryTest("mariadb-application.conf")
+ with MariaDBCleaner
+
class OracleJournalDaoStreamMessagesMemoryTest
extends JournalDaoStreamMessagesMemoryTest("oracle-application.conf")
with OracleCleaner
diff --git
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/JournalSequenceActorTest.scala
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/JournalSequenceActorTest.scala
index 3213041..09688c1 100644
---
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/JournalSequenceActorTest.scala
+++
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/JournalSequenceActorTest.scala
@@ -11,6 +11,7 @@ package org.apache.pekko.persistence.jdbc.integration
import org.apache.pekko.persistence.jdbc.query.{
JournalSequenceActorTest,
+ MariaDBCleaner,
MysqlCleaner,
OracleCleaner,
PostgresCleaner,
@@ -25,6 +26,10 @@ class MySQLJournalSequenceActorTest
extends JournalSequenceActorTest("mysql-application.conf", isOracle =
false)
with MysqlCleaner
+class MariaDBJournalSequenceActorTest
+ extends JournalSequenceActorTest("mariadb-application.conf", isOracle =
false)
+ with MariaDBCleaner
+
class OracleJournalSequenceActorTest
extends JournalSequenceActorTest("oracle-application.conf", isOracle =
true)
with OracleCleaner
diff --git
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/LimitWindowingStreamTest.scala
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/LimitWindowingStreamTest.scala
index 6ffcbfb..a1c023c 100644
---
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/LimitWindowingStreamTest.scala
+++
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/LimitWindowingStreamTest.scala
@@ -20,7 +20,13 @@
package org.apache.pekko.persistence.jdbc.integration
import org.apache.pekko.persistence.jdbc.journal.dao.LimitWindowingStreamTest
-import org.apache.pekko.persistence.jdbc.query.{ MysqlCleaner, OracleCleaner,
PostgresCleaner, SqlServerCleaner }
+import org.apache.pekko.persistence.jdbc.query.{
+ MariaDBCleaner,
+ MysqlCleaner,
+ OracleCleaner,
+ PostgresCleaner,
+ SqlServerCleaner
+}
class PostgresLimitWindowingStreamTest
extends LimitWindowingStreamTest("postgres-application.conf")
@@ -30,6 +36,10 @@ class MySQLLimitWindowingStreamTest
extends LimitWindowingStreamTest("mysql-application.conf")
with MysqlCleaner
+class MariaDBLimitWindowingStreamTest
+ extends LimitWindowingStreamTest("mariadb-application.conf")
+ with MariaDBCleaner
+
class OracleLimitWindowingStreamTest
extends LimitWindowingStreamTest("oracle-application.conf")
with OracleCleaner
diff --git
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/MariaDBDurableStateStorePluginSpec.scala
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/MariaDBDurableStateStorePluginSpec.scala
new file mode 100644
index 0000000..63fb5ed
--- /dev/null
+++
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/MariaDBDurableStateStorePluginSpec.scala
@@ -0,0 +1,32 @@
+/*
+ * 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.db.MariaDBProfile
+import org.apache.pekko.persistence.jdbc.state.scaladsl.{
+ DurableStateStorePluginSpec,
+ DurableStateStoreSchemaPluginSpec
+}
+
+class MariaDBDurableStateStorePluginSpec
+ extends
DurableStateStorePluginSpec(ConfigFactory.load("mariadb-shared-db-application.conf"),
MariaDBProfile) {}
+
+class MariaDBDurableStateStorePluginSchemaSpec
+ extends
DurableStateStoreSchemaPluginSpec(ConfigFactory.load("mariadb-application.conf"),
+ MariaDBProfile) {}
diff --git
a/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/MariaDBScalaJdbcDurableStateStoreQueryTest.scala
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/MariaDBScalaJdbcDurableStateStoreQueryTest.scala
new file mode 100644
index 0000000..6a73cb3
--- /dev/null
+++
b/integration-test/src/test/scala/org/apache/pekko/persistence/jdbc/integration/MariaDBScalaJdbcDurableStateStoreQueryTest.scala
@@ -0,0 +1,29 @@
+/*
+ * 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.actor.ActorSystem
+import org.apache.pekko.persistence.jdbc.state.scaladsl.JdbcDurableStateSpec
+import org.apache.pekko.persistence.jdbc.testkit.internal.MariaDB
+
+class MariaDBScalaJdbcDurableStateStoreQueryTest
+ extends
JdbcDurableStateSpec(ConfigFactory.load("mariadb-shared-db-application.conf"),
MariaDB) {
+ implicit lazy val system: ActorSystem =
+ ActorSystem("MariaDBScalaJdbcDurableStateStoreQueryTest",
config.withFallback(customSerializers))
+}
diff --git a/project/Dependencies.scala b/project/Dependencies.scala
index d725742..ba8625f 100644
--- a/project/Dependencies.scala
+++ b/project/Dependencies.scala
@@ -27,6 +27,7 @@ object Dependencies {
"org.postgresql" % "postgresql" % "42.7.8",
"com.h2database" % "h2" % "2.4.240",
"com.mysql" % "mysql-connector-j" % "9.5.0",
+ "org.mariadb.jdbc" % "mariadb-java-client" % "3.5.6",
"com.microsoft.sqlserver" % "mssql-jdbc" % "13.2.1.jre11",
"com.oracle.database.jdbc" % "ojdbc8" % "23.26.0.0.0")
diff --git a/scripts/docker-compose.yml b/scripts/docker-compose.yml
index 30e5c5e..9130946 100644
--- a/scripts/docker-compose.yml
+++ b/scripts/docker-compose.yml
@@ -22,6 +22,15 @@ services:
ports:
- "3306:3306" # credentials (root:root)
+ mariadb:
+ image: mariadb:latest
+ container_name: mariadb-test
+ environment:
+ - "TZ=Europe/Amsterdam"
+ - "MARIADB_ROOT_PASSWORD=root"
+ ports:
+ - "3307:3306" # credentials (root:root)
+
oracle:
image: gvenzl/oracle-xe:21.3.0-slim-faststart
container_name: oracle-test
diff --git a/scripts/launch-all.sh b/scripts/launch-all.sh
index dd8db87..048a3de 100755
--- a/scripts/launch-all.sh
+++ b/scripts/launch-all.sh
@@ -17,7 +17,7 @@
export VM_HOST="${VM_HOST:-localhost}"
# Wait for a certain service to become available
-# Usage: wait 3306 Mysql
+# Usage: wait 3306 MySQL
wait() {
while true; do
if ! nc -z $VM_HOST $1
@@ -35,6 +35,7 @@ docker compose -f scripts/docker-compose.yml kill
docker compose -f scripts/docker-compose.yml rm -f
docker compose -f scripts/docker-compose.yml up -d
wait 3306 MySQL
+wait 3307 MariaDB
wait 5432 Postgres
wait 1521 Oracle
wait 1433 SqlServer
diff --git a/scripts/launch-mariadb.sh b/scripts/launch-mariadb.sh
new file mode 100755
index 0000000..135ffa5
--- /dev/null
+++ b/scripts/launch-mariadb.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+# 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.
+
+export VM_HOST="${VM_HOST:-localhost}"
+
+# Wait for a certain service to become available
+# Usage: wait 3307 MariaDB
+wait() {
+while true; do
+ if ! nc -z $VM_HOST $1
+ then
+ echo "$2 not available, retrying..."
+ sleep 1
+ else
+ echo "$2 is available"
+ break;
+ fi
+done;
+}
+
+docker compose -f scripts/docker-compose.yml kill mariadb
+docker compose -f scripts/docker-compose.yml rm -f mariadb
+docker compose -f scripts/docker-compose.yml up -d mariadb
+wait 3307 MariaDB
diff --git a/scripts/mariadb-cli.sh b/scripts/mariadb-cli.sh
new file mode 100755
index 0000000..a291e62
--- /dev/null
+++ b/scripts/mariadb-cli.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# 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.
+
+echo "================== Help for mariadb cli ========================="
+echo "================================================================="
+docker exec -it mariadb-test mariadb --user=root --password=root
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]