1+
12=pod
23
34=head1 NAME
@@ -106,18 +107,15 @@ of finding port numbers, registering instances for cleanup, etc.
106107
107108sub new
108109{
109- my $class =shift ;
110- my $name =shift ;
111- my $pghost =shift ;
112- my $pgport =shift ;
110+ my ($class ,$name ,$pghost ,$pgport ) =@_ ;
113111my $testname = basename($0 );
114112$testname =~s /\. [^.]+$// ;
115- my $self = {
116- _port => $pgport ,
117- _host => $pghost ,
118- _basedir => TestLib::tempdir(" data_" .$name ),
119- _name => $name ,
120- _logfile => " $TestLib::log_path /${testname} _${name} .log" };
113+ my $self = {
114+ _port => $pgport ,
115+ _host => $pghost ,
116+ _basedir => TestLib::tempdir(" data_" .$name ),
117+ _name => $name ,
118+ _logfile => " $TestLib::log_path /${testname} _${name} .log" };
121119
122120bless $self ,$class ;
123121$self -> dump_info;
@@ -367,7 +365,7 @@ sub init
367365$params {hba_permit_replication } = 1
368366unless defined $params {hba_permit_replication };
369367$params {allows_streaming } = 0unless defined $params {allows_streaming };
370- $params {has_archiving } = 0unless defined $params {has_archiving };
368+ $params {has_archiving } = 0unless defined $params {has_archiving };
371369
372370mkdir $self -> backup_dir;
373371mkdir $self -> archive_dir;
@@ -405,7 +403,7 @@ sub init
405403close $conf ;
406404
407405$self -> set_replication_confif $params {hba_permit_replication };
408- $self -> enable_archivingif $params {has_archiving };
406+ $self -> enable_archivingif $params {has_archiving };
409407}
410408
411409=pod
@@ -492,7 +490,7 @@ sub init_from_backup
492490
493491$params {has_streaming } = 0unless defined $params {has_streaming };
494492$params {hba_permit_replication } = 1
495- unless defined $params {hba_permit_replication };
493+ unless defined $params {hba_permit_replication };
496494$params {has_restoring } = 0unless defined $params {has_restoring };
497495
498496print
@@ -514,7 +512,7 @@ sub init_from_backup
514512qq(
515513port =$port
516514) );
517- $self -> set_replication_confif $params {hba_permit_replication };
515+ $self -> set_replication_confif $params {hba_permit_replication };
518516$self -> enable_streaming($root_node )if $params {has_streaming };
519517$self -> enable_restoring($root_node )if $params {has_restoring };
520518}
@@ -607,19 +605,19 @@ sub promote
607605my $logfile =$self -> logfile;
608606my $name =$self -> name;
609607print " ### Promoting node\" $name \"\n " ;
610- TestLib::system_log(' pg_ctl' ,' -D' ,$pgdata ,' -l' ,$logfile ,
611- ' promote' );
608+ TestLib::system_log(' pg_ctl' ,' -D' ,$pgdata ,' -l' ,$logfile ,' promote' );
612609}
613610
614611# Internal routine to enable streaming replication on a standby node.
615612sub enable_streaming
616613{
617- my ($self ,$root_node ) =@_ ;
614+ my ($self ,$root_node ) =@_ ;
618615my $root_connstr =$root_node -> connstr;
619- my $name =$self -> name;
616+ my $name =$self -> name;
620617
621618print " ### Enabling streaming replication for node\" $name \"\n " ;
622- $self -> append_conf(' recovery.conf' ,qq(
619+ $self -> append_conf(
620+ ' recovery.conf' ,qq(
623621primary_conninfo='$root_connstr application_name=$name '
624622standby_mode=on
625623) );
@@ -628,7 +626,7 @@ standby_mode=on
628626# Internal routine to enable archive recovery command on a standby node
629627sub enable_restoring
630628{
631- my ($self ,$root_node ) =@_ ;
629+ my ($self ,$root_node ) =@_ ;
632630my $path =$root_node -> archive_dir;
633631my $name =$self -> name;
634632
@@ -641,11 +639,13 @@ sub enable_restoring
641639# first. Paths also need to be double-quoted to prevent failures where
642640# the path contains spaces.
643641$path =~s {\\ } { \\\\ } g if ($TestLib::windows_os );
644- my $copy_command =$TestLib::windows_os ?
645- qq{ copy "$path \\\\ %f " "%p "} :
646- qq{ cp$path /%f %p } ;
642+ my $copy_command =
643+ $TestLib::windows_os
644+ ?qq{ copy "$path \\\\ %f " "%p "}
645+ :qq{ cp$path /%f %p } ;
647646
648- $self -> append_conf(' recovery.conf' ,qq(
647+ $self -> append_conf(
648+ ' recovery.conf' ,qq(
649649restore_command = '$copy_command '
650650standby_mode = on
651651) );
@@ -667,12 +667,14 @@ sub enable_archiving
667667# first. Paths also need to be double-quoted to prevent failures where
668668# the path contains spaces.
669669$path =~s {\\ } { \\\\ } g if ($TestLib::windows_os );
670- my $copy_command =$TestLib::windows_os ?
671- qq{ copy "%p " "$path \\\\ %f "} :
672- qq{ cp%p $path /%f } ;
670+ my $copy_command =
671+ $TestLib::windows_os
672+ ?qq{ copy "%p " "$path \\\\ %f "}
673+ :qq{ cp%p $path /%f } ;
673674
674675# Enable archive_mode and archive_command on node
675- $self -> append_conf(' postgresql.conf' ,qq(
676+ $self -> append_conf(
677+ ' postgresql.conf' ,qq(
676678archive_mode = on
677679archive_command = '$copy_command '
678680) );