akkadotnet / akka.persistence.mysql Goto Github PK
View Code? Open in Web Editor NEWMySQL implementation for Akka.Persistence
License: Apache License 2.0
MySQL implementation for Akka.Persistence
License: Apache License 2.0
To be consistent with SqlServer, Postgres, Cassandra plugins, test against a container running MySql
Many tests fail with exception:
MySql.Data.MySqlClient.MySqlException
Authentication to host 'localhost' for user 'root' using method 'mysql_native_password' failed with message: Unknown database 'akka_persistence_tests'
at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.AuthenticationFailed(Exception ex)
at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.ReadPacket()
at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.Authenticate(Boolean reset)
at MySql.Data.MySqlClient.NativeDriver.Open()
at MySql.Data.MySqlClient.Driver.Open()
at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)
at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
at MySql.Data.MySqlClient.MySqlPool.GetConnection()
at MySql.Data.MySqlClient.MySqlConnection.Open()
at Akka.Persistence.MySql.Tests.DbUtils.Initialize() in ...\src\Akka.Persistence.MySql.Tests\DbUtils.cs:line 28
Tests create schema when schema is missing.
The code creating database actually exists but it doesn't execute because connection fails to open when the specified database is missing. I assume config should be updated so that database name is specified separately from connection string
The AbstractQueryExecutor code uses ExecuteReaderAsync
. It's a long-standing bug in MySql.Data (bug 70111) that the async I/O methods are not implemented; thus all these methods will fall back to running synchronously. (See also here and here on Stack Overflow.)
To fix this, you could switch to https://github.com/mysql-net/MySqlConnector, an OSS replacement for MySql.Data that supports true asynchronous I/O.
If you're interested in this, I'd be happy to open a PR.
When snapshot data is bigger than 65,535 bytes, following error is observed in logs:
Failed to save snapshot, Error: MySql.Data.MySqlClient.MySqlException (0x80004005): Data too long for column 'snapshot' at row 1
at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId)
at MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32& affectedRows, Int64& insertedId)
at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)
at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
at System.Data.Common.DbCommand.ExecuteNonQueryAsync(CancellationToken cancellationToken)
When I run the application. It always throw this error.
repo: https://github.com/heyixiaoran/AkkaTest/tree/test
[ERROR][2018/11/13 2:36:56][Thread 0004][akka://actor-system/system/akka.persistence.journal.sharding] Error while creating actor instance of type Akka.Persistence.MySql.Journal.MySqlJournal with 1 args: ( class : "Akka.Persistence.MySql.Journal.MySqlJournal, Akka.Persistence.MySql"
plugin-dispatcher : akka.actor.default-dispatcher
connection-string : Server=localhost;Port=3306;Database=akka;Uid=root;Pwd=123456;
connection-timeout : 30s
table-name : sharding_journal
auto-initialize : on
timestamp-provider : "Akka.Persistence.Sql.Common.Journal.DefaultTimestampProvider, Akka.Persistence.Sql.Common"
metadata-table-name : sharding_metadata
)
Cause: [akka://actor-system/system/akka.persistence.journal.sharding#777175266]: Akka.Actor.ActorInitializationException: Exception during creation ---> System.TypeLoadException: Error while creating actor instance of type Akka.Persistence.MySql.Journal.MySqlJournal with 1 args: ( class : "Akka.Persistence.MySql.Journal.MySqlJournal, Akka.Persistence.MySql"
plugin-dispatcher : akka.actor.default-dispatcher
connection-string : Server=localhost;Port=3306;Database=akka;Uid=root;Pwd=123456;
connection-timeout : 30s
table-name : sharding_journal
auto-initialize : on
timestamp-provider : "Akka.Persistence.Sql.Common.Journal.DefaultTimestampProvider, Akka.Persistence.Sql.Common"
metadata-table-name : sharding_metadata
) ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MissingMethodException: Method not found: 'Void Akka.Persistence.Sql.Common.Journal.QueryConfiguration..ctor(System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.TimeSpan, System.String)'.
at Akka.Persistence.MySql.Journal.MySqlJournal..ctor(Config journalConfig)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, Object[] args)
at Akka.Actor.Props.ActivatorProducer.Produce()
at Akka.Actor.Props.NewActor()
--- End of inner exception stack trace ---
at Akka.Actor.Props.NewActor()
at Akka.Actor.ActorCell.CreateNewActorInstance()
at Akka.Actor.ActorCell.<>c__DisplayClass109_0.b__0()
at Akka.Actor.ActorCell.UseThreadContext(Action action)
at Akka.Actor.ActorCell.NewActor()
at Akka.Actor.ActorCell.Create(Exception failure)
--- End of inner exception stack trace ---
at Akka.Actor.ActorCell.Create(Exception failure)
at Akka.Actor.ActorCell.SysMsgInvokeAll(EarliestFirstSystemMessageList messages, Int32 currentState)
[ERROR][2018/11/13 2:36:56][Thread 0004][akka://actor-system/system/akka.persistence.snapshot-store.sharding] Error while creating actor instance of type Akka.Persistence.MySql.Snapshot.MySqlSnapshotStore with 1 args: ( class : "Akka.Persistence.MySql.Snapshot.MySqlSnapshotStore, Akka.Persistence.MySql"
plugin-dispatcher : akka.actor.default-dispatcher
connection-string : Server=localhost;Port=3306;Database=akka;Uid=root;Pwd=123456;
connection-timeout : 30s
table-name : snapshot_store
auto-initialize : on
)
Cause: [akka://actor-system/system/akka.persistence.snapshot-store.sharding#464385363]: Akka.Actor.ActorInitializationException: Exception during creation ---> System.TypeLoadException: Error while creating actor instance of type Akka.Persistence.MySql.Snapshot.MySqlSnapshotStore with 1 args: ( class : "Akka.Persistence.MySql.Snapshot.MySqlSnapshotStore, Akka.Persistence.MySql"
plugin-dispatcher : akka.actor.default-dispatcher
connection-string : Server=localhost;Port=3306;Database=akka;Uid=root;Pwd=123456;
connection-timeout : 30s
table-name : snapshot_store
auto-initialize : on
) ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MissingMethodException: Method not found: 'Void Akka.Persistence.Sql.Common.Snapshot.QueryConfiguration..ctor(System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.TimeSpan, System.String)'.
at Akka.Persistence.MySql.Snapshot.MySqlSnapshotStore..ctor(Config config)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, Object[] args)
at Akka.Actor.Props.ActivatorProducer.Produce()
at Akka.Actor.Props.NewActor()
--- End of inner exception stack trace ---
at Akka.Actor.Props.NewActor()
at Akka.Actor.ActorCell.CreateNewActorInstance()
at Akka.Actor.ActorCell.<>c__DisplayClass109_0.b__0()
at Akka.Actor.ActorCell.UseThreadContext(Action action)
at Akka.Actor.ActorCell.NewActor()
at Akka.Actor.ActorCell.Create(Exception failure)
--- End of inner exception stack trace ---
at Akka.Actor.ActorCell.Create(Exception failure)
at Akka.Actor.ActorCell.SysMsgInvokeAll(EarliestFirstSystemMessageList messages, Int32 currentState)
I am having problems with using the 1.0.0 version of this module because of changes to signatures.
I discovered the latest changes were not pushed to Nuget: See https://www.nuget.org/packages/Akka.Persistence.MySql/
Please publish this to Nuget. Is there something I can do to help?
In order to prevent bugs when the default config changes, every persistence plugin should have an implementation of this Test:
https://github.com/akkadotnet/akka.net/blob/dev/src/core/Akka.Cluster.Tests/ClusterConfigSpec.cs
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.