Commit 68411dfd authored by Nick Thomas's avatar Nick Thomas

Partially revert "Optimise the external diff storage migration query"

This solved one problem, but introduced another. Revert the functional
change while keeping the rearrangement of code to make future changes
easier.
parent 5a27361c
...@@ -115,15 +115,7 @@ class MergeRequestDiff < ApplicationRecord ...@@ -115,15 +115,7 @@ class MergeRequestDiff < ApplicationRecord
end end
def ids_for_external_storage_migration_strategy_always(limit:) def ids_for_external_storage_migration_strategy_always(limit:)
ids = [] has_diff_files.files_in_database.limit(limit).pluck(:id)
files_in_database.each_batch(column: :merge_request_id, order_hint: :id) do |scope|
ids.concat(scope.has_diff_files.pluck(:id))
break if ids.count >= limit
end
ids.first(limit)
end end
def ids_for_external_storage_migration_strategy_outdated(limit:) def ids_for_external_storage_migration_strategy_outdated(limit:)
......
---
title: Optimise the external diff storage migration query
merge_request: 38579
author:
type: performance
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment