@@ -321,9 +321,6 @@ Y_UNIT_TEST_SUITE(KqpOlapBlobsSharing) {
321
321
322
322
void Execute () {
323
323
TLocalHelper (Kikimr).SetShardingMethod (ShardingType).CreateTestOlapTable (" olapTable" , " olapStore" , 24 , 4 );
324
-
325
- Tests::NCommon::TLoggerInit (Kikimr).SetComponents ({ NKikimrServices::TX_COLUMNSHARD, NKikimrServices::TX_COLUMNSHARD_SCAN }, " CS" ).SetPriority (NActors::NLog::PRI_DEBUG).Initialize ();
326
-
327
324
{
328
325
WriteTestData (Kikimr, " /Root/olapStore/olapTable" , 1000000 , 300000000 , 10000 );
329
326
WriteTestData (Kikimr, " /Root/olapStore/olapTable" , 1100000 , 300100000 , 10000 );
@@ -403,7 +400,7 @@ Y_UNIT_TEST_SUITE(KqpOlapBlobsSharing) {
403
400
}
404
401
405
402
Y_UNIT_TEST (TableReshardingModuloN) {
406
- TShardingTypeTest ().SetShardingType (" HASH_FUNCTION_CONSISTENCY_64 " ).Execute ();
403
+ TShardingTypeTest ().SetShardingType (" HASH_FUNCTION_MODULO_N " ).Execute ();
407
404
}
408
405
409
406
class TAsyncReshardingTest : public TReshardingTest {
@@ -435,11 +432,36 @@ Y_UNIT_TEST_SUITE(KqpOlapBlobsSharing) {
435
432
TReshardingTest::CheckCount (NumRows);
436
433
}
437
434
435
+ void AddManyColumns () {
436
+ auto alterQuery = TStringBuilder () << " ALTER TABLESTORE `/Root/olapStore` " ;
437
+ for (int i = 0 ; i < 10000 ; i++) {
438
+ alterQuery << " ADD COLUMN col_" << i << " Int8" ;
439
+ if (i < 10000 - 1 ) {
440
+ alterQuery << " , " ;
441
+ }
442
+ }
443
+
444
+ auto session = TableClient.CreateSession ().GetValueSync ().GetSession ();
445
+ auto alterResult = session.ExecuteSchemeQuery (alterQuery).GetValueSync ();
446
+
447
+ UNIT_ASSERT_VALUES_EQUAL_C (alterResult.GetStatus (), NYdb::EStatus::SUCCESS, alterResult.GetIssues ().ToString ());
448
+ }
449
+
450
+ void RestartAllShards () {
451
+ for (i64 id : CSController->GetShardActualIds ()) {
452
+ Kikimr.GetTestServer ().GetRuntime ()->Send (MakePipePerNodeCacheID (false ), NActors::TActorId (), new TEvPipeCache::TEvForward (new TEvents::TEvPoisonPill (), id, false ));
453
+ }
454
+ }
455
+
438
456
void ChangeSchema () {
439
- auto alterQuery =
440
- " ALTER OBJECT `/Root/olapStore` (TYPE TABLESTORE) SET (ACTION=ALTER_COLUMN, NAME=level, "
441
- " `SERIALIZER.CLASS_NAME`=`ARROW_SERIALIZER`, "
442
- " `COMPRESSION.TYPE`=`zstd`);" ;
457
+ const char * alterQuery;
458
+ if (HasNewCol) {
459
+ alterQuery = " ALTER TABLESTORE `/Root/olapStore` DROP COLUMN new_col" ;
460
+ } else {
461
+ alterQuery = " ALTER TABLESTORE `/Root/olapStore` ADD COLUMN new_col Int8" ;
462
+ }
463
+ HasNewCol = !HasNewCol;
464
+
443
465
auto session = TableClient.CreateSession ().GetValueSync ().GetSession ();
444
466
auto alterResult = session.ExecuteSchemeQuery (alterQuery).GetValueSync ();
445
467
@@ -454,6 +476,7 @@ Y_UNIT_TEST_SUITE(KqpOlapBlobsSharing) {
454
476
ui64 LastPathId = 1000000 ;
455
477
ui64 LastTs = 300000000 ;
456
478
ui64 NumRows = 0 ;
479
+ ui64 HasNewCol = false ;
457
480
};
458
481
459
482
Y_UNIT_TEST (UpsertWhileSplitTest) {
@@ -498,6 +521,44 @@ Y_UNIT_TEST_SUITE(KqpOlapBlobsSharing) {
498
521
tester.StartResharding (" SPLIT" );
499
522
tester.WaitResharding ();
500
523
524
+ tester.RestartAllShards ();
525
+
526
+ tester.CheckCount ();
527
+ }
528
+
529
+ Y_UNIT_TEST (MultipleSchemaVersions) {
530
+ TAsyncReshardingTest tester;
531
+ tester.DisableCompaction ();
532
+
533
+ for (int i = 0 ; i < 3 ; i++) {
534
+ tester.AddBatch (1 );
535
+ tester.ChangeSchema ();
536
+ }
537
+
538
+ tester.StartResharding (" SPLIT" );
539
+ tester.WaitResharding ();
540
+
541
+ tester.RestartAllShards ();
542
+
543
+ tester.CheckCount ();
544
+ }
545
+
546
+ Y_UNIT_TEST (HugeSchemeHistory) {
547
+ TAsyncReshardingTest tester;
548
+ tester.DisableCompaction ();
549
+
550
+ tester.AddManyColumns ();
551
+
552
+ for (int i = 0 ; i < 100 ; i++) {
553
+ tester.AddBatch (1 );
554
+ tester.ChangeSchema ();
555
+ }
556
+
557
+ tester.StartResharding (" SPLIT" );
558
+ tester.WaitResharding ();
559
+
560
+ tester.RestartAllShards ();
561
+
501
562
tester.CheckCount ();
502
563
}
503
564
}
0 commit comments