You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@kudu.apache.org by "Yingchun Lai (Code Review)" <ge...@cloudera.org> on 2019/09/21 10:32:18 UTC

[kudu-CR] [tools] Set extra-configs by JSON string

Yingchun Lai has uploaded this change for review. ( http://gerrit.cloudera.org:8080/14277


Change subject: [tools] Set extra-configs by JSON string
......................................................................

[tools] Set extra-configs by JSON string

When attempt to set a extra config to a negative number, the minus
will be parsed by gflags first, and then report an error, even if
it is wrapped by quotations marks.
e.g.
$ kudu table set_extra_config @onebox test_table kudu.table.maintenance_priority -1
ERROR: unknown command line flag '1'
This patch fixes this bug by passing a JSON string, and also support to
set multiple extra-configs. e.g.
$ kudu table set_extra_configs @onebox test_table '{"kudu.table.history_max_age_sec":"3600","kudu.table.maintenance_priority":"-1"}'

Change-Id: I3cc9a4c54d43bb0e0c67f42a2055b24b6f5f3f01
---
M src/kudu/tools/kudu-admin-test.cc
M src/kudu/tools/kudu-tool-test.cc
M src/kudu/tools/tool_action_table.cc
M src/kudu/util/jsonreader-test.cc
M src/kudu/util/jsonreader.cc
M src/kudu/util/jsonreader.h
6 files changed, 121 insertions(+), 19 deletions(-)



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

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3cc9a4c54d43bb0e0c67f42a2055b24b6f5f3f01
Gerrit-Change-Number: 14277
Gerrit-PatchSet: 1
Gerrit-Owner: Yingchun Lai <40...@qq.com>

[kudu-CR] [tools] Set extra-configs by JSON string

Posted by "Adar Dembo (Code Review)" <ge...@cloudera.org>.
Adar Dembo has posted comments on this change. ( http://gerrit.cloudera.org:8080/14277 )

Change subject: [tools] Set extra-configs by JSON string
......................................................................


Patch Set 1:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/14277/1//COMMIT_MSG
Commit Message:

http://gerrit.cloudera.org:8080/#/c/14277/1//COMMIT_MSG@9
PS1, Line 9: When attempt to set a extra config to a negative number, the minus
           : will be parsed by gflags first, and then report an error, even if
           : it is wrapped by quotations marks.
The gflags docs[1]:

  As in getopt(), -- by itself will terminate flags processing. So in foo -f1 1 -- -f2 2, f1 is considered a flag, but -f2 is not.

Did you try "kudu table set_extra_config @onebox test_table kudu.table.maintenance_priority -- -1"?

1. https://gflags.github.io/gflags/



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

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3cc9a4c54d43bb0e0c67f42a2055b24b6f5f3f01
Gerrit-Change-Number: 14277
Gerrit-PatchSet: 1
Gerrit-Owner: Yingchun Lai <40...@qq.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Yao Xu <oc...@gmail.com>
Gerrit-Reviewer: Yingchun Lai <40...@qq.com>
Gerrit-Comment-Date: Sat, 21 Sep 2019 22:15:11 +0000
Gerrit-HasComments: Yes

[kudu-CR] [tools] Set extra-configs by JSON string

Posted by "Yingchun Lai (Code Review)" <ge...@cloudera.org>.
Yingchun Lai has posted comments on this change. ( http://gerrit.cloudera.org:8080/14277 )

Change subject: [tools] Set extra-configs by JSON string
......................................................................


Patch Set 1:

> Patch Set 1:
> 
> (1 comment)

Thanks for your info!
Now I try it, and it wokrs roughly speaking. There is a argv rearrangment[1] when gflag parse command line, arguments before and after "--" will be swaped, e.g.
"kudu table set_extra_config @onebox test_table kudu.table.maintenance_priority -- -1" will be rearranged as:
"kudu -1 table set_extra_config @onebox test_table kudu.table.maintenance_priority", and this will report
"Invalid argument: unknown command '-1'"
However we can use command:
"kudu -- table set_extra_config @onebox test_table kudu.table.maintenance_priority -1" which will be rearanged as:
"kudu table set_extra_config @onebox test_table kudu.table.maintenance_priority -1", and it works.

So, I'll abandon this CR.

1. https://github.com/gflags/gflags/blob/b051bace27a6ac03fc0cbbeef117fe1d375aca1b/src/gflags.h.in#L341


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

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3cc9a4c54d43bb0e0c67f42a2055b24b6f5f3f01
Gerrit-Change-Number: 14277
Gerrit-PatchSet: 1
Gerrit-Owner: Yingchun Lai <40...@qq.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Yao Xu <oc...@gmail.com>
Gerrit-Reviewer: Yingchun Lai <40...@qq.com>
Gerrit-Comment-Date: Sun, 22 Sep 2019 11:11:09 +0000
Gerrit-HasComments: No

[kudu-CR] [tools] Set extra-configs by JSON string

Posted by "Yingchun Lai (Code Review)" <ge...@cloudera.org>.
Yingchun Lai has abandoned this change. ( http://gerrit.cloudera.org:8080/14277 )

Change subject: [tools] Set extra-configs by JSON string
......................................................................


Abandoned

not needed
-- 
To view, visit http://gerrit.cloudera.org:8080/14277
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: abandon
Gerrit-Change-Id: I3cc9a4c54d43bb0e0c67f42a2055b24b6f5f3f01
Gerrit-Change-Number: 14277
Gerrit-PatchSet: 1
Gerrit-Owner: Yingchun Lai <40...@qq.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Yao Xu <oc...@gmail.com>
Gerrit-Reviewer: Yingchun Lai <40...@qq.com>