From 18c9e73832e351d6f0b5e5914f9e35c29da2ab66 Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Mon, 19 Apr 2021 17:14:19 -0400 Subject: [PATCH] connect: do not set QuerySource.Node Setting this field to a value is equivalent to using the 'near' query paramter. The intent is to sort the results by proximity to the node requesting them. However with connect we send the results to envoy, which doesn't care about the order, so setting this field is increasing the work performed for no gain. It is necessary to unset this field now because we would like connect to use streaming, but streaming does not support sorting by proximity. --- agent/agent.go | 1 - agent/proxycfg/manager_test.go | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/agent/agent.go b/agent/agent.go index c6615af4b..493c9bd11 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -540,7 +540,6 @@ func (a *Agent) Start(ctx context.Context) error { Logger: a.logger.Named(logging.ProxyConfig), State: a.State, Source: &structs.QuerySource{ - Node: a.config.NodeName, Datacenter: a.config.Datacenter, Segment: a.config.SegmentName, }, diff --git a/agent/proxycfg/manager_test.go b/agent/proxycfg/manager_test.go index c4496b6d3..1c9067f50 100644 --- a/agent/proxycfg/manager_test.go +++ b/agent/proxycfg/manager_test.go @@ -352,10 +352,7 @@ func testManager_BasicLifecycle( require := require.New(t) logger := testutil.Logger(t) state := local.NewState(local.Config{}, logger, &token.Store{}) - source := &structs.QuerySource{ - Node: "node1", - Datacenter: "dc1", - } + source := &structs.QuerySource{Datacenter: "dc1"} // Stub state syncing state.TriggerSyncChanges = func() {}