Geo: Error updating status after resetting the secondary's main DB (the replica)
Encountered while Geo was being set up at Drupal https://gitlab.slack.com/archives/C8XUSB5L3/p1545428256060200:
ActiveRecord::StatementInvalid (PG::NotNullViolation: ERROR: null value in column "id" violates not-null constraint
DETAIL: Failing row contains (null, <snip>
: UPDATE "geo_node_statuses" SET "id" = NULL, <snip>
It seemed the secondary DB hadn't replicated the existing geo_node_statuses
record yet, after the secondary DB was reset.
-
The secondary Geo::MetricsUpdateService
orGeo::NodeStatusPostService
should not send over{ id: nil, ... }
: https://gitlab.com/gitlab-org/gitlab-ee/blob/885fb839/ee/app/services/geo/metrics_update_service.rb#L30 -
The primary endpoint POST /api/geo/status
should do some basic whitelisting of params: https://gitlab.com/gitlab-org/gitlab-ee/blob/782c97e0/ee/lib/api/geo.rb#L41
cc @stanhu
Edited by Stan Hu