replicator/lib/ruby/pg-wal-plugin.rb
def wait_until_login_works
    sleep_time = 0
    sleep_timeout = @master_max_startup_time
    while true
      psql_out = `echo "select 'UP'" |psql -p#{@config.getProperty("postgresql.port")} 2>&1`
      if psql_out =~ /UP/
        puts "Master is up and responding"
        break;
      else # TENT-161, can't depend on localized messages: psql_out =~ /the database system is starting up/
        puts psql_out
        if sleep_time <= sleep_timeout
          sleep_time += 5
          puts "Master database might still be starting up; sleeping #{sleep_time} of #{sleep_timeout} seconds..."
          sleep 5
        else
          raise SystemError, "Master database did not come up within #{sleep_timeout} secons"
        end
      end
    end    
  end
# Tries login to PostgreSQL until success or @master_max_startup_time reached.
Tries login to PostgreSQL until success or @master_max_startup_time reached.
Tries login to PostgreSQL until success or @master_max_startup_time reached .
def wait_until_login_works
    sleep_time = 0
    sleep_timeout = @master_max_startup_time
    while true
      psql_out = `echo "select 'UP'" |psql -p#{@config.getProperty("postgresql.port")} 2>&1`
      if psql_out =~ /UP/
        puts "Master is up and responding"
        break;
      else 
        puts psql_out
        if sleep_time <= sleep_timeout
          sleep_time += 5
          puts "Master database might still be starting up; sleeping #{sleep_time} of #{sleep_timeout} seconds..."
          sleep 5
        else
          raise SystemError, "Master database did not come up within #{sleep_timeout} secons"
        end
      end
    end    
  end
def wait_until_login_works sleep_time = 0 sleep_timeout = @master_max_startup_time while true psql_out = ` echo "select 'UP'" |psql -p #{ @config . getProperty ( "postgresql.port" ) }  2>&1 ` if psql_out =~ / UP / puts "Master is up and responding" break ; else puts psql_out if sleep_time <= sleep_timeout sleep_time += 5 puts "Master database might still be starting up; sleeping #{sleep_time} of #{sleep_timeout} seconds..." sleep 5 else raise SystemError , "Master database did not come up within #{sleep_timeout} secons" end end end end
Tries login to PostgreSQL until success or @master_max_startup_time reached.
Tries login to PostgreSQL until success or @master_max_startup_time reached .
# TENT-161, can't depend on localized messages: psql_out =~ /the database system is starting up/