Skip to content

Commit daa563b

Browse files
committed
Ydb stable 23-4-11
x-stable-origin-commit: 9cc0616f07997e08c92266a30796bc4ff25aea66
1 parent 31a6b06 commit daa563b

37 files changed

+693
-382
lines changed

ydb/core/base/blobstorage.h

+29-58
Original file line numberDiff line numberDiff line change
@@ -779,64 +779,35 @@ struct TEvBlobStorage {
779779
EvBunchOfEvents,
780780

781781
// blobstorage controller interface
782-
// EvControllerReadSchemeString = EvPut + 11 * 512,
783-
// EvControllerReadDataString,
784-
EvControllerRegisterNode = EvPut + 11 * 512 + 2,
785-
EvControllerCreatePDisk,
786-
EvControllerCreateVDiskSlots,
787-
EvControllerCreateGroup,
788-
EvControllerSelectGroups,
789-
EvControllerGetGroup,
790-
EvControllerUpdateDiskStatus,
791-
EvControllerUpdateGroupsUsage, // Not used.
792-
EvControllerConfigRequest,
793-
EvControllerConfigResponse,
794-
EvControllerProposeRequest,
795-
EvControllerProposeResponse,
796-
EvControllerVDiskStatusSubscribeRequest,
797-
EvControllerVDiskStatusReport,
798-
EvControllerGroupStatusRequest,
799-
EvControllerGroupStatusResponse,
800-
EvControllerUpdateGroup,
801-
EvControllerUpdateFaultyDisks,
802-
EvControllerProposeGroupKey,
803-
EvControllerUpdateGroupLatencies, // Not used.
804-
EvControllerUpdateGroupStat,
805-
EvControllerNotifyGroupChange,
806-
EvControllerCommitGroupLatencies,
807-
EvControllerUpdateSelfHealInfo,
808-
EvControllerScrubQueryStartQuantum,
809-
EvControllerScrubQuantumFinished,
810-
EvControllerScrubReportQuantumInProgress,
811-
EvControllerUpdateNodeDrives,
812-
EvControllerGroupDecommittedNotify,
813-
EvControllerGroupDecommittedResponse,
814-
EvControllerGroupMetricsExchange,
815-
816-
// EvControllerReadSchemeStringResult = EvPut + 12 * 512,
817-
// EvControllerReadDataStringResult,
818-
EvControllerNodeServiceSetUpdate = EvPut + 12 * 512 + 2,
819-
EvControllerCreatePDiskResult,
820-
EvControllerCreateVDiskSlotsResult,
821-
EvControllerCreateGroupResult,
822-
EvControllerSelectGroupsResult,
823-
EvRequestControllerInfo,
824-
EvResponseControllerInfo,
825-
EvControllerGroupReconfigureReplace, // Not used.
826-
EvControllerGroupReconfigureReplaceResult, // Not used.
827-
EvControllerGroupReconfigureWipe,
828-
EvControllerGroupReconfigureWipeResult,
829-
EvControllerNodeReport,
830-
EvControllerScrubStartQuantum,
831-
832-
EvControllerMigrationPause,
833-
EvControllerMigrationContinue,
834-
EvControllerMigrationFinished,
835-
EvControllerMigrationBatch,
836-
EvControllerMigrationBatchRequest,
837-
EvControllerMigrationDone,
838-
839-
EvControllerUpdateSystemViews,
782+
EvControllerRegisterNode = 0x10031602,
783+
EvControllerSelectGroups = 0x10031606,
784+
EvControllerGetGroup = 0x10031607,
785+
EvControllerUpdateDiskStatus = 0x10031608,
786+
EvControllerConfigRequest = 0x1003160a,
787+
EvControllerConfigResponse = 0x1003160b,
788+
EvControllerProposeGroupKey = 0x10031614,
789+
EvControllerUpdateGroupStat = 0x10031616,
790+
EvControllerNotifyGroupChange = 0x10031617,
791+
EvControllerCommitGroupLatencies = 0x10031618,
792+
EvControllerUpdateSelfHealInfo = 0x10031619,
793+
EvControllerScrubQueryStartQuantum = 0x1003161a,
794+
EvControllerScrubQuantumFinished = 0x1003161b,
795+
EvControllerScrubReportQuantumInProgress = 0x1003161c,
796+
EvControllerUpdateNodeDrives = 0x1003161d,
797+
EvControllerGroupDecommittedNotify = 0x1003161e,
798+
EvControllerGroupDecommittedResponse = 0x1003161f,
799+
EvControllerGroupMetricsExchange = 0x10031620,
800+
801+
// BSC interface result section
802+
EvControllerNodeServiceSetUpdate = 0x10031802,
803+
EvControllerSelectGroupsResult = 0x10031806,
804+
EvRequestControllerInfo = 0x10031807,
805+
EvResponseControllerInfo = 0x10031808,
806+
EvControllerGroupReconfigureWipe = 0x1003180b,
807+
EvControllerGroupReconfigureWipeResult = 0x1003180c,
808+
EvControllerNodeReport = 0x1003180d,
809+
EvControllerScrubStartQuantum = 0x1003180e,
810+
EvControllerUpdateSystemViews = 0x10031815,
840811

841812
// proxy - node controller interface
842813
EvConfigureProxy = EvPut + 13 * 512,

ydb/core/blobstorage/groupinfo/blobstorage_groupinfo_blobmap.cpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,14 @@ namespace NKikimr {
165165
TMirror3dcMapper(const TBlobStorageGroupInfo::TTopology *topology)
166166
: Topology(topology)
167167
, NumFailRealms(Topology->FailRealms.size())
168-
, NumFailDomainsPerFailRealm(Topology->FailRealms[0].FailDomains.size())
169-
, NumVDisksPerFailDomain(Topology->FailRealms[0].FailDomains[0].VDisks.size())
168+
, NumFailDomainsPerFailRealm(NumFailRealms ? Topology->FailRealms[0].FailDomains.size() : 0)
169+
, NumVDisksPerFailDomain(NumFailDomainsPerFailRealm ? Topology->FailRealms[0].FailDomains[0].VDisks.size() : 0)
170170
{
171-
Y_VERIFY(NumFailRealms >= NumFailRealmsInSubgroup &&
172-
NumFailDomainsPerFailRealm >= NumFailDomainsPerFailRealmInSubgroup,
173-
"mirror-3-dc group tolopogy is invalid: %s", topology->ToString().data());
171+
if (NumFailRealms && NumFailDomainsPerFailRealm && NumVDisksPerFailDomain) {
172+
Y_VERIFY(NumFailRealms >= NumFailRealmsInSubgroup &&
173+
NumFailDomainsPerFailRealm >= NumFailDomainsPerFailRealmInSubgroup,
174+
"mirror-3-dc group tolopogy is invalid: %s", topology->ToString().data());
175+
}
174176
}
175177

176178
void PickSubgroup(ui32 hash, TBlobStorageGroupInfo::TOrderNums &orderNums) override final {

ydb/core/blobstorage/ut_blobstorage/group_reconfiguration.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ Y_UNIT_TEST_SUITE(GroupReconfiguration) {
331331
Timer.Reset();
332332
auto ev = std::make_unique<TEvBlobStorage::TEvControllerGetGroup>();
333333
ev->Record.AddGroupIDs(GroupId);
334-
NTabletPipe::SendData(SelfId(), ClientId, ev.release(), 0);
334+
NTabletPipe::SendData(SelfId(), ClientId, ev.release(), Max<ui64>());
335335
}
336336
}
337337

ydb/core/blobstorage/ut_blobstorage/lib/env.h

+11-8
Original file line numberDiff line numberDiff line change
@@ -712,17 +712,20 @@ struct TEnvironmentSetup {
712712
Sim(TDuration::Seconds(15));
713713
}
714714

715-
void Wipe(ui32 nodeId, ui32 pdiskId, ui32 vslotId) {
716-
const TActorId self = Runtime->AllocateEdgeActor(Settings.ControllerNodeId, __FILE__, __LINE__);
717-
auto ev = std::make_unique<TEvBlobStorage::TEvControllerGroupReconfigureWipe>();
718-
auto& record = ev->Record;
719-
auto *vslot = record.MutableVSlotId();
715+
void Wipe(ui32 nodeId, ui32 pdiskId, ui32 vslotId, const TVDiskID& vdiskId) {
716+
NKikimrBlobStorage::TConfigRequest request;
717+
request.SetIgnoreGroupFailModelChecks(true);
718+
request.SetIgnoreDegradedGroupsChecks(true);
719+
request.SetIgnoreDisintegratedGroupsChecks(true);
720+
auto *cmd = request.AddCommand();
721+
auto *wipe = cmd->MutableWipeVDisk();
722+
auto *vslot = wipe->MutableVSlotId();
720723
vslot->SetNodeId(nodeId);
721724
vslot->SetPDiskId(pdiskId);
722725
vslot->SetVSlotId(vslotId);
723-
Runtime->SendToPipe(TabletId, self, ev.release(), 0, TTestActorSystem::GetPipeConfigWithRetries());
724-
auto response = WaitForEdgeActorEvent<TEvBlobStorage::TEvControllerGroupReconfigureWipeResult>(self);
725-
UNIT_ASSERT_VALUES_EQUAL(response->Get()->Record.GetStatus(), NKikimrProto::OK);
726+
VDiskIDFromVDiskID(vdiskId, wipe->MutableVDiskId());
727+
auto response = Invoke(request);
728+
UNIT_ASSERT_C(response.GetSuccess(), response.GetErrorDescription());
726729
}
727730

728731
void WaitForVDiskToGetRunning(const TVDiskID& vdiskId, TActorId actorId) {

ydb/core/blobstorage/ut_blobstorage/mirror3of4.cpp

+2-18
Original file line numberDiff line numberDiff line change
@@ -65,26 +65,10 @@ Y_UNIT_TEST_SUITE(Mirror3of4) {
6565
UNIT_ASSERT_VALUES_EQUAL(res->Get()->Status, NKikimrProto::OK);
6666
}
6767
if (i == 500) {
68-
const TActorId self = runtime->AllocateEdgeActor(1);
69-
auto ev = std::make_unique<TEvBlobStorage::TEvControllerGroupReconfigureWipe>();
70-
ev->Record.MutableVSlotId()->SetNodeId(2);
71-
ev->Record.MutableVSlotId()->SetPDiskId(1000);
72-
ev->Record.MutableVSlotId()->SetVSlotId(1000);
73-
runtime->SendToPipe(env.TabletId, self, ev.release(), 0, TTestActorSystem::GetPipeConfigWithRetries());
74-
auto response = env.WaitForEdgeActorEvent<TEvBlobStorage::TEvControllerGroupReconfigureWipeResult>(self);
75-
auto& r = response->Get()->Record;
76-
UNIT_ASSERT_EQUAL(r.GetStatus(), NKikimrProto::OK);
68+
env.Wipe(2, 1000, 1000, TVDiskID(groupId, 1, 0, 1, 0));
7769
}
7870
if (i == 600) {
79-
const TActorId self = runtime->AllocateEdgeActor(1);
80-
auto ev = std::make_unique<TEvBlobStorage::TEvControllerGroupReconfigureWipe>();
81-
ev->Record.MutableVSlotId()->SetNodeId(3);
82-
ev->Record.MutableVSlotId()->SetPDiskId(1000);
83-
ev->Record.MutableVSlotId()->SetVSlotId(1000);
84-
runtime->SendToPipe(env.TabletId, self, ev.release(), 0, TTestActorSystem::GetPipeConfigWithRetries());
85-
auto response = env.WaitForEdgeActorEvent<TEvBlobStorage::TEvControllerGroupReconfigureWipeResult>(self);
86-
auto& r = response->Get()->Record;
87-
UNIT_ASSERT_EQUAL(r.GetStatus(), NKikimrProto::OK);
71+
env.Wipe(3, 1000, 1000, TVDiskID(groupId, 1, 0, 2, 0));
8872
}
8973
}
9074

ydb/core/blobstorage/ut_blobstorage/osiris.cpp

+2-9
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,8 @@ bool DoTestCase(TBlobStorageGroupType::EErasureSpecies erasure, const std::set<s
6262
for (const auto& vslot : response.GetStatus(0).GetBaseConfig().GetVSlot()) {
6363
const TVDiskID vdiskId(vslot.GetGroupId(), vslot.GetGroupGeneration(), vslot.GetFailRealmIdx(),
6464
vslot.GetFailDomainIdx(), vslot.GetVDiskIdx());
65-
66-
const TActorId sender = env.Runtime->AllocateEdgeActor(1);
67-
auto ev = std::make_unique<TEvBlobStorage::TEvControllerGroupReconfigureWipe>();
68-
auto *slotId = ev->Record.MutableVSlotId();
69-
slotId->CopyFrom(vslot.GetVSlotId());
70-
env.Runtime->SendToPipe(env.TabletId, sender, ev.release(), 0, TTestActorSystem::GetPipeConfigWithRetries());
71-
auto response = env.WaitForEdgeActorEvent<TEvBlobStorage::TEvControllerGroupReconfigureWipeResult>(sender);
72-
Y_VERIFY(response->Get()->Record.GetStatus() == NKikimrProto::OK);
73-
65+
const auto& v = vslot.GetVSlotId();
66+
env.Wipe(v.GetNodeId(), v.GetPDiskId(), v.GetVSlotId(), vdiskId);
7467
env.Sim(TDuration::Seconds(30));
7568
}
7669

ydb/core/blobstorage/vdisk/common/blobstorage_event_filter.cpp

-6
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,6 @@ namespace NKikimr {
5454
TEvBlobStorage::EvControllerUpdateDiskStatus,
5555
TEvBlobStorage::EvControllerConfigRequest,
5656
TEvBlobStorage::EvControllerConfigResponse,
57-
TEvBlobStorage::EvControllerVDiskStatusSubscribeRequest,
58-
TEvBlobStorage::EvControllerVDiskStatusReport,
59-
TEvBlobStorage::EvControllerGroupStatusRequest,
60-
TEvBlobStorage::EvControllerGroupStatusResponse,
61-
TEvBlobStorage::EvControllerUpdateGroup,
62-
TEvBlobStorage::EvControllerUpdateFaultyDisks,
6357
TEvBlobStorage::EvControllerUpdateGroupStat,
6458

6559
TEvBlobStorage::EvControllerSelectGroupsResult,

ydb/core/kafka_proxy/actors/kafka_read_session_actor.cpp

+13-12
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,10 @@ void TKafkaReadSessionActor::HandleWakeup(TEvKafka::TEvWakeup::TPtr, const TActo
3636
return;
3737
}
3838

39-
for (auto& topicToPartitions: NewPartitionsToLockOnTime) {
40-
auto& partitions = topicToPartitions.second;
39+
for (auto& [topicName, partitions]: NewPartitionsToLockOnTime) {
4140
for (auto partitionsIt = partitions.begin(); partitionsIt != partitions.end(); ) {
4241
if (partitionsIt->LockOn <= ctx.Now()) {
43-
TopicPartitions[topicToPartitions.first].ToLock.emplace(partitionsIt->PartitionId);
42+
TopicPartitions[topicName].ToLock.emplace(partitionsIt->PartitionId);
4443
NeedRebalance = true;
4544
partitionsIt = partitions.erase(partitionsIt);
4645
} else {
@@ -408,6 +407,8 @@ void TKafkaReadSessionActor::HandlePipeDestroyed(TEvTabletPipe::TEvClientDestroy
408407
}
409408

410409
void TKafkaReadSessionActor::ProcessBalancerDead(ui64 tabletId, const TActorContext& ctx) {
410+
NewPartitionsToLockOnTime.clear();
411+
411412
for (auto& [topicName, topicInfo] : TopicsInfo) {
412413
if (topicInfo.TabletID == tabletId) {
413414
auto partitionsIt = TopicPartitions.find(topicName);
@@ -579,8 +580,7 @@ void TKafkaReadSessionActor::HandleReleasePartition(TEvPersQueue::TEvReleasePart
579580
auto newPartitionsToLockCount = newPartitionsToLockIt == NewPartitionsToLockOnTime.end() ? 0 : newPartitionsToLockIt->second.size();
580581

581582
auto topicPartitionsIt = TopicPartitions.find(pathIt->second->GetInternalName());
582-
Y_ABORT_UNLESS(topicPartitionsIt != TopicPartitions.end());
583-
Y_ABORT_UNLESS(record.GetCount() <= topicPartitionsIt->second.ToLock.size() + topicPartitionsIt->second.ReadingNow.size() + newPartitionsToLockCount);
583+
Y_ABORT_UNLESS(record.GetCount() <= (topicPartitionsIt.IsEnd() ? 0 : topicPartitionsIt->second.ToLock.size() + topicPartitionsIt->second.ReadingNow.size()) + newPartitionsToLockCount);
584584

585585
for (ui32 c = 0; c < record.GetCount(); ++c) {
586586
// if some partition not locked yet, then release it without rebalance
@@ -599,18 +599,19 @@ void TKafkaReadSessionActor::HandleReleasePartition(TEvPersQueue::TEvReleasePart
599599
}
600600

601601
NeedRebalance = true;
602-
size_t partitionToReleaseIndex = 0;
603-
size_t i = 0;
602+
ui32 partitionToRelease = 0;
603+
ui32 i = 0;
604604

605-
for (size_t partIndex = 0; partIndex < topicPartitionsIt->second.ReadingNow.size(); partIndex++) {
606-
if (!topicPartitionsIt->second.ToRelease.contains(partIndex) && (group == 0 || partIndex + 1 == group)) {
605+
for (auto curPartition : topicPartitionsIt->second.ReadingNow) {
606+
if (!topicPartitionsIt->second.ToRelease.contains(curPartition) && (group == 0 || curPartition + 1 == group)) {
607607
++i;
608-
if (rand() % i == 0) { // will lead to 1/n probability for each of n partitions
609-
partitionToReleaseIndex = partIndex;
608+
if (rand() % i == 0) {
609+
partitionToRelease = curPartition;
610610
}
611611
}
612612
}
613-
topicPartitionsIt->second.ToRelease.emplace(partitionToReleaseIndex);
613+
614+
topicPartitionsIt->second.ToRelease.emplace(partitionToRelease);
614615
}
615616
}
616617

ydb/core/kqp/compute_actor/kqp_scan_fetcher_actor.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,14 @@ void TKqpScanFetcherActor::HandleExecute(TEvKqpCompute::TEvScanError::TPtr& ev)
194194
YQL_ENSURE(state->Generation == msg.GetGeneration());
195195

196196
if (state->State == EShardState::Starting) {
197+
++TotalRetries;
198+
if (TotalRetries >= MAX_TOTAL_SHARD_RETRIES) {
199+
CA_LOG_E("TKqpScanFetcherActor: broken tablet for this request " << state->TabletId
200+
<< ", retries limit exceeded (" << state->TotalRetries << "/" << TotalRetries << ")");
201+
SendGlobalFail(NDqProto::COMPUTE_STATE_FAILURE, YdbStatusToDqStatus(status), issues);
202+
return PassAway();
203+
}
204+
197205
if (FindSchemeErrorInIssues(status, issues)) {
198206
return EnqueueResolveShard(state);
199207
}

ydb/core/mind/bscontroller/bsc.cpp

+17-15
Original file line numberDiff line numberDiff line change
@@ -75,21 +75,23 @@ void TBlobStorageController::TGroupInfo::CalculateGroupStatus() {
7575
failedByPDisk |= {Topology.get(), slot->GetShortVDiskId()};
7676
}
7777
}
78-
auto deriveStatus = [&](const auto& failed) {
79-
auto& checker = *Topology->QuorumChecker;
80-
if (!failed.GetNumSetItems()) { // all disks of group are operational
81-
return NKikimrBlobStorage::TGroupStatus::FULL;
82-
} else if (!checker.CheckFailModelForGroup(failed)) { // fail model exceeded
83-
return NKikimrBlobStorage::TGroupStatus::DISINTEGRATED;
84-
} else if (checker.IsDegraded(failed)) { // group degraded
85-
return NKikimrBlobStorage::TGroupStatus::DEGRADED;
86-
} else if (failed.GetNumSetItems()) { // group partially available, but not degraded
87-
return NKikimrBlobStorage::TGroupStatus::PARTIAL;
88-
} else {
89-
Y_FAIL("unexpected case");
90-
}
91-
};
92-
Status.MakeWorst(deriveStatus(failed), deriveStatus(failed | failedByPDisk));
78+
Status.MakeWorst(DeriveStatus(Topology.get(), failed), DeriveStatus(Topology.get(), failed | failedByPDisk));
79+
}
80+
}
81+
82+
NKikimrBlobStorage::TGroupStatus::E TBlobStorageController::DeriveStatus(const TBlobStorageGroupInfo::TTopology *topology,
83+
const TBlobStorageGroupInfo::TGroupVDisks& failed) {
84+
auto& checker = *topology->QuorumChecker;
85+
if (!failed.GetNumSetItems()) { // all disks of group are operational
86+
return NKikimrBlobStorage::TGroupStatus::FULL;
87+
} else if (!checker.CheckFailModelForGroup(failed)) { // fail model exceeded
88+
return NKikimrBlobStorage::TGroupStatus::DISINTEGRATED;
89+
} else if (checker.IsDegraded(failed)) { // group degraded
90+
return NKikimrBlobStorage::TGroupStatus::DEGRADED;
91+
} else if (failed.GetNumSetItems()) { // group partially available, but not degraded
92+
return NKikimrBlobStorage::TGroupStatus::PARTIAL;
93+
} else {
94+
Y_FAIL("unexpected case");
9395
}
9496
}
9597

0 commit comments

Comments
 (0)