Skip to content

Comments

Make ClusterControl.membershipSnapshot async property#969

Merged
ktoso merged 6 commits intoapple:mainfrom
yim-lee:iss949
Jun 13, 2022
Merged

Make ClusterControl.membershipSnapshot async property#969
ktoso merged 6 commits intoapple:mainfrom
yim-lee:iss949

Conversation

@yim-lee
Copy link
Member

@yim-lee yim-lee commented Jun 10, 2022

Resolves #949

@yim-lee yim-lee requested a review from ktoso June 10, 2022 06:26
self.membershipSnapshotLock.lock()
defer { self.membershipSnapshotLock.unlock() }
self._membershipSnapshotHolder.membership = snapshot
Task {
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure about usages of Task.

Copy link
Member

@ktoso ktoso left a comment

Choose a reason for hiding this comment

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

LGTM! Just very minor comments

try self.joinNodes(node: first, with: second, ensureMembers: .up)
try self.joinNodes(node: thirdNeverDownSystem, with: second, ensureMembers: .up)
try await self.joinNodes(node: first, with: second, ensureMembers: .up)
try await self.joinNodes(node: thirdNeverDownSystem, with: second, ensureMembers: .up)
Copy link
Member

Choose a reason for hiding this comment

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

Sweet :) nice to see the progressive asyncification of the test kit

get async throws {
try await self._membershipSnapshotHolder.get()
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Sweet :)

self._membershipSnapshotHolder.membership = snapshot
Task {
try await self._membershipSnapshotHolder.update(snapshot)
}
Copy link
Member

Choose a reason for hiding this comment

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

Yeah that's probably fine to be honest

private let membershipSnapshotLock: Lock
private let _membershipSnapshotHolder: MembershipHolder
private class MembershipHolder {
internal distributed actor MembershipHolder {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe as just an actor, no need to for distribution in this one after all?

Copy link
Member Author

@yim-lee yim-lee Jun 10, 2022

Choose a reason for hiding this comment

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

Ah that simplifies things

Amended 3efd08f

if let myselfMember = try await self.cluster.membershipSnapshot.uniqueMember(self.cluster.uniqueNode) {
self.cluster.down(member: myselfMember)
}
}
Copy link
Member

Choose a reason for hiding this comment

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

This probably is enough to use the cluster.down(node:) API, so then we don't need the task and async await dance 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

amended 3efd08f

@yim-lee yim-lee requested a review from ktoso June 10, 2022 17:58
@yim-lee
Copy link
Member Author

yim-lee commented Jun 10, 2022

Test failure: #970

@swift-server-bot test this please

@yim-lee
Copy link
Member Author

yim-lee commented Jun 10, 2022

Test failure: #971

@swift-server-bot test this please

@ktoso
Copy link
Member

ktoso commented Jun 13, 2022

Thanks for logging the failures, will investigate 👍

Copy link
Member

@ktoso ktoso left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@ktoso ktoso merged commit a8fb579 into apple:main Jun 13, 2022
@yim-lee yim-lee deleted the iss949 branch June 13, 2022 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make system.cluster.membershipSnapshot an async property so we can back it by an actor

2 participants