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

Member.UpNumber fix #1799

Merged
merged 1 commit into from
Mar 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/contrib/cluster/Akka.Cluster.Sharding/ShardRegion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ private MemberAgeComparer() { }

public int Compare(Member x, Member y)
{
if (y.IsOlderThan(x)) return -1;
return x.IsOlderThan(y) ? 1 : 0;
if (x.IsOlderThan(y)) return -1;
return y.IsOlderThan(x) ? 1 : 0;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/Akka.Cluster.Tests/TestMember.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static Member Create(Address address, MemberStatus status)

public static Member Create(Address address, MemberStatus status, ImmutableHashSet<string> roles)
{
return Member.Create(new UniqueAddress(address, 0), status, roles);
return Member.Create(new UniqueAddress(address, 0), 0, status, roles);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/Akka.Cluster/Member.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ public static Member Removed(UniqueAddress node)
readonly ImmutableHashSet<string> _roles;
public ImmutableHashSet<string> Roles { get { return _roles; } }

public static Member Create(UniqueAddress uniqueAddress, MemberStatus status, ImmutableHashSet<string> roles)
public static Member Create(UniqueAddress uniqueAddress, int upNumber, MemberStatus status, ImmutableHashSet<string> roles)
{
return new Member(uniqueAddress, 0, status, roles);
return new Member(uniqueAddress, upNumber, status, roles);
Copy link
Member

Choose a reason for hiding this comment

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

Oh wow, nice catch. I could see this being responsible for some fun issues with Cluster rejoin scenarios too.

}

Member(UniqueAddress uniqueAddress, int upNumber, MemberStatus status, ImmutableHashSet<string> roles)
Expand Down
2 changes: 1 addition & 1 deletion src/core/Akka.Cluster/Proto/ClusterMessageSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ private Gossip GossipFromProto(Msg.Gossip gossip)
return new Reachability(recordBuilder.ToImmutable(), versionsBuilder.ToImmutable());
};

Func<Msg.Member, Member> memberFromProto = member => Member.Create(addressMapping[member.AddressIndex], MemberStatusFromProto[member.Status],
Func<Msg.Member, Member> memberFromProto = member => Member.Create(addressMapping[member.AddressIndex], member.HasUpNumber ? member.UpNumber : 0, MemberStatusFromProto[member.Status],
member.RolesIndexesList.Select(x => roleMapping[x]).ToImmutableHashSet());

var members = gossip.MembersList.Select(memberFromProto).ToImmutableSortedSet(Member.Ordering);
Expand Down
3 changes: 2 additions & 1 deletion src/core/Akka/Actor/ActorPath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ public bool Equals(ActorPath other)
var a = path;
foreach (string element in name)
{
a = a / element;
if(!string.IsNullOrEmpty(element))
a = a / element;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've also added fix for ActorPath operator / used in singleton proxy. This way it's also handled in akka

}
return a;
}
Expand Down