Skip to content

Commit

Permalink
ChangeHandler not supported for > 1 database
Browse files Browse the repository at this point in the history
  • Loading branch information
patriknw committed Feb 5, 2024
1 parent d8fbc74 commit b67f4c3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ object R2dbcSettings {
numberOfDatabases * (numberOfDataPartitions / numberOfDatabases) == numberOfDataPartitions,
s"data-partition.number-of-databases [$numberOfDatabases] must be a whole number divisor of " +
s"data-partition.number-of-partitions [$numberOfDataPartitions].")
require(
durableStateChangeHandlerClasses.isEmpty || numberOfDatabases == 1,
"Durable State ChangeHandler not supported with more than one data partition database.")

val connectionFactorySettings =
if (numberOfDatabases == 1) {
Expand Down Expand Up @@ -291,7 +294,7 @@ final class R2dbcSettings private (
resolveAllTableNames(snapshotTableWithSchema(_))

/**
* INTERNAL API: All journal tables and their the lower slice
* INTERNAL API: All durable state tables and their the lower slice
*/
@InternalApi private[akka] val allDurableStateTablesWithSchema: Map[String, Int] =
resolveAllTableNames(durableStateTableWithSchema(_))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import scala.concurrent.Await
import scala.concurrent.ExecutionContext
import scala.concurrent.Future
import scala.concurrent.duration._

import akka.Done
import akka.actor.testkit.typed.scaladsl.LogCapturing
import akka.actor.testkit.typed.scaladsl.ScalaTestWithActorTestKit
Expand All @@ -28,6 +29,7 @@ import akka.persistence.state.scaladsl.GetObjectResult
import com.typesafe.config.Config
import com.typesafe.config.ConfigFactory
import org.scalatest.wordspec.AnyWordSpecLike

import akka.persistence.r2dbc.internal.codec.IdentityAdapter
import akka.persistence.r2dbc.internal.codec.QueryAdapter
import akka.persistence.r2dbc.internal.codec.SqlServerQueryAdapter
Expand Down Expand Up @@ -57,6 +59,9 @@ object DurableStateStoreChangeHandlerSpec {
"JavadslCustomEntity" = "$javaDslcustomEntity"
}
}
# ChangeHandler not supported for number-of-databases > 1.
# Test is pending for that, but must override to be able to "start" test.
akka.persistence.r2dbc.data-partition.number-of-databases = 1
""")
.withFallback(testConfig)

Expand Down Expand Up @@ -138,6 +143,8 @@ class DurableStateStoreChangeHandlerSpec
.getOrElse(0L)

"The R2DBC durable state store change handler" should {
// ChangeHandler not supported for number-of-databases > 1
pendingIfMoreThanOneDataPartition()

"be invoked for first revision" in {
val entityType = "CustomEntity"
Expand Down

0 comments on commit b67f4c3

Please sign in to comment.