Skip to content

Commit 11bc401

Browse files
committed
Ydb stable 22-4-31
x-stable-origin-commit: 2bc59c7eeae4a8f3d396867de193d1375dd388ce
1 parent 0b931ad commit 11bc401

35 files changed

+876
-150
lines changed

ydb/core/blobstorage/dsproxy/dsproxy_patch.cpp

Lines changed: 111 additions & 79 deletions
Large diffs are not rendered by default.

ydb/core/blobstorage/nodewarden/node_warden_impl.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,14 @@ void TNodeWarden::Handle(TEvStatusUpdate::TPtr ev) {
401401
auto *msg = ev->Get();
402402
const TVSlotId vslotId(msg->NodeId, msg->PDiskId, msg->VSlotId);
403403
if (const auto it = LocalVDisks.find(vslotId); it != LocalVDisks.end() && it->second.Status != msg->Status) {
404-
it->second.Status = msg->Status;
404+
auto& vdisk = it->second;
405+
vdisk.Status = msg->Status;
405406
SendDiskMetrics(false);
407+
408+
if (msg->Status == NKikimrBlobStorage::EVDiskStatus::READY && vdisk.WhiteboardVDiskId) {
409+
Send(WhiteboardId, new NNodeWhiteboard::TEvWhiteboard::TEvVDiskDropDonors(*vdisk.WhiteboardVDiskId,
410+
vdisk.WhiteboardInstanceGuid, NNodeWhiteboard::TEvWhiteboard::TEvVDiskDropDonors::TDropAllDonors()));
411+
}
406412
}
407413
}
408414

ydb/core/blobstorage/nodewarden/node_warden_impl.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,12 @@ namespace NKikimr::NStorage {
224224
return MakeBlobStorageVDiskID(NodeId, PDiskId, VDiskSlotId);
225225
}
226226

227+
void Serialize(NKikimrBlobStorage::TVSlotId *proto) const {
228+
proto->SetNodeId(NodeId);
229+
proto->SetPDiskId(PDiskId);
230+
proto->SetVSlotId(VDiskSlotId);
231+
}
232+
227233
auto AsTuple() const { return std::make_tuple(NodeId, PDiskId, VDiskSlotId); }
228234
friend bool operator <(const TVSlotId& x, const TVSlotId& y) { return x.AsTuple() < y.AsTuple(); }
229235
friend bool operator <=(const TVSlotId& x, const TVSlotId& y) { return x.AsTuple() <= y.AsTuple(); }
@@ -253,6 +259,7 @@ namespace NKikimr::NStorage {
253259

254260
// Last VDiskId reported to Node Whiteboard.
255261
std::optional<TVDiskID> WhiteboardVDiskId;
262+
ui64 WhiteboardInstanceGuid;
256263

257264
bool SlayInFlight = false;
258265

ydb/core/blobstorage/nodewarden/node_warden_vdisk.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ namespace NKikimr::NStorage {
175175
Send(WhiteboardId, new NNodeWhiteboard::TEvWhiteboard::TEvVDiskStateUpdate(vdiskId, groupInfo->GetStoragePoolName(),
176176
vslotId.PDiskId, vslotId.VDiskSlotId, pdiskGuid, kind, donorMode, whiteboardInstanceGuid, std::move(donors)));
177177
vdisk.WhiteboardVDiskId.emplace(vdiskId);
178+
vdisk.WhiteboardInstanceGuid = whiteboardInstanceGuid;
178179

179180
// create an actor
180181
auto *as = TActivationContext::ActorSystem();
@@ -281,9 +282,19 @@ namespace NKikimr::NStorage {
281282

282283
void TNodeWarden::Handle(TEvBlobStorage::TEvDropDonor::TPtr ev) {
283284
auto *msg = ev->Get();
284-
STLOG(PRI_INFO, BS_NODE, NW34, "TEvDropDonor", (VSlotId, TVSlotId(msg->NodeId, msg->PDiskId, msg->VSlotId)),
285-
(VDiskId, msg->VDiskId));
285+
const TVSlotId vslotId(msg->NodeId, msg->PDiskId, msg->VSlotId);
286+
STLOG(PRI_INFO, BS_NODE, NW34, "TEvDropDonor", (VSlotId, vslotId), (VDiskId, msg->VDiskId));
286287
SendDropDonorQuery(msg->NodeId, msg->PDiskId, msg->VSlotId, msg->VDiskId);
288+
289+
if (const auto it = LocalVDisks.find(vslotId); it != LocalVDisks.end()) {
290+
const auto& vdisk = it->second;
291+
if (vdisk.WhiteboardVDiskId) {
292+
NKikimrBlobStorage::TVSlotId id;
293+
vslotId.Serialize(&id);
294+
Send(WhiteboardId, new NNodeWhiteboard::TEvWhiteboard::TEvVDiskDropDonors(*vdisk.WhiteboardVDiskId,
295+
vdisk.WhiteboardInstanceGuid, {id}));
296+
}
297+
}
287298
}
288299

289300
void TNodeWarden::UpdateGroupInfoForDisk(TVDiskRecord& vdisk, const TIntrusivePtr<TBlobStorageGroupInfo>& newInfo) {

ydb/core/grpc_services/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ target_link_libraries(ydb-core-grpc_services PUBLIC
5353
cpp-client-resources
5454
)
5555
target_sources(ydb-core-grpc_services PRIVATE
56+
${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/audit_log.cpp
5657
${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/grpc_endpoint_publish_actor.cpp
5758
${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/grpc_helper.cpp
5859
${CMAKE_SOURCE_DIR}/ydb/core/grpc_services/grpc_mon.cpp

ydb/core/grpc_services/audit_log.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#include "defs.h"
2+
#include "audit_log.h"
3+
4+
#include "base/base.h"
5+
6+
namespace NKikimr {
7+
namespace NGRpcService {
8+
9+
void AuditLog(const IRequestProxyCtx* reqCtx, const TString& database,
10+
const TString& subject, const TActorContext& ctx)
11+
{
12+
LOG_NOTICE_S(ctx, NKikimrServices::GRPC_SERVER, "AUDIT: "
13+
<< "request name: " << reqCtx->GetRequestName()
14+
<< ", database: " << database
15+
<< ", peer: " << reqCtx->GetPeerName()
16+
<< ", subject: " << subject);
17+
}
18+
19+
}
20+
}
21+

ydb/core/grpc_services/audit_log.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#pragma once
2+
3+
namespace NKikimr {
4+
namespace NGRpcService {
5+
6+
class IRequestProxyCtx;
7+
8+
void AuditLog(const IRequestProxyCtx* reqCtx, const TString& database,
9+
const TString& subject, const TActorContext& ctx);
10+
11+
}
12+
}

ydb/core/grpc_services/grpc_request_check_actor.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#pragma once
22
#include "defs.h"
3+
#include "audit_log.h"
34
#include "service_ratelimiter_events.h"
45
#include "local_rate_limiter.h"
56
#include "operation_helpers.h"
@@ -112,6 +113,10 @@ class TGrpcRequestCheckActor
112113
}
113114
}
114115

116+
if (AppData(ctx)->FeatureFlags.GetEnableGrpcAudit()) {
117+
AuditLog(GrpcRequestBaseCtx_, CheckedDatabaseName_, GetSubject(), ctx);
118+
}
119+
115120
// Simple rps limitation
116121
static NRpcService::TRlConfig rpsRlConfig(
117122
"serverless_rt_coordination_node_path",
@@ -205,6 +210,11 @@ class TGrpcRequestCheckActor
205210
}
206211

207212
private:
213+
TString GetSubject() const {
214+
const auto sid = TBase::GetUserSID();
215+
return sid ? sid : "no subject";
216+
}
217+
208218
static NYql::TIssues GetRlIssues(const Ydb::RateLimiter::AcquireResourceResponse& resp) {
209219
NYql::TIssues opIssues;
210220
NYql::IssuesFromMessage(resp.operation().issues(), opIssues);

ydb/core/mind/hive/balancer.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ class THiveBalancer : public NActors::TActorBootstrapped<THiveBalancer>, public
146146
if (RecheckOnFinish && MaxMovements != 0 && Movements >= MaxMovements) {
147147
BLOG_D("Balancer initiated recheck");
148148
Hive->ProcessTabletBalancer();
149+
} else {
150+
Send(Hive->SelfId(), new TEvPrivate::TEvBalancerOut());
149151
}
150152
return IActor::PassAway();
151153
}
@@ -239,6 +241,7 @@ class THiveBalancer : public NActors::TActorBootstrapped<THiveBalancer>, public
239241
tablets.emplace_back(tablet);
240242
}
241243
}
244+
BLOG_TRACE("Balancer on node " << node->Id << ": " << tablets.size() << "/" << nodeTablets.size() << " tablets is suitable for balancing");
242245
if (!tablets.empty()) {
243246
switch (Hive->GetTabletBalanceStrategy()) {
244247
case NKikimrConfig::THiveConfig::HIVE_TABLET_BALANCE_STRATEGY_OLD_WEIGHTED_RANDOM:

ydb/core/mind/hive/hive_events.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ struct TEvPrivate {
2323
EvUnlockTabletReconnectTimeout,
2424
EvProcessPendingOperations,
2525
EvRestartComplete,
26+
EvBalancerOut,
2627
EvEnd
2728
};
2829

@@ -37,7 +38,7 @@ struct TEvPrivate {
3738
};
3839

3940
struct TEvProcessBootQueue : TEventLocal<TEvProcessBootQueue, EvProcessBootQueue> {};
40-
41+
4142
struct TEvPostponeProcessBootQueue : TEventLocal<TEvPostponeProcessBootQueue, EvPostponeProcessBootQueue> {};
4243

4344
struct TEvProcessDisconnectNode : TEventLocal<TEvProcessDisconnectNode, EvProcessDisconnectNode> {
@@ -78,6 +79,8 @@ struct TEvPrivate {
7879
};
7980

8081
struct TEvProcessPendingOperations : TEventLocal<TEvProcessPendingOperations, EvProcessPendingOperations> {};
82+
83+
struct TEvBalancerOut : TEventLocal<TEvBalancerOut, EvBalancerOut> {};
8184
};
8285

8386
} // NHive

0 commit comments

Comments
 (0)