Bug #26260
db:seed on Foreman 1.21 takes too long if you have a lot of discovered hosts
Description
Hi,
I have a Foreman instance with about 17k hosts and 18k discovered hosts and db:seed is taking a lot of time to assign the resources to the new default organization that 1.21 creates:
[root@devforeman ~]# grep organization_id /var/log/foreman/production.log | head -1
2019-03-06T16:23:56 [I|aud|] Host::Base (293112) update event on organization_id , 117
[root@devforeman ~]# grep organization_id /var/log/foreman/production.log | tail -1
2019-03-06T19:08:31 [I|aud|] Host::Base (194789) update event on organization_id , 117
[root@devforeman ~]# grep -c update /var/log/foreman/production.log
2942
Every update is taking about 3-4 seconds:
2019-03-06T19:04:22 [I|aud|] Host::Base (195408) update event on organization_id , 117
2019-03-06T19:04:27 [I|aud|] Host::Base (195407) update event on organization_id , 117
2019-03-06T19:04:31 [I|aud|] Host::Base (195406) update event on organization_id , 117
2019-03-06T19:04:35 [I|aud|] Host::Base (195405) update event on organization_id , 117
2019-03-06T19:04:39 [I|aud|] Host::Base (195404) update event on organization_id , 117
Shouldn't this be faster?
Thank you.
Associated revisions
History
#1
Updated by Evgeni Golov about 4 years ago
- Category set to Database
- Found in Releases 1.21.0 added
#2
Updated by The Foreman Bot about 4 years ago
- Assignee set to Tomer Brisker
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/6546 added
#3
Updated by Tomer Brisker about 4 years ago
- Target version set to 1.21.1
#4
Updated by Marek Hulán about 4 years ago
- Fixed in Releases 1.22.0 added
#5
Updated by Tomer Brisker about 4 years ago
- Fixed in Releases 1.21.1 added
#6
Updated by Tomer Brisker about 4 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset d1e191e10fba5b97856bde29cf10721464eddf1d.
#7
Updated by Tomer Brisker about 4 years ago
- Subject changed from db:seed on Foreman 1.21 takes too long if you have a lot of hosts to db:seed on Foreman 1.21 takes too long if you have a lot of discovered hosts
Fixes #26260 - Mass assign discovered hosts to seeded taxonomies (#6546)
Otherwise, assignment triggers callbacks and audits for each discobered
host, leading to very long seed time when upgrading with many discovered
hosts and taxonomies disabled.
Also, don't audit template assignments.