You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@kudu.apache.org by "Adar Dembo (Code Review)" <ge...@cloudera.org> on 2016/08/16 01:08:56 UTC

[kudu-CR] tool: rewrite parser logic

Adar Dembo has uploaded a new change for review.

  http://gerrit.cloudera.org:8080/3996

Change subject: tool: rewrite parser logic
......................................................................

tool: rewrite parser logic

While leaf and non-leaf actions share some common properties, there is much
they don't share. Rather than shoehorn both into the same Action paradigm, I
think it makes more sense to consider them separately.

This patch splits Action into either Mode (non-leaf node) or Action (leaf
node). The common properties are now found in the Label struct.
Additionally, each kind of node is now structured as a class with proper
encapsulation, builders, and other goodies. Overall this simplifies the
command line parsing logic, hides more internal details, and reduces the
boilerplate needed to add a mode or an action.

There's no change to the tool's interface with the outside world.

Change-Id: I794fc527525a57283f0165e262283adf14160def
---
M src/kudu/tools/tool_action.cc
M src/kudu/tools/tool_action.h
M src/kudu/tools/tool_action_fs.cc
M src/kudu/tools/tool_action_tablet.cc
M src/kudu/tools/tool_main.cc
5 files changed, 340 insertions(+), 203 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/96/3996/1
-- 
To view, visit http://gerrit.cloudera.org:8080/3996
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I794fc527525a57283f0165e262283adf14160def
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Adar Dembo <ad...@cloudera.com>

[kudu-CR] tool: rewrite parser logic

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Todd Lipcon has submitted this change and it was merged.

Change subject: tool: rewrite parser logic
......................................................................


tool: rewrite parser logic

While leaf and non-leaf actions share some common properties, there is much
they don't share. Rather than shoehorn both into the same Action paradigm, I
think it makes more sense to consider them separately.

This patch splits Action into either Mode (non-leaf node) or Action (leaf
node). The common properties are now found in the Label struct.
Additionally, each kind of node is now structured as a class with proper
encapsulation, builders, and other goodies. Overall this simplifies the
command line parsing logic, hides more internal details, and reduces the
boilerplate needed to add a mode or an action.

There's no change to the tool's interface with the outside world.

Change-Id: I794fc527525a57283f0165e262283adf14160def
Reviewed-on: http://gerrit.cloudera.org:8080/3996
Tested-by: Kudu Jenkins
Reviewed-by: Todd Lipcon <to...@apache.org>
---
M src/kudu/tools/tool_action.cc
M src/kudu/tools/tool_action.h
M src/kudu/tools/tool_action_fs.cc
M src/kudu/tools/tool_action_tablet.cc
M src/kudu/tools/tool_main.cc
5 files changed, 333 insertions(+), 200 deletions(-)

Approvals:
  Todd Lipcon: Looks good to me, approved
  Kudu Jenkins: Verified



-- 
To view, visit http://gerrit.cloudera.org:8080/3996
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I794fc527525a57283f0165e262283adf14160def
Gerrit-PatchSet: 4
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>

[kudu-CR] tool: rewrite parser logic

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Todd Lipcon has posted comments on this change.

Change subject: tool: rewrite parser logic
......................................................................


Patch Set 2: Code-Review+2

-- 
To view, visit http://gerrit.cloudera.org:8080/3996
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I794fc527525a57283f0165e262283adf14160def
Gerrit-PatchSet: 2
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-HasComments: No

[kudu-CR] tool: rewrite parser logic

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Todd Lipcon has posted comments on this change.

Change subject: tool: rewrite parser logic
......................................................................


Patch Set 2:

looks good but the patch it's based on seems to have exploded.

-- 
To view, visit http://gerrit.cloudera.org:8080/3996
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I794fc527525a57283f0165e262283adf14160def
Gerrit-PatchSet: 2
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-HasComments: No

[kudu-CR] tool: rewrite parser logic

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Todd Lipcon has posted comments on this change.

Change subject: tool: rewrite parser logic
......................................................................


Patch Set 3: Code-Review+2

-- 
To view, visit http://gerrit.cloudera.org:8080/3996
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I794fc527525a57283f0165e262283adf14160def
Gerrit-PatchSet: 3
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-HasComments: No

[kudu-CR] tool: rewrite parser logic

Posted by "Adar Dembo (Code Review)" <ge...@cloudera.org>.
Hello Todd Lipcon, Kudu Jenkins,

I'd like you to reexamine a change.  Please visit

    http://gerrit.cloudera.org:8080/3996

to look at the new patch set (#2).

Change subject: tool: rewrite parser logic
......................................................................

tool: rewrite parser logic

While leaf and non-leaf actions share some common properties, there is much
they don't share. Rather than shoehorn both into the same Action paradigm, I
think it makes more sense to consider them separately.

This patch splits Action into either Mode (non-leaf node) or Action (leaf
node). The common properties are now found in the Label struct.
Additionally, each kind of node is now structured as a class with proper
encapsulation, builders, and other goodies. Overall this simplifies the
command line parsing logic, hides more internal details, and reduces the
boilerplate needed to add a mode or an action.

There's no change to the tool's interface with the outside world.

Change-Id: I794fc527525a57283f0165e262283adf14160def
---
M src/kudu/tools/tool_action.cc
M src/kudu/tools/tool_action.h
M src/kudu/tools/tool_action_fs.cc
M src/kudu/tools/tool_action_tablet.cc
M src/kudu/tools/tool_main.cc
5 files changed, 333 insertions(+), 200 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/96/3996/2
-- 
To view, visit http://gerrit.cloudera.org:8080/3996
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I794fc527525a57283f0165e262283adf14160def
Gerrit-PatchSet: 2
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>

[kudu-CR] tool: rewrite parser logic

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Todd Lipcon has posted comments on this change.

Change subject: tool: rewrite parser logic
......................................................................


Patch Set 1:

(2 comments)

http://gerrit.cloudera.org:8080/#/c/3996/1/src/kudu/tools/tool_action.h
File src/kudu/tools/tool_action.h:

PS1, Line 66: // Invokes an action, passing in the complete action chain and all remaining
            : // command line arguments. The arguments are passed by value so that the
            : // function can modify them if need be.
what's this comment attached to?


PS1, Line 94:  // After Build() is called, submodes_ and actions_ are empty.
hrm, isn't it better to just say 'May be only called once'?


-- 
To view, visit http://gerrit.cloudera.org:8080/3996
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I794fc527525a57283f0165e262283adf14160def
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-HasComments: Yes

[kudu-CR] tool: rewrite parser logic

Posted by "Kudu Jenkins (Code Review)" <ge...@cloudera.org>.
Kudu Jenkins has posted comments on this change.

Change subject: tool: rewrite parser logic
......................................................................


Patch Set 3:

Build Started http://104.196.14.100/job/kudu-gerrit/2942/

-- 
To view, visit http://gerrit.cloudera.org:8080/3996
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I794fc527525a57283f0165e262283adf14160def
Gerrit-PatchSet: 3
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-HasComments: No

[kudu-CR] tool: rewrite parser logic

Posted by "Kudu Jenkins (Code Review)" <ge...@cloudera.org>.
Kudu Jenkins has posted comments on this change.

Change subject: tool: rewrite parser logic
......................................................................


Patch Set 1:

Build Started http://104.196.14.100/job/kudu-gerrit/2933/

-- 
To view, visit http://gerrit.cloudera.org:8080/3996
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I794fc527525a57283f0165e262283adf14160def
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-HasComments: No

[kudu-CR] tool: rewrite parser logic

Posted by "Kudu Jenkins (Code Review)" <ge...@cloudera.org>.
Kudu Jenkins has posted comments on this change.

Change subject: tool: rewrite parser logic
......................................................................


Patch Set 2:

Build Started http://104.196.14.100/job/kudu-gerrit/2936/

-- 
To view, visit http://gerrit.cloudera.org:8080/3996
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I794fc527525a57283f0165e262283adf14160def
Gerrit-PatchSet: 2
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-HasComments: No

[kudu-CR] tool: rewrite parser logic

Posted by "Adar Dembo (Code Review)" <ge...@cloudera.org>.
Adar Dembo has posted comments on this change.

Change subject: tool: rewrite parser logic
......................................................................


Patch Set 3:

> looks good but the patch it's based on seems to have exploded.

Yeah, I rebased to switch the order around. And I thought _that_ patch was the non-controversial one. Guess it needs more work.

-- 
To view, visit http://gerrit.cloudera.org:8080/3996
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I794fc527525a57283f0165e262283adf14160def
Gerrit-PatchSet: 3
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-HasComments: No

[kudu-CR] tool: rewrite parser logic

Posted by "Adar Dembo (Code Review)" <ge...@cloudera.org>.
Adar Dembo has posted comments on this change.

Change subject: tool: rewrite parser logic
......................................................................


Patch Set 1:

(2 comments)

http://gerrit.cloudera.org:8080/#/c/3996/1/src/kudu/tools/tool_action.h
File src/kudu/tools/tool_action.h:

PS1, Line 66: // Invokes an action, passing in the complete action chain and all remaining
            : // command line arguments. The arguments are passed by value so that the
            : // function can modify them if need be.
> what's this comment attached to?
Oops, meant to remove that.


PS1, Line 94:  // After Build() is called, submodes_ and actions_ are empty.
> hrm, isn't it better to just say 'May be only called once'?
OK.


-- 
To view, visit http://gerrit.cloudera.org:8080/3996
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I794fc527525a57283f0165e262283adf14160def
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-HasComments: Yes