-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix DData infinite status/gossip round #5056
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
Conversation
var path = _config.GetString("dir"); | ||
_dir = path.EndsWith(DatabaseName) | ||
? Path.GetFullPath($"{path}-{Context.System.Name}-{Self.Path.Parent.Name}-{Cluster.Cluster.Get(Context.System).SelfAddress.Port}") | ||
: Path.GetFullPath(path); | ||
|
||
_dirExists = Directory.Exists(_dir); | ||
|
||
_log.Info($"Using durable data in LMDB directory [{_dir}]"); |
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.
Move logging here, should be called once at startup, not every time a new LMDB environment is created
|
||
namespace Akka.DistributedData.Serialization.Proto.Msg | ||
{ | ||
internal sealed partial class OtherMessage : IComparable<OtherMessage> |
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.
Needed to allow OtherMessage
can be sorted
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.
Would it be easier to just write an IComparer
? So we don't have to hack around a generated class?
b.Vvector = SerializationSupport.VersionVectorToProto(ints.VersionVector); | ||
b.TypeInfo.Type = ValType.Int; | ||
var intElements = new List<int>(ints.ElementsMap.Keys); | ||
intElements.Sort(); |
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.
ORSet elements need to be sorted during serialization so that it have consistent SHA-1 digest
foreach (var val in intElements) | ||
{ | ||
b.IntElements.Add(val); | ||
b.Dots.Add(SerializationSupport.VersionVectorToProto(ints.ElementsMap[val])); |
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.
ElementsMap isn't serialized as a dictionary, instead keys and version vector are serialized as separate lists. Due to this serialization scheme, key ordering and value ordering matters. VersionVector need to be inserted in the same order as the newly sorted keys.
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.
One small change
@@ -80,11 +82,16 @@ public LmdbDurableStore(Config config) | |||
TimeSpan.Zero : | |||
_config.GetTimeSpan("write-behind-interval"); | |||
|
|||
_mapSize = _config.GetByteSize("map-size") ?? 100 * 1024 * 1024; |
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.
This was always the default size, so no big deal.
|
||
private readonly TimeSpan _writeBehindInterval; | ||
private readonly string _dir; | ||
private bool _dirExists; |
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.
Good idea to cache this
|
||
namespace Akka.DistributedData.Serialization.Proto.Msg | ||
{ | ||
internal sealed partial class OtherMessage : IComparable<OtherMessage> |
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.
Would it be easier to just write an IComparer
? So we don't have to hack around a generated class?
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.
LGTM
|
||
namespace Akka.DistributedData.Serialization | ||
{ | ||
internal class OtherMessageComparer : IComparer<OtherMessage> |
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.
We should make this static
and have a readonly
singleton here, but we can easily do that in an update
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.
Ah, you already did that inside the serializer
Closes #5022