Skip to content

Commit b6305b5

Browse files
authored
Merge pull request #17690 from zverevgeny/merge_25.1.1.4
Merge 25.1.1.4 into 25-1-analytics
2 parents 659facd + fefdc47 commit b6305b5

File tree

136 files changed

+4576
-1751
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+4576
-1751
lines changed

ydb/apps/ydb/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
* Fixed return code of command `ydb workload * run --check-canonical` for the case when benchmark query results differ from canonical ones.
12
* Added support for dual configuration mode in the `ydb admin cluster config fetch` command, allowing it to handle separate cluster and storage config sections.
23
* Add options for client certificates in SSL/TLS connections.
34
* Add `ydb admin node config init` command to initialize directory with node config files.

ydb/core/base/blobstorage.h

+7
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,9 @@ struct TEvBlobStorage {
757757
EvHugeQueryForbiddenChunks,
758758
EvHugeForbiddenChunks,
759759
EvContinueShred,
760+
EvQuerySyncToken,
761+
EvSyncToken,
762+
EvReleaseSyncToken,
760763

761764
EvYardInitResult = EvPut + 9 * 512, /// 268 636 672
762765
EvLogResult,
@@ -870,6 +873,8 @@ struct TEvBlobStorage {
870873
EvControllerShredResponse = 0x1003162a,
871874
EvControllerFetchConfigRequest = 0x1003162b,
872875
EvControllerFetchConfigResponse = 0x1003162c,
876+
EvControllerDistconfRequest = 0x1003162d,
877+
EvControllerDistconfResponse = 0x1003162e,
873878

874879
// BSC interface result section
875880
EvControllerNodeServiceSetUpdate = 0x10031802,
@@ -2523,6 +2528,8 @@ struct TEvBlobStorage {
25232528
struct TEvControllerShredResponse;
25242529
struct TEvControllerFetchConfigRequest;
25252530
struct TEvControllerFetchConfigResponse;
2531+
struct TEvControllerDistconfRequest;
2532+
struct TEvControllerDistconfResponse;
25262533

25272534
struct TEvMonStreamQuery;
25282535
struct TEvMonStreamActorDeathNote;

ydb/core/base/services/blobstorage_service_id.h

+5
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ inline TActorId MakeBlobStorageReplBrokerID() {
7676
return TActorId(0, TStringBuf(x, 12));
7777
}
7878

79+
inline TActorId MakeBlobStorageSyncBrokerID() {
80+
char x[12] = {'b', 's', 's', 'y', 'n', 'c', 'b', 'r', 'o', 'k', 'e', 'r'};
81+
return TActorId(0, TStringBuf(x, 12));
82+
}
83+
7984
inline TActorId MakeBlobStorageNodeWardenID(ui32 node) {
8085
char x[12] = {'b','s','n','o','d','e','c','n','t','r','l','r'};
8186
return TActorId(node, TStringBuf(x, 12));

ydb/core/blobstorage/base/blobstorage_console_events.h

+17-16
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ namespace NKikimr {
1010
NKikimrBlobStorage::TEvControllerProposeConfigRequest, EvControllerProposeConfigRequest> {
1111
TEvControllerProposeConfigRequest() = default;
1212

13-
TEvControllerProposeConfigRequest(ui64 configHash, ui64 configVersion) {
13+
TEvControllerProposeConfigRequest(ui64 configHash, ui64 configVersion, bool distconf) {
1414
Record.SetConfigHash(configHash);
1515
Record.SetConfigVersion(configVersion);
16+
Record.SetDistconf(distconf);
1617
}
1718

1819
TString ToString() const override {
@@ -32,14 +33,8 @@ namespace NKikimr {
3233
NKikimrBlobStorage::TEvControllerConsoleCommitRequest, EvControllerConsoleCommitRequest> {
3334
TEvControllerConsoleCommitRequest() = default;
3435

35-
TEvControllerConsoleCommitRequest(
36-
const TString& yamlConfig,
37-
bool allowUnknownFields = false,
38-
bool bypassMetadataChecks = false) {
39-
36+
TEvControllerConsoleCommitRequest(const TString& yamlConfig) {
4037
Record.SetYAML(yamlConfig);
41-
Record.SetAllowUnknownFields(allowUnknownFields);
42-
Record.SetBypassMetadataChecks(bypassMetadataChecks);
4338
}
4439

4540
TString ToString() const override {
@@ -82,14 +77,9 @@ namespace NKikimr {
8277
NKikimrBlobStorage::TEvControllerReplaceConfigRequest, EvControllerReplaceConfigRequest> {
8378
TEvControllerReplaceConfigRequest() = default;
8479

85-
TEvControllerReplaceConfigRequest(
86-
std::optional<TString> clusterYaml,
87-
std::optional<TString> storageYaml,
88-
std::optional<bool> switchDedicatedStorageSection,
89-
bool dedicatedConfigMode,
90-
bool allowUnknownFields,
91-
bool bypassMetadataChecks) {
92-
80+
TEvControllerReplaceConfigRequest(std::optional<TString> clusterYaml, std::optional<TString> storageYaml,
81+
std::optional<bool> switchDedicatedStorageSection, bool dedicatedConfigMode, bool allowUnknownFields,
82+
bool bypassMetadataChecks, bool enableConfigV2, bool disableConfigV2) {
9383
if (clusterYaml) {
9484
Record.SetClusterYaml(*clusterYaml);
9585
}
@@ -102,6 +92,11 @@ namespace NKikimr {
10292
Record.SetDedicatedConfigMode(dedicatedConfigMode);
10393
Record.SetAllowUnknownFields(allowUnknownFields);
10494
Record.SetBypassMetadataChecks(bypassMetadataChecks);
95+
if (enableConfigV2) {
96+
Record.SetSwitchEnableConfigV2(true);
97+
} else if (disableConfigV2) {
98+
Record.SetSwitchEnableConfigV2(false);
99+
}
105100
}
106101

107102
TString ToString() const override {
@@ -130,4 +125,10 @@ namespace NKikimr {
130125
struct TEvBlobStorage::TEvControllerFetchConfigResponse : TEventPB<TEvControllerFetchConfigResponse,
131126
NKikimrBlobStorage::TEvControllerFetchConfigResponse, EvControllerFetchConfigResponse> {};
132127

128+
struct TEvBlobStorage::TEvControllerDistconfRequest : TEventPB<TEvControllerDistconfRequest,
129+
NKikimrBlobStorage::TEvControllerDistconfRequest, EvControllerDistconfRequest> {};
130+
131+
struct TEvBlobStorage::TEvControllerDistconfResponse : TEventPB<TEvControllerDistconfResponse,
132+
NKikimrBlobStorage::TEvControllerDistconfResponse, EvControllerDistconfResponse> {};
133+
133134
}

ydb/core/blobstorage/dsproxy/dsproxy_get_block.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace NKikimr {
1111

1212
class TBlobStorageGroupGetBlockRequest : public TBlobStorageGroupRequestActor {
1313
const ui64 TabletId;
14-
ui64 Generation;
14+
ui64 Generation = 0;
1515
const TInstant Deadline;
1616
ui64 Requests = 0;
1717
ui64 Responses = 0;

ydb/core/blobstorage/nodewarden/distconf.h

+8-2
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ namespace NKikimr::NStorage {
227227
// pending event queue
228228
std::deque<TAutoPtr<IEventHandle>> PendingEvents;
229229
std::vector<ui32> NodeIds;
230+
THashSet<ui32> NodeIdsSet;
230231
TNodeIdentifier SelfNode;
231232

232233
// scatter tasks
@@ -351,8 +352,13 @@ namespace NKikimr::NStorage {
351352
bool HasQuorum() const;
352353
void ProcessCollectConfigs(TEvGather::TCollectConfigs *res);
353354

354-
using TProcessCollectConfigsResult = std::variant<std::monostate, TString, NKikimrBlobStorage::TStorageConfig>;
355-
TProcessCollectConfigsResult ProcessCollectConfigs(TEvGather::TCollectConfigs *res, const TString *selfAssemblyUUID);
355+
struct TProcessCollectConfigsResult {
356+
std::variant<std::monostate, TString, NKikimrBlobStorage::TStorageConfig> Outcome;
357+
bool IsDistconfDisabledQuorum = false;
358+
};
359+
TProcessCollectConfigsResult ProcessCollectConfigs(TEvGather::TCollectConfigs *res,
360+
std::optional<TStringBuf> selfAssemblyUUID);
361+
356362
std::optional<TString> ProcessProposeStorageConfig(TEvGather::TProposeStorageConfig *res);
357363

358364
struct TExConfigError : yexception {};

ydb/core/blobstorage/nodewarden/distconf_binding.cpp

+12-2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ namespace NKikimr::NStorage {
5858
// issue updates
5959
NodeIds = std::move(nodeIds);
6060
BindQueue.Update(NodeIds);
61+
NodeIdsSet = {NodeIds.begin(), NodeIds.end()};
6162
}
6263

6364
void TDistributedConfigKeeper::IssueNextBindRequest() {
@@ -323,7 +324,8 @@ namespace NKikimr::NStorage {
323324
const auto [it, inserted] = AllBoundNodes.try_emplace(std::move(nodeId));
324325
TIndirectBoundNode& node = it->second;
325326

326-
if (inserted) { // disable this node from target binding set, this is the first mention of this node
327+
if (inserted && NodeIdsSet.contains(it->first.NodeId())) {
328+
// disable this node from target binding set, this is the first mention of this node
327329
BindQueue.Disable(it->first.NodeId());
328330
}
329331

@@ -363,7 +365,9 @@ namespace NKikimr::NStorage {
363365

364366
if (node.Refs.empty()) {
365367
AllBoundNodes.erase(it);
366-
BindQueue.Enable(nodeId.NodeId());
368+
if (NodeIdsSet.contains(nodeId.NodeId())) {
369+
BindQueue.Enable(nodeId.NodeId());
370+
}
367371
if (msg) {
368372
nodeId.Serialize(msg->Record.AddDeletedBoundNodeIds());
369373
}
@@ -382,6 +386,12 @@ namespace NKikimr::NStorage {
382386
STLOG(PRI_DEBUG, BS_NODE, NWDC02, "TEvNodeConfigPush", (NodeId, senderNodeId), (Cookie, ev->Cookie),
383387
(SessionId, ev->InterconnectSession), (Binding, Binding), (Record, record));
384388

389+
if (!NodeIdsSet.contains(senderNodeId)) {
390+
// node has been already deleted from the config, but new subscription is coming through -- ignoring it
391+
SendEvent(*ev, TEvNodeConfigReversePush::MakeRejected());
392+
return;
393+
}
394+
385395
// check if we can't accept this message (or else it would make a cycle)
386396
if (record.GetInitial() && senderNodeId == GetRootNodeId()) {
387397
STLOG(PRI_DEBUG, BS_NODE, NWDC28, "TEvNodeConfigPush rejected", (NodeId, senderNodeId),

ydb/core/blobstorage/nodewarden/distconf_console.cpp

+14-5
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,14 @@ namespace NKikimr::NStorage {
3535
return; // still waiting for previous one
3636
}
3737

38+
ProposeRequestInFlight = true;
39+
3840
if (!StorageConfig || !StorageConfig->HasConfigComposite()) {
39-
return; // no config yet
41+
// send empty proposition just to connect to console
42+
auto ev = std::make_unique<TEvBlobStorage::TEvControllerProposeConfigRequest>();
43+
ev->Record.SetDistconf(true);
44+
NTabletPipe::SendData(SelfId(), ConsolePipeId, ev.release(), ++ProposeRequestCookie);
45+
return;
4046
}
4147

4248
Y_ABORT_UNLESS(MainConfigYamlVersion);
@@ -51,11 +57,14 @@ namespace NKikimr::NStorage {
5157
MainConfigFetchYamlHash, *MainConfigYamlVersion));
5258
ProposedConfigHashVersion.emplace(MainConfigFetchYamlHash, *MainConfigYamlVersion);
5359
NTabletPipe::SendData(SelfId(), ConsolePipeId, new TEvBlobStorage::TEvControllerProposeConfigRequest(
54-
MainConfigFetchYamlHash, *MainConfigYamlVersion), ++ProposeRequestCookie);
55-
ProposeRequestInFlight = true;
60+
MainConfigFetchYamlHash, *MainConfigYamlVersion, true), ++ProposeRequestCookie);
5661
}
5762

5863
void TDistributedConfigKeeper::Handle(TEvBlobStorage::TEvControllerValidateConfigResponse::TPtr ev) {
64+
STLOG(PRI_DEBUG, BS_NODE, NWDC10, "received TEvControllerValidateConfigResponse",
65+
(Sender, ev->Sender), (Cookie, ev->Cookie), (Record, ev->Get()->Record),
66+
(ConsoleConfigValidationQ.size, ConsoleConfigValidationQ.size()));
67+
5968
auto& q = ConsoleConfigValidationQ;
6069
auto pred = [&](const auto& item) {
6170
const auto& [actorId, yaml, cookie] = item;
@@ -114,7 +123,7 @@ namespace NKikimr::NStorage {
114123
break;
115124

116125
case NKikimrBlobStorage::TEvControllerProposeConfigResponse::ReverseCommit:
117-
Y_DEBUG_ABORT();
126+
// just do nothing, we didn't have the config in distconf, possibly it is being enabled
118127
break;
119128
}
120129
}
@@ -204,7 +213,7 @@ namespace NKikimr::NStorage {
204213
if (!fetched) { // fill in 'to-be-fetched' version of config with version incremented by one
205214
try {
206215
auto metadata = NYamlConfig::GetMainMetadata(yaml);
207-
metadata.Cluster = metadata.Cluster.value_or("unknown"); // TODO: fix this
216+
metadata.Cluster = metadata.Cluster.value_or(AppData()->ClusterName);
208217
metadata.Version = metadata.Version.value_or(0) + 1;
209218
temp = NYamlConfig::ReplaceMetadata(yaml, metadata);
210219
} catch (const std::exception& ex) {

ydb/core/blobstorage/nodewarden/distconf_fsm.cpp

+32-18
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,17 @@ namespace NKikimr::NStorage {
110110
}
111111

112112
void TDistributedConfigKeeper::ProcessCollectConfigs(TEvGather::TCollectConfigs *res) {
113-
TOverloaded handler{
114-
[&](std::monostate&&) {
113+
auto r = ProcessCollectConfigs(res, std::nullopt);
114+
std::visit(TOverloaded{
115+
[&](std::monostate&) {
115116
STLOG(PRI_DEBUG, BS_NODE, NWDC61, "ProcessCollectConfigs: monostate");
116117
RootState = ERootState::RELAX;
117118
},
118-
[&](TString&& error) {
119+
[&](TString& error) {
119120
STLOG(PRI_DEBUG, BS_NODE, NWDC63, "ProcessCollectConfigs: error", (Error, error));
120121
SwitchToError(error);
121122
},
122-
[&](NKikimrBlobStorage::TStorageConfig&& proposedConfig) {
123+
[&](NKikimrBlobStorage::TStorageConfig& proposedConfig) {
123124
STLOG(PRI_DEBUG, BS_NODE, NWDC64, "ProcessCollectConfigs: proposed new config",
124125
(ProposedConfig, proposedConfig));
125126
TEvScatter task;
@@ -130,12 +131,11 @@ namespace NKikimr::NStorage {
130131
propose->MutableConfig()->Swap(&proposedConfig);
131132
IssueScatterTask(TActorId(), std::move(task));
132133
}
133-
};
134-
std::visit(handler, ProcessCollectConfigs(res, nullptr));
134+
}, r.Outcome);
135135
}
136136

137137
TDistributedConfigKeeper::TProcessCollectConfigsResult TDistributedConfigKeeper::ProcessCollectConfigs(
138-
TEvGather::TCollectConfigs *res, const TString *selfAssemblyUUID) {
138+
TEvGather::TCollectConfigs *res, std::optional<TStringBuf> selfAssemblyUUID) {
139139
auto generateSuccessful = [&](auto&& callback) {
140140
for (const auto& item : res->GetNodes()) {
141141
for (const auto& node : item.GetNodeIds()) {
@@ -171,10 +171,24 @@ namespace NKikimr::NStorage {
171171

172172
if (nodeQuorum && !configQuorum) {
173173
// check if there is quorum of no-distconf config along the cluster
174+
auto generateNodesWithoutDistconf = [&](auto&& callback) {
175+
for (const auto& item : res->GetNodes()) {
176+
if (item.GetBaseConfig().GetSelfManagementConfig().GetEnabled()) {
177+
continue;
178+
}
179+
for (const auto& node : item.GetNodeIds()) {
180+
callback(node);
181+
}
182+
}
183+
};
184+
if (HasNodeQuorum(*StorageConfig, generateNodesWithoutDistconf)) {
185+
// yes, distconf is disabled on the majority of the nodes, so we can't do anything about it
186+
return {.IsDistconfDisabledQuorum = true};
187+
}
174188
}
175189

176190
if (!nodeQuorum || !configQuorum) {
177-
return "no quorum for CollectConfigs";
191+
return {"no quorum for CollectConfigs"};
178192
}
179193

180194
// TODO: validate self-assembly UUID
@@ -223,7 +237,7 @@ namespace NKikimr::NStorage {
223237
(BaseConfigs.size, baseConfigs.size()));
224238
Y_DEBUG_ABORT("Multiple nonintersecting node sets have quorum of BaseConfig");
225239
Halt();
226-
return "Multiple nonintersecting node sets have quorum of BaseConfig";
240+
return {"Multiple nonintersecting node sets have quorum of BaseConfig"};
227241
}
228242
NKikimrBlobStorage::TStorageConfig *baseConfig = nullptr;
229243
for (auto& [meta, info] : baseConfigs) {
@@ -289,13 +303,13 @@ namespace NKikimr::NStorage {
289303
(Generation, generation), (Configs, configs));
290304
Y_DEBUG_ABORT("Multiple nonintersecting node sets have quorum of persistent config");
291305
Halt();
292-
return "Multiple nonintersecting node sets have quorum of persistent config";
306+
return {"Multiple nonintersecting node sets have quorum of persistent config"};
293307
}
294308
Y_ABORT_UNLESS(configs.size() == 1);
295309
persistedConfig = configs.front();
296310
}
297311
if (maxSeenGeneration && (!persistedConfig || persistedConfig->GetGeneration() < maxSeenGeneration)) {
298-
return "couldn't obtain quorum for configuration that was seen in effect";
312+
return {"couldn't obtain quorum for configuration that was seen in effect"};
299313
}
300314

301315
// let's try to find possibly proposed config, but without a quorum, and try to reconstruct it
@@ -311,7 +325,7 @@ namespace NKikimr::NStorage {
311325
(PersistentConfig, *persistedConfig), (ProposedConfig, config));
312326
Y_DEBUG_ABORT("persistently proposed config has too big generation");
313327
Halt();
314-
return "persistently proposed config has too big generation";
328+
return {"persistently proposed config has too big generation"};
315329
}
316330
}
317331
if (proposedConfig && (proposedConfig->GetGeneration() != config.GetGeneration() ||
@@ -361,11 +375,11 @@ namespace NKikimr::NStorage {
361375
if (!CurrentSelfAssemblyUUID) {
362376
CurrentSelfAssemblyUUID.emplace(CreateGuidAsString());
363377
}
364-
selfAssemblyUUID = &CurrentSelfAssemblyUUID.value();
378+
selfAssemblyUUID.emplace(CurrentSelfAssemblyUUID.value());
365379
}
366380
propositionBase.emplace(*baseConfig);
367-
if (auto error = GenerateFirstConfig(baseConfig, *selfAssemblyUUID)) {
368-
return *error;
381+
if (auto error = GenerateFirstConfig(baseConfig, TString(*selfAssemblyUUID))) {
382+
return {*error};
369383
}
370384
configToPropose = baseConfig;
371385
}
@@ -392,12 +406,12 @@ namespace NKikimr::NStorage {
392406

393407
if (error) {
394408
Y_DEBUG_ABORT("incorrect config proposition");
395-
return "incorrect config proposition";
409+
return {"incorrect config proposition"};
396410
}
397411

398412
if (propositionBase) {
399413
if (auto error = ValidateConfig(*propositionBase)) {
400-
return TStringBuilder() << "failed to propose configuration, base config contains errors: " << *error;
414+
return {TStringBuilder() << "failed to propose configuration, base config contains errors: " << *error};
401415
}
402416
if (auto error = ValidateConfigUpdate(*propositionBase, *configToPropose)) {
403417
Y_FAIL_S("incorrect config proposed: " << *error);
@@ -408,7 +422,7 @@ namespace NKikimr::NStorage {
408422
}
409423
}
410424

411-
return std::move(*configToPropose);
425+
return {std::move(*configToPropose)};
412426
}
413427

414428
return {};

0 commit comments

Comments
 (0)