20183: Move update_priority tests. Fix updater starvation.
authorTom Clegg <tom@curii.com>
Mon, 6 Mar 2023 00:27:22 +0000 (19:27 -0500)
committerTom Clegg <tom@curii.com>
Mon, 6 Mar 2023 00:27:22 +0000 (19:27 -0500)
commit2c0977ca3532844d67ddeec64cf198dca7b3763a
tree2f8673c705b1fa5f165b43d4fb2c465ff301fa3b
parentaeb2b25c254f8e98a67c0cc3e6cd8cdadcb8bd36
20183: Move update_priority tests. Fix updater starvation.

Previously (in the Rails implementation) the "find containers that
have priority=0 but need priority>0" query was returning all
containers with active (committed, priority>0) requests. However, it
is possible for all such requests to have parent
containers (requesting_container_uuid) to have priority=0, in which
case Container.update_priority!() leaves the container priority at 0.

With the controller implementation, this was manifesting as lack of
progress, and warnings in logs.

This commit fixes it by not including such containers as needing
priority>0.

With the previous Rails setup, this could cause infinite recursion:
the updater thread called update_priority!(), which left
priority=0 but still triggered an after_commit hook, which
(if the updater thread had already been running for >5s) started a new
updater thread, which called update_priority!() on the same container,
etc.

Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>
lib/controller/localdb/container.go
lib/controller/localdb/container_test.go [new file with mode: 0644]
services/api/app/controllers/arvados/v1/containers_controller.rb
services/api/test/functional/arvados/v1/containers_controller_test.rb
services/api/test/unit/update_priority_test.rb [deleted file]