Skip to content
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 sharding recovery error and WithTransport serialization #3744

Merged

Conversation

Aaronontheweb
Copy link
Member

Should resolve #3414 and related issues.

@Aaronontheweb
Copy link
Member Author

Got massively interrupted (airport) while I was working on this, so it's not in a compile-able state. Will prioritize this ASAP though. Think there's some possibilities for Akka.Remote performance improvements too.

@@ -42,5 +42,8 @@ class = ""Akka.Persistence.Sqlite.Journal.BatchingSqliteJournal, Akka.Persistenc
}
}");
}

// TODO: hack. Replace when https://github.com/akkadotnet/akka.net/issues/3811
protected override bool SupportsSerialization => false;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another reason for #3811 - none of the Akka.Persistence.Sql journals support WriterGuid at the moment due to their hand-rolled serialization layers, so the serialization specs will not pass.

@Aaronontheweb
Copy link
Member Author

This PR is finished - complete port of akka/akka#25068 sans the Artery bits.

string manifest = "";
if (serializer is SerializerWithStringManifest)
// TODO: hack. Replace when https://github.com/akkadotnet/akka.net/issues/3811
Akka.Serialization.Serialization.WithTransport(_serialization.System, () =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I right that WithTransport sets a specific ambient context for serialization data? If so maybe it would be easier to just pass that context directly into inner function parameter? How application will behave when we'll have multiple actor systems living in the same process, serializing at the same time?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't pass it in because other libraries may not directly have access to when it's set via Akka.Remote - rather it gets parked ambiently in the local thread's storage and then unset when it's done being used. Won't be an issue for multiple actor systems due to the latter - the reference always gets unset and not leaked from the thread. There's more comments on the JVM issue that I ported this from: akka/akka#25068

/// <summary>
/// Initializes a new instance of the <see cref="SqlSnapshotStore"/> class.
/// </summary>
/// <param name="config">The configuration used to configure the snapshot store.</param>
protected SqlSnapshotStore(Config config)
{
_actorSystem = Context.System.AsInstanceOf<ExtendedActorSystem>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the advantage of AsInstanceOf over direct type cast? Honestly in my opinion, this is part which follows Scala over simple logic.

{
if (serializer.IncludeManifest)
{
payload.PayloadManifest = ByteString.CopyFromUtf8(obj.GetType().TypeQualifiedName());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you checked how TypeQualifiedName works for mscorlib between .NET Core and Full Framework? IIRC, there was an issue there since two frameworks used different naming for standard lib assembly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same method we called before - I just moved it into a different place.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I.e. I kept it consistent with its previous behavior as of 1.3.13

src/core/Akka.Persistence/Snapshot/LocalSnapshotStore.cs Outdated Show resolved Hide resolved
src/core/Akka/Serialization/Serialization.cs Show resolved Hide resolved
@Aaronontheweb Aaronontheweb merged commit 8f9d19f into akkadotnet:dev Jul 18, 2019
@Aaronontheweb Aaronontheweb deleted the fix-3414-sharding-recovery-error branch July 18, 2019 01:50
Aaronontheweb added a commit to Aaronontheweb/akka.net that referenced this pull request Jul 21, 2019
…et#3744)

* fixed typo in RemoteActorRefProvider comment

* Working on akkadotnet#3414 - bringing SerializeWithTransport API up to par with JVM

* added spec to help validate CurrentTransportInformation issues

Based on the equivalent JVM spec

* working on bringing serialization up to snuff

* brought serialization class up to snuff

* wrapping up RmeoteActorRefProvider implementation

* WIP

* cleaning up Serialization class

* looks like there's a Lazy<SerializationInfo> translation from Scala to C# that we haven't quite done

* fixed Serialization class

* fixed bug with Akka.Remote.Serialization.SerializationTransportInformationSpec

* forced a couple of specs using default akka.remote configs to run sequentially

This was done in order to avoid the two specs trying to bind on the same port at the same time.

* added serialization verification to the Akka.Persistence.TCK

* fixed issues with default Akka.Perisstence.TCK specs

* fixed IActorRef serialziation support in Akka.Persistence journals and snapshot stores

* fixed compilation issuyes

* fixed Akka.Sql.Common serialization in a backwards-compatible fashion

* had to disable serialization specs for Sql Journals

* Added API approvals

* updated creator and serialize-all-messages serialization

* added ITestOutputHelper to Akka.Cluster.Sharding.Tests.SupervisionSpec

* made changes to LocalSnapshotSerializer

* fixed bug in WithTransport method

* updated Akka.Remote MessageSerializer
Aaronontheweb added a commit to Aaronontheweb/akka.net that referenced this pull request Jul 21, 2019
…et#3744)

* fixed typo in RemoteActorRefProvider comment

* Working on akkadotnet#3414 - bringing SerializeWithTransport API up to par with JVM

* added spec to help validate CurrentTransportInformation issues

Based on the equivalent JVM spec

* working on bringing serialization up to snuff

* brought serialization class up to snuff

* wrapping up RmeoteActorRefProvider implementation

* WIP

* cleaning up Serialization class

* looks like there's a Lazy<SerializationInfo> translation from Scala to C# that we haven't quite done

* fixed Serialization class

* fixed bug with Akka.Remote.Serialization.SerializationTransportInformationSpec

* forced a couple of specs using default akka.remote configs to run sequentially

This was done in order to avoid the two specs trying to bind on the same port at the same time.

* added serialization verification to the Akka.Persistence.TCK

* fixed issues with default Akka.Perisstence.TCK specs

* fixed IActorRef serialziation support in Akka.Persistence journals and snapshot stores

* fixed compilation issuyes

* fixed Akka.Sql.Common serialization in a backwards-compatible fashion

* had to disable serialization specs for Sql Journals

* Added API approvals

* updated creator and serialize-all-messages serialization

* added ITestOutputHelper to Akka.Cluster.Sharding.Tests.SupervisionSpec

* made changes to LocalSnapshotSerializer

* fixed bug in WithTransport method

* updated Akka.Remote MessageSerializer
Aaronontheweb added a commit to Aaronontheweb/akka.net that referenced this pull request Jul 26, 2019
…et#3744)

* fixed typo in RemoteActorRefProvider comment

* Working on akkadotnet#3414 - bringing SerializeWithTransport API up to par with JVM

* added spec to help validate CurrentTransportInformation issues

Based on the equivalent JVM spec

* working on bringing serialization up to snuff

* brought serialization class up to snuff

* wrapping up RmeoteActorRefProvider implementation

* WIP

* cleaning up Serialization class

* looks like there's a Lazy<SerializationInfo> translation from Scala to C# that we haven't quite done

* fixed Serialization class

* fixed bug with Akka.Remote.Serialization.SerializationTransportInformationSpec

* forced a couple of specs using default akka.remote configs to run sequentially

This was done in order to avoid the two specs trying to bind on the same port at the same time.

* added serialization verification to the Akka.Persistence.TCK

* fixed issues with default Akka.Perisstence.TCK specs

* fixed IActorRef serialziation support in Akka.Persistence journals and snapshot stores

* fixed compilation issuyes

* fixed Akka.Sql.Common serialization in a backwards-compatible fashion

* had to disable serialization specs for Sql Journals

* Added API approvals

* updated creator and serialize-all-messages serialization

* added ITestOutputHelper to Akka.Cluster.Sharding.Tests.SupervisionSpec

* made changes to LocalSnapshotSerializer

* fixed bug in WithTransport method

* updated Akka.Remote MessageSerializer
Aaronontheweb added a commit to Aaronontheweb/akka.net that referenced this pull request Jul 30, 2019
…et#3744)

* fixed typo in RemoteActorRefProvider comment

* Working on akkadotnet#3414 - bringing SerializeWithTransport API up to par with JVM

* added spec to help validate CurrentTransportInformation issues

Based on the equivalent JVM spec

* working on bringing serialization up to snuff

* brought serialization class up to snuff

* wrapping up RmeoteActorRefProvider implementation

* WIP

* cleaning up Serialization class

* looks like there's a Lazy<SerializationInfo> translation from Scala to C# that we haven't quite done

* fixed Serialization class

* fixed bug with Akka.Remote.Serialization.SerializationTransportInformationSpec

* forced a couple of specs using default akka.remote configs to run sequentially

This was done in order to avoid the two specs trying to bind on the same port at the same time.

* added serialization verification to the Akka.Persistence.TCK

* fixed issues with default Akka.Perisstence.TCK specs

* fixed IActorRef serialziation support in Akka.Persistence journals and snapshot stores

* fixed compilation issuyes

* fixed Akka.Sql.Common serialization in a backwards-compatible fashion

* had to disable serialization specs for Sql Journals

* Added API approvals

* updated creator and serialize-all-messages serialization

* added ITestOutputHelper to Akka.Cluster.Sharding.Tests.SupervisionSpec

* made changes to LocalSnapshotSerializer

* fixed bug in WithTransport method

* updated Akka.Remote MessageSerializer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exception in PersistentShardCoordinator ReceiveRecover
2 participants