@@ -3108,30 +3108,56 @@ Y_UNIT_TEST_SUITE(IncrementalBackup) {
31083108
31093109 SimulateSleep (server, TDuration::Seconds (5 ));
31103110
3111- auto mainTableBackup = KqpSimpleExec (runtime, R"(
3112- SELECT key, value FROM `/Root/.backups/collections/MyCollection/19700101000002Z_incremental/Table`
3111+ // Find the incremental backup directory using DescribePath
3112+ TString backupDir = FindIncrementalBackupDir (runtime, edgeActor, " /Root/.backups/collections/MyCollection" );
3113+ UNIT_ASSERT_C (!backupDir.empty (), " Could not find incremental backup directory" );
3114+
3115+ Cerr << " Using backup directory: " << backupDir << Endl;
3116+
3117+ // Verify the incremental backup table was created using DescribePath
3118+ TString mainTablePath = TStringBuilder () << " /Root/.backups/collections/MyCollection/" << backupDir << " /Table" ;
3119+
3120+ auto tableRequest = MakeHolder<TEvTxUserProxy::TEvNavigate>();
3121+ tableRequest->Record .MutableDescribePath ()->SetPath (mainTablePath);
3122+ tableRequest->Record .MutableDescribePath ()->MutableOptions ()->SetShowPrivateTable (true );
3123+ runtime.Send (new IEventHandle (MakeTxProxyID (), edgeActor, tableRequest.Release ()));
3124+ auto tableReply = runtime.GrabEdgeEventRethrow <NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult>(edgeActor);
3125+
3126+ UNIT_ASSERT_EQUAL (tableReply->Get ()->GetRecord ().GetStatus (), NKikimrScheme::EStatus::StatusSuccess);
3127+ UNIT_ASSERT (tableReply->Get ()->GetRecord ().GetPathDescription ().HasTable ());
3128+
3129+ // Verify the table has the expected schema (including incremental backup metadata column)
3130+ bool hasChangeMetadataColumn = false ;
3131+ for (const auto & col : tableReply->Get ()->GetRecord ().GetPathDescription ().GetTable ().GetColumns ()) {
3132+ if (col.GetName () == " __ydb_incrBackupImpl_changeMetadata" ) {
3133+ hasChangeMetadataColumn = true ;
3134+ break ;
3135+ }
3136+ }
3137+ UNIT_ASSERT_C (hasChangeMetadataColumn, " Incremental backup table should have __ydb_incrBackupImpl_changeMetadata column" );
3138+
3139+ // Now verify the actual data
3140+ auto mainTableBackup = KqpSimpleExec (runtime, TStringBuilder () << R"(
3141+ SELECT key, value FROM `)" << mainTablePath << R"( `
31133142 ORDER BY key
31143143 )" );
31153144
31163145 UNIT_ASSERT_C (mainTableBackup.find (" uint32_value: 2" ) != TString::npos,
3117- " Main table backup should exist with OmitIndexes flag " );
3146+ " Main table backup should contain updated key 2 " );
31183147 UNIT_ASSERT_C (mainTableBackup.find (" uint32_value: 250" ) != TString::npos,
31193148 " Main table backup should contain updated value" );
31203149
3121- bool indexBackupExists = true ;
3122- try {
3123- auto indexBackup = KqpSimpleExec (runtime, R"(
3124- SELECT * FROM `/Root/.backups/collections/MyCollection/19700101000002Z_incremental/__ydb_backup_meta/indexes/Table/ByValue`
3125- )" );
3126- if (indexBackup.empty () || indexBackup.find (" ERROR" ) != TString::npos ||
3127- indexBackup.find (" not found" ) != TString::npos || indexBackup.find (" doesn't exist" ) != TString::npos) {
3128- indexBackupExists = false ;
3129- }
3130- } catch (...) {
3131- indexBackupExists = false ;
3132- }
3133-
3134- UNIT_ASSERT_C (!indexBackupExists, " Index backup should NOT exist when OmitIndexes flag is set" );
3150+ // Verify index backup does NOT exist when OmitIndexes is set
3151+ TString indexMetaPath = TStringBuilder () << " /Root/.backups/collections/MyCollection/" << backupDir << " /__ydb_backup_meta" ;
3152+
3153+ auto indexMetaRequest = MakeHolder<TEvTxUserProxy::TEvNavigate>();
3154+ indexMetaRequest->Record .MutableDescribePath ()->SetPath (indexMetaPath);
3155+ runtime.Send (new IEventHandle (MakeTxProxyID (), edgeActor, indexMetaRequest.Release ()));
3156+ auto indexMetaReply = runtime.GrabEdgeEventRethrow <NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult>(edgeActor);
3157+
3158+ // With OmitIndexes=true, the __ydb_backup_meta directory should not exist
3159+ UNIT_ASSERT_C (indexMetaReply->Get ()->GetRecord ().GetStatus () == NKikimrScheme::EStatus::StatusPathDoesNotExist,
3160+ " Index backup metadata directory should NOT exist when OmitIndexes flag is set" );
31353161 }
31363162 Y_UNIT_TEST (BasicIndexIncrementalRestore) {
31373163 TPortManager portManager;
0 commit comments