Skip to content

Commit 1def359

Browse files
authored
Support metadata storage over pdisk (#6814)
1 parent 48a86ec commit 1def359

32 files changed

+1776
-315
lines changed

ydb/core/base/blobstorage.h

+5
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,7 @@ struct TEvBlobStorage {
732732
EvMinHugeBlobSizeUpdate,
733733
EvHugePreCompact,
734734
EvHugePreCompactResult,
735+
EvPDiskMetadataLoaded,
735736

736737
EvYardInitResult = EvPut + 9 * 512, /// 268 636 672
737738
EvLogResult,
@@ -868,6 +869,10 @@ struct TEvBlobStorage {
868869
EvNodeWardenBaseConfig,
869870
EvNodeWardenDynamicConfigSubscribe,
870871
EvNodeWardenDynamicConfigPush,
872+
EvNodeWardenReadMetadata,
873+
EvNodeWardenReadMetadataResult,
874+
EvNodeWardenWriteMetadata,
875+
EvNodeWardenWriteMetadataResult,
871876

872877
// Other
873878
EvRunActor = EvPut + 15 * 512,

ydb/core/blobstorage/nodewarden/distconf.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ namespace NKikimr::NStorage {
3434
DrivesToRead.push_back(drive.GetPath());
3535
});
3636
std::sort(DrivesToRead.begin(), DrivesToRead.end());
37-
38-
auto query = std::bind(&TThis::ReadConfig, TActivationContext::ActorSystem(), SelfId(), DrivesToRead, Cfg, 0);
39-
Send(MakeIoDispatcherActorId(), new TEvInvokeQuery(std::move(query)));
37+
ReadConfig();
4038
} else {
4139
StorageConfigLoaded = true;
4240
}
@@ -181,6 +179,10 @@ namespace NKikimr::NStorage {
181179
#endif
182180

183181
STFUNC(TDistributedConfigKeeper::StateWaitForInit) {
182+
STLOG(PRI_DEBUG, BS_NODE, NWDC53, "StateWaitForInit event", (Type, ev->GetTypeRewrite()),
183+
(StorageConfigLoaded, StorageConfigLoaded), (NodeListObtained, NodeListObtained),
184+
(PendingEvents.size, PendingEvents.size()));
185+
184186
auto processPendingEvents = [&] {
185187
if (PendingEvents.empty()) {
186188
Become(&TThis::StateFunc);
@@ -195,7 +197,9 @@ namespace NKikimr::NStorage {
195197
switch (ev->GetTypeRewrite()) {
196198
case TEvInterconnect::TEvNodesInfo::EventType:
197199
Handle(reinterpret_cast<TEvInterconnect::TEvNodesInfo::TPtr&>(ev));
198-
change = !std::exchange(NodeListObtained, true);
200+
if (!NodeIds.empty()) {
201+
change = !std::exchange(NodeListObtained, true);
202+
}
199203
break;
200204

201205
case TEvPrivate::EvStorageConfigLoaded:
@@ -216,10 +220,6 @@ namespace NKikimr::NStorage {
216220
}
217221

218222
if (change && NodeListObtained && StorageConfigLoaded) {
219-
if (IsSelfStatic) {
220-
UpdateBound(SelfNode.NodeId(), SelfNode, *StorageConfig, nullptr);
221-
IssueNextBindRequest();
222-
}
223223
processPendingEvents();
224224
}
225225
}

ydb/core/blobstorage/nodewarden/distconf.h

+3-7
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ namespace NKikimr::NStorage {
220220
std::deque<TAutoPtr<IEventHandle>> PendingEvents;
221221
std::vector<ui32> NodeIds;
222222
TNodeIdentifier SelfNode;
223+
bool SelfBound = false;
223224

224225
// scatter tasks
225226
ui64 NextScatterCookie = RandomNumber<ui64>();
@@ -265,15 +266,10 @@ namespace NKikimr::NStorage {
265266
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
266267
// PDisk configuration retrieval and storing
267268

268-
static void ReadConfig(TActorSystem *actorSystem, TActorId selfId, const std::vector<TString>& drives,
269-
const TIntrusivePtr<TNodeWardenConfig>& cfg, ui64 cookie);
270-
271-
static void WriteConfig(TActorSystem *actorSystem, TActorId selfId, const std::vector<TString>& drives,
272-
const TIntrusivePtr<TNodeWardenConfig>& cfg, const NKikimrBlobStorage::TPDiskMetadataRecord& record);
273-
269+
void ReadConfig(ui64 cookie = 0);
270+
void WriteConfig(std::vector<TString> drives, NKikimrBlobStorage::TPDiskMetadataRecord record);
274271
void PersistConfig(TPersistCallback callback);
275272
void Handle(TEvPrivate::TEvStorageConfigStored::TPtr ev);
276-
277273
void Handle(TEvPrivate::TEvStorageConfigLoaded::TPtr ev);
278274

279275
static TString CalculateFingerprint(const NKikimrBlobStorage::TStorageConfig& config);

ydb/core/blobstorage/nodewarden/distconf_binding.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ namespace NKikimr::NStorage {
5858
// issue updates
5959
NodeIds = std::move(nodeIds);
6060
BindQueue.Update(NodeIds);
61-
if (NodeListObtained && StorageConfigLoaded) {
61+
if (NodeListObtained && StorageConfigLoaded && !std::exchange(SelfBound, true)) {
62+
UpdateBound(SelfNode.NodeId(), SelfNode, *StorageConfig, nullptr);
6263
IssueNextBindRequest();
6364
}
6465
}

ydb/core/blobstorage/nodewarden/distconf_fsm.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,7 @@ namespace NKikimr::NStorage {
328328
}
329329
std::sort(drives.begin(), drives.end());
330330
drives.erase(std::unique(drives.begin(), drives.end()), drives.end());
331-
auto query = std::bind(&TThis::ReadConfig, TActivationContext::ActorSystem(), SelfId(), drives, Cfg, cookie);
332-
Send(MakeIoDispatcherActorId(), new TEvInvokeQuery(std::move(query)));
331+
ReadConfig(cookie);
333332
++task.AsyncOperationsPending;
334333
break;
335334
}

0 commit comments

Comments
 (0)