Skip to content

Commit f74adc0

Browse files
authored
Switch SyncLog to modern entrypoint format (#6590)
1 parent d0aff76 commit f74adc0

24 files changed

+25
-107
lines changed

ydb/core/base/compile_time_flags.h

-9
This file was deleted.

ydb/core/base/localdb.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include "localdb.h"
2-
#include "compile_time_flags.h"
32

43
#include <ydb/core/protos/resource_broker.pb.h>
54

ydb/core/base/statestorage_guardian.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include "tablet.h"
55

66
#include <ydb/core/base/appdata.h>
7-
#include <ydb/core/base/compile_time_flags.h>
87
#include <ydb/library/services/services.pb.h>
98

109
#include <ydb/library/actors/core/actor_bootstrapped.h>

ydb/core/base/statestorage_proxy.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include "statestorage_impl.h"
22
#include "tabletid.h"
33

4-
#include <ydb/core/base/compile_time_flags.h>
54
#include <ydb/library/services/services.pb.h>
65

76
#include <ydb/library/actors/core/actor_bootstrapped.h>

ydb/core/blobstorage/pdisk/blobstorage_pdisk_config.h

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include "defs.h"
33

44
#include <ydb/core/base/blobstorage.h>
5-
#include <ydb/core/base/compile_time_flags.h>
65
#include <ydb/core/blobstorage/base/vdisk_priorities.h>
76
#include <ydb/core/control/immediate_control_board_wrapper.h>
87
#include <ydb/core/protos/blobstorage.pb.h>

ydb/core/blobstorage/pdisk/blobstorage_pdisk_crypto.h

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#pragma once
22
#include "defs.h"
33

4-
#include <ydb/core/base/compile_time_flags.h>
54
#include <ydb/core/blobstorage/crypto/crypto.h>
65

76
namespace NKikimr {

ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_run.h

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include "blobstorage_pdisk_ut_config.h"
55
#include "blobstorage_pdisk_ut_context.h"
66

7-
#include <ydb/core/base/compile_time_flags.h>
87
#include <ydb/core/base/services/blobstorage_service_id.h>
98

109
#include <util/folder/tempdir.h>

ydb/core/blobstorage/pdisk/blobstorage_pdisk_writer.h

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include "blobstorage_pdisk_mon.h"
1010
#include "blobstorage_pdisk_request_id.h"
1111

12-
#include <ydb/core/base/compile_time_flags.h>
1312
#include <ydb/core/blobstorage/crypto/crypto.h>
1413

1514
#include <util/generic/deque.h>

ydb/core/blobstorage/vdisk/common/vdisk_events.h

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <ydb/core/blobstorage/storagepoolmon/storagepool_counters.h>
1616
#include <ydb/core/base/blobstorage_common.h>
1717

18-
#include <ydb/core/base/compile_time_flags.h>
1918
#include <ydb/core/base/event_filter.h>
2019
#include <ydb/core/base/interconnect_channels.h>
2120
#include <ydb/core/protos/blobstorage_config.pb.h>

ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogdata.cpp

+10-36
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ namespace NKikimr {
431431
, ChunksToDeleteDelayed(std::move(chunksToDeleteDelayed))
432432
{}
433433

434-
void TEntryPointSerializer::Serialize(const TDeltaToDiskRecLog &delta, bool oldFormat) {
434+
void TEntryPointSerializer::Serialize(const TDeltaToDiskRecLog &delta) {
435435
// fill in the protobuf
436436
NKikimrVDiskData::TSyncLogEntryPoint pb;
437437
pb.SetRecoveryLogConfirmedLsn(RecoveryLogConfirmedLsn);
@@ -441,48 +441,22 @@ namespace NKikimr {
441441
}
442442
const ui32 indexRecsNum = SyncLogSnap->SerializeToProto(pb, delta);
443443
// produce serialized data for the entry point
444-
SerializedData = Serialize(pb, oldFormat);
444+
SerializedData = Serialize(pb);
445445

446446
// fill in EntryPointDbgInfo
447447
EntryPointDbgInfo = TEntryPointDbgInfo(SerializedData.size(),
448448
ChunksToDeleteDelayed.size(),
449449
indexRecsNum);
450450
}
451451

452-
TString TEntryPointSerializer::Serialize(const NKikimrVDiskData::TSyncLogEntryPoint &pb, bool oldFormat) {
453-
if (oldFormat) {
454-
TStringStream s;
455-
// Header
456-
const ui32 reservedData = 0;
457-
const ui32 signature = TSyncLogHeader::SyncLogOldSignature;
458-
s.Write(&signature, sizeof(signature));
459-
s.Write(&reservedData, sizeof(reservedData));
460-
const ui64 pdiskGuid = pb.GetPDiskGuid();
461-
s.Write(&pdiskGuid, sizeof(pdiskGuid));
462-
const ui64 vdiskIncarnationGuid = pb.GetVDiskIncarnationGuid();
463-
s.Write(&vdiskIncarnationGuid, sizeof(vdiskIncarnationGuid));
464-
// LogStartLsn
465-
const ui64 logStartLsn = pb.GetLogStartLsn();
466-
s.Write(&logStartLsn, sizeof(logStartLsn));
467-
// chunksToDeleteDelayed
468-
const ui32 delChunksSize = pb.ChunksToDeleteDelayedSize();
469-
s.Write(&delChunksSize, sizeof(delChunksSize));
470-
for (ui64 i = 0; i < delChunksSize; ++i) {
471-
const ui32 chunkId = pb.GetChunksToDeleteDelayed(i);
472-
s.Write(&chunkId, sizeof(chunkId));
473-
}
474-
s.Write(pb.GetDiskRecLogSerialized().data(), pb.GetDiskRecLogSerialized().size());
475-
476-
return s.Str();
477-
} else {
478-
// signature
479-
TStringStream s;
480-
s.Write(&TSyncLogHeader::SyncLogPbSignature, sizeof(ui32));
481-
// pb payload
482-
bool success = pb.SerializeToArcadiaStream(&s);
483-
Y_ABORT_UNLESS(success);
484-
return s.Str();
485-
}
452+
TString TEntryPointSerializer::Serialize(const NKikimrVDiskData::TSyncLogEntryPoint &pb) {
453+
// signature
454+
TStringStream s;
455+
s.Write(&TSyncLogHeader::SyncLogPbSignature, sizeof(ui32));
456+
// pb payload
457+
bool success = pb.SerializeToArcadiaStream(&s);
458+
Y_ABORT_UNLESS(success);
459+
return s.Str();
486460
}
487461

488462
////////////////////////////////////////////////////////////////////////////

ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogdata.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ namespace NKikimr {
280280
TVector<ui32> &&chunksToDeleteDelayed,
281281
ui64 recoveryLogConfirmedLsn);
282282

283-
void Serialize(const TDeltaToDiskRecLog &delta, bool oldFormat);
283+
void Serialize(const TDeltaToDiskRecLog &delta);
284284
TString GetSerializedData() const { return SerializedData; }
285285
TEntryPointDbgInfo GetEntryPointDbgInfo() const { return EntryPointDbgInfo; }
286286

@@ -292,7 +292,7 @@ namespace NKikimr {
292292
TString SerializedData;
293293
TEntryPointDbgInfo EntryPointDbgInfo;
294294

295-
static TString Serialize(const NKikimrVDiskData::TSyncLogEntryPoint &pb, bool oldFormat);
295+
static TString Serialize(const NKikimrVDiskData::TSyncLogEntryPoint &pb);
296296
};
297297

298298
////////////////////////////////////////////////////////////////////////////

ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogdata_ut.cpp

+5-23
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ namespace NKikimr {
4343

4444

4545
void TestEmptySyncLog(const TVector<ui32> &chunksToDeleteDelayed,
46-
ui64 recoveryLogConfirmedLsn,
47-
bool oldFormat)
46+
ui64 recoveryLogConfirmedLsn)
4847
{
4948
TSyncLogPtr syncLog = CreateEmpty();
5049

@@ -53,42 +52,25 @@ namespace NKikimr {
5352
TEntryPointSerializer serializer(syncLogSnap, std::move(copyOfChunksToDeleteDelayed),
5453
recoveryLogConfirmedLsn);
5554
TDeltaToDiskRecLog delta(10);
56-
serializer.Serialize(delta, oldFormat);
55+
serializer.Serialize(delta);
5756
TString serializedData = serializer.GetSerializedData();
5857

5958
auto recoveredSyncLog = Parse(serializedData);
6059
TEntryPointParser parser = MakeParser(serializedData);
6160
UNIT_ASSERT(parser.GetChunksToDelete() == chunksToDeleteDelayed);
62-
if (oldFormat) {
63-
UNIT_ASSERT(parser.GetRecoveryLogConfirmedLsn() == 0);
64-
} else {
65-
UNIT_ASSERT(parser.GetRecoveryLogConfirmedLsn() == recoveryLogConfirmedLsn);
66-
}
67-
}
68-
69-
70-
Y_UNIT_TEST(SerializeParseEmpty1_Old) {
71-
TVector<ui32> chunksToDeleteDelayed;
72-
ui64 recoveryLogConfirmedLsn = 0;
73-
TestEmptySyncLog(chunksToDeleteDelayed, recoveryLogConfirmedLsn, true);
74-
}
75-
76-
Y_UNIT_TEST(SerializeParseEmpty2_Old) {
77-
TVector<ui32> chunksToDeleteDelayed = {78, 3};
78-
ui64 recoveryLogConfirmedLsn = 783246;
79-
TestEmptySyncLog(chunksToDeleteDelayed, recoveryLogConfirmedLsn, true);
61+
UNIT_ASSERT(parser.GetRecoveryLogConfirmedLsn() == recoveryLogConfirmedLsn);
8062
}
8163

8264
Y_UNIT_TEST(SerializeParseEmpty1_Proto) {
8365
TVector<ui32> chunksToDeleteDelayed;
8466
ui64 recoveryLogConfirmedLsn = 0;
85-
TestEmptySyncLog(chunksToDeleteDelayed, recoveryLogConfirmedLsn, false);
67+
TestEmptySyncLog(chunksToDeleteDelayed, recoveryLogConfirmedLsn);
8668
}
8769

8870
Y_UNIT_TEST(SerializeParseEmpty2_Proto) {
8971
TVector<ui32> chunksToDeleteDelayed = {78, 3};
9072
ui64 recoveryLogConfirmedLsn = 783246;
91-
TestEmptySyncLog(chunksToDeleteDelayed, recoveryLogConfirmedLsn, false);
73+
TestEmptySyncLog(chunksToDeleteDelayed, recoveryLogConfirmedLsn);
9274
}
9375
}
9476

ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogkeeper_committer.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include "blobstorage_synclog_public_events.h"
44

55
#include <ydb/core/base/blobstorage_grouptype.h>
6-
#include <ydb/core/base/compile_time_flags.h>
76

87
using namespace NKikimrServices;
98

@@ -35,8 +34,7 @@ namespace NKikimr {
3534

3635
void GenerateCommit(const TActorContext &ctx) {
3736
// serialize
38-
const bool oldFormat = !KIKIMR_VDISK_SYNCLOG_ENTRY_POINT_PROTO_FORMAT;
39-
EntryPointSerializer.Serialize(Delta, oldFormat);
37+
EntryPointSerializer.Serialize(Delta);
4038

4139
// lsn
4240
TLsnSeg seg = SlCtx->LsnMngr->AllocLsnForLocalUse();

ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogkeeper_ut.cpp

+7-14
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ namespace NKikimr {
5555
class TSyncLogKeeperTest {
5656
public:
5757
void CreateState(TEntryPointPair ep);
58-
void Run(bool oldFormatForEntryPoint);
58+
void Run();
5959

6060
void PrintStatus(const TString &str = {}) {
6161
::NKikimr::PrintStatus(State.get(), str);
@@ -130,8 +130,7 @@ namespace NKikimr {
130130

131131
class TCommitWithNoSwapAndDelChunks {
132132
public:
133-
TCommitWithNoSwapAndDelChunks(bool oldFormatForEntryPoint)
134-
: OldFormatForEntryPoint(oldFormatForEntryPoint)
133+
TCommitWithNoSwapAndDelChunks()
135134
{}
136135

137136
void Start(TSyncLogKeeperState *state, ui64 recoveryLogConfirmedLsn) {
@@ -148,7 +147,7 @@ namespace NKikimr {
148147
TDeltaToDiskRecLog delta(10);
149148
TEntryPointSerializer entryPointSerializer(CommitData->SyncLogSnap,
150149
std::move(CommitData->ChunksToDeleteDelayed), CommitData->RecoveryLogConfirmedLsn);
151-
entryPointSerializer.Serialize(delta, OldFormatForEntryPoint);
150+
entryPointSerializer.Serialize(delta);
152151

153152
TCommitHistory commitHistory(TInstant(), commitLsn, CommitData->RecoveryLogConfirmedLsn);
154153
TEvSyncLogCommitDone commitDone(commitHistory, entryPointSerializer.GetEntryPointDbgInfo(),
@@ -162,11 +161,10 @@ namespace NKikimr {
162161
return {entryPointSerializer.GetSerializedData(), commitLsn};
163162
}
164163
private:
165-
const bool OldFormatForEntryPoint;
166164
std::unique_ptr<TSyncLogKeeperCommitData> CommitData;
167165
};
168166

169-
void TSyncLogKeeperTest::Run(bool oldFormatForEntryPoint) {
167+
void TSyncLogKeeperTest::Run() {
170168
TEntryPointPair entryPointPair;
171169
CreateState(TEntryPointPair{TString(), 0});
172170
// start with empty log
@@ -187,7 +185,7 @@ namespace NKikimr {
187185
Y_ABORT_UNLESS(commit);
188186

189187
// start parallel commit
190-
TCommitWithNoSwapAndDelChunks parallelCommit(oldFormatForEntryPoint);
188+
TCommitWithNoSwapAndDelChunks parallelCommit;
191189
parallelCommit.Start(State.get(), 10);
192190

193191
// write more messages during parallel commit
@@ -208,7 +206,7 @@ namespace NKikimr {
208206
Y_ABORT_UNLESS(commit);
209207

210208
// start parallel commit
211-
TCommitWithNoSwapAndDelChunks parallelCommit2(oldFormatForEntryPoint);
209+
TCommitWithNoSwapAndDelChunks parallelCommit2;
212210
parallelCommit2.Start(State.get(), 31);
213211

214212
// commit finished with lsn=33
@@ -239,14 +237,9 @@ namespace NKikimr {
239237
////////////////////////////////////////////////////////////////////////////
240238
Y_UNIT_TEST_SUITE(TBlobStorageSyncLogKeeper) {
241239

242-
Y_UNIT_TEST(CutLog_EntryPointOldFormat) {
243-
TSyncLogKeeperTest test;
244-
test.Run(true);
245-
}
246-
247240
Y_UNIT_TEST(CutLog_EntryPointNewFormat) {
248241
TSyncLogKeeperTest test;
249-
test.Run(false);
242+
test.Run();
250243
}
251244

252245
}

ydb/core/client/client_ut.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include <ydb/core/base/appdata.h>
2-
#include <ydb/core/base/compile_time_flags.h>
32
#include <ydb/library/services/services.pb.h>
43
#include <ydb/core/tablet/tablet_impl.h>
54
#include <ydb/core/testlib/test_client.h>

ydb/core/tablet/tablet_sys.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include "tablet_sys.h"
22
#include "tablet_tracing_signals.h"
33

4-
#include <ydb/core/base/compile_time_flags.h>
54
#include <ydb/core/base/hive.h>
65
#include <ydb/core/base/tablet_pipecache.h>
76
#include <ydb/library/services/services.pb.h>

ydb/core/tablet_flat/flat_executor.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include "util_fmt_desc.h"
2828

2929
#include <ydb/core/base/appdata.h>
30-
#include <ydb/core/base/compile_time_flags.h>
3130
#include <ydb/core/base/hive.h>
3231
#include <ydb/core/base/tablet_pipecache.h>
3332
#include <ydb/core/control/immediate_control_board_impl.h>

ydb/core/tx/datashard/datashard_pipeline.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include "datashard_txs.h"
66
#include "datashard_write_operation.h"
77

8-
#include <ydb/core/base/compile_time_flags.h>
98
#include <ydb/core/base/cputime.h>
109
#include <ydb/core/base/feature_flags.h>
1110
#include <ydb/core/tx/balance_coverage/balance_coverage_builder.h>

ydb/core/tx/schemeshard/schemeshard_info_types.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include "schemeshard_utils.h"
44

55
#include <ydb/core/base/appdata.h>
6-
#include <ydb/core/base/compile_time_flags.h>
76
#include <ydb/core/base/tx_processing.h>
87
#include <ydb/core/base/channel_profiles.h>
98
#include <ydb/core/engine/minikql/flat_local_tx_factory.h>

ydb/core/tx/schemeshard/ut_base/ut_base.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#include <ydb/core/tx/schemeshard/ut_helpers/helpers.h>
22
#include <ydb/core/tx/schemeshard/schemeshard_utils.h>
33

4-
#include <ydb/core/base/compile_time_flags.h>
5-
64
#include <util/generic/size_literals.h>
75
#include <util/string/cast.h>
86

ydb/core/tx/schemeshard/ut_base/ut_info_types.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#include <ydb/core/tx/schemeshard/ut_helpers/helpers.h>
22
#include <ydb/core/tx/schemeshard/schemeshard_info_types.h>
33

4-
#include <ydb/core/base/compile_time_flags.h>
5-
64
#include <util/string/strip.h>
75

86
using namespace NKikimr;

ydb/core/tx/schemeshard/ut_move/ut_move.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include <ydb/core/tx/schemeshard/ut_helpers/helpers.h>
22
#include <ydb/core/tx/schemeshard/schemeshard_utils.h>
33

4-
#include <ydb/core/base/compile_time_flags.h>
54
#include <ydb/core/kqp/ut/common/kqp_ut_common.h>
65
#include <ydb/core/tx/datashard/change_exchange.h>
76

ydb/core/tx/schemeshard/ut_move_reboots/ut_move_reboots.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include <ydb/core/tx/schemeshard/ut_helpers/helpers.h>
22
#include <ydb/core/tx/schemeshard/schemeshard_utils.h>
33

4-
#include <ydb/core/base/compile_time_flags.h>
54
#include <ydb/core/kqp/ut/common/kqp_ut_common.h>
65
#include <ydb/core/tx/datashard/change_exchange.h>
76

ydb/core/tx/schemeshard/ut_topic_splitmerge/ut_topic_splitmerge.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include <ydb/core/tx/schemeshard/ut_helpers/helpers.h>
22
#include <ydb/core/tx/schemeshard/schemeshard_utils.h>
33

4-
#include <ydb/core/base/compile_time_flags.h>
54
#include <ydb/services/lib/sharding/sharding.h>
65

76
#include <util/generic/size_literals.h>

0 commit comments

Comments
 (0)