10
10
#include < ydb/core/tx/columnshard/hooks/testing/controller.h>
11
11
#include < ydb/core/tx/columnshard/operations/write_data.h>
12
12
#include < ydb/core/tx/columnshard/test_helper/columnshard_ut_common.h>
13
+ #include < ydb/core/tx/columnshard/test_helper/test_combinator.h>
13
14
#include < ydb/core/tx/columnshard/test_helper/controllers.h>
14
15
#include < ydb/core/tx/columnshard/test_helper/shard_reader.h>
15
16
#include < ydb/core/tx/columnshard/test_helper/shard_writer.h>
@@ -434,11 +435,12 @@ void TestWrite(const TestTableDescription& table) {
434
435
UNIT_ASSERT (ok);
435
436
}
436
437
437
- void TestWriteOverload (const TestTableDescription& table) {
438
+ void TestWriteOverload (const TestTableDescription& table, bool WritePortionsOnInsert ) {
438
439
TTestBasicRuntime runtime;
439
440
TTester::Setup (runtime);
441
+ runtime.GetAppData ().FeatureFlags .SetEnableWritePortionsOnInsert (WritePortionsOnInsert);
440
442
auto csDefaultControllerGuard = NKikimr::NYDBTest::TControllers::RegisterCSControllerGuard<TDefaultTestsController>();
441
-
443
+ csDefaultControllerGuard-> SetOverrideBlobSplitSettings (std::nullopt);
442
444
TActorId sender = runtime.AllocateEdgeActor ();
443
445
CreateTestBootstrapper (runtime, CreateTestTabletInfo (TTestTxConfig::TxTablet0, TTabletTypes::ColumnShard), &CreateColumnShard);
444
446
@@ -462,26 +464,31 @@ void TestWriteOverload(const TestTableDescription& table) {
462
464
TDeque<TAutoPtr<IEventHandle>> capturedWrites;
463
465
464
466
auto captureEvents = [&](TTestActorRuntimeBase&, TAutoPtr<IEventHandle>& ev) {
465
- if (auto * msg = TryGetPrivateEvent<NColumnShard::TEvPrivate::TEvWriteBlobsResult>(ev)) {
466
- Cerr << " CATCH TEvWrite, status " << msg->GetPutResult ().GetPutStatus () << Endl;
467
- if (toCatch && msg->GetPutResult ().GetPutStatus () != NKikimrProto::UNKNOWN) {
468
- capturedWrites.push_back (ev.Release ());
467
+ if (toCatch) {
468
+ TAutoPtr<IEventHandle> eventToCapture;
469
+ if (WritePortionsOnInsert) {
470
+ if (auto * msg = TryGetPrivateEvent<NColumnShard::NPrivateEvents::NWrite::TEvWritePortionResult>(ev)) {
471
+ Cerr << " CATCH TEvWritePortionResult, status " << msg->GetWriteStatus () << Endl;
472
+ if (msg->GetWriteStatus () != NKikimrProto::EReplyStatus::UNKNOWN) {
473
+ eventToCapture = ev.Release ();
474
+ }
475
+ }
476
+ } else {
477
+ if (auto * msg = TryGetPrivateEvent<NColumnShard::TEvPrivate::TEvWriteBlobsResult>(ev)) {
478
+ Cerr << " CATCH TEvWrite, status " << msg->GetPutResult ().GetPutStatus () << Endl;
479
+ if (msg->GetPutResult ().GetPutStatus () != NKikimrProto::UNKNOWN) {
480
+ eventToCapture = ev.Release ();
481
+ }
482
+ }
483
+ }
484
+ if (eventToCapture) {
469
485
--toCatch;
486
+ capturedWrites.push_back (std::move (eventToCapture));
470
487
return true ;
471
- } else {
472
- return false ;
473
488
}
474
489
}
475
490
return false ;
476
491
};
477
-
478
- auto resendOneCaptured = [&]() {
479
- UNIT_ASSERT (capturedWrites.size ());
480
- Cerr << " RESEND TEvWrite" << Endl;
481
- runtime.Send (capturedWrites.front ().Release ());
482
- capturedWrites.pop_front ();
483
- };
484
-
485
492
runtime.SetEventFilter (captureEvents);
486
493
487
494
const ui32 toSend = toCatch + 1 ;
@@ -492,7 +499,8 @@ void TestWriteOverload(const TestTableDescription& table) {
492
499
UNIT_ASSERT_VALUES_EQUAL (WaitWriteResult (runtime, TTestTxConfig::TxTablet0), (ui32)NKikimrDataEvents::TEvWriteResult::STATUS_OVERLOADED);
493
500
494
501
while (capturedWrites.size ()) {
495
- resendOneCaptured ();
502
+ runtime.Send (capturedWrites.front ().Release ());
503
+ capturedWrites.pop_front ();
496
504
UNIT_ASSERT_VALUES_EQUAL (WaitWriteResult (runtime, TTestTxConfig::TxTablet0), (ui32)NKikimrDataEvents::TEvWriteResult::STATUS_COMPLETED);
497
505
}
498
506
@@ -1665,15 +1673,10 @@ Y_UNIT_TEST_SUITE(TColumnShardTestReadWrite) {
1665
1673
TestWrite (table);
1666
1674
}
1667
1675
1668
- Y_UNIT_TEST (WriteOverload) {
1676
+ Y_UNIT_TEST_QUATRO (WriteOverload, InStore, WithWritePortionsOnInsert ) {
1669
1677
TestTableDescription table;
1670
- TestWriteOverload (table);
1671
- }
1672
-
1673
- Y_UNIT_TEST (WriteStandaloneOverload) {
1674
- TestTableDescription table;
1675
- table.InStore = false ;
1676
- TestWriteOverload (table);
1678
+ table.InStore = InStore;
1679
+ TestWriteOverload (table, WithWritePortionsOnInsert);
1677
1680
}
1678
1681
1679
1682
Y_UNIT_TEST (WriteReadDuplicate) {
0 commit comments