serving/xrefs: add --merge_cross_references flag
Summary: --merge_cross_references controls whether the PagedCrossReferences.merge_with field should be considered in a CrossReferences call.  By default, they should be considered.
Reviewers: zarko, #core_team
Subscribers: #core_team
@@ -53,7 +53,10 @@ import (
"golang.org/x/net/trace"
)
-var maxTicketsPerRequest = flag.Int("max_tickets_per_request", 20, "Maximum number of tickets allowed per request")
+var (
+ maxTicketsPerRequest = flag.Int("max_tickets_per_request", 20, "Maximum number of tickets allowed per request")
+ mergeCrossReferences = flag.Bool("merge_cross_references", true, "Whether to merge nodes when responding to a CrossReferencesRequest")
+)
type edgeSetResult struct {
PagedEdgeSet *srvpb.PagedEdgeSet
@@ -882,6 +885,7 @@ func (t *Table) CrossReferences(ctx context.Context, req *xpb.CrossReferencesReq
crs.MarkedSource = m2m(cr.MarkedSource)
}
+ if *mergeCrossReferences {
// Add any additional merge nodes to the set of table lookups
for _, mergeNode := range cr.MergeWith {
if prevMerge, ok := mergeInto[mergeNode]; ok {
@@ -896,6 +900,7 @@ func (t *Table) CrossReferences(ctx context.Context, req *xpb.CrossReferencesReq
tickets = append(tickets, mergeNode)
mergeInto[mergeNode] = ticket
}
+ }
for _, grp := range cr.Group {
switch {
