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 state: remove support for updating legacy ACL tokens 2021-10-25 17:25:14 -04:00
acl_events.go convert indexSecret to the new index (#11007) 2021-09-10 09:10:11 -04:00
acl_events_test.go acl: global tokens created by auth methods now correctly replicate to secondary datacenters (#9351) 2020-12-09 15:22:29 -06:00
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: only run startACLUpgrade once 2021-09-29 16:22:01 -04:00
acl_test.go acl: remove ACLTokenTypeManagement 2021-10-25 17:25:14 -04:00
autopilot.go state: use ReadTxn and WriteTxn interface 2021-03-29 18:52:16 -04:00
autopilot_test.go Switch to using the external autopilot module 2020-11-09 09:22:11 -05:00
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 Update Intentions.List with partitions (#11299) 2021-10-13 10:47:12 -04:00
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 state: remove unnecessary kind index 2021-04-15 17:37:28 -04:00
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 state: partition nodes and coordinates in the state store (#10859) 2021-08-17 13:29:39 -05:00
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 state: partition nodes and coordinates in the state store (#10859) 2021-08-17 13:29:39 -05:00
delay_oss.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
delay_test.go testing: skip slow tests with -short 2020-12-07 13:42:55 -05:00
federation_state.go state: use tableIndex constant 2021-03-29 18:52:20 -04:00
graveyard.go KV state store refactoring and partitioning (#11510) 2021-11-08 09:35:56 -05:00
graveyard_oss.go refactor session state store tables to use the new index pattern (#11525) 2021-11-08 16:20:50 -05:00
graveyard_test.go KV state store refactoring and partitioning (#11510) 2021-11-08 09:35:56 -05:00
index_connect_test.go state: convert services table service and connect indexer 2021-03-29 15:42:24 -04:00
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 refactor session state store tables to use the new index pattern (#11525) 2021-11-08 16:20:50 -05:00
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 KV state store refactoring and partitioning (#11510) 2021-11-08 09:35:56 -05:00
memdb.go rpcclient: use streaming for connect health 2021-03-12 11:35:42 -05:00
operations_oss.go refactor session state store tables to use the new index pattern (#11525) 2021-11-08 16:20:50 -05:00
prepared_query.go refactor session state store tables to use the new index pattern (#11525) 2021-11-08 16:20:50 -05:00
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 refactor session state store tables to use the new index pattern (#11525) 2021-11-08 16:20:50 -05:00
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 rename helper method to reflect the non-deprecated terminology (#11509) 2021-11-05 13:51:50 -05:00
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 use const instead of literals for `tableIndex` (#11039) 2021-09-15 10:24:04 -04:00
system_metadata_test.go server: create new memdb table for storing system metadata (#8703) 2020-10-06 10:08:37 -05:00
tombstone_gc.go
tombstone_gc_test.go
txn.go KV state store refactoring and partitioning (#11510) 2021-11-08 09:35:56 -05:00
txn_test.go state: partition nodes and coordinates in the state store (#10859) 2021-08-17 13:29:39 -05:00
usage.go Replace fmt.Sprintf with function 2021-10-11 12:43:38 -05:00
usage_oss.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
usage_test.go Rename and prefix ConfigEntry in Usage table 2021-10-07 16:19:55 -05:00