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

MC: Add CP subsystem mgmt operations to client #16226

Conversation

puzpuzpuz
Copy link
Contributor

  • Adds new client operations for MC purposes:
    • getCPMembers
    • promoteToCPMember
    • removeCPMember
    • resetCPSubsystem

Protocol changes: hazelcast/hazelcast-client-protocol#276

@puzpuzpuz
Copy link
Contributor Author

run-lab-run

@puzpuzpuz puzpuzpuz requested review from emre-aydin and removed request for emre-aydin December 10, 2019 16:17
List<SimpleEntry<String, String>> result = new ArrayList<>();
for (CPMember cpMember : cpMembers) {
String address = "[" + cpMember.getAddress().getHost() + "]:" + cpMember.getAddress().getPort();
result.add(new SimpleEntry<>(cpMember.getUuid().toString(), address));
Copy link
Contributor

Choose a reason for hiding this comment

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

I have commented also in protocol pr. We should use uuid type in the protocol and avoid uuid to string conversion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The type was changed.

@sancar could you take another look at this PR tomorrow?


@Override
public String getMethodName() {
return "mcGetCPMembers";
Copy link
Contributor

Choose a reason for hiding this comment

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

Needs to be getCPMembers. We use the method name in the protocol definition. Same for other message tasks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My concern is potential collision with public client operations with the same name (getCPMembers) that could be introduced in future. Do you think I should add mc prefixes into client protocol for these methods, or it's fine to get rid of them here?

Copy link
Contributor

Choose a reason for hiding this comment

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

That I don't know much about. Someone from the client team probably knows more. @asimarslan @sancar @ihsandemir what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

We are trying to match the method name to method name that user calls. If there is no User API, then the correct choice is not really well defined. In that sense, putting mc prefix to avoid a future collision is a good choice.

Even if we are trying to match the names to protocol, I am not aware of it. @asimarslan What do you think ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As the correct approach is not certain, I've removed prefixes from #getMethodNames.

Copy link
Contributor

@emre-aydin emre-aydin left a comment

Choose a reason for hiding this comment

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

Looks good apart from one minor thing to fix.

@puzpuzpuz puzpuzpuz force-pushed the v4.0/enhancement/mc-client-cp-subsystem-mgmt branch from 21b7c3f to 02021f0 Compare December 11, 2019 08:18
nodeEngine.getHazelcastInstance().getCPSubsystem().getCPSubsystemManagementService();
return cpService.getCPMembers().toCompletableFuture()
.thenApply(cpMembers -> {
List<SimpleEntry<String, String>> result = new ArrayList<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we have List<Entry<String, String>> here instead of CPMemberDTO?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's because we have to deal with data types defined for codecs. And the general guideline in the client protocol generator is to avoid adding custom types where possible. That's why List<CPMember> is represented as List<Map.Entry<String, String>>.

A side note: it's going to change from List<Map.Entry<String, String>> to List<Map.Entry<UUID, Address>> (see comment from @sancar).

Copy link
Contributor

Choose a reason for hiding this comment

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

got it. thx

@puzpuzpuz puzpuzpuz force-pushed the v4.0/enhancement/mc-client-cp-subsystem-mgmt branch from a0671d6 to c0bed93 Compare December 12, 2019 08:09
@puzpuzpuz
Copy link
Contributor Author

run-lab-run

1 similar comment
@puzpuzpuz
Copy link
Contributor Author

run-lab-run

@puzpuzpuz
Copy link
Contributor Author

Merging this PR as the only failed test is a known issue and has nothing to do with local changes:
#16079

@puzpuzpuz puzpuzpuz merged commit 24aa432 into hazelcast:master Dec 12, 2019
@puzpuzpuz puzpuzpuz deleted the v4.0/enhancement/mc-client-cp-subsystem-mgmt branch December 12, 2019 12:49
@mmedenjak mmedenjak added the Source: Internal PR or issue was opened by an employee label Apr 13, 2020
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.

None yet

5 participants