* Switch to `pflag` for all parsing
This transparently swaps the cli parsing library used by `internal/flag`
from the standard library `flag` package to `spf13/pflag`.
It also introduces hook points for packages throughout the vitess codebase
to register their flags for either all commands using `servenv` or a
particular subset of commands. This allows these packages to continue to
define their flag variables in a package-private way, but without
polluting the global flagset.
Signed-off-by: Andrew Mason <andrew@planetscale.com>
* Workaround exit code difference between stdlib `flag` and `pflag`
tl;dr stdlib `flag` has [this][1] and `pflag` does not
[1]: dcf0929de6
Signed-off-by: Andrew Mason <andrew@planetscale.com>
* adjust test data for difference in spacing between pflag/stdflag
Signed-off-by: Andrew Mason <andrew@planetscale.com>
* update lingering legacy flag tests
Signed-off-by: Andrew Mason <andrew@planetscale.com>
* Update vtgate/tabletgateway.go to use new interface to isolate flags, update test data
Signed-off-by: Andrew Mason <andrew@planetscale.com>
* update flags in java test code
Signed-off-by: Andrew Mason <andrew@planetscale.com>
* Add helper function to issue deprecation warnings when parsing flags
This package is internal, and extremely temporary. After the
necessary backwards-compatability deprecation cycle to switch to
`pflag`, will be removed.
Signed-off-by: Andrew Mason <andrew@planetscale.com>
* Update `cmd` callsites that don't parse via `servenv` to use deprecation-aware parser
Signed-off-by: Andrew Mason <andrew@planetscale.com>
* Override `Usage` func to show flags with double-dashes in `-h` output
Signed-off-by: Andrew Mason <andrew@planetscale.com>
* Extract and rework the deprecation warning text, plus a little cleaner structure
Signed-off-by: Andrew Mason <andrew@planetscale.com>
* Fixup import ordering for `context` while I'm here
Signed-off-by: Andrew Mason <andrew@planetscale.com>
* Handle positional arguments to filter out the double-dash for backwards compatibility
Signed-off-by: Andrew Mason <andrew@planetscale.com>
* Refactor to support subflag usages and custom usage funcs
Signed-off-by: Andrew Mason <andrew@planetscale.com>
* Add ability to filter out certain flags from the Usage
Signed-off-by: Andrew Mason <andrew@planetscale.com>
* Documentation for SetUsage nonsense
Signed-off-by: Andrew Mason <andrew@planetscale.com>
* Override custom Usages, preserving intended effects
Signed-off-by: Andrew Mason <andrew@planetscale.com>
* Special consideration for v1 reshard workflow cli
Signed-off-by: Andrew Mason <andrew@planetscale.com>
* Update flags in tests
Signed-off-by: Andrew Mason <andrew@planetscale.com>
* Filter out double-dash separator when running `vtctl`/`vtctlclient` <= v13.0.0
Signed-off-by: Andrew Mason <andrew@planetscale.com>
* Add release notes for CLI deprecations with advice
Signed-off-by: Andrew Mason <andrew@planetscale.com>
The code seems to be out of date, unmaintained, and incompatible with current versions of influx and recent versions of the influx golang client.
Signed-off-by: David Weitzman <dweitzman@pinterest.com>
Note: This is the revert of a temporary revert and has the same effect
as the original PR: https://github.com/vitessio/vitess/pull/3830
Revert "Revert "Factor out glog references""
This reverts commit 246e2898d2.
Signed-off-by: David Weitzman <dweitzman@pinterest.com>
This commit consists only of the changes from running the following:
```
find go -name '*.go' | xargs -n 10 -- sed -i -r -e \
's,"github.com/youtube/vitess/go/,"vitess.io/vitess/go/,'
```
The only part of go/zk we were still using is go/zk/zkctl.
Moved it to go/vt/zkctl.
Removed the rest of go/zk code. The config part (ZK_CLIENT_CONF json
config) was moved to CellInfo.The Metaconn part was moved to the topo
service code (for the cell map) and to zk2topo (for the ZkConn retrying
part).
Note re-running bootstrap.sh is required here, as the path for zksrv.sh
has changed.
Please refer to #2694 and #2670 for motivation and reasoning for
this change.
I've tried to follow best practice in inserting the copyright
headers. In other open source projects, not all files carry
the notice. For example documentation doesn't. I've followed
similar ground rules.
I did not change the php because there is a separate LICENSE
file there by Pixel Federation. We'll first need to notify
them our intent before changing anything there.
As for the presubmit check, it's going to be non-trivial
because of the number of exceptions, like file types,
directories and generated code. So, it will have to be
a separate project.
This matches the mysqlctld model. When zkctld starts, it performs either
"init" or "start" as necessary. This allows the scheduler to recover the
task by restarting it, without having to purge the data dir.