File tree 2 files changed +12
-6
lines changed
2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ ydb/core/client/ut TClientTest.PromoteFollower
4
4
ydb/core/client/ut TClientTest.ReadFromFollower
5
5
ydb/core/client/ut TFlatTest.AutoSplitMergeQueue
6
6
ydb/core/cms/ut_sentinel TSentinelTests.BSControllerCantChangeStatus
7
- ydb/core/debug_tools/ut OperationLog.ConcurrentWrites
8
7
ydb/core/quoter/ut QuoterWithKesusTest.PrefetchCoefficient
9
8
ydb/core/kafka_proxy/ut KafkaProtocol.CreatePartitionsScenario
10
9
ydb/core/kafka_proxy/ut KafkaProtocol.ProduceScenario
Original file line number Diff line number Diff line change @@ -27,14 +27,15 @@ class TOperationLog {
27
27
private:
28
28
constexpr static ui32 Capacity = S;
29
29
std::array<std::atomic<TString*>, S> Records;
30
- // RecordIdx is shifted to prevent underflow on decrement
30
+ // RecordPosition is shifted to prevent underflow on decrement
31
31
std::atomic<ui64> NextRecordPosition = Capacity;
32
32
33
33
public:
34
- TOperationLog () = default ;
35
-
36
- TOperationLog (const TOperationLog& other) = delete ;
37
- TOperationLog& operator =(const TOperationLog& other) = delete ;
34
+ TOperationLog (bool initializeRecords = true , TString defaultValue = " Race occured, try again" ) {
35
+ if (initializeRecords) {
36
+ InitializeRecords (defaultValue);
37
+ }
38
+ };
38
39
39
40
TOperationLog (TOperationLog&& other) = default ;
40
41
TOperationLog& operator =(TOperationLog&& other) = default ;
@@ -45,6 +46,12 @@ class TOperationLog {
45
46
}
46
47
}
47
48
49
+ bool InitializeRecords (TString value = " Race occured, try again" ) {
50
+ for (auto & record : Records) {
51
+ record.store (new TString (value))
52
+ }
53
+ }
54
+
48
55
BorrowedRecord BorrowByIdx (ui32 idx) {
49
56
ui32 position = (NextRecordPosition.load () - 1 - idx) % Capacity;
50
57
if (idx >= Size ()) {
You can’t perform that action at this time.
0 commit comments