As an administrator, I want to use a single fieldConfigurationScheme for new projects. However, when we have a large number of projects using a single fieldConfigurationScheme, it takes a very long time to associate a new project with the fieldCongurationScheme.
fieldConfigSchemeManager.updateFieldConfigScheme(...) takes as a parameter a list of associated projects (i.e. all of them), and updates the database for each project one-by-one (com.atlassian.jira.issue.context.persistence.FieldConfigContextPersisterWorker.store(....) ) also flushing the fieldConfigScheme cache each time.
Large Jira Instance, >2000 projects, using a specific fieldConfigurationScheme
- create >2000 projects
- create a fieldConfigurationScheme
- associate all projects with the fieldConfigurationScheme
- create a new project
- set DEBUG for the com.atlassian.cache.event package
- associate new project with fieldConfigurationScheme and see in the logs that com.atlassian.jira.issue.context.persistence.FieldConfigContextPersisterWorker.configContextsBySchemeId cache is flushed 2000 times
Persistence is handled efficiently, i.e. only add the association for the new project instead of updating all associations, hence causing a single cache flush.
*com.atlassian.jira.issue.context.persistence.FieldConfigContextPersisterWorker.store(....) * is called once for each project that's already associated with the same fieldConfigurationScheme.