Skip to content

Add --no-discovery option to YDB cli #16266

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ydb/apps/ydb/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
* Added "--no-discovery" option. It allows to skip discovery and use user provided endpoint to connect to YDB cluster.
* Added `--retries` to `ydb workload <clickbenh|tpch|tpcds> run` command.
* Added `--partition-size` param to `ydb workload <clickbench/tpcds/tpch> init`.
* Fixed bugs in `ydb scheme rmdir`: 1) do not try to delete subdomains, 2) order the deletion of external tables before the deletion of external data sources.
12 changes: 12 additions & 0 deletions ydb/apps/ydb/ut/parse_command_line.cpp
Original file line number Diff line number Diff line change
@@ -284,6 +284,18 @@ Y_UNIT_TEST_SUITE(ParseOptionsTest) {
);
}

Y_UNIT_TEST_F(NoDiscoveryCommandLine, TCliTestFixture) {
RunCli(
{
"-v",
"-e", GetEndpoint(),
"-d", GetDatabase(),
"--no-discovery",
"scheme", "ls",
}
);
}

Y_UNIT_TEST_F(EndpointAndDatabaseFromActiveProfile, TCliTestFixture) {
TString profile = fmt::format(R"yaml(
profiles:
2 changes: 2 additions & 0 deletions ydb/public/lib/ydb_cli/commands/ydb_command.cpp
Original file line number Diff line number Diff line change
@@ -29,6 +29,8 @@ TDriverConfig TYdbCommand::CreateDriverConfig(TConfig& config) {
driverConfig.UseSecureConnection(config.CaCerts);
if (config.IsNetworkIntensive)
driverConfig.SetNetworkThreadsNum(16);
if (config.SkipDiscovery)
driverConfig.SetDiscoveryMode(EDiscoveryMode::Off);
driverConfig.UseClientCertificate(config.ClientCert, config.ClientCertPrivateKey);

return driverConfig;
10 changes: 10 additions & 0 deletions ydb/public/lib/ydb_cli/commands/ydb_root_common.cpp
Original file line number Diff line number Diff line change
@@ -155,6 +155,16 @@ void TClientCommandRootCommon::Config(TConfig& config) {
.RequiredArgument("NAME").StoreResult(&ProfileName);
opts.AddLongOption('y', "assume-yes", "Automatic yes to prompts; assume \"yes\" as answer to all prompts and run non-interactively")
.Optional().StoreTrue(&config.AssumeYes);

if (config.HelpCommandVerbosiltyLevel >= 2) {
opts.AddLongOption("no-discovery", "Do not perform discovery (client balancing) for ydb cluster connection."
" If this option is set the user provided endpoint (by -e option) will be used to setup a connections")
.Optional().StoreTrue(&config.SkipDiscovery);
} else {
opts.AddLongOption("no-discovery")
.Optional().Hidden().StoreTrue(&config.SkipDiscovery);
}

TClientCommandRootBase::Config(config);

TAuthMethodOption* iamTokenAuth = nullptr;
1 change: 1 addition & 0 deletions ydb/public/lib/ydb_cli/common/command.h
Original file line number Diff line number Diff line change
@@ -125,6 +125,7 @@ class TClientCommand {

TMap<TString, TVector<TConnectionParam>> ConnectionParams;
bool EnableSsl = false;
bool SkipDiscovery = false;
bool IsNetworkIntensive = false;
TString Oauth2KeyFile;
TString Oauth2KeyParams;