open-consul/agent/consul/state
R.B. Boyer 3804677570
server: suppress spurious blocking query returns where multiple config entries are involved (#12362)
Starting from and extending the mechanism introduced in #12110 we can specially handle the 3 main special Consul RPC endpoints that react to many config entries in a single blocking query in Connect:

- `DiscoveryChain.Get`
- `ConfigEntry.ResolveServiceConfig`
- `Intentions.Match`

All of these will internally watch for many config entries, and at least one of those will likely be not found in any given query. Because these are blends of multiple reads the exact solution from #12110 isn't perfectly aligned, but we can tweak the approach slightly and regain the utility of that mechanism.

### No Config Entries Found

In this case, despite looking for many config entries none may be found at all. Unlike #12110 in this scenario we do not return an empty reply to the caller, but instead synthesize a struct from default values to return. This can be handled nearly identically to #12110 with the first 1-2 replies being non-empty payloads followed by the standard spurious wakeup suppression mechanism from #12110.

### No Change Since Last Wakeup

Once a blocking query loop on the server has completed and slept at least once, there is a further optimization we can make here to detect if any of the config entries that were present at specific versions for the prior execution of the loop are identical for the loop we just woke up for. In that scenario we can return a slightly different internal sentinel error and basically externally handle it similar to #12110.

This would mean that even if 20 discovery chain read RPC handling goroutines wakeup due to the creation of an unrelated config entry, the only ones that will terminate and reply with a blob of data are those that genuinely have new data to report.

### Extra Endpoints

Since this pattern is pretty reusable, other key config-entry-adjacent endpoints used by `agent/proxycfg` also were updated:

- `ConfigEntry.List`
- `Internal.IntentionUpstreams` (tproxy)
2022-02-25 15:46:34 -06:00
..
acl.go
acl_events.go
acl_events_test.go
acl_oss.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
acl_oss_test.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
acl_schema.go
acl_test.go
autopilot.go
autopilot_test.go
catalog.go catalog: compare node names case insensitively in more places (#12444) 2022-02-24 16:54:47 -06:00
catalog_events.go catalog: compare node names case insensitively in more places (#12444) 2022-02-24 16:54:47 -06:00
catalog_events_oss.go catalog: compare node names case insensitively in more places (#12444) 2022-02-24 16:54:47 -06:00
catalog_events_test.go streaming: split event buffer by key (#12080) 2022-01-28 12:27:00 +00:00
catalog_oss.go Add a new table to query service names by kind 2021-12-03 17:28:12 -07:00
catalog_oss_test.go Add a new table to query service names by kind 2021-12-03 17:28:12 -07:00
catalog_schema.go state: fix freed VIP table id index 2021-12-10 14:41:45 -08:00
catalog_test.go catalog: compare node names case insensitively in more places (#12444) 2022-02-24 16:54:47 -06:00
config_entry.go server: suppress spurious blocking query returns where multiple config entries are involved (#12362) 2022-02-25 15:46:34 -06:00
config_entry_intention.go
config_entry_intention_oss.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
config_entry_oss.go configentry: make a new package to hold shared config entry structs that aren't used for RPC or the FSM (#12384) 2022-02-22 10:36:36 -06:00
config_entry_oss_test.go configentry: make a new package to hold shared config entry structs that aren't used for RPC or the FSM (#12384) 2022-02-22 10:36:36 -06:00
config_entry_schema.go
config_entry_test.go configentry: make a new package to hold shared config entry structs that aren't used for RPC or the FSM (#12384) 2022-02-22 10:36:36 -06:00
connect_ca.go ca: Add CARoots.Active method 2021-12-08 18:41:51 -05:00
connect_ca_test.go bulk rewrite using this script 2022-01-20 10:46:23 -06:00
coordinate.go
coordinate_oss.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
coordinate_oss_test.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
coordinate_test.go
delay_oss.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
delay_test.go
federation_state.go
graveyard.go
graveyard_oss.go
graveyard_test.go
index_connect_test.go
indexer.go Partition session checks store (#11638) 2021-11-24 09:10:38 -05:00
intention.go Update intention topology to use new table 2021-12-03 17:28:31 -07:00
intention_oss.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
intention_test.go bulk rewrite using this script 2022-01-20 10:46:23 -06:00
kvs.go
kvs_oss.go Move IndexEntryName helpers to common files (#12365) 2022-02-16 12:56:38 -05:00
kvs_oss_test.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
kvs_test.go
memdb.go
operations_oss.go
prepared_query.go
prepared_query_index.go
prepared_query_index_test.go
prepared_query_test.go [OSS] Remove remaining references to master (#11827) 2022-01-20 12:47:50 +00:00
query.go Partition session checks store (#11638) 2021-11-24 09:10:38 -05:00
query_oss.go
schema.go Add a new table to query service names by kind 2021-12-03 17:28:12 -07:00
schema_oss.go Move IndexEntryName helpers to common files (#12365) 2022-02-16 12:56:38 -05:00
schema_oss_test.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
schema_test.go Add a new table to query service names by kind 2021-12-03 17:28:12 -07:00
session.go sessions partitioning tests (#11734) 2021-12-03 15:36:07 -05:00
session_oss.go port oss changes (#11736) 2021-12-03 17:23:55 -05:00
session_test.go Partition/kv indexid sessions (#11639) 2021-11-24 11:34:36 -05:00
state_store.go
state_store_oss_test.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
state_store_test.go sessions partitioning tests (#11734) 2021-12-03 15:36:07 -05:00
store_integration_test.go streaming: split event buffer by key (#12080) 2022-01-28 12:27:00 +00:00
system_metadata.go
system_metadata_test.go
tombstone_gc.go
tombstone_gc_test.go
txn.go
txn_test.go
usage.go
usage_oss.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
usage_test.go