Geo::VerificationStateBackfillWorker generating large slow queries for merge_request_diff_details
## Summary After upgrading to 18.6.3, `Geo::VerificationStateBackfillWorker` is generating very large, slow queries (21MB entries) for `merge_request_diff_details` inserts. The bug was introduced in commit 46daeb484579 ("Allow selective sync by orgs for Merge Request Diff"), which is included in 18.6.0+. When `org_mover_extend_selective_sync_to_primary_checksumming` feature flag is disabled, the `MergeRequestDiff.verifiables` scope ignores the `primary_key_in` parameter: ```ruby scope :verifiables, ->(primary_key_in = nil) do ... if ::Gitlab::Geo.org_mover_extend_selective_sync_to_primary_checksumming? replicables.merge(selective_sync_scope(...)) else replicables # here end end ``` This causes the `pluck_verifiable_ids_in_range(range)` method to return all merge_request_diffs with external storage, rather than just those in the specified range. The bug has been fixed in 18.7.0 in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/210607/diffs#b74cb494ca3d0f98d2c398d5eac6e1313c91259e_35_35 and backported to 18.6 via https://gitlab.com/gitlab-org/gitlab/-/merge_requests/219691. We still need to add this to the upgrade notes. But we need to wait for the next patch release. ## Related RFH Issue https://gitlab.com/gitlab-com/request-for-help/-/work_items/4062
issue