Geo: issue boards can't pre-populate on secondary node

Summary

I was trying to access issue boards on a secondary node, and got 500 error (see logs below)

Steps to reproduce

Create a new project access it from secondary node, click on the issues board link

What is the current bug behavior?

Trying to access the issues board for the first time on secondary node, give us 500

What is the expected correct behavior?

We should not try to create records when visiting the issues board from the secondary node.

Correct behavior here would be to just render an empty state view

Relevant logs and/or screenshots

ActiveRecord::StatementInvalid (PG::ReadOnlySqlTransaction: ERROR:  cannot execute INSERT in a read-only transaction
: INSERT INTO "boards" ("project_id", "created_at", "updated_at") VALUES (8, '2018-06-08 15:42:27.993698', '2018-06-08 15:42:27.993698') RETURNING "id"):
  config/initializers/active_record_locking.rb:15:in `_create_record'
  app/services/boards/create_service.rb:19:in `create_board!'
  app/services/boards/create_service.rb:6:in `execute'
  app/services/boards/list_service.rb:17:in `create_board!'
  app/services/boards/list_service.rb:6:in `execute'
  ee/app/services/ee/boards/list_service.rb:9:in `execute'
  app/controllers/projects/boards_controller.rb:24:in `boards'
  lib/gitlab/i18n.rb:50:in `with_locale'
  lib/gitlab/i18n.rb:56:in `with_user_locale'
  app/controllers/application_controller.rb:368:in `set_locale'
  lib/gitlab/middleware/multipart.rb:95:in `call'
  lib/gitlab/request_profiler/middleware.rb:14:in `call'
  ee/lib/gitlab/jira/middleware.rb:15:in `call'
  lib/gitlab/middleware/go.rb:17:in `call'
  lib/gitlab/etag_caching/middleware.rb:11:in `call'
  lib/gitlab/middleware/read_only/controller.rb:28:in `call'
  lib/gitlab/middleware/read_only.rb:16:in `call'
  lib/gitlab/request_context.rb:18:in `call'
  lib/gitlab/metrics/requests_rack_middleware.rb:27:in `call'
  lib/gitlab/middleware/release_env.rb:10:in `call'

Possible fixes

Render an empty state view + have database records creation fenced around Gitlab::Database.read_only?

Assignee Loading
Time tracking Loading