neutron/neutron/tests/unit
Terry Wilson 1f30f2dfff Rely on worker count for HashRing caching
The current code looks at a hash ring node's created_at/updated_at
fields and tries to determine whether the node has been updated
based on whether updated_at - created_at > 1 second (due to the
method that initially fills them being different by microseconds).
Unfortunately, due to the notify() method being called which calls
the hash ring node's touch_node(), a node can be updated in under
a second, meaning we will prevent caching for much longer than
we intend.

When using sqlite in-memory db, this continually re-creating the
Hash Ring objects for every event that is processed is exposing an
issue where rows that should be in the db just *aren't*.

This patch instead limits the hash ring nodes to api workers and
prevents caching only until the number of nodes == number of api
workers on the host. The switch from spawning hash ring nodes
where !is_maintenance to is_api_worker is primarily because it
seems to be difficult to get a list of *all* workers from which to
subtract the maintenance worker so that _wait_startup_before_caching
can wait for that specific number of workers. In practice, this
means that RpcWorker and ServiceWorker workers would not process
HashRing events.

A note on bug 1903008: While this change will greatly reduce the
likelihood of this issue taking place, we still have some work to
do in order to fully understand why it rubs the database backend
in the wrong way. Thus, we will make this change 'related to'
instead of closing the bug.

Related-Bug: #1894117
Related-Bug: #1903008
Change-Id: Ia198d45f49bddda549a0e70a3374b8339f88887b
(cherry picked from commit c4007b0833)
2021-05-06 14:31:44 +00:00
..
agent [OVN] Only account for bound ports in metadata agent 2021-04-27 10:05:52 +00:00
api DHCP notification optimization 2021-04-23 10:01:20 +00:00
cmd Migrate "netstat" to oslo.privsep 2020-06-19 14:59:11 +00:00
common Rely on worker count for HashRing caching 2021-05-06 14:31:44 +00:00
conf/agent Agent common config 2017-03-15 09:52:18 -06:00
core_extensions Remove the dependency on the "mock" package 2020-04-28 18:05:37 -04:00
db DHCP notification optimization 2021-04-23 10:01:20 +00:00
debug Remove the dependency on the "mock" package 2020-04-28 18:05:37 -04:00
extensions Improve Network delete performance 2021-05-05 11:50:22 +04:00
hacking Remove "six" library 2020-07-28 16:55:52 +00:00
ipam [OVN] Use new distributed device_owner for OVN distributed services 2020-07-08 13:26:35 +00:00
notifiers Add config option ``http_retries`` 2020-06-29 22:07:46 -04:00
objects Add source_ip_prefix and destination_ip_prefix to metering label rules 2020-09-30 12:26:01 +00:00
pecan_wsgi Remove the dependency on the "mock" package 2020-04-28 18:05:37 -04:00
plugins [OVN] Simplify connection creation logic 2021-05-03 20:07:28 +02:00
privileged Migrate "netstat" to oslo.privsep 2020-06-19 14:59:11 +00:00
quota Remove the dependency on the "mock" package 2020-04-28 18:05:37 -04:00
scheduler Revert "DVR: Remove control plane arp updates for DVR" 2021-03-09 13:07:17 +00:00
services trivial: Make driver_controller's _attrs_to_driver py3 compatible 2021-04-29 07:34:09 +00:00
tests Remove "six" library 2020-07-28 16:55:52 +00:00
__init__.py Don't set use_stderr to False for tests 2017-04-15 01:41:29 +00:00
_test_extension_portbindings.py Remove "six" library 2020-07-28 16:55:52 +00:00
dummy_plugin.py Remove Neutron LBaaS 2019-09-20 07:46:06 +00:00
extension_stubs.py Consume ServicePluginBase from neutron-lib 2017-03-17 12:06:57 -06:00
fake_resources.py Merge "[OVN] Use the Chassis_Private table for agents healthcheck" 2020-08-22 01:26:33 +00:00
test_auth.py Fix context deprecation warnings 2018-02-13 15:02:49 -05:00
test_manager.py Remove the dependency on the "mock" package 2020-04-28 18:05:37 -04:00
test_neutron_plugin_base_v2.py Add unit test to validate non DB base core plugin can be loaded 2017-11-15 21:21:35 +00:00
test_opts.py Fix the sriov agent config group name 2016-05-05 16:16:08 +08:00
test_policy.py Remove the dependency on the "mock" package 2020-04-28 18:05:37 -04:00
test_service.py Remove the dependency on the "mock" package 2020-04-28 18:05:37 -04:00
test_worker.py Remove the dependency on the "mock" package 2020-04-28 18:05:37 -04:00
test_wsgi.py Remove "six" library 2020-07-28 16:55:52 +00:00
testlib_api.py Remove usage of six.text_type and six.string_type 2020-05-22 14:02:55 -04:00