mirror of
				https://github.com/postgres/postgres.git
				synced 2025-10-31 00:03:57 -04:00 
			
		
		
		
	Back out rserv changes that would allow limit of replicated tables ---
not ready yet.
This commit is contained in:
		
							parent
							
								
									111d8e522b
								
							
						
					
					
						commit
						ec67d2a3fe
					
				| @ -19,7 +19,7 @@ my %Stables = (); | |||||||
| 
 | 
 | ||||||
| sub PrepareSnapshot | sub PrepareSnapshot | ||||||
| { | { | ||||||
| 	my ($conn, $outf, $server, $onlytables) = @_; # (@_[0], @_[1], @_[2]); | 	my ($conn, $outf, $server) = @_; # (@_[0], @_[1], @_[2]); | ||||||
| 
 | 
 | ||||||
| 	my $result = $conn->exec("BEGIN"); | 	my $result = $conn->exec("BEGIN"); | ||||||
| 	if ($result->resultStatus ne PGRES_COMMAND_OK) | 	if ($result->resultStatus ne PGRES_COMMAND_OK) | ||||||
| @ -52,10 +52,6 @@ sub PrepareSnapshot | |||||||
| 	while (@row = $result->fetchrow) | 	while (@row = $result->fetchrow) | ||||||
| 	{ | 	{ | ||||||
| 	#	printf "$row[0], $row[1], $row[2]\n"; | 	#	printf "$row[0], $row[1], $row[2]\n"; | ||||||
| 		if (ref($onlytables) eq 'HASH') { |  | ||||||
| 			next unless (exists $onlytables->{$row[1]}); |  | ||||||
| 			$onlytables->{$row[1]} = $row[0] unless ($onlytables->{$row[1]}); |  | ||||||
| 		} |  | ||||||
| 		push @{$Mtables{$row[0]}}, $row[1], $row[2]; | 		push @{$Mtables{$row[0]}}, $row[1], $row[2]; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| @ -236,7 +232,7 @@ sub GetSYNCID | |||||||
| 
 | 
 | ||||||
| sub CleanLog | sub CleanLog | ||||||
| { | { | ||||||
| 	my ($conn, $howold, $onlytables) = @_; # (@_[0], @_[1]); | 	my ($conn, $howold) = @_; # (@_[0], @_[1]); | ||||||
| 
 | 
 | ||||||
| 	my $result = $conn->exec("BEGIN"); | 	my $result = $conn->exec("BEGIN"); | ||||||
| 	if ($result->resultStatus ne PGRES_COMMAND_OK) | 	if ($result->resultStatus ne PGRES_COMMAND_OK) | ||||||
| @ -278,11 +274,6 @@ sub CleanLog | |||||||
| 	my $alist = join(',', keys %active); | 	my $alist = join(',', keys %active); | ||||||
| 	my $sinfo = "logid < $maxid"; | 	my $sinfo = "logid < $maxid"; | ||||||
| 	$sinfo .= " and logid not in ($alist)" if $alist ne ''; | 	$sinfo .= " and logid not in ($alist)" if $alist ne ''; | ||||||
| 	#if (ref($onlytables) eq 'HASH') { |  | ||||||
| 	#	foreach my $onlytable (keys %{$onlytables}) { |  | ||||||
| 	#		$sinfo |  | ||||||
| 	#	} |  | ||||||
| 	#} |  | ||||||
| 	 | 	 | ||||||
| 	$sql = "delete from _RSERV_LOG_ where " .  | 	$sql = "delete from _RSERV_LOG_ where " .  | ||||||
| 		"logtime < now() - '$howold second'::interval and $sinfo"; | 		"logtime < now() - '$howold second'::interval and $sinfo"; | ||||||
| @ -311,7 +302,7 @@ sub CleanLog | |||||||
| 
 | 
 | ||||||
| sub ApplySnapshot | sub ApplySnapshot | ||||||
| { | { | ||||||
| 	my ($conn, $inpf, $onlytables) = @_; # (@_[0], @_[1]); | 	my ($conn, $inpf) = @_; # (@_[0], @_[1]); | ||||||
| 
 | 
 | ||||||
| 	my $result = $conn->exec("BEGIN"); | 	my $result = $conn->exec("BEGIN"); | ||||||
| 	if ($result->resultStatus ne PGRES_COMMAND_OK) | 	if ($result->resultStatus ne PGRES_COMMAND_OK) | ||||||
| @ -345,10 +336,6 @@ sub ApplySnapshot | |||||||
| 	while (@row = $result->fetchrow) | 	while (@row = $result->fetchrow) | ||||||
| 	{ | 	{ | ||||||
| 	#	printf "	%s	%s\n", $row[1], $row[0]; | 	#	printf "	%s	%s\n", $row[1], $row[0]; | ||||||
| 		if (ref($onlytables) eq 'HASH') { |  | ||||||
| 			next unless (exists $onlytables->{$row[1]}); |  | ||||||
| 			$onlytables->{$row[1]} = $row[0] unless ($onlytables->{$row[1]}); |  | ||||||
| 		} |  | ||||||
| 		push @{$Stables{$row[1]}}, $row[0], $row[2], $row[3]; | 		push @{$Stables{$row[1]}}, $row[0], $row[2], $row[3]; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -32,7 +32,6 @@ if (defined($opt_help) || (scalar(@ARGV) < 2)) { | |||||||
| 
 | 
 | ||||||
| my $master = $ARGV[0] || "master"; | my $master = $ARGV[0] || "master"; | ||||||
| my $slave = $ARGV[1] || "slave"; | my $slave = $ARGV[1] || "slave"; | ||||||
| my $tables = $#ARGV < 2 ? undef : { map {($_, undef)} @ARGV[2..$#ARGV] }; |  | ||||||
| my $server = 0; | my $server = 0; | ||||||
| 
 | 
 | ||||||
| my $minfo = "dbname=$master"; | my $minfo = "dbname=$master"; | ||||||
| @ -57,7 +56,7 @@ SyncSync($mconn, $sconn); | |||||||
| my $outf = new IO::File; | my $outf = new IO::File; | ||||||
| open $outf, ">$snapshot"; | open $outf, ">$snapshot"; | ||||||
| print "\n>>>>>>>>>>>>> Prepare Snapshot\n\n" if ($verbose); | print "\n>>>>>>>>>>>>> Prepare Snapshot\n\n" if ($verbose); | ||||||
| $res = PrepareSnapshot($mconn, $outf, $server, $tables); | $res = PrepareSnapshot($mconn, $outf, $server); | ||||||
| close $outf; | close $outf; | ||||||
| die "\n>>>>>>>>>>>>> ERROR\n" if $res < 0; | die "\n>>>>>>>>>>>>> ERROR\n" if $res < 0; | ||||||
| if ($res == 0) | if ($res == 0) | ||||||
| @ -69,7 +68,7 @@ if ($res == 0) | |||||||
| my $inpf = new IO::File; | my $inpf = new IO::File; | ||||||
| open $inpf, "<$snapshot"; | open $inpf, "<$snapshot"; | ||||||
| print "\n>>>>>>>>>>>>> Apply Snapshot\n\n" if ($verbose); | print "\n>>>>>>>>>>>>> Apply Snapshot\n\n" if ($verbose); | ||||||
| $res = ApplySnapshot($sconn, $inpf, $tables); | $res = ApplySnapshot($sconn, $inpf); | ||||||
| close $inpf; | close $inpf; | ||||||
| die "\n>>>>>>>>>>>>> ERROR\n" if $res < 0; | die "\n>>>>>>>>>>>>> ERROR\n" if $res < 0; | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user