consul/agent/cache
Matt Keeler dbc48ea3f7 Fixes race condition in Agent Cache (#5796)
* Fix race condition during a cache get

Check the entry we pulled out of the cache while holding the lock had Fetching set.
If it did then we should use the existing Waiter instead of calling fetch. The reason
this is better than just calling fetch is that fetch re-gets the entry out of the
entries map and the previous fetch may have finished. Therefore this prevents
erroneously starting a new fetch because we just missed the last update.

* Fix race condition fully

The first commit still allowed for the following scenario:

• No entry existing when checked in getWithIndex while holding the read lock
• Then by time we had reached fetch it had been created and finished.

* always use ok when returning

* comment mentioning the reading from entries.

* use cacheHit consistently
2019-05-07 11:15:49 +01:00
..
cache.go Fixes race condition in Agent Cache (#5796) 2019-05-07 11:15:49 +01:00
cache_test.go Fixes race condition in Agent Cache (#5796) 2019-05-07 11:15:49 +01:00
entry.go connect: agent leaf cert caching improvements (#5091) 2019-01-10 12:46:11 +00:00
entry_test.go agent/cache: unit tests for ExpiryHeap, found a bug! 2018-06-14 09:42:03 -07:00
mock_Request.go agent/cache: Reorganize some files, RequestInfo struct, prepare for partitioning 2018-06-14 09:42:00 -07:00
mock_Type.go Support Agent Caching for Service Discovery Results (#4541) 2018-10-10 16:55:34 +01:00
request.go Support Agent Caching for Service Discovery Results (#4541) 2018-10-10 16:55:34 +01:00
testing.go Add cache.Notify to abstract watching for cache updates for types that support blocking semantics. (#4695) 2018-10-10 16:55:34 +01:00
type.go connect: tame thundering herd of CSRs on CA rotation (#5228) 2019-01-22 17:19:36 +00:00
watch.go Make central service config opt-in and rework the initial registration 2019-04-24 06:11:08 -07:00
watch_test.go Test an index=0 value in cache.Notify 2019-04-25 02:11:07 -07:00