-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix selecting serializer in BatchingSqlJournal #2946
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix selecting serializer in BatchingSqlJournal #2946
Conversation
MNTR on .NET Core issue |
@Aaronontheweb @pmbanka this PR is targeting dev branch. should it be targeting v1.3 branch? |
@Aaronontheweb @pmbanka if it is supposed to be targeting dev branch, I'll need to make a quick change to the dev branch build scripts to no-op on this build step. stand by and I will submit a PR, it'll need to be there anyway |
Update - you can disregard whatever is below the line, actually old journal will also throw NRE on a null payload, so this is at least consistent. @Aaronontheweb @heynickc one more thing. The batching version is not 100% replacement of non-batching event journal, because regular akka.net/src/contrib/persistence/Akka.Persistence.Sql.Common/Journal/QueryExecutor.cs Line 623 in 020ae2d
whereas current implementation of |
@heynickc I targeted |
@pmbanka target the v1.3 branch. We're releasing it in a day or so. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
@@ -527,7 +526,7 @@ protected BatchingSqlJournal(BatchingSqlJournalSetup setup) | |||
|
|||
_remainingOperations = Setup.MaxConcurrentOperations; | |||
Buffer = new Queue<IJournalRequest>(Setup.MaxBatchSize); | |||
_getSerializer = Context.System.Serialization.FindSerializerFor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch
@@ -1151,7 +1150,7 @@ protected virtual void WriteEvent(TCommand command, IPersistentRepresentation pe | |||
var manifest = string.IsNullOrEmpty(persistent.Manifest) | |||
? payloadType.TypeQualifiedName() | |||
: persistent.Manifest; | |||
var serializer = _getSerializer(payloadType); | |||
var serializer = _serialization.FindSerializerForType(payloadType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks right to me.
cc @alexvaluyskiy your thoughts? |
BatchingSqlJournal
has a bug where it selects serializer for a payload usingSerialization.FindSerializerFor
method, but instead of passing a payload into the method, it passes the type of payload.I changed the type of
_getSerializer
because I believe it will prevent making similar mistakes in the future.