aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Belyakov <serg-belyakov@ydb.tech>2024-05-31 20:53:10 +0300
committerGitHub <noreply@github.com>2024-05-31 20:53:10 +0300
commit6281a34256dce8603dce668f18a4b660a29145fe (patch)
treee231a9d3c655d50c3006f4f7e466479618337bf0
parent8b269a195b251b8d34f6bb0965766ed76dce9996 (diff)
downloadydb-6281a34256dce8603dce668f18a4b660a29145fe.tar.gz
Fix OperationLog::ConcurrentWrites (#5089)
-rw-r--r--ydb/core/debug_tools/ut/main.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/ydb/core/debug_tools/ut/main.cpp b/ydb/core/debug_tools/ut/main.cpp
index 93e2b457ba..5c2228e462 100644
--- a/ydb/core/debug_tools/ut/main.cpp
+++ b/ydb/core/debug_tools/ut/main.cpp
@@ -83,12 +83,13 @@ Y_UNIT_TEST_SUITE(OperationLog) {
std::thread reader([&]() {
for (ui32 i = 0; i < readsNum; ++i) {
ui32 logIdx = RandomNumber<ui32>() % logSize;
- if (logIdx > log.Size()) {
- auto record = log.BorrowByIdx(i);
- UNIT_ASSERT(record);
- TString copyRecord = *record;
- ui32 recordNum = IntFromString<ui32, 10>(copyRecord);
- UNIT_ASSERT_LE(recordNum, recordIdx.load());
+ if (logIdx < log.Size()) {
+ NKikimr::TOperationLog<logSize>::BorrowedRecord record = log.BorrowByIdx(logIdx);
+ if (record) {
+ ui32 recordNum = IntFromString<ui32, 10>(*record);
+ Y_ABORT_UNLESS(recordNum <= recordIdx.load());
+ }
+ log.ReturnBorrowedRecord(record);
}
}
});