# Selective project replication adds a wrinkle to FDW queries, so
# we fallback to the legacy version for now.
relation=
ifGitlab::Geo.fdw?&&!selective_sync
fdw_find_projects_updated_recently
else
legacy_find_projects_updated_recently
end
relation.limit(batch_size)
end
protected
protected
defselective_sync
defselective_sync
...
@@ -32,7 +45,16 @@ module Geo
...
@@ -32,7 +45,16 @@ module Geo
deffdw_find_unsynced_projects
deffdw_find_unsynced_projects
fdw_table=Geo::Fdw::Project.table_name
fdw_table=Geo::Fdw::Project.table_name
Geo::Fdw::Project.joins("LEFT OUTER JOIN project_registry ON project_registry.project_id = #{fdw_table}.id").where('project_registry.project_id IS NULL')
Geo::Fdw::Project.joins("LEFT OUTER JOIN project_registry ON project_registry.project_id = #{fdw_table}.id")
.where('project_registry.project_id IS NULL')
end
deffdw_find_projects_updated_recently
fdw_table=Geo::Fdw::Project.table_name
Geo::Fdw::Project.joins("INNER JOIN project_registry ON project_registry.project_id = #{fdw_table}.id")