We see in #27387 that a call to `polymorphic_path` will cause duplicate
SELECT route calls for each merge request in a milestone. This happens
because calling `project.namespace.becomes(Namespace)` will instantiate
a new instance of a Namespace for each merge request, which causes a N+1
query on the routes table. This change caches the state of the route by
the specific class and ID, which dramatically eliminates duplicate work.
Starting with GitLab 9.1.0 we will no longer allow downtime migrations
unless absolutely necessary. This commit updates the various developer
guides and adds code that is necessary to make zero downtime migrations
less painful.
* upstream/master: (197 commits)
Add text to break up diagrams
Implement review comments from @DouweM for !10467.
Fix rubocop offence
Linking to edit file directly
Optimise trace handling code to use streaming instead of full read
Use config.toml to configure Gitaly
Fix indexes in container repositories table
Recent search history for issues
Fix rubocop
Use change direction in spec
Use be_pending
Improve trigger_schedule.rb
Implement a offset calculation on cron_parser_spec
Clean up trigger_schedule_worker_spec.rb
Improve instantiate recursion in cron_parser.rb
Fix unnecessary changes in schema.rb
Add empty line in cron_parser.rb
Use parenthesis for respond_to :ref
Define next_time as let in trigger_schedule_spec
Remove next_run_at: nil from trigger_schedule_spec
...
- Have `Uniquify` take a block instead of a Proc/function. This is more
idiomatic than passing around a function in Ruby.
- Block a user before moving their issues to the ghost user. This avoids a data
race where an issue is created after the issues are migrated to the ghost user,
and before the destroy takes place.
- No need to migrate issues (to the ghost user) in a transaction, because
we're using `update_all`
- Other minor changes
1. Refactoring and specs in the `Uniquify` class.
2. Don't use the `AdvisoryLocking` class. Similar functionality is
provided (backed by Redis) in the `ExclusiveLease` class.