mononoke: add edge from unode to linked bonsai changeset in walker

Summary: When doing a deep walk step into history via the unode's linked changeset.

Reviewed By: ikostia

Differential Revision: D24838459

fbshipit-source-id: cf2196f95e7b6bf3c3ba2cd1c44fef748a11597f
This commit is contained in:
Alex Hornby 2020-11-13 05:21:34 -08:00 committed by Facebook GitHub Bot
parent 143e18ec2b
commit 0f47fb897d
4 changed files with 16 additions and 6 deletions

View File

@ -111,9 +111,9 @@ count-objects, shallow walk across bonsai and unodes
* Type:Walked,Checks,Children BonsaiChangeset:1,* BonsaiUnodeMapping:1,* Bookmark:1,1,1 UnodeManifest:1,* (glob)
count-objects, deep walk across bonsai and unodes
$ mononoke_walker --storage-id=blobstore --readonly-storage scrub -q --bookmark master_bookmark -I deep -i bonsai -i derived_unodes 2>&1 | strip_glog
$ mononoke_walker --storage-id=blobstore --readonly-storage scrub -q --bookmark master_bookmark -I deep -i bonsai -i derived_unodes -X BonsaiChangesetToBonsaiParent 2>&1 | strip_glog
Walking roots * (glob)
Walking edge types [BonsaiChangesetToBonsaiParent, BonsaiChangesetToBonsaiUnodeMapping, BonsaiUnodeMappingToRootUnodeManifest, BookmarkToBonsaiChangeset, UnodeManifestToUnodeManifestParent]
Walking edge types [BonsaiChangesetToBonsaiUnodeMapping, BonsaiUnodeMappingToRootUnodeManifest, BookmarkToBonsaiChangeset, UnodeManifestToLinkedBonsaiChangeset, UnodeManifestToUnodeManifestParent]
Walking node types [BonsaiChangeset, BonsaiUnodeMapping, Bookmark, UnodeManifest]
Final count: (10, 10)
Bytes/s,* (glob)

View File

@ -287,7 +287,7 @@ create_graph!(
(
UnodeManifest,
PathKey<ManifestUnodeId>,
[UnodeManifestParent(UnodeManifest)]
[UnodeManifestParent(UnodeManifest), LinkedBonsaiChangeset(BonsaiChangeset)]
),
(BonsaiUnodeMapping, ChangesetId, [RootUnodeManifest(UnodeManifest)]),
);

View File

@ -173,6 +173,7 @@ const DEEP_INCLUDE_EDGE_TYPES: &[EdgeType] = &[
EdgeType::ChangesetInfoToChangesetInfoParent,
EdgeType::FsnodeToChildFsnode,
EdgeType::FsnodeToFileContent,
EdgeType::UnodeManifestToLinkedBonsaiChangeset,
EdgeType::UnodeManifestToUnodeManifestParent,
];

View File

@ -896,19 +896,28 @@ async fn unode_manifest_step<V: VisitOne>(
let unode_manifest = unode_manifest_id
.load(ctx.clone(), &repo.get_blobstore())
.await?;
let mut manifest_edges = vec![];
let mut edges = vec![];
checker.add_edge(
&mut edges,
EdgeType::UnodeManifestToLinkedBonsaiChangeset,
|| Node::BonsaiChangeset(*unode_manifest.linknode()),
);
for p in unode_manifest.parents() {
checker.add_edge(
&mut manifest_edges,
&mut edges,
EdgeType::UnodeManifestToUnodeManifestParent,
|| Node::UnodeManifest(PathKey::new(*p, path.clone())),
);
}
Ok(StepOutput(
checker.step_data(NodeType::UnodeManifest, || {
NodeData::UnodeManifest(unode_manifest)
}),
manifest_edges,
edges,
))
}