Skip to content

When last Geo::EventLog is not available, geo:status rake task fails

Ash McKenzie requested to merge ash.mckenzie/geo-rake-status-bugfix into master

What does this MR do?

Fixes a crash with the geo:status where there is no Geo::EventLog entry. Made formatting consistent for <number> (<message>) and also added a trailing newline to improve readability.

Are there points in the code the reviewer needs to double check?

N/A

Why was this MR needed?

Whilst debugging a broken local Geo setup, I discovered the bug and without this MR, the geo:status rake tasks fails to complete.

Screenshots (if relevant)

Current

https://ee-secondary1.local/
-----------------------------------------------------
                        GitLab version: 10.7.3-ee
                         Health Status: Healthy
                          Repositories: 1/1 (100%)
                           LFS objects: 0/0 (0%)
                           Attachments: 0/0 (0%)
                                 Wikis: 1/1 (100%)
                         Sync settings: Full
              Database replication lag: 0 seconds
       Last event ID seen from primary: rake aborted!
NoMethodError: undefined method `>' for nil:NilClass
/opt/gitlab/embedded/service/gitlab-rails/ee/lib/tasks/geo.rake:261:in `block (2 levels) in <top (required)>'
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'
Tasks: TOP => geo:status
(See full trace by running task with --trace)
$

New (with no Geo::EventLog entry)

https://ee-secondary1.local/
-----------------------------------------------------
                        GitLab version: 10.7.3-ee
                         Health Status: Healthy
                          Repositories: 2/2 (100%)
                           LFS objects: 0/0 (0%)
                           Attachments: 0/0 (0%)
                                 Wikis: 2/2 (100%)
                         Sync settings: Full
              Database replication lag: 0 seconds
       Last event ID seen from primary: N/A
Last status was pulled by primary node: 1 minute ago

$

New (with Geo::EventLog entry)

https://ee-secondary1.local/
-----------------------------------------------------
                        GitLab version: 10.7.3-ee
                         Health Status: Healthy
                          Repositories: 2/2 (100%)
                           LFS objects: 0/0 (0%)
                           Attachments: 0/0 (0%)
                                 Wikis: 2/2 (100%)
                         Sync settings: Full
              Database replication lag: 0 seconds
       Last event ID seen from primary: 5 (about 24 hours ago)
     Last event ID processed by cursor: 5 (about 24 hours ago)
Last status was pulled by primary node: 2 minutes ago

$

Does this MR meet the acceptance criteria?

  • Changelog entry added, if necessary
  • [ ] Documentation created/updated
  • [ ] API support added
  • [ ] Tests added for this feature/bug
  • Conform by the code review guidelines
    • [ ] Has been reviewed by a UX Designer
    • [ ] Has been reviewed by a Frontend maintainer
    • Has been reviewed by a Backend maintainer
    • Has been reviewed by a Database specialist
  • EE specific content should be in the top level /ee folder
  • Conform by the merge request performance guides
  • Conform by the style guides
  • If you have multiple commits, please combine them into a few logically organized commits by squashing them
  • [ ] Internationalization required/considered
  • [ ] If paid feature, have we considered GitLab.com plan and how it works for groups and is there a design for promoting it to users who aren't on the correct plan
  • [ ] End-to-end tests pass (package-qa manual pipeline job)

What are the relevant issue numbers?

N/A

Edited by Ash McKenzie

Merge request reports