Skip to content

Commit 32a98b5

Browse files
committed
Address comments
1 parent b3ecf6a commit 32a98b5

File tree

2 files changed

+54
-103
lines changed

2 files changed

+54
-103
lines changed

ydb/core/blobstorage/dsproxy/dsproxy_put.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ class TBlobStorageGroupPutRequest : public TBlobStorageGroupRequestActor {
4242
TErasureSplitContext ErasureSplitContext = TErasureSplitContext::Init(MaxBytesToSplitAtOnce);
4343
TBatchedVec<TStackVec<TRope, TypicalPartsInBlob>> PartSets;
4444

45-
static_assert(MaxBatchedPutRequests <= sizeof(ui64) * 8);
46-
std::map<TInstant, ui64> PutDeadlineMasks;
47-
ui64 DeadlineMask = 0;
45+
using TDeadlineMask = std::bitset<MaxBatchedPutRequests>;
46+
std::map<TInstant, TDeadlineMask> PutDeadlineMasks;
47+
TDeadlineMask DeadlineMask;
4848

4949
TStackVec<ui64, TypicalDisksInGroup> WaitingVDiskResponseCount;
5050
ui64 WaitingVDiskCount = 0;
@@ -651,7 +651,7 @@ class TBlobStorageGroupPutRequest : public TBlobStorageGroupRequestActor {
651651
<< " RestartCounter# " << RestartCounter);
652652

653653
for (size_t blobIdx = 0; blobIdx < PutImpl.Blobs.size(); ++blobIdx) {
654-
PutDeadlineMasks[PutImpl.Blobs[blobIdx].Deadline] |= (1 << blobIdx);
654+
PutDeadlineMasks[PutImpl.Blobs[blobIdx].Deadline].set(blobIdx);
655655
LWTRACK(DSProxyPutBootstrapStart, PutImpl.Blobs[blobIdx].Orbit);
656656
}
657657

@@ -738,7 +738,7 @@ class TBlobStorageGroupPutRequest : public TBlobStorageGroupRequestActor {
738738

739739
TPutImpl::TPutResultVec putResults;
740740
for (size_t blobIdx = 0; blobIdx < PutImpl.Blobs.size(); ++blobIdx) {
741-
if (!PutImpl.Blobs[blobIdx].Replied && (DeadlineMask & (1 << blobIdx))) {
741+
if (!PutImpl.Blobs[blobIdx].Replied && DeadlineMask[blobIdx]) {
742742
PutImpl.PrepareOneReply(NKikimrProto::DEADLINE, blobIdx, LogCtx, "Deadline timer hit", putResults);
743743
}
744744
}

ydb/core/blobstorage/ut_blobstorage/deadlines.cpp

Lines changed: 49 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ Y_UNIT_TEST_SUITE(Deadlines) {
129129
}
130130

131131
template <class TVResult>
132-
void TestPut(const TBlobStorageGroupType& erasure, ui32 requests) {
132+
void TestPutImpl(const TBlobStorageGroupType& erasure, ui32 requests) {
133133
TDuration delay = TDuration::Seconds(50);
134134
TDuration timeout = TDuration::Seconds(40);
135135

@@ -149,7 +149,7 @@ Y_UNIT_TEST_SUITE(Deadlines) {
149149
TestImpl<TVResult, TEvBlobStorage::TEvPutResult>(erasure, delay, timeout, send, requests);
150150
}
151151

152-
void TestGet(const TBlobStorageGroupType& erasure, bool restoreGet, bool indexOnly) {
152+
void TestGetImpl(const TBlobStorageGroupType& erasure, bool restoreGet, bool indexOnly) {
153153
TDuration delay = TDuration::Seconds(50);
154154
TDuration timeout = TDuration::Seconds(40);
155155

@@ -174,7 +174,7 @@ Y_UNIT_TEST_SUITE(Deadlines) {
174174
TestImpl<TEvBlobStorage::TEvVGetResult, TEvBlobStorage::TEvGetResult>(erasure, delay, timeout, send);
175175
}
176176

177-
void TestBlock(const TBlobStorageGroupType& erasure) {
177+
void TestBlockImpl(const TBlobStorageGroupType& erasure) {
178178
TDuration delay = TDuration::Seconds(50);
179179
TDuration timeout = TDuration::Seconds(40);
180180

@@ -188,7 +188,7 @@ Y_UNIT_TEST_SUITE(Deadlines) {
188188
TestImpl<TEvBlobStorage::TEvVBlockResult, TEvBlobStorage::TEvBlockResult>(erasure, delay, timeout, send);
189189
}
190190

191-
void TestPatch(const TBlobStorageGroupType& erasure) {
191+
void TestPatchImpl(const TBlobStorageGroupType& erasure) {
192192
TDuration delay = TDuration::Seconds(50);
193193
TDuration timeout = TDuration::Seconds(40);
194194

@@ -219,7 +219,7 @@ Y_UNIT_TEST_SUITE(Deadlines) {
219219
TestImpl<TEvBlobStorage::TEvVMovedPatchResult, TEvBlobStorage::TEvPatchResult>(erasure, delay, timeout, send);
220220
}
221221

222-
void TestDiscover(const TBlobStorageGroupType& erasure, bool readBody) {
222+
void TestDiscoverImpl(const TBlobStorageGroupType& erasure, bool readBody) {
223223
TDuration delay = TDuration::Seconds(50);
224224
TDuration timeout = TDuration::Seconds(40);
225225

@@ -245,7 +245,7 @@ Y_UNIT_TEST_SUITE(Deadlines) {
245245
TestImpl<TEvBlobStorage::TEvVGetResult, TEvBlobStorage::TEvDiscoverResult>(erasure, delay, timeout, send);
246246
}
247247

248-
void TestRange(const TBlobStorageGroupType& erasure, bool restore, bool indexOnly) {
248+
void TestRangeImpl(const TBlobStorageGroupType& erasure, bool restore, bool indexOnly) {
249249
TDuration delay = TDuration::Seconds(50);
250250
TDuration timeout = TDuration::Seconds(40);
251251

@@ -275,7 +275,7 @@ Y_UNIT_TEST_SUITE(Deadlines) {
275275
TestImpl<TEvBlobStorage::TEvVGetResult, TEvBlobStorage::TEvRangeResult>(erasure, delay, timeout, send);
276276
}
277277

278-
void TestCollectGarbage(const TBlobStorageGroupType& erasure, bool multicollect, bool hard) {
278+
void TestCollectGarbageImpl(const TBlobStorageGroupType& erasure, bool multicollect, bool hard) {
279279
TDuration delay = TDuration::Seconds(50);
280280
TDuration timeout = TDuration::Seconds(40);
281281

@@ -311,7 +311,7 @@ Y_UNIT_TEST_SUITE(Deadlines) {
311311
TestImpl<TEvBlobStorage::TEvVCollectGarbageResult, TEvBlobStorage::TEvCollectGarbageResult>(erasure, delay, timeout, send);
312312
}
313313

314-
void TestStatus(const TBlobStorageGroupType& erasure) {
314+
void TestStatusImpl(const TBlobStorageGroupType& erasure) {
315315
TDuration delay = TDuration::Seconds(50);
316316
TDuration timeout = TDuration::Seconds(40);
317317

@@ -325,134 +325,85 @@ Y_UNIT_TEST_SUITE(Deadlines) {
325325
TestImpl<TEvBlobStorage::TEvVStatusResult, TEvBlobStorage::TEvStatusResult>(erasure, delay, timeout, send);
326326
}
327327

328-
template<class Tag>
329-
void Test(const TBlobStorageGroupType&) {}
330-
331-
struct TTagPut {};
332-
struct TTagMultiPut {};
333-
334-
struct TTagGet {};
335-
struct TTagRestoreGet {};
336-
struct TTagIndexGet {};
337-
struct TTagIndexRestoreGet {};
338-
339-
struct TTagBlock {};
340-
341-
struct TTagPatch {};
342-
343-
struct TTagDiscover {};
344-
struct TTagDiscoverReadBody {};
345-
346-
struct TTagRange {};
347-
struct TTagRestoreRange {};
348-
struct TTagIndexRange {};
349-
struct TTagIndexRestoreRange {};
350-
351-
struct TTagHardCollectGarbage {};
352-
struct TTagSoftCollectGarbage {};
353-
struct TTagHardMultiCollectGarbage {};
354-
struct TTagSoftMultiCollectGarbage {};
355-
356-
struct TTagStatus {};
357-
358-
template<>
359-
void Test<TTagPut>(const TBlobStorageGroupType& erasure) {
360-
TestPut<TEvBlobStorage::TEvVPutResult>(erasure, 1);
328+
void TestPut(const TBlobStorageGroupType& erasure) {
329+
TestPutImpl<TEvBlobStorage::TEvVPutResult>(erasure, 1);
361330
}
362331

363-
template<>
364-
void Test<TTagMultiPut>(const TBlobStorageGroupType& erasure) {
365-
TestPut<TEvBlobStorage::TEvVMultiPutResult>(erasure, 10);
332+
void TestMultiPut(const TBlobStorageGroupType& erasure) {
333+
TestPutImpl<TEvBlobStorage::TEvVMultiPutResult>(erasure, 10);
366334
}
367335

368-
template<>
369-
void Test<TTagGet>(const TBlobStorageGroupType& erasure) {
370-
TestGet(erasure, false, false);
336+
void TestGet(const TBlobStorageGroupType& erasure) {
337+
TestGetImpl(erasure, false, false);
371338
}
372339

373-
template<>
374-
void Test<TTagRestoreGet>(const TBlobStorageGroupType& erasure) {
375-
TestGet(erasure, true, false);
340+
void TestRestoreGet(const TBlobStorageGroupType& erasure) {
341+
TestGetImpl(erasure, true, false);
376342
}
377343

378-
template<>
379-
void Test<TTagIndexGet>(const TBlobStorageGroupType& erasure) {
380-
TestGet(erasure, false, true);
344+
void TestIndexGet(const TBlobStorageGroupType& erasure) {
345+
TestGetImpl(erasure, false, true);
381346
}
382347

383-
template<>
384-
void Test<TTagIndexRestoreGet>(const TBlobStorageGroupType& erasure) {
385-
TestGet(erasure, true, true);
348+
void TestIndexRestoreGet(const TBlobStorageGroupType& erasure) {
349+
TestGetImpl(erasure, true, true);
386350
}
387351

388-
template<>
389-
void Test<TTagBlock>(const TBlobStorageGroupType& erasure) {
390-
TestBlock(erasure);
352+
void TestBlock(const TBlobStorageGroupType& erasure) {
353+
TestBlockImpl(erasure);
391354
}
392355

393-
template<>
394-
void Test<TTagPatch>(const TBlobStorageGroupType& erasure) {
395-
TestPatch(erasure);
356+
void TestPatch(const TBlobStorageGroupType& erasure) {
357+
TestPatchImpl(erasure);
396358
}
397359

398-
template<>
399-
void Test<TTagDiscover>(const TBlobStorageGroupType& erasure) {
400-
TestDiscover(erasure, false);
360+
void TestDiscover(const TBlobStorageGroupType& erasure) {
361+
TestDiscoverImpl(erasure, false);
401362
}
402363

403-
template<>
404-
void Test<TTagDiscoverReadBody>(const TBlobStorageGroupType& erasure) {
405-
TestDiscover(erasure, true);
364+
void TestDiscoverReadBody(const TBlobStorageGroupType& erasure) {
365+
TestDiscoverImpl(erasure, true);
406366
}
407367

408-
template<>
409-
void Test<TTagRange>(const TBlobStorageGroupType& erasure) {
410-
TestRange(erasure, false, false);
368+
void TestRange(const TBlobStorageGroupType& erasure) {
369+
TestRangeImpl(erasure, false, false);
411370
}
412371

413-
template<>
414-
void Test<TTagRestoreRange>(const TBlobStorageGroupType& erasure) {
415-
TestRange(erasure, true, false);
372+
void TestRestoreRange(const TBlobStorageGroupType& erasure) {
373+
TestRangeImpl(erasure, true, false);
416374
}
417375

418-
template<>
419-
void Test<TTagIndexRange>(const TBlobStorageGroupType& erasure) {
420-
TestRange(erasure, false, true);
376+
void TestIndexRange(const TBlobStorageGroupType& erasure) {
377+
TestRangeImpl(erasure, false, true);
421378
}
422379

423-
template<>
424-
void Test<TTagIndexRestoreRange>(const TBlobStorageGroupType& erasure) {
425-
TestRange(erasure, true, true);
380+
void TestIndexRestoreRange(const TBlobStorageGroupType& erasure) {
381+
TestRangeImpl(erasure, true, true);
426382
}
427383

428-
template<>
429-
void Test<TTagHardCollectGarbage>(const TBlobStorageGroupType& erasure) {
430-
TestCollectGarbage(erasure, false, true);
384+
void TestHardCollectGarbage(const TBlobStorageGroupType& erasure) {
385+
TestCollectGarbageImpl(erasure, false, true);
431386
}
432387

433-
template<>
434-
void Test<TTagSoftCollectGarbage>(const TBlobStorageGroupType& erasure) {
435-
TestCollectGarbage(erasure, false, false);
388+
void TestSoftCollectGarbage(const TBlobStorageGroupType& erasure) {
389+
TestCollectGarbageImpl(erasure, false, false);
436390
}
437391

438-
template<>
439-
void Test<TTagHardMultiCollectGarbage>(const TBlobStorageGroupType& erasure) {
440-
TestCollectGarbage(erasure, false, true);
392+
void TestHardMultiCollectGarbage(const TBlobStorageGroupType& erasure) {
393+
TestCollectGarbageImpl(erasure, false, true);
441394
}
442395

443-
template<>
444-
void Test<TTagSoftMultiCollectGarbage>(const TBlobStorageGroupType& erasure) {
445-
TestCollectGarbage(erasure, false, false);
396+
void TestSoftMultiCollectGarbage(const TBlobStorageGroupType& erasure) {
397+
TestCollectGarbageImpl(erasure, false, false);
446398
}
447399

448-
template<>
449-
void Test<TTagStatus>(const TBlobStorageGroupType& erasure) {
450-
TestStatus(erasure);
400+
void TestStatus(const TBlobStorageGroupType& erasure) {
401+
TestStatusImpl(erasure);
451402
}
452403

453-
#define TEST_DEADLINE(method, erasure) \
454-
Y_UNIT_TEST(Test##method##erasure) { \
455-
Test<TTag##method>(TBlobStorageGroupType::Erasure##erasure); \
404+
#define TEST_DEADLINE(method, erasure) \
405+
Y_UNIT_TEST(Test##method##erasure) { \
406+
Test##method(TBlobStorageGroupType::Erasure##erasure); \
456407
}
457408

458409
TEST_DEADLINE(Put, Mirror3dc);

0 commit comments

Comments
 (0)