Geo: Primary unable to update GeoNodeStatus on 11.11.0 RC1
After updating to 11.11.0-rc1-ee, the primary is unable to update its GeoNodeStatus.
mkozono@selective-sync-test-primary:~$ sudo gitlab-rails console
-------------------------------------------------------------------------------------
GitLab: 11.11.0-rc1-ee (fe49e763214)
GitLab Shell: 9.0.0
PostgreSQL: 9.6.11
Geo enabled: yes
Geo server: primary
-------------------------------------------------------------------------------------
Loading production environment (Rails 5.1.7)
irb(main):001:0> GeoNodeStatus.current_node_status
Traceback (most recent call last):
12: from (irb):1
11: from ee/app/models/geo_node_status.rb:100:in `current_node_status'
10: from ee/app/models/geo_node_status.rb:163:in `load_data_from_current_node'
9: from ee/app/finders/geo/lfs_object_registry_finder.rb:6:in `count_syncable'
8: from ee/app/finders/geo/lfs_object_registry_finder.rb:26:in `syncable'
7: from ee/app/finders/geo/registry_finder.rb:30:in `use_legacy_queries_for_selective_sync?'
6: from ee/app/finders/geo/registry_finder.rb:26:in `use_legacy_queries?'
5: from ee/lib/gitlab/geo/fdw.rb:23:in `disabled?'
4: from ee/lib/gitlab/geo/fdw.rb:15:in `enabled?'
3: from ee/lib/gitlab/geo/fdw.rb:64:in `fdw_capable?'
2: from ee/lib/gitlab/geo/fdw.rb:71:in `has_foreign_server?'
1: from ee/app/models/geo/tracking_base.rb:20:in `connection'
Geo::TrackingBase::SecondaryNotConfigured (Geo secondary database is not configured)
I was able to workaround that by manually patching ee/app/finders/geo/lfs_object_registry_finder.rb
with:
def syncable
if Gitlab::Geo.secondary? && use_legacy_queries_for_selective_sync?
legacy_finder.syncable
elsif Gitlab::Geo.secondary? && selective_sync?
fdw_geo_node.lfs_objects.syncable
else
LfsObject.syncable
end
end
And similar for attachment_registry_finder.rb
.
After that it worked:
mkozono@selective-sync-test-primary:~$ sudo gitlab-rails console
-------------------------------------------------------------------------------------
GitLab: 11.11.0-rc1-ee (fe49e763214)
GitLab Shell: 9.0.0
PostgreSQL: 9.6.11
Geo enabled: yes
Geo server: primary
-------------------------------------------------------------------------------------
Loading production environment (Rails 5.1.7)
irb(main):001:0>
irb(main):002:0> GeoNodeStatus.current_node_status
=> #<GeoNodeStatus id: 1, geo_node_id: 1, db_replication_lag_seconds: nil, repositories_synced_count: nil, repositories_failed_count: nil, lfs_objects_count: 4, lfs_objects_synced_count: nil, lfs_objects_failed_count: nil, attachments_count: 3, attachments_synced_count: nil, attachments_failed_count: nil,...
...