Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
shnikd committed Mar 27, 2024
1 parent 46e1e9c commit a74befa
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 7 deletions.
38 changes: 32 additions & 6 deletions ydb/core/tx/schemeshard/schemeshard_export_flow_proposals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,37 @@ 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();

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<TString, NKikimrSchemeOp::TSequenceDescription::TSetVal> 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<TEvSchemeShard::TEvModifySchemeTransaction> BackupPropose(
TSchemeShard* ss,
TTxId txId,
Expand All @@ -107,11 +130,14 @@ THolder<TEvSchemeShard::TEvModifySchemeTransaction> 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);
Expand Down
2 changes: 1 addition & 1 deletion ydb/core/tx/schemeshard/schemeshard_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit a74befa

Please sign in to comment.