Skip to content

Make config api from bsconfig api #14617

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
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
cc8a2de
WIP
Enjection Feb 12, 2025
4635e89
WIP
Enjection Feb 13, 2025
a830f35
WIP
Enjection Feb 13, 2025
d3b48aa
WIP
Enjection Feb 13, 2025
c64da47
WIP
Enjection Feb 13, 2025
fe0e88d
WIP
Enjection Feb 14, 2025
f2e26b7
WIP
Enjection Feb 14, 2025
fa3f657
WIP
Enjection Feb 14, 2025
f3ed238
WIP
Enjection Feb 14, 2025
85036cb
WIP
Enjection Feb 16, 2025
4c5bc2b
WIP
Enjection Feb 16, 2025
5ee283c
WIP
Enjection Feb 16, 2025
f35b326
WIP
Enjection Feb 16, 2025
8f48461
WIP
Enjection Feb 16, 2025
84a553d
WIP
Enjection Feb 16, 2025
b779348
WIP
Enjection Feb 16, 2025
5fe9f69
WIP
Enjection Feb 16, 2025
9170885
WIP
Enjection Feb 16, 2025
8231e77
WIP
Enjection Feb 16, 2025
f6ff750
WIP
Enjection Feb 16, 2025
c31770e
Merge branch 'main' into feature/configs/old-new-api-alignment
Enjection Feb 16, 2025
c5d3a96
WIP
Enjection Feb 16, 2025
98d2a0d
WIP
Enjection Feb 16, 2025
9fc81bc
WIP
Enjection Feb 16, 2025
c8b67a9
WIP
Enjection Feb 16, 2025
a6b181c
WIP
Enjection Feb 16, 2025
6ff72ae
WIP
Enjection Feb 16, 2025
dbbc677
WIP
Enjection Feb 16, 2025
dbb88dc
WIP
Enjection Feb 17, 2025
0302ead
WIP
Enjection Feb 17, 2025
c5778c2
WIP
Enjection Feb 17, 2025
d432002
WIP
Enjection Feb 17, 2025
d0b2bc0
WIP
Enjection Feb 17, 2025
f5623cd
WIP
Enjection Feb 17, 2025
2cdcd64
WIP
Enjection Feb 17, 2025
5788a94
WIP
Enjection Feb 17, 2025
1c75f86
WIP
Enjection Feb 17, 2025
c37c082
WIP
Enjection Feb 17, 2025
2e8492f
WIP
Enjection Feb 17, 2025
dd5d4de
WIP
Enjection Feb 17, 2025
8cb368e
Merge branch 'main' into feature/configs/old-new-api-alignment
Enjection Feb 17, 2025
0156589
WIP
Enjection Feb 17, 2025
0d2badd
Merge branch 'main' into feature/configs/old-new-api-alignment
Enjection Feb 18, 2025
8a86cc2
WIP
Enjection Feb 18, 2025
bc23f9f
WIP
Enjection Feb 18, 2025
df75b3a
WIP
Enjection Feb 18, 2025
e2e8a8e
WIP
Enjection Feb 18, 2025
1a3da75
WIP
Enjection Feb 18, 2025
8c98eac
WIP
Enjection Feb 18, 2025
a4b73f7
WIP
Enjection Feb 18, 2025
95d7ef6
WIP
Enjection Feb 18, 2025
eb368c9
WIP
Enjection Feb 18, 2025
0a9f80c
simplify
Enjection Feb 19, 2025
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
20 changes: 17 additions & 3 deletions ydb/core/blobstorage/base/blobstorage_console_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,14 @@ namespace NKikimr {
NKikimrBlobStorage::TEvControllerConsoleCommitRequest, EvControllerConsoleCommitRequest> {
TEvControllerConsoleCommitRequest() = default;

TEvControllerConsoleCommitRequest(const TString& yamlConfig) {
TEvControllerConsoleCommitRequest(
const TString& yamlConfig,
bool allowUnknownFields = false,
bool bypassMetadataChecks = false) {

Record.SetYAML(yamlConfig);
Record.SetAllowUnknownFields(allowUnknownFields);
Record.SetBypassMetadataChecks(bypassMetadataChecks);
}

TString ToString() const override {
Expand Down Expand Up @@ -76,8 +82,14 @@ namespace NKikimr {
NKikimrBlobStorage::TEvControllerReplaceConfigRequest, EvControllerReplaceConfigRequest> {
TEvControllerReplaceConfigRequest() = default;

TEvControllerReplaceConfigRequest(std::optional<TString> clusterYaml, std::optional<TString> storageYaml,
std::optional<bool> switchDedicatedStorageSection, bool dedicatedConfigMode) {
TEvControllerReplaceConfigRequest(
std::optional<TString> clusterYaml,
std::optional<TString> storageYaml,
std::optional<bool> switchDedicatedStorageSection,
bool dedicatedConfigMode,
bool allowUnknownFields,
bool bypassMetadataChecks) {

if (clusterYaml) {
Record.SetClusterYaml(*clusterYaml);
}
Expand All @@ -88,6 +100,8 @@ namespace NKikimr {
Record.SetSwitchDedicatedStorageSection(*switchDedicatedStorageSection);
}
Record.SetDedicatedConfigMode(dedicatedConfigMode);
Record.SetAllowUnknownFields(allowUnknownFields);
Record.SetBypassMetadataChecks(bypassMetadataChecks);
}

TString ToString() const override {
Expand Down
3 changes: 2 additions & 1 deletion ydb/core/blobstorage/nodewarden/distconf_console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ namespace NKikimr::NStorage {
}

NTabletPipe::SendData(SelfId(), ConsolePipeId, new TEvBlobStorage::TEvControllerConsoleCommitRequest(
MainConfigYaml), ++CommitRequestCookie);
MainConfigYaml), // FIXME: probably should propagate force here
++CommitRequestCookie);
break;
}

Expand Down
2 changes: 2 additions & 0 deletions ydb/core/cms/console/console_configs_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ void TConfigsManager::ValidateMainConfig(TUpdateConfigOpContext& opCtx) {
}
} catch (const yexception &e) {
opCtx.Error = e.what();
} catch (const std::exception& e) {
opCtx.Error = e.what();
}
}

Expand Down
61 changes: 51 additions & 10 deletions ydb/core/cms/console/console_handshake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,35 @@ namespace NKikimr::NConsole {

class TConfigsManager::TConsoleCommitActor : public TActorBootstrapped<TConsoleCommitActor> {
public:
TConsoleCommitActor(TActorId senderId, const TString& mainYamlConfig, TActorId interconnectSession, ui64 cookie)
TConsoleCommitActor(
TActorId senderId,
const TString& mainYamlConfig,
bool allowUnknownFields,
bool bypassMetadataChecks,
TActorId interconnectSession,
ui64 cookie)
: SenderId(senderId)
, MainYamlConfig(mainYamlConfig)
, AllowUnknownFields(allowUnknownFields)
, BypassMetadataChecks(bypassMetadataChecks)
, InterconnectSession(interconnectSession)
, Cookie(cookie)
{}

void Bootstrap(const TActorId& consoleId) {
auto request = std::make_unique<TEvConsole::TEvReplaceYamlConfigRequest>();
request->Record.MutableRequest()->set_config(MainYamlConfig);
Send(consoleId, request.release());
auto executeRequest = [&](auto& request) {
request->Record.MutableRequest()->set_config(MainYamlConfig);
request->Record.MutableRequest()->set_allow_unknown_fields(AllowUnknownFields);
Send(consoleId, request.release());
};

if (BypassMetadataChecks) {
auto request = std::make_unique<TEvConsole::TEvSetYamlConfigRequest>();
executeRequest(request);
} else {
auto request = std::make_unique<TEvConsole::TEvReplaceYamlConfigRequest>();
executeRequest(request);
}

Become(&TThis::StateWork);
}
Expand All @@ -38,6 +56,13 @@ class TConfigsManager::TConsoleCommitActor : public TActorBootstrapped<TConsoleC
PassAway();
}

void Handle(TEvConsole::TEvSetYamlConfigResponse::TPtr& /*ev*/) {
auto response = std::make_unique<TEvBlobStorage::TEvControllerConsoleCommitResponse>();
response->Record.SetStatus(NKikimrBlobStorage::TEvControllerConsoleCommitResponse::Committed);
SendInReply(std::move(response));
PassAway();
}

void Handle(TEvConsole::TEvGenericError::TPtr& ev) {
auto response = std::make_unique<TEvBlobStorage::TEvControllerConsoleCommitResponse>();
response->Record.SetStatus(NKikimrBlobStorage::TEvControllerConsoleCommitResponse::NotCommitted);
Expand All @@ -48,13 +73,16 @@ class TConfigsManager::TConsoleCommitActor : public TActorBootstrapped<TConsoleC

STRICT_STFUNC(StateWork,
hFunc(TEvConsole::TEvReplaceYamlConfigResponse, Handle)
hFunc(TEvConsole::TEvSetYamlConfigResponse, Handle)
hFunc(TEvConsole::TEvGenericError, Handle)
sFunc(TEvents::TEvPoisonPill, PassAway)
)

private:
TActorId SenderId;
TString MainYamlConfig;
bool AllowUnknownFields;
bool BypassMetadataChecks;
TActorId InterconnectSession;
ui64 Cookie;

Expand Down Expand Up @@ -117,12 +145,21 @@ void TConfigsManager::Handle(TEvBlobStorage::TEvControllerProposeConfigRequest::

void TConfigsManager::Handle(TEvBlobStorage::TEvControllerConsoleCommitRequest::TPtr& ev, const TActorContext& /*ctx*/) {
auto response = std::make_unique<TEvBlobStorage::TEvControllerConsoleCommitResponse>();
const auto& mainYamlConfig = ev->Get()->Record.GetYAML();
auto& record = ev->Get()->Record;
const auto& mainYamlConfig = record.GetYAML();
bool allowUnknownFields = record.GetAllowUnknownFields();
bool bypassMetadataChecks = record.GetBypassMetadataChecks();
if (!CheckSession(*ev, response, NKikimrBlobStorage::TEvControllerConsoleCommitResponse::SessionMismatch)) {
return;
}

IActor* actor = new TConsoleCommitActor(ev->Sender, mainYamlConfig, ev->InterconnectSession, ev->Cookie);
IActor* actor = new TConsoleCommitActor(
ev->Sender,
mainYamlConfig,
allowUnknownFields,
bypassMetadataChecks,
ev->InterconnectSession,
ev->Cookie);
CommitActor = Register(actor);
}

Expand All @@ -133,22 +170,26 @@ void TConfigsManager::Handle(TEvBlobStorage::TEvControllerValidateConfigRequest:
}

auto& record = response->Record;

bool bypassMetadataChecks = ev->Get()->Record.GetBypassMetadataChecks();

auto mainYamlConfig = ev->Get()->Record.GetYAML();

TUpdateConfigOpContext opCtx;
ReplaceMainConfigMetadata(mainYamlConfig, false, opCtx);
ReplaceMainConfigMetadata(mainYamlConfig, bypassMetadataChecks, opCtx);
ValidateMainConfig(opCtx);
bool hasForbiddenUnknownFields = !opCtx.UnknownFields.empty() && !ev->Get()->Record.GetAllowUnknownFields();

if (opCtx.Error || !opCtx.UnknownFields.empty()) {
if (opCtx.Error || hasForbiddenUnknownFields) {
record.SetStatus(NKikimrBlobStorage::TEvControllerValidateConfigResponse::ConfigNotValid);
TStringStream s;
if (opCtx.Error) {
s << *opCtx.Error << (opCtx.UnknownFields.empty() ? "" : " and ");
}
if (!opCtx.UnknownFields.empty()) {
if (hasForbiddenUnknownFields) {
s << "has forbidden unknown fields";
}
record.SetErrorReason(s.Str());
record.SetErrorReason(s.Str()); // TODO get warnings back
} else {
record.SetStatus(NKikimrBlobStorage::TEvControllerValidateConfigResponse::ConfigIsValid);
record.SetYAML(opCtx.UpdatedConfig);
Expand Down
14 changes: 7 additions & 7 deletions ydb/core/cms/ui/yaml_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,16 +235,16 @@ class YamlConfigState {

onYamlLoaded(success, data) {
if (success) {
this.cluster = data.Response.identity.cluster;
$('#yaml-cluster').text(data.Response.identity.cluster);
this.cluster = data.Response.identity[0].cluster;
$('#yaml-cluster').text(data.Response.identity[0].cluster);

this.version = data.Response.identity.version;
$('#yaml-version').text(data.Response.identity.version);
this.version = data.Response.identity[0].version;
$('#yaml-version').text(data.Response.identity[0].version);

if (this.config !== data.Response.config) {
this.codeMirror.setValue((data.Response.config !== undefined) ? data.Response.config[0] : "");
if (this.config !== data.Response.config[0]) {
this.codeMirror.setValue((data.Response.config[0] !== undefined) ? data.Response.config[0] : "");
this.codeMirror.trigger('fold', 'editor.foldLevel2');
this.config = data.Response.config;
this.config = data.Response.config[0];
}

if (data.Response.volatile_configs === undefined) {
Expand Down
10 changes: 5 additions & 5 deletions ydb/core/driver_lib/run/run.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@

#include <ydb/services/auth/grpc_service.h>
#include <ydb/services/cms/grpc_service.h>
#include <ydb/services/bsconfig/grpc_service.h>
#include <ydb/services/config/grpc_service.h>
#include <ydb/services/dynamic_config/grpc_service.h>
#include <ydb/services/datastreams/grpc_service.h>
#include <ydb/services/discovery/grpc_service.h>
Expand Down Expand Up @@ -620,8 +620,8 @@ void TKikimrRunner::InitializeGRpc(const TKikimrRunConfig& runConfig) {
names["tablet_service"] = &hasTabletService;
TServiceCfg hasView = services.empty();
names["view"] = &hasView;
TServiceCfg hasBSConfig = services.empty();
names["bsconfig"] = &hasBSConfig;
TServiceCfg hasConfig = services.empty();
names["config"] = &hasConfig;

std::unordered_set<TString> enabled;
for (const auto& name : services) {
Expand Down Expand Up @@ -915,8 +915,8 @@ void TKikimrRunner::InitializeGRpc(const TKikimrRunConfig& runConfig) {
grpcRequestProxies[0], hasView.IsRlAllowed()));
}

if (hasBSConfig) {
server.AddService(new NGRpcService::TBSConfigGRpcService(ActorSystem.Get(), Counters, grpcRequestProxies[0]));
if (hasConfig) {
server.AddService(new NGRpcService::TConfigGRpcService(ActorSystem.Get(), Counters, grpcRequestProxies[0]));
}

if (ModuleFactories) {
Expand Down
52 changes: 26 additions & 26 deletions ydb/core/driver_lib/run/ya.make
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,7 @@ SRCS(

PEERDIR(
contrib/libs/protobuf
ydb/library/actors/core
ydb/library/actors/dnsresolver
ydb/library/actors/interconnect
ydb/library/actors/memory_log
ydb/library/actors/prof
ydb/library/actors/protos
ydb/library/actors/util
library/cpp/getopt/small
ydb/public/sdk/cpp/src/library/grpc/client
ydb/library/grpc/server
ydb/library/grpc/server/actors
library/cpp/logger
library/cpp/malloc/api
library/cpp/messagebus
Expand All @@ -57,8 +47,8 @@ PEERDIR(
library/cpp/svnversion
ydb/core/actorlib_impl
ydb/core/audit
ydb/core/base
ydb/core/backup/controller
ydb/core/base
ydb/core/blob_depot
ydb/core/blobstorage
ydb/core/blobstorage/backpressure
Expand Down Expand Up @@ -86,10 +76,10 @@ PEERDIR(
ydb/core/health_check
ydb/core/http_proxy
ydb/core/jaeger_tracing
ydb/core/kafka_proxy
ydb/core/kesus/proxy
ydb/core/kesus/tablet
ydb/core/keyvalue
ydb/core/kafka_proxy
ydb/core/kqp
ydb/core/kqp/federated_query
ydb/core/kqp/finalize_script_service
Expand Down Expand Up @@ -124,11 +114,11 @@ PEERDIR(
ydb/core/tracing
ydb/core/tx
ydb/core/tx/columnshard
ydb/core/tx/coordinator
ydb/core/tx/conveyor/service
ydb/core/tx/limiter/service
ydb/core/tx/limiter/grouped_memory/usage
ydb/core/tx/coordinator
ydb/core/tx/datashard
ydb/core/tx/limiter/grouped_memory/usage
ydb/core/tx/limiter/service
ydb/core/tx/long_tx_service
ydb/core/tx/long_tx_service/public
ydb/core/tx/mediator
Expand All @@ -145,44 +135,54 @@ PEERDIR(
ydb/core/viewer
ydb/core/ymq/actor
ydb/core/ymq/http
ydb/library/actors/core
ydb/library/actors/dnsresolver
ydb/library/actors/interconnect
ydb/library/actors/memory_log
ydb/library/actors/prof
ydb/library/actors/protos
ydb/library/actors/util
ydb/library/folder_service
ydb/library/folder_service/proto
ydb/library/grpc/server
ydb/library/grpc/server/actors
ydb/library/pdisk_io
ydb/library/security
yql/essentials/minikql/comp_nodes/llvm14
yt/yql/providers/yt/codec/codegen
yt/yql/providers/yt/comp_nodes/llvm14
yt/yql/providers/yt/comp_nodes/dq/llvm14
ydb/library/yql/providers/pq/cm_client
ydb/library/yql/providers/s3/actors
yql/essentials/public/udf/service/exception_policy
ydb/public/lib/base
ydb/public/lib/deprecated/client
ydb/public/sdk/cpp/src/library/grpc/client
ydb/services/auth
ydb/services/backup
ydb/services/bsconfig
ydb/services/cms
ydb/services/dynamic_config
ydb/services/config
ydb/services/datastreams
ydb/services/deprecated/persqueue_v0
ydb/services/discovery
ydb/services/dynamic_config
ydb/services/ext_index/metadata
ydb/services/ext_index/service
ydb/services/fq
ydb/services/kesus
ydb/services/keyvalue
ydb/services/local_discovery
ydb/services/maintenance
ydb/services/metadata/ds_table
ydb/services/metadata
ydb/services/ext_index/service
ydb/services/ext_index/metadata
ydb/services/metadata/ds_table
ydb/services/monitoring
ydb/services/persqueue_cluster_discovery
ydb/services/deprecated/persqueue_v0
ydb/services/persqueue_v1
ydb/services/rate_limiter
ydb/services/replication
ydb/services/tablet
ydb/services/view
ydb/services/ydb
yql/essentials/minikql/comp_nodes/llvm14
yql/essentials/public/udf/service/exception_policy
yt/yql/providers/yt/codec/codegen
yt/yql/providers/yt/comp_nodes/dq/llvm14
yt/yql/providers/yt/comp_nodes/llvm14
)

YQL_LAST_ABI_VERSION()
Expand Down
Loading
Loading