ee/lib/gitlab/database/load_balancing/host.rb
# Returns true if the replica has replicated enough data to be useful.
Returns true if the replica has replicated enough data to be useful.
Returns true if the replica has replicated enough data to be useful .
def data_is_recent_enough?
           To prevent this from happening we check if the lag size (in bytes)
           of the replica is small enough for the replica to be useful. We
           only do this if we haven't replicated in a while so we only need
           to connect to the primary when truly necessary.
          if (lag_size = replication_lag_size)
            lag_size <= LoadBalancing.max_replication_difference
          else
            false
          end
        end
def data_is_recent_enough? if ( lag_size = replication_lag_size ) lag_size <= LoadBalancing . max_replication_difference else false end end
Returns true if the replica has replicated enough data to be useful.
Returns true if the replica has replicated enough data to be useful .
# It's possible for a replica to not replay WAL data for a while, # despite being up to date. This can happen when a primary does not # receive any writes for a while. # # To prevent this from happening we check if the lag size (in bytes) # of the replica is small enough for the replica to be useful. We # only do this if we haven't replicated in a while so we only need # to connect to the primary when truly necessary.