Skip to content

Conversation

@hanishakoneru
Copy link
Contributor

A command line tool (ozone omha) to get information related to OM HA.
This Jira proposes to add the getServiceState option for OM HA which lists all the OMs in the service and their corresponding Ratis server roles (LEADER/ FOLLOWER).
We can later add more options to this tool.

@hadoop-yetus

This comment has been minimized.

Comment on lines 59 to 62
Copy link
Contributor

@dineshchitlangia dineshchitlangia Oct 4, 2019

Choose a reason for hiding this comment

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

It will be better to use entrySet() instead of keySet() for performance as it would avoid the lookup on L61. Although this method will not be doing extensive amount of work, I believe it is still worth making this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

Choose a reason for hiding this comment

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

Declare this class as final.

Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: Have we named this command omha because we have plans in future to also add similar command for SCM?
If not, how about naming the command as haadmin , omadmin, admin.
Not a deal breaker but was just thinking if we can keep it similar to hdfs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed the command to "ozone admin om".
SCM HA is also in the pipeline sometime in the future.
As Marton also suggested, we can have all admin commands under this. This will include SCMCli also.

Copy link
Contributor

@dineshchitlangia dineshchitlangia left a comment

Choose a reason for hiding this comment

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

Thanks @hanishakoneru for working on this.
Posted comments inline requesting changes.

Also, there are checkstyle/findbugs violation related to patch.

Copy link
Member

@elek elek left a comment

Choose a reason for hiding this comment

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

Thanks the patch @hanishakoneru.

Overall it looks good to me, but I have usability suggestions (not strong opinions). And sorry if they seem to be bikeshedding.

  1. Until now we put more and more admin commands to ozone scmlcli. Recently we discussed to rename it to something more generic (ozone admin is suggested in HDDS-2184). If it will be a generic admin tool I think it would be better to put this helper to there. (ozone admin omha ....).

  2. As half of my life spent in linux command line, I would prefer to use the generic cli conventions (use --long-parameter instead of --longParameter (avoid camelCase) and use simple subcommand for the name of the action instead of --subcommand). In short: try to follow the convention of git.

Eg. use ozone admin om getservicestate --service-id

But it could be only my preference ;-)

  1. Recently I spent a little time to unify all the RPC interfaces to use the same pattern.

message OMRequest {
  required Type cmdType = 1; // Type of the command

  // A string that identifies this command, we generate  Trace ID in Ozone
  // frontend and this allows us to trace that command all over ozone.
  optional string traceID = 2;

  required string clientId = 3;

  optional UserInfo userInfo = 4;


  optional CreateVolumeRequest              createVolumeRequest            = 11;
  optional SetVolumePropertyRequest         setVolumePropertyRequest       = 12;
  optional CheckVolumeAccessRequest         checkVolumeAccessRequest       = 13;
  optional InfoVolumeRequest                infoVolumeRequest              = 14;

I called it message based pattern: we have one method and the calls are separated by the message type (in proto2, in proto3 it will be nicer). I know that it's not the perfect approach (adding typesafe new method to the rpc service -- as you did -- has some visibility benefit), but this the convention which is started by a other proto files in ozone. I would prefer to follow a common pattern even if this is not the best one.

And if we use this convention the OzoneProtocolMessageDispatcher would provide logging, metrics, ozone-insight and opentracing support for free. Therefore I suggest to add new call as a new type to the OMRequest (submitRequest(OMRequest)).

  1. I guess your motivation was to separate the admin commands and client commands and I 100% agree with you. But currently in ozone scm the admin commands and client commands both in ScmContainerLocationRequest. Which is not perfect, I agree. But for good separation (IMHO) we need two separated RPC service/port (one for the client one for the admin commands, and the port of the admin commands can be disabled/guarded).

So I suggest to put it to the OzoneProtocol.proto as part of the OMRequest (as a short term solution). Or create a new RPC server (OzoneManagerAdminProtocol) and follow the exisisting message based approach there.

(and sorry if my comments were too opinionated)

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 use case for this RPC? it is used only from the OM HA tool? or is some thing that clients need to know when communicating with the OM? if clients need to know this info, then clients already make a call called getServiceList and this info is more appropriate to be part of that call? Then both clients and tools like OM HA can get to that information pretty easily.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Clients do not need this information.
I have added a new OMRequest to get the OM server roles. Did not add it to getServiceList api because getServiceList is called when creating RpcClient (so all clients make this call when starting up). But adding the server roles also to this api would mean one extra Ratis call to get the server roles which is not required by all clients. Hence, kept the two calls separate.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry did not see this comment. How can a client communicate to OM? Does it not need to send the request to the leader ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also just wondering, is there a reason to add a new RPC and not use the submitRequet pattern -- that is add the message to the OMRequest / OMResponse pattern?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right. There is no need for new RPC. I thought we could keep the admin protocols separate from the client protocols. But I think we can just use the OMRequest for now. Updated it.

@elek
Copy link
Member

elek commented Oct 13, 2019

Thank you very much to open this pull request.

During the weekend the Ozone source code has been moved out from apache/hadoop repository to apache/hadoop-ozone repository.

This git commits are rewritten, but the branch of this pull request is also transformed (state of Saturday morning), you can use the new, migrated branch to recreate this pull request.

Your pull request is important for us: Can you please re-create your pull request in the new repository?

1. Create a new fork of https://github.com/apache/hadoop-ozone

2. Clone it and have both your fork and the apache repo as remotes:

git clone [email protected]:hanishakoneru/hadoop-ozone.git
cd hadoop-ozone
git remote add apache [email protected]:apache/hadoop-ozone.git
git fetch apache

3. Fetch your migrated branch and push it to your fork.

git checkout -b HDDS-2240 apache/HDDS-2240
git push origin HDDS-2240

4. And create the new pull request on the new repository.

https://github.com/apache/hadoop-ozone/compare/master...hanishakoneru:HDDS-2240?expand=1

If you need more information, please check this wiki page or contact with me (my github user name + apache.org).

Thank you, and sorry for the inconvenience.

@hanishakoneru
Copy link
Contributor Author

@elek Thank you for your comments and suggestions.

  1. I have changed the command to "ozone admin om". We can add scmcli also to the same ozone admin command. Also followed the cli conventions. The command would look like
    ozone admin om getserviceroles --service-id
  2. Updated the protocol and using the a new OMRequest to get the service roles.

@hanishakoneru
Copy link
Contributor Author

Thank you @dineshchitlangia @elek and @anuengineer for the review and comments.
I have migrated the Pull Request to the new hadoop-ozone repo - apache/ozone#9

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
0 reexec 42 Docker mode activated.
_ Prechecks _
+1 dupname 0 No case conflicting files found.
0 shelldocs 1 Shelldocs was not available.
+1 @author 0 The patch does not contain any @author tags.
-1 test4tests 0 The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
_ trunk Compile Tests _
0 mvndep 35 Maven dependency ordering for branch
-1 mvninstall 35 hadoop-hdds in trunk failed.
-1 mvninstall 38 hadoop-ozone in trunk failed.
-1 compile 24 hadoop-hdds in trunk failed.
-1 compile 19 hadoop-ozone in trunk failed.
+1 checkstyle 62 trunk passed
+1 mvnsite 0 trunk passed
+1 shadedclient 813 branch has no errors when building and testing our client artifacts.
-1 javadoc 27 hadoop-hdds in trunk failed.
-1 javadoc 24 hadoop-ozone in trunk failed.
0 spotbugs 932 Used deprecated FindBugs config; considering switching to SpotBugs.
-1 findbugs 38 hadoop-hdds in trunk failed.
-1 findbugs 25 hadoop-ozone in trunk failed.
_ Patch Compile Tests _
0 mvndep 23 Maven dependency ordering for patch
-1 mvninstall 40 hadoop-hdds in the patch failed.
-1 mvninstall 41 hadoop-ozone in the patch failed.
-1 compile 29 hadoop-hdds in the patch failed.
-1 compile 23 hadoop-ozone in the patch failed.
-1 cc 29 hadoop-hdds in the patch failed.
-1 cc 23 hadoop-ozone in the patch failed.
-1 javac 29 hadoop-hdds in the patch failed.
-1 javac 23 hadoop-ozone in the patch failed.
-0 checkstyle 34 hadoop-ozone: The patch generated 27 new + 0 unchanged - 0 fixed = 27 total (was 0)
+1 mvnsite 0 the patch passed
+1 shellcheck 32 There were no new shellcheck issues.
+1 whitespace 0 The patch has no whitespace issues.
+1 shadedclient 737 patch has no errors when building and testing our client artifacts.
-1 javadoc 27 hadoop-hdds in the patch failed.
-1 javadoc 24 hadoop-ozone in the patch failed.
-1 findbugs 36 hadoop-hdds in the patch failed.
-1 findbugs 26 hadoop-ozone in the patch failed.
_ Other Tests _
-1 unit 33 hadoop-hdds in the patch failed.
-1 unit 30 hadoop-ozone in the patch failed.
+1 asflicense 36 The patch does not generate ASF License warnings.
2577
Subsystem Report/Notes
Docker Client=19.03.3 Server=19.03.3 base: https://builds.apache.org/job/hadoop-multibranch/job/PR-1586/2/artifact/out/Dockerfile
GITHUB PR #1586
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient findbugs checkstyle shellcheck shelldocs cc
uname Linux 220484ce9b24 4.15.0-60-generic #67-Ubuntu SMP Thu Aug 22 16:55:30 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality personality/hadoop.sh
git revision trunk / 5f4641a
Default Java 1.8.0_222
mvninstall https://builds.apache.org/job/hadoop-multibranch/job/PR-1586/2/artifact/out/branch-mvninstall-hadoop-hdds.txt
mvninstall https://builds.apache.org/job/hadoop-multibranch/job/PR-1586/2/artifact/out/branch-mvninstall-hadoop-ozone.txt
compile https://builds.apache.org/job/hadoop-multibranch/job/PR-1586/2/artifact/out/branch-compile-hadoop-hdds.txt
compile https://builds.apache.org/job/hadoop-multibranch/job/PR-1586/2/artifact/out/branch-compile-hadoop-ozone.txt
javadoc https://builds.apache.org/job/hadoop-multibranch/job/PR-1586/2/artifact/out/branch-javadoc-hadoop-hdds.txt
javadoc https://builds.apache.org/job/hadoop-multibranch/job/PR-1586/2/artifact/out/branch-javadoc-hadoop-ozone.txt
findbugs https://builds.apache.org/job/hadoop-multibranch/job/PR-1586/2/artifact/out/branch-findbugs-hadoop-hdds.txt
findbugs https://builds.apache.org/job/hadoop-multibranch/job/PR-1586/2/artifact/out/branch-findbugs-hadoop-ozone.txt
mvninstall https://builds.apache.org/job/hadoop-multibranch/job/PR-1586/2/artifact/out/patch-mvninstall-hadoop-hdds.txt
mvninstall https://builds.apache.org/job/hadoop-multibranch/job/PR-1586/2/artifact/out/patch-mvninstall-hadoop-ozone.txt
compile https://builds.apache.org/job/hadoop-multibranch/job/PR-1586/2/artifact/out/patch-compile-hadoop-hdds.txt
compile https://builds.apache.org/job/hadoop-multibranch/job/PR-1586/2/artifact/out/patch-compile-hadoop-ozone.txt
cc https://builds.apache.org/job/hadoop-multibranch/job/PR-1586/2/artifact/out/patch-compile-hadoop-hdds.txt
cc https://builds.apache.org/job/hadoop-multibranch/job/PR-1586/2/artifact/out/patch-compile-hadoop-ozone.txt
javac https://builds.apache.org/job/hadoop-multibranch/job/PR-1586/2/artifact/out/patch-compile-hadoop-hdds.txt
javac https://builds.apache.org/job/hadoop-multibranch/job/PR-1586/2/artifact/out/patch-compile-hadoop-ozone.txt
checkstyle https://builds.apache.org/job/hadoop-multibranch/job/PR-1586/2/artifact/out/diff-checkstyle-hadoop-ozone.txt
javadoc https://builds.apache.org/job/hadoop-multibranch/job/PR-1586/2/artifact/out/patch-javadoc-hadoop-hdds.txt
javadoc https://builds.apache.org/job/hadoop-multibranch/job/PR-1586/2/artifact/out/patch-javadoc-hadoop-ozone.txt
findbugs https://builds.apache.org/job/hadoop-multibranch/job/PR-1586/2/artifact/out/patch-findbugs-hadoop-hdds.txt
findbugs https://builds.apache.org/job/hadoop-multibranch/job/PR-1586/2/artifact/out/patch-findbugs-hadoop-ozone.txt
unit https://builds.apache.org/job/hadoop-multibranch/job/PR-1586/2/artifact/out/patch-unit-hadoop-hdds.txt
unit https://builds.apache.org/job/hadoop-multibranch/job/PR-1586/2/artifact/out/patch-unit-hadoop-ozone.txt
Test Results https://builds.apache.org/job/hadoop-multibranch/job/PR-1586/2/testReport/
Max. process+thread count 451 (vs. ulimit of 5500)
modules C: hadoop-ozone/common hadoop-ozone/client hadoop-ozone/ozone-manager hadoop-ozone/tools U: hadoop-ozone
Console output https://builds.apache.org/job/hadoop-multibranch/job/PR-1586/2/console
versions git=2.7.4 maven=3.3.9 shellcheck=0.4.6
Powered by Apache Yetus 0.10.0 http://yetus.apache.org

This message was automatically generated.

@elek
Copy link
Member

elek commented Oct 14, 2019

Thanks the migration @hanishakoneru (and BTW, thanks the update, I will check it). I am closing this one as we have the new one.

@elek elek closed this Oct 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants