Skip to content

Commit f9b4db5

Browse files
authored
Merge c6028fd into 9d0310a
2 parents 9d0310a + c6028fd commit f9b4db5

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

.github/config/muted_ya.txt

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ ydb/core/client/ut TClientTest.PromoteFollower
44
ydb/core/client/ut TClientTest.ReadFromFollower
55
ydb/core/client/ut TFlatTest.AutoSplitMergeQueue
66
ydb/core/cms/ut_sentinel TSentinelTests.BSControllerCantChangeStatus
7-
ydb/core/debug_tools/ut OperationLog.ConcurrentWrites
87
ydb/core/quoter/ut QuoterWithKesusTest.PrefetchCoefficient
98
ydb/core/kafka_proxy/ut KafkaProtocol.CreatePartitionsScenario
109
ydb/core/kafka_proxy/ut KafkaProtocol.ProduceScenario

ydb/core/debug_tools/operation_log.h

+12-5
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@ class TOperationLog {
2727
private:
2828
constexpr static ui32 Capacity = S;
2929
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
3131
std::atomic<ui64> NextRecordPosition = Capacity;
3232

3333
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+
};
3839

3940
TOperationLog(TOperationLog&& other) = default;
4041
TOperationLog& operator=(TOperationLog&& other) = default;
@@ -45,6 +46,12 @@ class TOperationLog {
4546
}
4647
}
4748

49+
bool InitializeRecords(TString value = "Race occured, try again") {
50+
for (auto& record : Records) {
51+
record.store(new TString(value))
52+
}
53+
}
54+
4855
BorrowedRecord BorrowByIdx(ui32 idx) {
4956
ui32 position = (NextRecordPosition.load() - 1 - idx) % Capacity;
5057
if (idx >= Size()) {

0 commit comments

Comments
 (0)