consul/agent
R.B. Boyer 11213ae180
health: ensure /v1/health/service/:service endpoint returns the most recent results when a filter is used with streaming (#12640)
The primary bug here is in the streaming subsystem that makes the overall v1/health/service/:service request behave incorrectly when servicing a blocking request with a filter provided.

There is a secondary non-streaming bug being fixed here that is much less obvious related to when to update the `reply` variable in a `blockingQuery` evaluation. It is unlikely that it is triggerable in practical environments and I could not actually get the bug to manifest, but I fixed it anyway while investigating the original issue.

Simple reproduction (streaming):

1. Register a service with a tag.

        curl -sL --request PUT 'http://localhost:8500/v1/agent/service/register' \
            --header 'Content-Type: application/json' \
            --data-raw '{ "ID": "ID1", "Name": "test", "Tags":[ "a" ], "EnableTagOverride": true }'

2. Do an initial filter query that matches on the tag.

        curl -sLi --get 'http://localhost:8500/v1/health/service/test' --data-urlencode 'filter=a in Service.Tags'

3. Note you get one result. Use the `X-Consul-Index` header to establish
   a blocking query in another terminal, this should not return yet.

        curl -sLi --get 'http://localhost:8500/v1/health/service/test?index=$INDEX' --data-urlencode 'filter=a in Service.Tags'

4. Re-register that service with a different tag.

        curl -sL --request PUT 'http://localhost:8500/v1/agent/service/register' \
            --header 'Content-Type: application/json' \
            --data-raw '{ "ID": "ID1", "Name": "test", "Tags":[ "b" ], "EnableTagOverride": true }'

5. Your blocking query from (3) should return with a header
   `X-Consul-Query-Backend: streaming` and empty results if it works
   correctly `[]`.

Attempts to reproduce with non-streaming failed (where you add `&near=_agent` to the read queries and ensure `X-Consul-Query-Backend: blocking-query` shows up in the results).
2022-04-27 10:39:45 -05:00
..
ae sdk: add TestLogLevel for setting log level in tests 2022-02-03 13:42:28 -05:00
auto-config peering: initial sync (#12842) 2022-04-21 17:34:40 -05:00
cache peering: initial sync (#12842) 2022-04-21 17:34:40 -05:00
cache-types peering: initial sync (#12842) 2022-04-21 17:34:40 -05:00
checks Merge pull request #12685 from hashicorp/http-check-redirect-option 2022-04-07 11:29:27 -07:00
config Add an internal env var for managed cluster config in the ui (#12796) 2022-04-15 09:55:52 -07:00
configentry Fixup acl.EnterpriseMeta 2022-04-05 15:11:49 -07:00
connect chore: upgrade mockery to v2 and regenerate (#12836) 2022-04-21 09:48:21 -05:00
consul health: ensure /v1/health/service/:service endpoint returns the most recent results when a filter is used with streaming (#12640) 2022-04-27 10:39:45 -05:00
debug bulk rewrite using this script 2022-01-20 10:46:23 -06:00
dns lib: add validation package + DNS label validation (#12535) 2022-03-17 18:31:28 -07:00
exec re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
grpc peering: initial sync (#12842) 2022-04-21 17:34:40 -05:00
local Fixup acl.EnterpriseMeta 2022-04-05 15:11:49 -07:00
metadata partitions: various refactors to support partitioning the serf LAN pool (#11568) 2021-11-15 09:51:14 -06:00
mock
pool Add timeout to Client RPC calls (#11500) 2022-04-21 16:21:35 -04:00
proxycfg Implement routing and intentions for AWS Lambdas 2022-04-13 11:45:25 -04:00
router sdk: add TestLogLevel for setting log level in tests 2022-02-03 13:42:28 -05:00
routine-leak-checker Remove references to "master" ACL tokens in tests (#11751) 2021-12-07 12:48:50 +00:00
rpc peering: initial sync (#12842) 2022-04-21 17:34:40 -05:00
rpcclient/health health: ensure /v1/health/service/:service endpoint returns the most recent results when a filter is used with streaming (#12640) 2022-04-27 10:39:45 -05:00
structs health: ensure /v1/health/service/:service endpoint returns the most recent results when a filter is used with streaming (#12640) 2022-04-27 10:39:45 -05:00
submatview peering: initial sync (#12842) 2022-04-21 17:34:40 -05:00
systemd
token agent/token: rename `agent_master` to `agent_recovery` (internally) (#11744) 2021-12-07 12:12:47 +00:00
uiserver Add an internal env var for managed cluster config in the ui (#12796) 2022-04-15 09:55:52 -07:00
xds connect: Add Envoy 1.22 to integration tests, remove Envoy 1.18 (#12805) 2022-04-18 09:36:07 -07:00
acl.go Bulk acl message fixup oss (#12470) 2022-03-10 18:48:27 -08:00
acl_endpoint.go Add expanded token read flag and endpoint option 2022-03-31 10:49:49 -07:00
acl_endpoint_legacy.go
acl_endpoint_legacy_test.go agent: Ensure partition is considered in agent endpoints (#11427) 2021-10-26 15:20:57 -04:00
acl_endpoint_test.go acl: Clarify node/service identities must be lowercase (#12807) 2022-04-21 09:29:16 -07:00
acl_oss.go agent: support `X-Consul-Results-Filtered-By-ACLs` header in agent-local endpoints (#11610) 2021-12-03 20:36:28 +00:00
acl_test.go Fixup acl.EnterpriseMeta 2022-04-05 15:11:49 -07:00
agent.go update raft to v1.3.8 (#12844) 2022-04-25 10:19:26 -04:00
agent_endpoint.go Fixup acl.EnterpriseMeta 2022-04-05 15:11:49 -07:00
agent_endpoint_oss.go Fixup acl.EnterpriseMeta 2022-04-05 15:11:49 -07:00
agent_endpoint_test.go ca: fix a bug that caused a non blocking leaf cert query after a blocking leaf cert query to block (#12820) 2022-04-20 12:21:47 -05:00
agent_oss.go Fixup acl.EnterpriseMeta 2022-04-05 15:11:49 -07:00
agent_test.go Update go version to 1.18.1 2022-04-18 11:41:10 -04:00
apiserver.go
apiserver_test.go
catalog_endpoint.go Change error-handling across handlers. (#12225) 2022-01-31 11:17:35 -05:00
catalog_endpoint_oss.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
catalog_endpoint_test.go catalog: compare node names case insensitively in more places (#12444) 2022-02-24 16:54:47 -06:00
check.go Fixup acl.EnterpriseMeta 2022-04-05 15:11:49 -07:00
config_endpoint.go Fixup acl.EnterpriseMeta 2022-04-05 15:11:49 -07:00
config_endpoint_test.go Fixup acl.EnterpriseMeta 2022-04-05 15:11:49 -07:00
connect_auth.go Fixup acl.EnterpriseMeta 2022-04-05 15:11:49 -07:00
connect_ca_endpoint.go add root_cert_ttl option for consul connect, vault ca providers (#11428) 2021-11-02 11:02:10 -07:00
connect_ca_endpoint_test.go Update go version to 1.18.1 2022-04-18 11:41:10 -04:00
coordinate_endpoint.go Change error-handling across handlers. (#12225) 2022-01-31 11:17:35 -05:00
coordinate_endpoint_test.go Change error-handling across handlers. (#12225) 2022-01-31 11:17:35 -05:00
delegate_mock_test.go Fixup acl.EnterpriseMeta 2022-04-05 15:11:49 -07:00
denylist.go
denylist_test.go
discovery_chain_endpoint.go Fixup acl.EnterpriseMeta 2022-04-05 15:11:49 -07:00
discovery_chain_endpoint_test.go fix broken test (#12741) 2022-04-11 10:56:57 -05:00
dns.go Fixup acl.EnterpriseMeta 2022-04-05 15:11:49 -07:00
dns_oss.go Fixup acl.EnterpriseMeta 2022-04-05 15:11:49 -07:00
dns_test.go Remove references to "master" ACL tokens in tests (#11751) 2021-12-07 12:48:50 +00:00
enterprise_delegate_oss.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
event_endpoint.go Change error-handling across handlers. (#12225) 2022-01-31 11:17:35 -05:00
event_endpoint_test.go Change error-handling across handlers. (#12225) 2022-01-31 11:17:35 -05:00
federation_state_endpoint.go URL-encode/decode resource names for HTTP API part 3 (#12103) 2022-01-26 13:12:42 -05:00
health_endpoint.go peering: initial sync (#12842) 2022-04-21 17:34:40 -05:00
health_endpoint_test.go health: ensure /v1/health/service/:service endpoint returns the most recent results when a filter is used with streaming (#12640) 2022-04-27 10:39:45 -05:00
http.go peering: initial sync (#12842) 2022-04-21 17:34:40 -05:00
http_decode_test.go add test cases for h2ping_use_tls default behavior 2021-10-09 17:12:52 -04:00
http_oss.go Fixup acl.EnterpriseMeta 2022-04-05 15:11:49 -07:00
http_oss_test.go Remove references to "master" ACL tokens in tests (#11751) 2021-12-07 12:48:50 +00:00
http_register.go peering: initial sync (#12842) 2022-04-21 17:34:40 -05:00
http_test.go testing: fix test failures caused by new log level 2022-02-03 17:07:39 -05:00
intentions_endpoint.go Fixup acl.EnterpriseMeta 2022-04-05 15:11:49 -07:00
intentions_endpoint_oss_test.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
intentions_endpoint_test.go Fixup acl.EnterpriseMeta 2022-04-05 15:11:49 -07:00
keyring.go Allows keyring operations on client agents 2022-02-24 17:24:57 +00:00
keyring_test.go Remove references to "master" ACL tokens in tests (#11751) 2021-12-07 12:48:50 +00:00
kvs_endpoint.go docs: fix yet more references to agent/options 2022-04-11 17:38:49 -07:00
kvs_endpoint_test.go
metrics.go agent: move agent tls metric monitor to a more appropriate place 2021-10-27 16:26:09 -04:00
metrics_test.go add more labels to RequestRecorder (#12727) 2022-04-12 10:50:25 -07:00
nodeid.go
nodeid_test.go
notify.go
notify_test.go
operator_endpoint.go Fixup acl.EnterpriseMeta 2022-04-05 15:11:49 -07:00
operator_endpoint_oss.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
operator_endpoint_test.go
peering_endpoint.go peering: initial sync (#12842) 2022-04-21 17:34:40 -05:00
peering_endpoint_oss_test.go peering: initial sync (#12842) 2022-04-21 17:34:40 -05:00
peering_endpoint_test.go peering: initial sync (#12842) 2022-04-21 17:34:40 -05:00
prepared_query_endpoint.go Change error-handling across handlers. (#12225) 2022-01-31 11:17:35 -05:00
prepared_query_endpoint_test.go Change error-handling across handlers. (#12225) 2022-01-31 11:17:35 -05:00
reload.go
remote_exec.go
remote_exec_test.go Remove references to "master" ACL tokens in tests (#11751) 2021-12-07 12:48:50 +00:00
retry_join.go agent: refactor the agent delegate interface to be partition friendly (#11429) 2021-10-26 15:08:55 -05:00
retry_join_test.go
service_checks_test.go
service_manager.go
service_manager_test.go bulk rewrite using this script 2022-01-20 10:46:23 -06:00
session_endpoint.go Change error-handling across handlers. (#12225) 2022-01-31 11:17:35 -05:00
session_endpoint_test.go
setup.go Add timeout to Client RPC calls (#11500) 2022-04-21 16:21:35 -04:00
setup_oss.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
sidecar_service.go
sidecar_service_test.go bulk rewrite using this script 2022-01-20 10:46:23 -06:00
signal_unix.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
signal_windows.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
snapshot_endpoint.go
snapshot_endpoint_test.go
status_endpoint.go
status_endpoint_test.go
streaming_test.go regenerate expired certs (#11462) 2021-11-01 11:40:16 -04:00
testagent.go peering: initial sync (#12842) 2022-04-21 17:34:40 -05:00
testagent_test.go
translate_addr.go
txn_endpoint.go docs: fix yet more references to agent/options 2022-04-11 17:38:49 -07:00
txn_endpoint_test.go Change error-handling across handlers. (#12225) 2022-01-31 11:17:35 -05:00
ui_endpoint.go Fixup acl.EnterpriseMeta 2022-04-05 15:11:49 -07:00
ui_endpoint_oss_test.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
ui_endpoint_test.go Support for connect native services in topology view. (#12098) 2022-02-16 16:51:54 -05:00
user_event.go Vendor in rpc mono repo for net/rpc fork, go-msgpack, msgpackrpc. (#12311) 2022-02-14 09:45:45 -08:00
user_event_test.go Update 4 non-acl tests that used the legacy ACL.Apply 2021-09-21 17:57:29 -04:00
util.go Remove some usage of md5 from the system (#11491) 2021-11-04 13:07:54 -07:00
util_test.go Remove some usage of md5 from the system (#11491) 2021-11-04 13:07:54 -07:00
watch_handler.go
watch_handler_test.go