Skip to content

Commit

Permalink
Merge pull request #10191 from uzhastik/24_3_merge_5
Browse files Browse the repository at this point in the history
24 3 merge 5
  • Loading branch information
maximyurchuk authored Oct 8, 2024
2 parents d438205 + f83a4c6 commit dfc2b36
Show file tree
Hide file tree
Showing 256 changed files with 16,583 additions and 9,486 deletions.
20 changes: 11 additions & 9 deletions ydb/core/base/board_lookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace NKikimr {
class TBoardLookupActor : public TActorBootstrapped<TBoardLookupActor> {
const TString Path;
const TActorId Owner;
const ui64 Cookie;
const EBoardLookupMode Mode;
const bool Subscriber;
TBoardRetrySettings BoardRetrySettings;
Expand Down Expand Up @@ -111,12 +112,12 @@ class TBoardLookupActor : public TActorBootstrapped<TBoardLookupActor> {
void NotAvailable() {
if (CurrentStateFunc() != &TThis::StateSubscribe) {
Send(Owner, new TEvStateStorage::TEvBoardInfo(
TEvStateStorage::TEvBoardInfo::EStatus::NotAvailable, Path));
TEvStateStorage::TEvBoardInfo::EStatus::NotAvailable, Path), 0, Cookie);
} else {
Send(Owner,
new TEvStateStorage::TEvBoardInfoUpdate(
TEvStateStorage::TEvBoardInfo::EStatus::NotAvailable, Path
)
), 0, Cookie
);
}
return PassAway();
Expand All @@ -129,7 +130,7 @@ class TBoardLookupActor : public TActorBootstrapped<TBoardLookupActor> {
auto reply = MakeHolder<TEvStateStorage::TEvBoardInfo>(
TEvStateStorage::TEvBoardInfo::EStatus::Ok, Path);
reply->InfoEntries = std::move(Info);
Send(Owner, std::move(reply));
Send(Owner, std::move(reply), 0, Cookie);
if (Subscriber) {
Become(&TThis::StateSubscribe);
return;
Expand Down Expand Up @@ -240,7 +241,7 @@ class TBoardLookupActor : public TActorBootstrapped<TBoardLookupActor> {
auto reply = MakeHolder<TEvStateStorage::TEvBoardInfoUpdate>(
TEvStateStorage::TEvBoardInfo::EStatus::Ok, Path);
reply->Updates = { { oid, std::move(update.value()) } };
Send(Owner, std::move(reply));
Send(Owner, std::move(reply), 0, Cookie);
}
} else {
if (info.GetDropped()) {
Expand Down Expand Up @@ -308,7 +309,7 @@ class TBoardLookupActor : public TActorBootstrapped<TBoardLookupActor> {
auto reply = MakeHolder<TEvStateStorage::TEvBoardInfoUpdate>(
TEvStateStorage::TEvBoardInfo::EStatus::Ok, Path);
reply->Updates = std::move(updates);
Send(Owner, std::move(reply));
Send(Owner, std::move(reply), 0, Cookie);
}
}

Expand Down Expand Up @@ -484,7 +485,7 @@ class TBoardLookupActor : public TActorBootstrapped<TBoardLookupActor> {
auto reply = MakeHolder<TEvStateStorage::TEvBoardInfoUpdate>(
TEvStateStorage::TEvBoardInfo::EStatus::Ok, Path);
reply->Updates = std::move(updates);
Send(Owner, std::move(reply));
Send(Owner, std::move(reply), 0, Cookie);
}
}

Expand All @@ -495,9 +496,10 @@ class TBoardLookupActor : public TActorBootstrapped<TBoardLookupActor> {

TBoardLookupActor(
const TString &path, TActorId owner, EBoardLookupMode mode,
TBoardRetrySettings boardRetrySettings)
TBoardRetrySettings boardRetrySettings, ui64 cookie = 0)
: Path(path)
, Owner(owner)
, Cookie(cookie)
, Mode(mode)
, Subscriber(Mode == EBoardLookupMode::Subscription)
, BoardRetrySettings(std::move(boardRetrySettings))
Expand Down Expand Up @@ -545,8 +547,8 @@ class TBoardLookupActor : public TActorBootstrapped<TBoardLookupActor> {

IActor* CreateBoardLookupActor(
const TString &path, const TActorId &owner, EBoardLookupMode mode,
TBoardRetrySettings boardRetrySettings) {
return new TBoardLookupActor(path, owner, mode, std::move(boardRetrySettings));
TBoardRetrySettings boardRetrySettings, ui64 cookie) {
return new TBoardLookupActor(path, owner, mode, std::move(boardRetrySettings), cookie);
}

}
2 changes: 1 addition & 1 deletion ydb/core/base/statestorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ IActor* CreateStateStorageBoardReplica(const TIntrusivePtr<TStateStorageInfo> &,
IActor* CreateSchemeBoardReplica(const TIntrusivePtr<TStateStorageInfo>&, ui32);
IActor* CreateBoardLookupActor(
const TString &path, const TActorId &owner, EBoardLookupMode mode,
TBoardRetrySettings boardRetrySettings = {});
TBoardRetrySettings boardRetrySettings = {}, ui64 cookie = 0);
IActor* CreateBoardPublishActor(
const TString &path, const TString &payload, const TActorId &owner, ui32 ttlMs, bool reg,
TBoardRetrySettings boardRetrySettings = {});
Expand Down
5 changes: 3 additions & 2 deletions ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,7 @@ void TPDisk::WhiteboardReport(TWhiteboardReport &whiteboardReport) {
TGuard<TMutex> guard(StateMutex);
const ui64 totalSize = Format.DiskSize;
const ui64 availableSize = (ui64)Format.ChunkSize * Keeper.GetFreeChunkCount();

if (*Mon.PDiskBriefState != TPDiskMon::TPDisk::Error) {
*Mon.FreeSpaceBytes = availableSize;
*Mon.UsedSpaceBytes = totalSize - availableSize;
Expand All @@ -1487,7 +1487,7 @@ void TPDisk::WhiteboardReport(TWhiteboardReport &whiteboardReport) {
*Mon.UsedSpaceBytes = 32_KB;
*Mon.TotalSpaceBytes = 32_KB;
}

NKikimrWhiteboard::TPDiskStateInfo& pdiskState = reportResult->PDiskState->Record;
pdiskState.SetPDiskId(PDiskId);
pdiskState.SetPath(Cfg->GetDevicePath());
Expand All @@ -1499,6 +1499,7 @@ void TPDisk::WhiteboardReport(TWhiteboardReport &whiteboardReport) {
pdiskState.SetSystemSize(Format.ChunkSize * (Keeper.GetOwnerHardLimit(OwnerSystemLog) + Keeper.GetOwnerHardLimit(OwnerSystemReserve)));
pdiskState.SetLogUsedSize(Format.ChunkSize * (Keeper.GetOwnerHardLimit(OwnerCommonStaticLog) - Keeper.GetOwnerFree(OwnerCommonStaticLog)));
pdiskState.SetLogTotalSize(Format.ChunkSize * Keeper.GetOwnerHardLimit(OwnerCommonStaticLog));
pdiskState.SetNumActiveSlots(TotalOwners);
if (ExpectedSlotCount) {
pdiskState.SetExpectedSlotCount(ExpectedSlotCount);
}
Expand Down
16 changes: 14 additions & 2 deletions ydb/core/change_exchange/change_sender_common_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,10 @@ class TBaseChangeSender {
}

TActorId GetChangeServer() const { return ChangeServer; }
void CreateSenders(const TVector<ui64>& partitionIds, bool partitioningChanged = true) {
if (partitioningChanged) {

private:
void CreateSendersImpl(const TVector<ui64>& partitionIds) {
if (partitionIds) {
CreateMissingSenders(partitionIds);
} else {
RecreateSenders(GonePartitions);
Expand All @@ -427,6 +429,16 @@ class TBaseChangeSender {
}
}

protected:
void CreateSenders(const TVector<ui64>& partitionIds) {
Y_ABORT_UNLESS(partitionIds);
CreateSendersImpl(partitionIds);
}

void CreateSenders() {
CreateSendersImpl({});
}

void KillSenders() {
for (const auto& [_, sender] : std::exchange(Senders, {})) {
if (sender.ActorId) {
Expand Down
15 changes: 15 additions & 0 deletions ydb/core/change_exchange/util.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "util.h"

namespace NKikimr::NChangeExchange {

TVector<ui64> MakePartitionIds(const TVector<TKeyDesc::TPartitionInfo>& partitions) {
TVector<ui64> result(::Reserve(partitions.size()));

for (const auto& partition : partitions) {
result.push_back(partition.ShardId);
}

return result;
}

}
9 changes: 9 additions & 0 deletions ydb/core/change_exchange/util.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once

#include <ydb/core/scheme/scheme_tabledefs.h>

namespace NKikimr::NChangeExchange {

TVector<ui64> MakePartitionIds(const TVector<TKeyDesc::TPartitionInfo>& partitions);

}
1 change: 1 addition & 0 deletions ydb/core/change_exchange/ya.make
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ SRCS(
change_exchange.cpp
change_record.cpp
change_sender_monitoring.cpp
util.cpp
)

GENERATE_ENUM_SERIALIZATION(change_record.h)
Expand Down
24 changes: 23 additions & 1 deletion ydb/core/cms/api_adapters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,33 @@ namespace {
}
}

Ydb::Maintenance::ActionState::ActionReason ConvertReason(NKikimrCms::TAction::TIssue::EType cmsActionIssueType) {
using EIssueType = NKikimrCms::TAction::TIssue;
switch (cmsActionIssueType) {
case EIssueType::UNKNOWN:
return Ydb::Maintenance::ActionState::ACTION_REASON_UNSPECIFIED;
case EIssueType::GENERIC:
return Ydb::Maintenance::ActionState::ACTION_REASON_GENERIC;
case EIssueType::TOO_MANY_UNAVAILABLE_VDISKS:
return Ydb::Maintenance::ActionState::ACTION_REASON_TOO_MANY_UNAVAILABLE_VDISKS;
case EIssueType::TOO_MANY_UNAVAILABLE_STATE_STORAGE_RINGS:
return Ydb::Maintenance::ActionState::ACTION_REASON_TOO_MANY_UNAVAILABLE_STATE_STORAGE_RINGS;
case EIssueType::DISABLED_NODES_LIMIT_REACHED:
return Ydb::Maintenance::ActionState::ACTION_REASON_DISABLED_NODES_LIMIT_REACHED;
case EIssueType::TENANT_DISABLED_NODES_LIMIT_REACHED:
return Ydb::Maintenance::ActionState::ACTION_REASON_TENANT_DISABLED_NODES_LIMIT_REACHED;
case EIssueType::SYS_TABLETS_NODE_LIMIT_REACHED:
return Ydb::Maintenance::ActionState::ACTION_REASON_SYS_TABLETS_NODE_LIMIT_REACHED;
}
return Ydb::Maintenance::ActionState::ACTION_REASON_UNSPECIFIED;
}

void ConvertAction(const NKikimrCms::TAction& cmsAction, Ydb::Maintenance::ActionState& actionState) {
ConvertAction(cmsAction, *actionState.mutable_action()->mutable_lock_action());
// FIXME: specify action_uid
actionState.set_status(Ydb::Maintenance::ActionState::ACTION_STATUS_PENDING);
actionState.set_reason(Ydb::Maintenance::ActionState::ACTION_REASON_UNSPECIFIED); // FIXME: specify
actionState.set_reason(ConvertReason(cmsAction.GetIssue().GetType()));
actionState.set_reason_details(cmsAction.GetIssue().GetMessage());
}

void ConvertActionUid(const TString& taskUid, const TString& permissionId,
Expand Down
7 changes: 0 additions & 7 deletions ydb/core/cms/cluster_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@ using TClusterInfoPtr = TIntrusivePtr<TClusterInfo>;
struct TCmsState;
using TCmsStatePtr = TIntrusivePtr<TCmsState>;

struct TErrorInfo {
NKikimrCms::TStatus::ECode Code = NKikimrCms::TStatus::ALLOW;
TString Reason;
TInstant Deadline;
ui64 RollbackPoint = 0;
};

/**
* Structure to hold info about issued permission. A set of
* all issued permissions is a part of CMS persistent state.
Expand Down
Loading

0 comments on commit dfc2b36

Please sign in to comment.