Skip to content

Commit baccf61

Browse files
committed
Add --no-discovery option.
It allows to skip discovery and use user provided endpoint to connect to YDB cluster.
1 parent 04d730d commit baccf61

File tree

5 files changed

+26
-0
lines changed

5 files changed

+26
-0
lines changed

ydb/apps/ydb/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
* Added "--no-discovery" option. It allows to skip discovery and use user provided endpoint to connect to YDB cluster.
12
* Added `--retries` to `ydb workload <clickbenh|tpch|tpcds> run` command.
23
* Added `--partition-size` param to `ydb workload <clickbench/tpcds/tpch> init`.
34
* 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.

ydb/apps/ydb/ut/parse_command_line.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,18 @@ Y_UNIT_TEST_SUITE(ParseOptionsTest) {
284284
);
285285
}
286286

287+
Y_UNIT_TEST_F(NoDiscoveryCommandLine, TCliTestFixture) {
288+
RunCli(
289+
{
290+
"-v",
291+
"-e", GetEndpoint(),
292+
"-d", GetDatabase(),
293+
"--no-discovery",
294+
"scheme", "ls",
295+
}
296+
);
297+
}
298+
287299
Y_UNIT_TEST_F(EndpointAndDatabaseFromActiveProfile, TCliTestFixture) {
288300
TString profile = fmt::format(R"yaml(
289301
profiles:

ydb/public/lib/ydb_cli/commands/ydb_command.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ TDriverConfig TYdbCommand::CreateDriverConfig(TConfig& config) {
2929
driverConfig.UseSecureConnection(config.CaCerts);
3030
if (config.IsNetworkIntensive)
3131
driverConfig.SetNetworkThreadsNum(16);
32+
if (config.SkipDiscovery)
33+
driverConfig.SetDiscoveryMode(EDiscoveryMode::Off);
3234
driverConfig.UseClientCertificate(config.ClientCert, config.ClientCertPrivateKey);
3335

3436
return driverConfig;

ydb/public/lib/ydb_cli/commands/ydb_root_common.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,16 @@ void TClientCommandRootCommon::Config(TConfig& config) {
155155
.RequiredArgument("NAME").StoreResult(&ProfileName);
156156
opts.AddLongOption('y', "assume-yes", "Automatic yes to prompts; assume \"yes\" as answer to all prompts and run non-interactively")
157157
.Optional().StoreTrue(&config.AssumeYes);
158+
159+
if (config.HelpCommandVerbosiltyLevel >= 2) {
160+
opts.AddLongOption("no-discovery", "Do not perform discovery (client balancing) for ydb cluster connection."
161+
" If this option is set the user provided endpoint (by -e option) will be used to setup a connections")
162+
.Optional().StoreTrue(&config.SkipDiscovery);
163+
} else {
164+
opts.AddLongOption("no-discovery")
165+
.Optional().Hidden().StoreTrue(&config.SkipDiscovery);
166+
}
167+
158168
TClientCommandRootBase::Config(config);
159169

160170
TAuthMethodOption* iamTokenAuth = nullptr;

ydb/public/lib/ydb_cli/common/command.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ class TClientCommand {
125125

126126
TMap<TString, TVector<TConnectionParam>> ConnectionParams;
127127
bool EnableSsl = false;
128+
bool SkipDiscovery = false;
128129
bool IsNetworkIntensive = false;
129130
TString Oauth2KeyFile;
130131
TString Oauth2KeyParams;

0 commit comments

Comments
 (0)