Skip to content

Commit 9378e60

Browse files
committed
Revert "Merge tag 'tags/24.3.9-hotfix-2' into stream-nb-24-3"
This reverts commit 989fbc6, reversing changes made to eb870f2.
1 parent 989fbc6 commit 9378e60

File tree

548 files changed

+3862
-16847
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

548 files changed

+3862
-16847
lines changed

.github/config/muted_ya.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ ydb/core/quoter/ut QuoterWithKesusTest.PrefetchCoefficient
99
ydb/core/keyvalue/ut_trace TKeyValueTracingTest.*
1010
ydb/core/kqp/provider/ut KikimrIcGateway.TestLoadBasicSecretValueFromExternalDataSourceMetadata
1111
ydb/core/kqp/ut/olap KqpOlapBlobsSharing.*
12+
ydb/core/kqp/ut/olap KqpOlap.ScanQueryOltpAndOlap
1213
ydb/core/kqp/ut/olap KqpOlapStatistics.StatsUsageWithTTL
14+
ydb/core/kqp/ut/olap KqpOlap.YqlScriptOltpAndOlap
1315
ydb/core/kqp/ut/olap KqpOlapAggregations.Aggregation_ResultCountAll_FilterL
1416
ydb/core/kqp/ut/olap KqpOlapWrite.WriteDeleteCleanGC
1517
ydb/core/kqp/ut/pg KqpPg.CreateIndex
@@ -30,7 +32,6 @@ ydb/core/kqp/ut/service KqpQueryService.ExecuteQueryPgTableSelect
3032
ydb/core/kqp/ut/service KqpQueryService.QueryOnClosedSession
3133
ydb/core/kqp/ut/service KqpService.CloseSessionsWithLoad
3234
ydb/core/kqp/ut/service [38/50]*
33-
ydb/core/kqp/ut/service KqpQueryService.TableSink_OltpUpdate
3435
ydb/core/persqueue/ut [37/40] chunk chunk
3536
ydb/core/persqueue/ut [38/40] chunk chunk
3637
ydb/core/persqueue/ut TPQTest.*DirectRead*

ydb/apps/ydbd/ya.make

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
PROGRAM(ydbd)
22

3-
IF (NOT SANITIZER_TYPE) # for some reasons some tests with asan are failed, see comment in CPPCOM-32
4-
NO_EXPORT_DYNAMIC_SYMBOLS()
5-
ENDIF()
3+
NO_EXPORT_DYNAMIC_SYMBOLS()
64

75
IF (OS_LINUX)
86
ALLOCATOR(TCMALLOC_256K)

ydb/core/audit/audit_log.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include "audit_log.h"
2+
#include "audit_log_impl.h"
3+
4+
#include <library/cpp/logger/record.h>
5+
#include <ydb/library/actors/core/hfunc.h>
6+
#include <ydb/library/actors/core/log.h>
7+
8+
namespace NKikimr::NAudit {
9+
10+
std::atomic<bool> AUDIT_LOG_ENABLED = false;
11+
12+
THolder<NActors::IActor> CreateAuditWriter(TMap<NKikimrConfig::TAuditConfig::EFormat, TVector<THolder<TLogBackend>>> logBackends)
13+
{
14+
AUDIT_LOG_ENABLED.store(true);
15+
return MakeHolder<TAuditLogActor>(std::move(logBackends));
16+
}
17+
18+
void SendAuditLog(const NActors::TActorSystem* sys, TVector<std::pair<TString, TString>>&& parts)
19+
{
20+
auto request = MakeHolder<TEvAuditLog::TEvWriteAuditLog>(Now(), std::move(parts));
21+
sys->Send(MakeAuditServiceID(), request.Release());
22+
}
23+
24+
} // namespace NKikimr::NAudit

ydb/core/audit/audit_log.h

Lines changed: 93 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
#pragma once
22

3-
#include <utility>
4-
#include <atomic>
5-
6-
#include <util/generic/string.h>
7-
#include <util/generic/vector.h>
3+
#include <ydb/core/base/events.h>
84

95
#include <ydb/library/actors/core/actor.h>
6+
#include <ydb/library/actors/core/events.h>
7+
#include <library/cpp/logger/backend.h>
8+
#include <ydb/core/protos/config.pb.h>
9+
#include <ydb/library/services/services.pb.h>
10+
11+
#include <library/cpp/logger/record.h>
12+
#include <ydb/library/actors/core/hfunc.h>
13+
#include <ydb/library/actors/core/log.h>
14+
15+
#include <util/generic/strbuf.h>
16+
#include <util/datetime/base.h>
1017

1118
#define AUDIT_LOG_S(sys, expr) \
1219
do { \
@@ -17,7 +24,7 @@
1724
} \
1825
} while (0) /**/
1926

20-
#define AUDIT_LOG(expr) AUDIT_LOG_S((::NActors::TlsActivationContext->ExecutorThread.ActorSystem), expr)
27+
#define AUDIT_LOG(expr) AUDIT_LOG_S((TlsActivationContext->ExecutorThread.ActorSystem), expr)
2128

2229
#define AUDIT_PART_NO_COND(key, value) AUDIT_PART_COND(key, value, true)
2330
#define AUDIT_PART_COND(key, value, condition) \
@@ -30,14 +37,90 @@
3037
#define GET_AUDIT_PART_MACRO(_1, _2, _3, NAME,...) NAME
3138
#define AUDIT_PART(...) GET_AUDIT_PART_MACRO(__VA_ARGS__, AUDIT_PART_COND, AUDIT_PART_NO_COND)(__VA_ARGS__)
3239

33-
namespace NActors {
34-
class TActorSystem;
35-
}
36-
3740
namespace NKikimr::NAudit {
3841

3942
extern std::atomic<bool> AUDIT_LOG_ENABLED;
4043

44+
struct TEvAuditLog
45+
{
46+
//
47+
// Events declaration
48+
//
49+
50+
enum EEvents
51+
{
52+
EvBegin = EventSpaceBegin(TKikimrEvents::ES_YDB_AUDIT_LOG),
53+
54+
// Request actors
55+
EvWriteAuditLog = EvBegin + 0,
56+
57+
EvEnd
58+
};
59+
60+
static_assert(EvEnd <= EventSpaceEnd(TKikimrEvents::ES_YDB_AUDIT_LOG),
61+
"expected EvEnd <= EventSpaceEnd(TKikimrEvents::ES_YDB_AUDIT_LOG)");
62+
63+
struct TEvWriteAuditLog
64+
: public NActors::TEventLocal<TEvWriteAuditLog, EvWriteAuditLog>
65+
{
66+
TInstant Time;
67+
TVector<std::pair<TString, TString>> Parts;
68+
69+
TEvWriteAuditLog(TInstant time, TVector<std::pair<TString, TString>>&& parts)
70+
: Time(time)
71+
, Parts(std::move(parts))
72+
{}
73+
};
74+
};
75+
76+
class TAuditLogActor final
77+
: public TActor<TAuditLogActor>
78+
{
79+
private:
80+
const TMap<NKikimrConfig::TAuditConfig::EFormat, TVector<THolder<TLogBackend>>> LogBackends;
81+
public:
82+
TAuditLogActor(TMap<NKikimrConfig::TAuditConfig::EFormat, TVector<THolder<TLogBackend>>> logBackends)
83+
: TActor(&TThis::StateWork)
84+
, LogBackends(std::move(logBackends))
85+
{
86+
}
87+
88+
static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
89+
return NKikimrServices::TActivity::AUDIT_WRITER_ACTOR;
90+
}
91+
92+
private:
93+
STFUNC(StateWork);
94+
95+
void HandlePoisonPill(
96+
const TEvents::TEvPoisonPill::TPtr& ev,
97+
const TActorContext& ctx);
98+
99+
void HandleWriteAuditLog(
100+
const TEvAuditLog::TEvWriteAuditLog::TPtr& ev,
101+
const TActorContext& ctx);
102+
103+
static void WriteLog(
104+
const TString& log,
105+
const TVector<THolder<TLogBackend>>& logBackends);
106+
107+
static TString GetJsonLog(
108+
const TEvAuditLog::TEvWriteAuditLog::TPtr& ev);
109+
110+
static TString GetTxtLog(
111+
const TEvAuditLog::TEvWriteAuditLog::TPtr& ev);
112+
113+
void HandleUnexpectedEvent(STFUNC_SIG);
114+
};
115+
116+
////////////////////////////////////////////////////////////////////////////////
117+
41118
void SendAuditLog(const NActors::TActorSystem* sys, TVector<std::pair<TString, TString>>&& parts);
42119

120+
inline NActors::TActorId MakeAuditServiceID() {
121+
return NActors::TActorId(0, TStringBuf("YDB_AUDIT"));
122+
}
123+
124+
THolder<NActors::IActor> CreateAuditWriter(TMap<NKikimrConfig::TAuditConfig::EFormat, TVector<THolder<TLogBackend>>> logBackends);
125+
43126
} // namespace NKikimr::NAudit

0 commit comments

Comments
 (0)