Geo: GeoNodeStatus should not serialize or allow `id` parameter
A customer was setting up Geo and noticing 500 errors on the api/v4/geo/status endpoint (https://gitlab.slack.com/archives/C8XUSB5L3/p1545427519051400):
ActiveRecord::StatementInvalid (PG::NotNullViolation: ERROR: null value in column "id" violates not-null constraint
DETAIL: Failing row contains (null, 8, 0, 5991, 400, 0, 0, 0, 0, 0, 0, 19423, 2018-12-21 19:20:15, 19423, 2018-12-21 19:20:15, null, null, 2018-12-21 21:32:08.346123, The Geo node does not appear to be replicating the database from..., null, null, null, 6172, 208, 0, 0, 0, 11.5.3-ee, 588b25b, 5798, 187, 5973, 0, 0, 0, 0, null, null, 187, null, null, 0, \x7505d64a54e061b7acd54ccd58b49dc43500b635, 187, 0, 8750).
: UPDATE "geo_node_statuses" SET "id" = NULL, "repositories_synced_count" = 5991, "repositories_failed_count" = 400, "created_at" = NULL, "updated_at" = NULL,
The api_json.log shows that id value was blank, probably because database replication wasn't running between the primary and the secondary (https://gitlab.slack.com/archives/C8XUSB5L3/p1545426978047400):
{"time":"2018-12-21T21:15:38.799Z","severity":"INFO","duration":50.6,"db":4.3,"view":46.300000000000004,"status":500,"method":"POST","path":"/api/v4/geo/status","params":[{"key":"id","value":""},{"key":"geo_node_id","value":"8"},{"key":"db_replication_lag_seconds","value":"0"},...
- How is
ideven being serialized? I don't see it in theGeoNodeStatusentities.rb. - We should discard the
idattribute completely on save. This might mean another Geo node can overwrite the status of another node.