diff options
author | Stan Hu <stanhu@gmail.com> | 2019-06-25 18:33:18 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-06-25 18:35:29 +0300 |
commit | d092ed178fe490769f60df2e1ce8a667b812fc79 (patch) | |
tree | ef25e2bbf9d610fee90212e428e277622c4ad407 /app/models/postgresql | |
parent | 30131a3aca2a26daafa22ed66fa97d720a504309 (diff) |
Fix background migrations failing with unused replication slot
When there is an unused replication slot, the replication lag function
will return a nil value, resulting in "NoMethodError: undefined method
`>=' for nil:NilClass" error. We now just ignore these nil values.
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/63666
Diffstat (limited to 'app/models/postgresql')
-rw-r--r-- | app/models/postgresql/replication_slot.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/postgresql/replication_slot.rb b/app/models/postgresql/replication_slot.rb index 74ccf23cf69..7a123deb719 100644 --- a/app/models/postgresql/replication_slot.rb +++ b/app/models/postgresql/replication_slot.rb @@ -28,7 +28,7 @@ module Postgresql # We force the use of a transaction here so the query always goes to the # primary, even when using the EE DB load balancer. sizes = transaction { pluck(lag_function) } - too_great = sizes.count { |size| size >= max } + too_great = sizes.compact.count { |size| size >= max } # If too many replicas are falling behind too much, the availability of a # GitLab instance might suffer. To prevent this from happening we require |