This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/test
Joseph Schorr 8c4e86f48b Change queue to use state-field for claiming items
Before this change, the queue code would check that none of the fields on the item to be claimed had changed between the time when the item was selected and the item is claimed. While this is a safe approach, it also causes quite a bit of lock contention in MySQL, because InnoDB will take a lock on *any* rows examined by the `where` clause of the `update`, even if they will ultimately thrown out due to other clauses (See: http://dev.mysql.com/doc/refman/5.7/en/innodb-locks-set.html: "A ..., an UPDATE, ... generally set record locks on every index record that is scanned in the processing of the SQL statement. It does not matter whether there are WHERE conditions in the statement that would exclude the row. InnoDB does not remember the exact WHERE condition, but only knows which index ranges were scanned").

As a result, we want to minimize the number of fields accessed in the `where` clause on an update to the QueueItem row. To do so, we introduce a new `state_id` column, which is updated on *every change* to the QueueItem rows with a unique, random value. We can then have the queue item claiming code simply check that the `state_id` column has not changed between the retrieval and claiming steps. This minimizes the number of columns being checked to two (`id` and `state_id`), and thus, should significantly reduce lock contention. Note that we can not (yet) reduce to just a single `state_id` column (which should work in theory), because we need to maintain backwards compatibility with existing items in the QueueItem table, which will be given empty `state_id` values when the migration in this change runs.

Also adds a number of tests for other queue operations that we want to make sure operate correctly following this change.

[Delivers #133632501]
2017-01-17 13:29:26 -05:00
..
data Adding in new indices for queueitem table. 2017-01-17 10:04:31 -05:00
triggerjson Fix github trigger when submitting a webhook without a head_commit 2016-11-16 14:14:17 -05:00
__init__.py Add some tests to verify we're not leaking anything to completely public users (we're not) 2013-11-06 17:09:22 -05:00
analytics.py Add some tests to make sure our docker API is properly respecting auth. 2013-11-07 17:10:57 -05:00
fulldbtest.sh Add configurable Docker host in full db tests 2016-12-01 15:45:08 -05:00
helpers.py Fix external auth returns for query_user calls 2016-12-07 14:28:42 -05:00
queue_threads.py Refactor queue locking to not use select for update 2015-11-03 11:32:28 -05:00
registry_tests.py Fix pytests and enable parallel registry tests 2016-12-20 15:42:04 -05:00
specs.py Change permissions model so that non-admins do not get org-wide read 2016-08-04 16:47:28 -04:00
test_anon_checked.py Fix tests in response to breakage in #351 2015-08-17 16:26:20 -04:00
test_api_security.py Custom SSL certificates config panel 2017-01-13 14:34:35 -05:00
test_api_usage.py Merge pull request #2245 from coreos-inc/recaptcha 2017-01-17 11:34:23 -05:00
test_auth.py rename auth.auth to auth.process 2016-09-29 15:24:57 -04:00
test_backfill_allocator.py Fix allocator test 2016-02-11 17:18:19 -05:00
test_blobmodel.py Fix uncompressed size for blob store and add test 2016-03-29 14:16:56 -04:00
test_buildman.py Make the redis client use AsyncWrapper and coroutines 2016-11-18 15:59:14 -05:00
test_cloud_storage.py Add a chunk cleanup queue for async GC of empty chunks 2016-11-15 15:07:41 -05:00
test_digest_tools.py Prevent invalid tags on builds 2016-07-25 17:50:35 -07:00
test_dockerfileparse.py Fix Dockerfile parsing for unicode and add testing 2015-08-31 14:32:26 -04:00
test_endpoints.py test(endpoints/api): ensure empty 202 resp 2016-12-14 16:32:06 -05:00
test_endtoend_auth.py fix(136521333): Handle None email_or_id in avatar code 2016-12-21 15:00:55 -05:00
test_external_jwt_authn.py Fix external auth returns for query_user calls 2016-12-07 14:28:42 -05:00
test_filelike.py Add retry support to Swift 2016-07-26 09:56:00 -07:00
test_gc.py Improve the garbage collection tests. 2016-09-07 13:25:19 -04:00
test_github.py Fix handling of Github API paths and add tests 2016-06-30 14:10:22 -04:00
test_image_sharing.py Unionize the mega query - It needed more performance-based benefits 2015-10-09 14:45:05 -07:00
test_imagetree.py Improve the imagetree test. 2016-09-07 13:25:19 -04:00
test_keystone_auth.py Fix external auth returns for query_user calls 2016-12-07 14:28:42 -05:00
test_ldap.py fix(136521333): Handle None email_or_id in avatar code 2016-12-21 15:00:55 -05:00
test_license.py s/Regions/Deployments 2016-10-24 16:04:04 -04:00
test_manifests.py Fix verbs in manifestlist 2016-09-26 14:49:58 -04:00
test_metricqueue.py Fixes prometheus start metric 2016-09-30 13:09:03 -04:00
test_morecollections.py Change security notification code to use the new stream diff reporters 2016-12-20 12:50:19 -05:00
test_names.py Prevent invalid tags on builds 2016-07-25 17:50:35 -07:00
test_notifications.py Adding in cancel notifications 2016-11-30 14:38:34 -05:00
test_notificationworker.py Add an end-to-end test for the notifications queue 2016-09-21 15:15:35 -04:00
test_permissions.py Accidental refactor, split out legacy.py into separate sumodules and update all call sites. 2015-07-17 11:56:15 -04:00
test_prepare_trigger.py Fix github trigger when submitting a webhook without a head_commit 2016-11-16 14:14:17 -05:00
test_queries.py Making some refactors to make it easier to cancel the build at any time. 2016-10-24 15:59:33 -04:00
test_queue.py Change queue to use state-field for claiming items 2017-01-17 13:29:26 -05:00
test_queuefile.py Add retry support to Swift 2016-07-26 09:56:00 -07:00
test_registry_v2_auth.py registry auth tests: test more access types 2016-11-28 14:02:08 -05:00
test_repomodel.py Add a sitemap.txt for popular public repos 2016-06-17 14:34:20 -04:00
test_secscan.py Fix whitespace 2016-12-20 13:25:23 -05:00
test_ssl_util.py Custom SSL certificates config panel 2017-01-13 14:34:35 -05:00
test_storageproxy.py Fix full database test script to not fail randomly 2016-11-30 18:24:08 -05:00
test_storagereplication.py Fix storage replication for CAS and add tests 2016-07-12 13:46:06 -04:00
test_streamlayerformat.py Refactor the util directory to use subpackages. 2015-08-03 16:04:19 -04:00
test_suconfig_api.py Add support for deleting namespaces (users, organizations) 2016-10-21 15:41:09 -04:00
test_swift.py Add a chunk cleanup queue for async GC of empty chunks 2016-11-15 15:07:41 -05:00
test_trigger.py Fix pytests and enable parallel registry tests 2016-12-20 15:42:04 -05:00
test_util.py Better handling of namespace validation to fix a number of issues 2016-10-20 13:32:22 -04:00
test_v1_endpoint_security.py Change permissions model so that non-admins do not get org-wide read 2016-08-04 16:47:28 -04:00
test_v2_endpoint_security.py Change permissions model so that non-admins do not get org-wide read 2016-08-04 16:47:28 -04:00
test_validate_config.py Add SSL certificate utility and tests 2017-01-10 17:06:13 -05:00
test_validation.py Basic labels support 2016-08-26 15:24:26 -04:00
test_visible_repos.py Add additional tests for repo visibility and further simplify the query for perf 2015-10-15 12:12:57 -04:00
testconfig.py Add support for recaptcha during the create account flow 2017-01-09 11:08:21 -05:00
testlogs.py Accidental refactor, split out legacy.py into separate sumodules and update all call sites. 2015-07-17 11:56:15 -04:00
testutil.py Fix pytests and enable parallel registry tests 2016-12-20 15:42:04 -05:00