|
1 | | -#include "helpers/typed_local.h" |
2 | 1 | #include "helpers/local.h" |
| 2 | +#include "helpers/typed_local.h" |
3 | 3 | #include "helpers/writer.h" |
4 | | -#include <ydb/core/tx/columnshard/data_sharing/initiator/controller/abstract.h> |
5 | | -#include <ydb/core/tx/columnshard/hooks/testing/controller.h> |
| 4 | + |
| 5 | +#include <ydb/core/base/tablet_pipecache.h> |
6 | 6 | #include <ydb/core/tx/columnshard/common/snapshot.h> |
7 | | -#include <ydb/core/tx/columnshard/data_sharing/initiator/status/abstract.h> |
8 | 7 | #include <ydb/core/tx/columnshard/data_sharing/common/context/context.h> |
9 | | -#include <ydb/core/tx/columnshard/data_sharing/destination/session/destination.h> |
10 | 8 | #include <ydb/core/tx/columnshard/data_sharing/destination/events/control.h> |
11 | | -#include <ydb/core/base/tablet_pipecache.h> |
| 9 | +#include <ydb/core/tx/columnshard/data_sharing/destination/session/destination.h> |
| 10 | +#include <ydb/core/tx/columnshard/data_sharing/initiator/controller/abstract.h> |
| 11 | +#include <ydb/core/tx/columnshard/data_sharing/initiator/status/abstract.h> |
| 12 | +#include <ydb/core/tx/columnshard/hooks/testing/controller.h> |
| 13 | + |
12 | 14 | #include <ydb/public/sdk/cpp/client/ydb_operation/operation.h> |
13 | 15 | #include <ydb/public/sdk/cpp/client/ydb_ss_tasks/task.h> |
14 | 16 |
|
| 17 | +#include <chrono> |
| 18 | +#include <thread> |
| 19 | + |
15 | 20 | namespace NKikimr::NKqp { |
16 | 21 |
|
17 | 22 | Y_UNIT_TEST_SUITE(KqpOlapBlobsSharing) { |
@@ -276,7 +281,7 @@ Y_UNIT_TEST_SUITE(KqpOlapBlobsSharing) { |
276 | 281 | void WaitResharding(const TString& hint = "") { |
277 | 282 | const TInstant start = TInstant::Now(); |
278 | 283 | bool clean = false; |
279 | | - while (TInstant::Now() - start < TDuration::Seconds(20)) { |
| 284 | + while (TInstant::Now() - start < TDuration::Seconds(200)) { |
280 | 285 | NYdb::NOperation::TOperationClient operationClient(Kikimr.GetDriver()); |
281 | 286 | auto result = operationClient.List<NYdb::NSchemeShard::TBackgroundProcessesResponse>().GetValueSync(); |
282 | 287 | UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), NYdb::EStatus::SUCCESS, result.GetIssues().ToString()); |
@@ -408,7 +413,8 @@ Y_UNIT_TEST_SUITE(KqpOlapBlobsSharing) { |
408 | 413 |
|
409 | 414 | public: |
410 | 415 | TAsyncReshardingTest() { |
411 | | - TLocalHelper(Kikimr).CreateTestOlapTable("olapTable", "olapStore", 128, 4); |
| 416 | + Tests::NCommon::TLoggerInit(Kikimr).SetPriority(NLog::PRI_CRIT).Initialize(); |
| 417 | + TLocalHelper(Kikimr).CreateTestOlapTable("olapTable", "olapStore", 1024, 32); |
412 | 418 | } |
413 | 419 |
|
414 | 420 | void AddBatch(int numRows) { |
@@ -561,5 +567,120 @@ Y_UNIT_TEST_SUITE(KqpOlapBlobsSharing) { |
561 | 567 |
|
562 | 568 | tester.CheckCount(); |
563 | 569 | } |
| 570 | + |
| 571 | + Y_UNIT_TEST(MultipleMerge) { |
| 572 | + TAsyncReshardingTest tester; |
| 573 | + tester.DisableCompaction(); |
| 574 | + |
| 575 | + tester.AddBatch(10000); |
| 576 | + |
| 577 | + for (int i = 0; i < 4; i++) { |
| 578 | + tester.StartResharding("MERGE"); |
| 579 | + tester.WaitResharding(); |
| 580 | + } |
| 581 | + |
| 582 | + tester.RestartAllShards(); |
| 583 | + |
| 584 | + tester.CheckCount(); |
| 585 | + } |
| 586 | + |
| 587 | + Y_UNIT_TEST(MultipleSplits) { |
| 588 | + TAsyncReshardingTest tester; |
| 589 | + tester.DisableCompaction(); |
| 590 | + |
| 591 | + tester.AddBatch(10000); |
| 592 | + |
| 593 | + for (int i = 0; i < 4; i++) { |
| 594 | + tester.StartResharding("SPLIT"); |
| 595 | + tester.WaitResharding(); |
| 596 | + } |
| 597 | + |
| 598 | + tester.RestartAllShards(); |
| 599 | + |
| 600 | + tester.CheckCount(); |
| 601 | + } |
| 602 | + |
| 603 | + Y_UNIT_TEST(MultipleSplitsThenMerges) { |
| 604 | + TAsyncReshardingTest tester; |
| 605 | + tester.DisableCompaction(); |
| 606 | + |
| 607 | + tester.AddBatch(10000); |
| 608 | + |
| 609 | + for (int i = 0; i < 4; i++) { |
| 610 | + tester.StartResharding("SPLIT"); |
| 611 | + tester.WaitResharding(); |
| 612 | + } |
| 613 | + |
| 614 | + for (int i = 0; i < 8; i++) { |
| 615 | + tester.StartResharding("MERGE"); |
| 616 | + tester.WaitResharding(); |
| 617 | + } |
| 618 | + |
| 619 | + tester.RestartAllShards(); |
| 620 | + |
| 621 | + tester.CheckCount(); |
| 622 | + } |
| 623 | + |
| 624 | + Y_UNIT_TEST(MultipleSplitsWithRestartsAfterWait) { |
| 625 | + TAsyncReshardingTest tester; |
| 626 | + tester.DisableCompaction(); |
| 627 | + |
| 628 | + tester.AddBatch(10000); |
| 629 | + |
| 630 | + for (int i = 0; i < 4; i++) { |
| 631 | + tester.StartResharding("SPLIT"); |
| 632 | + tester.WaitResharding(); |
| 633 | + tester.RestartAllShards(); |
| 634 | + } |
| 635 | + |
| 636 | + tester.CheckCount(); |
| 637 | + } |
| 638 | + |
| 639 | + Y_UNIT_TEST(MultipleSplitsWithRestartsWhenWait) { |
| 640 | + TAsyncReshardingTest tester; |
| 641 | + tester.DisableCompaction(); |
| 642 | + |
| 643 | + tester.AddBatch(10000); |
| 644 | + |
| 645 | + for (int i = 0; i < 4; i++) { |
| 646 | + tester.StartResharding("SPLIT"); |
| 647 | + tester.RestartAllShards(); |
| 648 | + tester.WaitResharding(); |
| 649 | + } |
| 650 | + tester.RestartAllShards(); |
| 651 | + |
| 652 | + tester.CheckCount(); |
| 653 | + } |
| 654 | + |
| 655 | + Y_UNIT_TEST(MultipleMergesWithRestartsAfterWait) { |
| 656 | + TAsyncReshardingTest tester; |
| 657 | + tester.DisableCompaction(); |
| 658 | + |
| 659 | + tester.AddBatch(10000); |
| 660 | + |
| 661 | + for (int i = 0; i < 4; i++) { |
| 662 | + tester.StartResharding("MERGE"); |
| 663 | + tester.WaitResharding(); |
| 664 | + tester.RestartAllShards(); |
| 665 | + } |
| 666 | + |
| 667 | + tester.CheckCount(); |
| 668 | + } |
| 669 | + |
| 670 | + Y_UNIT_TEST(MultipleMergesWithRestartsWhenWait) { |
| 671 | + TAsyncReshardingTest tester; |
| 672 | + tester.DisableCompaction(); |
| 673 | + |
| 674 | + tester.AddBatch(10000); |
| 675 | + |
| 676 | + for (int i = 0; i < 4; i++) { |
| 677 | + tester.StartResharding("MERGE"); |
| 678 | + tester.RestartAllShards(); |
| 679 | + tester.WaitResharding(); |
| 680 | + } |
| 681 | + tester.RestartAllShards(); |
| 682 | + |
| 683 | + tester.CheckCount(); |
| 684 | + } |
564 | 685 | } |
565 | 686 | } |
0 commit comments