@@ -321,9 +321,6 @@ Y_UNIT_TEST_SUITE(KqpOlapBlobsSharing) {
321321
322322 void Execute () {
323323 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-
327324 {
328325 WriteTestData (Kikimr, " /Root/olapStore/olapTable" , 1000000 , 300000000 , 10000 );
329326 WriteTestData (Kikimr, " /Root/olapStore/olapTable" , 1100000 , 300100000 , 10000 );
@@ -403,7 +400,7 @@ Y_UNIT_TEST_SUITE(KqpOlapBlobsSharing) {
403400 }
404401
405402 Y_UNIT_TEST (TableReshardingModuloN) {
406- TShardingTypeTest ().SetShardingType (" HASH_FUNCTION_CONSISTENCY_64 " ).Execute ();
403+ TShardingTypeTest ().SetShardingType (" HASH_FUNCTION_MODULO_N " ).Execute ();
407404 }
408405
409406 class TAsyncReshardingTest : public TReshardingTest {
@@ -435,11 +432,36 @@ Y_UNIT_TEST_SUITE(KqpOlapBlobsSharing) {
435432 TReshardingTest::CheckCount (NumRows);
436433 }
437434
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+
438456 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+
443465 auto session = TableClient.CreateSession ().GetValueSync ().GetSession ();
444466 auto alterResult = session.ExecuteSchemeQuery (alterQuery).GetValueSync ();
445467
@@ -454,6 +476,7 @@ Y_UNIT_TEST_SUITE(KqpOlapBlobsSharing) {
454476 ui64 LastPathId = 1000000 ;
455477 ui64 LastTs = 300000000 ;
456478 ui64 NumRows = 0 ;
479+ ui64 HasNewCol = false ;
457480 };
458481
459482 Y_UNIT_TEST (UpsertWhileSplitTest) {
@@ -498,6 +521,44 @@ Y_UNIT_TEST_SUITE(KqpOlapBlobsSharing) {
498521 tester.StartResharding (" SPLIT" );
499522 tester.WaitResharding ();
500523
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+
501562 tester.CheckCount ();
502563 }
503564}
0 commit comments