mirror of https://github.com/status-im/consul.git
11213ae180
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). |
||
---|---|---|
.. | ||
acl.go | ||
acl_cache.go | ||
acl_cache_test.go | ||
acl_oss.go | ||
acl_test.go | ||
auto_encrypt.go | ||
autopilot.go | ||
autopilot_oss.go | ||
catalog.go | ||
catalog_oss.go | ||
check_definition.go | ||
check_definition_test.go | ||
check_type.go | ||
config_entry.go | ||
config_entry_discoverychain.go | ||
config_entry_discoverychain_oss.go | ||
config_entry_discoverychain_test.go | ||
config_entry_export_oss_test.go | ||
config_entry_exports.go | ||
config_entry_exports_test.go | ||
config_entry_gateways.go | ||
config_entry_gateways_test.go | ||
config_entry_intentions.go | ||
config_entry_intentions_oss.go | ||
config_entry_intentions_test.go | ||
config_entry_mesh.go | ||
config_entry_mesh_oss.go | ||
config_entry_oss.go | ||
config_entry_oss_test.go | ||
config_entry_test.go | ||
connect.go | ||
connect_ca.go | ||
connect_ca_test.go | ||
connect_oss.go | ||
connect_proxy_config.go | ||
connect_proxy_config_oss.go | ||
connect_proxy_config_test.go | ||
discovery_chain.go | ||
discovery_chain_oss.go | ||
errors.go | ||
federation_state.go | ||
identity.go | ||
intention.go | ||
intention_oss.go | ||
intention_test.go | ||
operator.go | ||
peering.go | ||
prepared_query.go | ||
prepared_query_test.go | ||
protobuf_compat.go | ||
sanitize_oss.go | ||
service_definition.go | ||
service_definition_test.go | ||
snapshot.go | ||
structs.go | ||
structs_filtering_test.go | ||
structs_oss.go | ||
structs_oss_test.go | ||
structs_test.go | ||
system_metadata.go | ||
testing.go | ||
testing_catalog.go | ||
testing_connect_proxy_config.go | ||
testing_intention.go | ||
testing_service_definition.go | ||
txn.go |