~ubuntu-branches/ubuntu/maverick/slony1/maverick

« back to all changes in this revision

Viewing changes to tools/test_slony_replication.pl

  • Committer: Bazaar Package Importer
  • Author(s): Peter Eisentraut
  • Date: 2010-04-17 23:06:42 UTC
  • mfrom: (1.1.12 upstream) (2.1.11 sid)
  • Revision ID: james.westby@ubuntu.com-20100417230642-fhld39orcligbnm4
Tags: 1.2.21-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!perl   # -*- perl -*-
2
 
# $Id: test_slony_replication.pl,v 1.3.4.1 2009-08-17 17:39:58 devrim Exp $
 
2
# $Id: test_slony_replication.pl,v 1.3.4.2 2010-02-10 22:50:11 cbbrowne Exp $
3
3
# Christopher Browne
4
4
# Copyright 2004-2009
5
5
# Afilias Canada
47
47
my $dbh = Pg::connectdb($initialDSN);
48
48
 
49
49
# Query to find the "master" node
50
 
my $masterquery = "
 
50
my $masterquery = qq{
51
51
  select sub_provider 
52
52
   from "_$cluster".sl_subscribe s1 
53
53
   where not exists (select * from "_$cluster".sl_subscribe s2 
56
56
                                           s1.sub_active = 't' and s2.sub_active = 't')
57
57
   and s1.sub_set = $set
58
58
   group by sub_provider;
59
 
";
 
59
};
60
60
 
61
61
my $tq = $dbh->exec($masterquery);
62
62
 
70
70
print "Rummage for DSNs\n";
71
71
# Query to find live DSNs
72
72
my $dsnsquery =
73
 
"
 
73
qq{
74
74
   select p.pa_server, p.pa_conninfo
75
75
   from "_$cluster".sl_path p
76
76
   where exists (select * from "_$cluster".sl_subscribe s where 
78
78
                          (s.sub_provider = p.pa_server or s.sub_receiver = p.pa_server) and
79
79
                          sub_active = 't')
80
80
   group by pa_server, pa_conninfo;
81
 
";
 
81
};
82
82
 
83
83
print "Query:\n$dsnsquery\n";
84
84
$tq = $dbh->exec($dsnsquery);