diff --git a/ydb/core/tx/schemeshard/schemeshard_export_flow_proposals.cpp b/ydb/core/tx/schemeshard/schemeshard_export_flow_proposals.cpp index 1f17e652ed16..4af5a86d53ea 100644 --- a/ydb/core/tx/schemeshard/schemeshard_export_flow_proposals.cpp +++ b/ydb/core/tx/schemeshard/schemeshard_export_flow_proposals.cpp @@ -76,7 +76,6 @@ static NKikimrSchemeOp::TPathDescription GetTableDescription(TSchemeShard* ss, c opts.SetReturnPartitioningInfo(false); opts.SetReturnPartitionConfig(true); opts.SetReturnBoundaries(true); - opts.SetReturnSetVal(true); auto desc = DescribePath(ss, TlsActivationContext->AsActorContext(), pathId, opts); auto record = desc->GetRecord(); @@ -84,6 +83,30 @@ static NKikimrSchemeOp::TPathDescription GetTableDescription(TSchemeShard* ss, c return record.GetPathDescription(); } +void FillSetValForSequences(TSchemeShard* ss, NKikimrSchemeOp::TTableDescription& description, + const TPathId& exportItemPathId) { + NKikimrSchemeOp::TDescribeOptions opts; + opts.SetReturnSetVal(true); + + auto pathDescription = DescribePath(ss, TlsActivationContext->AsActorContext(), exportItemPathId, opts); + auto tableDescription = pathDescription->GetRecord().GetPathDescription().GetTable(); + + THashMap setValForSequences; + + for (const auto& sequenceDescription : tableDescription.GetSequences()) { + if (sequenceDescription.HasSetVal()) { + setValForSequences[sequenceDescription.GetName()] = sequenceDescription.GetSetVal(); + } + } + + for (auto& sequenceDescription : *description.MutableSequences()) { + auto it = setValForSequences.find(sequenceDescription.GetName()); + if (it != setValForSequences.end()) { + *sequenceDescription.MutableSetVal() = it->second; + } + } +} + THolder BackupPropose( TSchemeShard* ss, TTxId txId, @@ -107,11 +130,14 @@ THolder BackupPropose( task.SetNeedToBill(!exportInfo->UserSID || !ss->SystemBackupSIDs.contains(*exportInfo->UserSID)); const TPath sourcePath = TPath::Init(exportInfo->Items[itemIdx].SourcePathId, ss); - const TPath exportPathItem = exportPath.Child(ToString(itemIdx)); - if (sourcePath.IsResolved() && exportPathItem.IsResolved()) { - auto exportDescription = GetTableDescription(ss, exportPathItem.Base()->PathId); - exportDescription.MutableTable()->SetName(sourcePath.LeafName()); - task.MutableTable()->CopyFrom(exportDescription); + const TPath exportItemPath = exportPath.Child(ToString(itemIdx)); + if (sourcePath.IsResolved() && exportItemPath.IsResolved()) { + auto sourceDescription = GetTableDescription(ss, sourcePath.Base()->PathId); + if (sourceDescription.HasTable()) { + FillSetValForSequences( + ss, *sourceDescription.MutableTable(), exportItemPath.Base()->PathId); + } + task.MutableTable()->CopyFrom(sourceDescription); } task.SetSnapshotStep(exportInfo->SnapshotStep); diff --git a/ydb/core/tx/schemeshard/schemeshard_impl.cpp b/ydb/core/tx/schemeshard/schemeshard_impl.cpp index bf604eb8767c..68a6f65715d5 100644 --- a/ydb/core/tx/schemeshard/schemeshard_impl.cpp +++ b/ydb/core/tx/schemeshard/schemeshard_impl.cpp @@ -6566,7 +6566,7 @@ void TSchemeShard::FillTableDescriptionForShardIdx( << ": path#d# " << childPathId << ", name# " << childName); auto info = Sequences.at(childPathId); - DescribeSequence(childPathId, childName, info, *tableDescr->MutableSequences()->Add()); + DescribeSequence(childPathId, childName, info, *tableDescr->MutableSequences()->Add(), false); break; }