@@ -76,14 +76,37 @@ static NKikimrSchemeOp::TPathDescription GetTableDescription(TSchemeShard* ss, c
76
76
opts.SetReturnPartitioningInfo (false );
77
77
opts.SetReturnPartitionConfig (true );
78
78
opts.SetReturnBoundaries (true );
79
- opts.SetReturnSetVal (true );
80
79
81
80
auto desc = DescribePath (ss, TlsActivationContext->AsActorContext (), pathId, opts);
82
81
auto record = desc->GetRecord ();
83
82
84
83
return record.GetPathDescription ();
85
84
}
86
85
86
+ void FillSetValForSequences (TSchemeShard* ss, NKikimrSchemeOp::TTableDescription& description,
87
+ const TPathId& exportItemPathId) {
88
+ NKikimrSchemeOp::TDescribeOptions opts;
89
+ opts.SetReturnSetVal (true );
90
+
91
+ auto pathDescription = DescribePath (ss, TlsActivationContext->AsActorContext (), exportItemPathId, opts);
92
+ auto tableDescription = pathDescription->GetRecord ().GetPathDescription ().GetTable ();
93
+
94
+ THashMap<TString, NKikimrSchemeOp::TSequenceDescription::TSetVal> setValForSequences;
95
+
96
+ for (const auto & sequenceDescription : tableDescription.GetSequences ()) {
97
+ if (sequenceDescription.HasSetVal ()) {
98
+ setValForSequences[sequenceDescription.GetName ()] = sequenceDescription.GetSetVal ();
99
+ }
100
+ }
101
+
102
+ for (auto & sequenceDescription : *description.MutableSequences ()) {
103
+ auto it = setValForSequences.find (sequenceDescription.GetName ());
104
+ if (it != setValForSequences.end ()) {
105
+ *sequenceDescription.MutableSetVal () = it->second ;
106
+ }
107
+ }
108
+ }
109
+
87
110
THolder<TEvSchemeShard::TEvModifySchemeTransaction> BackupPropose (
88
111
TSchemeShard* ss,
89
112
TTxId txId,
@@ -107,11 +130,14 @@ THolder<TEvSchemeShard::TEvModifySchemeTransaction> BackupPropose(
107
130
task.SetNeedToBill (!exportInfo->UserSID || !ss->SystemBackupSIDs .contains (*exportInfo->UserSID ));
108
131
109
132
const TPath sourcePath = TPath::Init (exportInfo->Items [itemIdx].SourcePathId , ss);
110
- const TPath exportPathItem = exportPath.Child (ToString (itemIdx));
111
- if (sourcePath.IsResolved () && exportPathItem.IsResolved ()) {
112
- auto exportDescription = GetTableDescription (ss, exportPathItem.Base ()->PathId );
113
- exportDescription.MutableTable ()->SetName (sourcePath.LeafName ());
114
- task.MutableTable ()->CopyFrom (exportDescription);
133
+ const TPath exportItemPath = exportPath.Child (ToString (itemIdx));
134
+ if (sourcePath.IsResolved () && exportItemPath.IsResolved ()) {
135
+ auto sourceDescription = GetTableDescription (ss, sourcePath.Base ()->PathId );
136
+ if (sourceDescription.HasTable ()) {
137
+ FillSetValForSequences (
138
+ ss, *sourceDescription.MutableTable (), exportItemPath.Base ()->PathId );
139
+ }
140
+ task.MutableTable ()->CopyFrom (sourceDescription);
115
141
}
116
142
117
143
task.SetSnapshotStep (exportInfo->SnapshotStep );
0 commit comments