Skip to content

Commit

Permalink
Ydb stable 22-4-44
Browse files Browse the repository at this point in the history
x-stable-origin-commit: 1a8317bc9b27fc6c8a8453c7938b4b252db85a01
  • Loading branch information
dcherednik committed Nov 28, 2022
1 parent 87f7fce commit 9b78acb
Show file tree
Hide file tree
Showing 712 changed files with 3,003 additions and 1,400 deletions.
5 changes: 5 additions & 0 deletions library/cpp/grpc/server/grpc_request.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ class TGRpcRequestImpl
return Request_;
}

NProtoBuf::Message* GetRequestMut() override {
return Request_;
}


TAuthState& GetAuthState() override {
return AuthState_;
}
Expand Down
3 changes: 3 additions & 0 deletions library/cpp/grpc/server/grpc_request_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ class IRequestContextBase: public TThrRefBase {
//! Get pointer to the request's message.
virtual const NProtoBuf::Message* GetRequest() const = 0;

//! Get mutable pointer to the request's message.
virtual NProtoBuf::Message* GetRequestMut() = 0;

//! Get current auth state
virtual TAuthState& GetAuthState() = 0;

Expand Down
9 changes: 7 additions & 2 deletions ydb/core/client/server/msgbus_server_s3_listing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -747,8 +747,13 @@ class TS3ListingRequestGrpc : protected TMessageConverter, public NMsgBusProxy::
}
GrpcRequest->ReplyWithYdbStatus(grpcStatus);
} else {
Ydb::S3Internal::S3ListingResult grpcResult = TMessageConverter::ConvertResult(msgbusResponse);
GrpcRequest->SendResult(grpcResult, Ydb::StatusIds::SUCCESS);
try {
Ydb::S3Internal::S3ListingResult grpcResult = TMessageConverter::ConvertResult(msgbusResponse);
GrpcRequest->SendResult(grpcResult, Ydb::StatusIds::SUCCESS);
} catch(std::exception ex) {
GrpcRequest->RaiseIssue(NYql::ExceptionToIssue(ex));
GrpcRequest->ReplyWithYdbStatus(Ydb::StatusIds::INTERNAL_ERROR);
}
}
}
};
Expand Down
8 changes: 6 additions & 2 deletions ydb/core/cms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ target_link_libraries(ydb-core-cms.global PUBLIC
tools-enum_parser-enum_serialization_runtime
)
target_sources(ydb-core-cms.global PRIVATE
${CMAKE_BINARY_DIR}/ydb/core/cms/bda6b2eb0fe591794e0191b6befe2972.cpp
${CMAKE_BINARY_DIR}/ydb/core/cms/117417182f73c245478c9903130ed8f2.cpp
)
resources(ydb-core-cms.global
${CMAKE_BINARY_DIR}/ydb/core/cms/bda6b2eb0fe591794e0191b6befe2972.cpp
${CMAKE_BINARY_DIR}/ydb/core/cms/117417182f73c245478c9903130ed8f2.cpp
INPUTS
${CMAKE_SOURCE_DIR}/ydb/core/cms/ui/index.html
${CMAKE_SOURCE_DIR}/ydb/core/cms/ui/cms.css
Expand Down Expand Up @@ -124,6 +124,8 @@ resources(ydb-core-cms.global
${CMAKE_SOURCE_DIR}/ydb/core/cms/ui/res/remove.png
${CMAKE_SOURCE_DIR}/ydb/core/cms/ui/validators.js
${CMAKE_SOURCE_DIR}/ydb/core/cms/ui/sentinel_state.js
${CMAKE_SOURCE_DIR}/ydb/core/cms/ui/nanotable.js
${CMAKE_SOURCE_DIR}/ydb/core/cms/ui/sentinel.css
KEYS
cms/ui/index.html
cms/ui/cms.css
Expand Down Expand Up @@ -151,4 +153,6 @@ resources(ydb-core-cms.global
cms/ui/res/remove.png
cms/ui/validators.js
cms/ui/sentinel_state.js
cms/ui/nanotable.js
cms/ui/sentinel.css
)
11 changes: 6 additions & 5 deletions ydb/core/cms/cms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1052,14 +1052,15 @@ void TCms::Die(const TActorContext& ctx)
TActorBase::Die(ctx);
}

void TCms::AddHostState(const TNodeInfo &node, TClusterStateResponse &resp, TInstant timestamp)
void TCms::AddHostState(const TClusterInfoPtr &clusterInfo, const TNodeInfo &node, TClusterStateResponse &resp, TInstant timestamp)
{
auto *host = resp.MutableState()->AddHosts();
host->SetName(node.Host);
host->SetState(node.State);
host->SetNodeId(node.NodeId);
host->SetInterconnectPort(node.IcPort);
host->SetTimestamp(timestamp.GetValue());
node.Location.Serialize(host->MutableLocation(), false);
if (node.State == UP || node.VDisks || node.PDisks) {
for (const auto flag : GetEnumAllValues<EService>()) {
if (!(node.Services & flag)) {
Expand All @@ -1076,15 +1077,15 @@ void TCms::AddHostState(const TNodeInfo &node, TClusterStateResponse &resp, TIns
}

for (const auto &vdId : node.VDisks) {
const auto &vdisk = ClusterInfo->VDisk(vdId);
const auto &vdisk = clusterInfo->VDisk(vdId);
auto *device = host->AddDevices();
device->SetName(vdisk.GetDeviceName());
device->SetState(vdisk.State);
device->SetTimestamp(timestamp.GetValue());
}

for (const auto &pdId : node.PDisks) {
const auto &pdisk = ClusterInfo->PDisk(pdId);
const auto &pdisk = clusterInfo->PDisk(pdId);
auto *device = host->AddDevices();
device->SetName(pdisk.GetDeviceName());
device->SetState(pdisk.State);
Expand Down Expand Up @@ -1602,7 +1603,7 @@ void TCms::Handle(TEvCms::TEvClusterStateRequest::TPtr &ev,
for (const auto &host : rec.GetHosts()) {
if (ClusterInfo->NodesCount(host) >= 1) {
for (const TNodeInfo *node : ClusterInfo->HostNodes(host)) {
AddHostState(*node, resp->Record, ClusterInfo->GetTimestamp());
AddHostState(ClusterInfo, *node, resp->Record, ClusterInfo->GetTimestamp());
}
} else {
return ReplyWithError<TEvCms::TEvClusterStateResponse>(
Expand All @@ -1611,7 +1612,7 @@ void TCms::Handle(TEvCms::TEvClusterStateRequest::TPtr &ev,
}
} else {
for (const auto &entry : ClusterInfo->AllNodes())
AddHostState(*entry.second, resp->Record, ClusterInfo->GetTimestamp());
AddHostState(ClusterInfo, *entry.second, resp->Record, ClusterInfo->GetTimestamp());
}

resp->Record.MutableStatus()->SetCode(TStatus::OK);
Expand Down
3 changes: 2 additions & 1 deletion ydb/core/cms/cms_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ class TCms : public TActor<TCms>, public TTabletExecutedFlat {

void PersistNodeTenants(TTransactionContext& txc, const TActorContext& ctx);

static void AddHostState(const TClusterInfoPtr &clusterInfo, const TNodeInfo &node, NKikimrCms::TClusterStateResponse &resp, TInstant timestamp);

private:
using TActorBase = TActor<TCms>;
using EStatusCode = NKikimrCms::TStatus::ECode;
Expand Down Expand Up @@ -355,7 +357,6 @@ class TCms : public TActor<TCms>, public TTabletExecutedFlat {
void Cleanup(const TActorContext &ctx);
void Die(const TActorContext& ctx) override;

void AddHostState(const TNodeInfo &node, NKikimrCms::TClusterStateResponse &resp, TInstant timestamp);
void GetPermission(TEvCms::TEvManagePermissionRequest::TPtr &ev, bool all, const TActorContext &ctx);
void RemovePermission(TEvCms::TEvManagePermissionRequest::TPtr &ev, bool done, const TActorContext &ctx);
void GetRequest(TEvCms::TEvManageRequestRequest::TPtr &ev, bool all, const TActorContext &ctx);
Expand Down
2 changes: 1 addition & 1 deletion ydb/core/cms/console/console__create_tenant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class TTenantsManager::TTxCreateTenant : public TTransactionBase<TTenantsManager

Tenant->IsExternalSubdomain = Self->FeatureFlags.GetEnableExternalSubdomains();
Tenant->IsExternalHive = Self->FeatureFlags.GetEnableExternalHive();
Tenant->IsExternalSysViewProcessor = Self->FeatureFlags.GetEnablePersistentQueryStats();
Tenant->IsExternalSysViewProcessor = Self->FeatureFlags.GetEnableSystemViews();

if (rec.options().disable_external_subdomain()) {
Tenant->IsExternalSubdomain = false;
Expand Down
43 changes: 43 additions & 0 deletions ydb/core/cms/json_proxy_sentinel.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,49 @@ class TJsonProxySentinel : public TJsonProxyCms<TEvCms::TEvGetSentinelStateReque
TAutoPtr<TRequest> PrepareRequest(const TActorContext &) override
{
TAutoPtr<TRequest> request = new TRequest;
const TCgiParameters& cgi = RequestEvent->Get()->Request.GetParams();

if (cgi.Has("show")) {
NKikimrCms::TGetSentinelStateRequest::EShow show;
NKikimrCms::TGetSentinelStateRequest::EShow_Parse(cgi.Get("show"), &show);
request->Record.SetShow(show);
}

if (cgi.Has("range")) {
TVector<std::pair<ui32, ui32>> ranges;
auto rangesStr = cgi.Get("range");
TVector<TString> strRanges;
StringSplitter(rangesStr).Split(',').Collect(&strRanges);
for (auto& strRange : strRanges) {
ui32 begin = 0;
ui32 end = 0;
if (!StringSplitter(strRange).Split('-').TryCollectInto(&begin, &end)) {
if (TryFromString<ui32>(strRange, begin)) {
end = begin;
} else {
break; // TODO
}
}
ranges.push_back({begin, end});
}
sort(ranges.begin(), ranges.end());
auto it = ranges.begin();
auto current = *(it)++;
while (it != ranges.end()) {
if (current.second > it->first){
current.second = std::max(current.second, it->second);
} else {
auto* newRange = request->Record.AddRanges();
newRange->SetBegin(current.first);
newRange->SetEnd(current.second);
current = *(it);
}
it++;
}
auto* newRange = request->Record.AddRanges();
newRange->SetBegin(current.first);
newRange->SetEnd(current.second);
}

return request;
}
Expand Down
Loading

0 comments on commit 9b78acb

Please sign in to comment.