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

cli/conn+config: all client commands should accept --url #4984

Closed
bdarnell opened this issue Mar 8, 2016 · 0 comments · Fixed by #29467
Closed

cli/conn+config: all client commands should accept --url #4984

bdarnell opened this issue Mar 8, 2016 · 0 comments · Fixed by #29467
Labels
C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) docs-todo E-easy Easy issue to tackle, requires little or no CockroachDB experience help wanted Help is requested / needed by the one who filed the issue to fix it.
Milestone

Comments

@bdarnell
Copy link
Contributor

bdarnell commented Mar 8, 2016

Currently CLI commands that use the SQL driver under the hood (sql, zone, user) accept a --url parameter, but those that use the KV (or other) API (range, node, kv, exterminate, quit) do not. Commands in the latter group should accept a URL too and parse the necessary fields from it so that users don't have to know about these implementation details. (see discussion in #4957)

@bdarnell bdarnell added this to the 1.0 milestone Mar 8, 2016
@petermattis petermattis modified the milestones: 1.0, Q2, Beta Apr 6, 2016
@petermattis petermattis modified the milestones: Q2, Q3 Jul 11, 2016
@petermattis petermattis modified the milestone: Q3 Aug 3, 2017
@knz knz added E-easy Easy issue to tackle, requires little or no CockroachDB experience help wanted Help is requested / needed by the one who filed the issue to fix it. C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) labels Aug 11, 2017
@dianasaur323 dianasaur323 added this to the Later milestone Sep 17, 2017
@knz knz changed the title cli: all client commands should accept --url cli/conn+config: all client commands should accept --url Apr 11, 2018
craig bot pushed a commit that referenced this issue Sep 6, 2018
29467: cli: make all client commands recognize `--url` r=knz a=knz

Fixes #4984.
Fixes #29567.

Prior to this patch, the client commands using a SQL connection under
the hood would accept `--url` in addition to discrete
parameters (`--host`, `--port`, etc); however, non-SQL client commands
did not recognize `--url`.

This was causing UX pain/fatigue because users had to remember which
commands accept a URL and which commands do not. It also made
automation more difficult.

(For context, it was not reasonable to propose to users to _never_ use
`--url` and always stick to discrete flags, because some parameters
can only be specified via `--url`, for example the application name.)

This patch resolves the UX problem by ensuring that all client
commands accept `--url`, in addition to the discrete flags. This
effectively makes all CockroachDB commands (*) homogeneous/consistent
wrt their connection flags.

The value provided via `--url` and via the other discrete flags mesh
as follows:

```
//            flags parser
//                /    \
//         .-----'      `-------.
//         |                    |
//       --url               --host, --port, etc
//         |                    |
//   urlParser.Set()            |
//         |                    |
//         `-------.    .-------'
//                  \  /
//          sqlCtx/cliCtx/baseCtx
//                   |
//                  / \
//         .-------'   `--------.
//         |                    |
//         |                    |
//      non-SQL           makeClientConnURL()
//     commands                 |
//    (quit, init, etc)         |
//                          SQL commands
//                        (user, zone, etc)
```

(*) except for `cockroach workload`, which still has the status an
adopted appendage with its separate argument handling.

Release note (cli change): All `cockroach` client sub-commands (except
for `cockroach workload`) now support the `--url` flag.

Co-authored-by: Raphael 'kena' Poss <knz@cockroachlabs.com>
@craig craig bot closed this as completed in #29467 Sep 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) docs-todo E-easy Easy issue to tackle, requires little or no CockroachDB experience help wanted Help is requested / needed by the one who filed the issue to fix it.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants