ee/lib/gitlab/database/load_balancing/host.rb
# Returns the number of bytes this secondary is lagging behind the
# primary.
#
# This method will return nil if no lag size could be calculated.
Returns the number of bytes this secondary is lagging behind the
primary.

This method will return nil if no lag size could be calculated.
Returns the number of bytes this secondary is lagging behind the primary . This method will return nil if no lag size could be calculated .
def replication_lag_size
          location = connection.quote(primary_write_location)
          row = query_and_release(<<-SQL.squish)
            SELECT #{Gitlab::Database.pg_wal_lsn_diff}(#{location}, #{Gitlab::Database.pg_last_wal_replay_lsn}())::float
              AS diff
          SQL
          row['diff'].to_i if row.any?
        rescue *CONNECTION_ERRORS
          nil
        end
def replication_lag_size location = connection . quote ( primary_write_location ) row = query_and_release ( <<-SQL . squish ) 
            SELECT  #{ Gitlab :: Database . pg_wal_lsn_diff } ( #{ location } ,  #{ Gitlab :: Database . pg_last_wal_replay_lsn } ())::float
              AS diff
           SQL row [ 'diff' ] . to_i if row . any? rescue * CONNECTION_ERRORS nil end
Returns the number of bytes this secondary is lagging behind the
primary.
Returns the number of bytes this secondary is lagging behind the primary .