Bug 750307
| Summary: | Duplicate pools possible | ||
|---|---|---|---|
| Product: | [Community] Candlepin | Reporter: | Andrew Edwards <aedwards> |
| Component: | candlepin | Assignee: | Jesus M. Rodriguez <jesusr> |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | John Sefler <jsefler> |
| Severity: | urgent | Docs Contact: | |
| Priority: | urgent | ||
| Version: | 0.5 | CC: | jesusr, mkhusid, tpfromme, xdmoon |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Solaris | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2012-01-13 19:17:08 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 682238 | ||
|
Description
Andrew Edwards
2011-10-31 16:26:25 UTC
The duplication is a result of multiple RefreshPoolsJobs running simultaneously for the same owner. The fix serializes the jobs for a given owner. Though it is still valid for multiple jobs to run if they are going to work on different owners. single server test -------------------- 1) ensure you have candlepin configured for quartz clustering: https://fedorahosted.org/candlepin/wiki/QuartzSetup 2) deploy candlepin 3) load up a bunch of subscriptions to allow the refresh pools job to take a bit of time to run, allowing you to investigate the db to verify things are running properly #!/bin/sh for i in `seq 1 1000`; do curl -k --user admin:admin --request POST --data '{"product":{"id":"awesomeos-server-basic"},"startDate":"Tue, 13 Sep 2016 01:00:00 -0400","accountNumber":123456,"quantity":20,"endDate":"Wed, 13 Sep 2017 01:00:00 -0400","contractNumber":123,"providedProducts":[{"id":"37060"}]}' --header 'accept: application/json' --header 'content-type: application/json' https://localhost:8443/candlepin/owners/admin/subscriptions 1>/dev/null 2>/dev/null; done; 4) open up psql client: select id,state,starttime,targetid from cp_job where id like 'refresh%'; 5) create a bunch of refresh pools jobs requests (5 is sufficient): curl -k -u admin:admin --request PUT https://localhost:8443/candlepin/owners/admin/subscriptions curl -k -u admin:admin --request PUT https://localhost:8443/candlepin/owners/admin/subscriptions curl -k -u admin:admin --request PUT https://localhost:8443/candlepin/owners/admin/subscriptions curl -k -u admin:admin --request PUT https://localhost:8443/candlepin/owners/admin/subscriptions curl -k -u admin:admin --request PUT https://localhost:8443/candlepin/owners/admin/subscriptions 6) re-run the sql statement from step 3. Notice that only one job is in state 2 (RUNNING), the rest are in 0 or 1 (CREATED,PENDING). 7) reload query and monitor the jobs as they go from 0 -> 3, one at at time. multiple candlepin server test ------------------------------- 1) ensure you have candlepin configured for quartz clustering: https://fedorahosted.org/candlepin/wiki/QuartzSetup 2) configure both candlepins to talk to the *SAME* database. jpa.config.hibernate.connection.url=jdbc:postgresql://192.168.1.35/candlepin org.quartz.dataSource.myDS.URL = jdbc:postgresql://192.168.1.35/candlepin Do this on BOTH candlepin instances. 3) deploy candlepin on at least 2 machines 4) load up a bunch of subscriptions to allow the refresh pools job to take a bit of time to run, allowing you to investigate the db to verify things are running properly #!/bin/sh for i in `seq 1 1000`; do curl -k --user admin:admin --request POST --data '{"product":{"id":"awesomeos-server-basic"},"startDate":"Tue, 13 Sep 2016 01:00:00 -0400","accountNumber":123456,"quantity":20,"endDate":"Wed, 13 Sep 2017 01:00:00 -0400","contractNumber":123,"providedProducts":[{"id":"37060"}]}' --header 'accept: application/json' --header 'content-type: application/json' https://localhost:8443/candlepin/owners/admin/subscriptions 1>/dev/null 2>/dev/null; done; 5) open up psql client: select id,state,starttime,targetid from cp_job where id like 'refresh%'; 6) create a bunch of refresh pools jobs requests (5 is sufficient): curl -k -u admin:admin --request PUT https://localhost:8443/candlepin/owners/admin/subscriptions curl -k -u admin:admin --request PUT https://localhost:8443/candlepin/owners/admin/subscriptions curl -k -u admin:admin --request PUT https://localhost:8443/candlepin/owners/admin/subscriptions curl -k -u admin:admin --request PUT https://localhost:8443/candlepin/owners/admin/subscriptions curl -k -u admin:admin --request PUT https://localhost:8443/candlepin/owners/admin/subscriptions 7) re-run the sql statement from step 3. Notice that only one job is in state 2 (RUNNING), the rest are in 0 or 1 (CREATED,PENDING). 8) reload query and monitor the jobs as they go from 0 -> 3, one at at time. multiple owners ----------------- Repeat the setup for loading a bunch of subscriptions for another owner say, snowwhite. Then run multiple refresh jobs some for admin and others against snowwhite. Verify that only one job from each owner is running. |