pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Achilleus Mantzios <achill@matrix.gatewaynet.com>
To: ssinger@navtechinc.com
Cc: pgsql-admin@postgresql.org, <pgsql-general@postgresql.org>
Subject: Conditional row grained replication with DBMirror
Date: Fri, 8 Aug 2003 09:53:51 -0200 (GMT+2)
Message-ID: <Pine.LNX.4.44.0308080942420.11089-100000@matrix.gatewaynet.com> (raw)



I made a modification on  DBMirror.pl,
an addition in the slavedatabase.conf file,
and added another replication table "specialtables".

The goal was to have a way of controlling 
when a row of table (if the table is present in specialtables),
will be mirrored to the remote slave.

Lets assume, we have a bank's central IT DEPT master DB
and some branches abroad.

Rows in some tables (e.g. personel, branches, statistics on transactions, 
etc...)
have no reason to be replicated to all sites, but only
those sites that these rows refer to:

E.G.
we have
test=# \d personel
            Table "public.personel"
    Column     |          Type          | Modifiers
---------------+------------------------+-----------
 id       | integer | not null
 name | character varying(20)  |
 branchid | integer  | 
test=#

or 
test=# \d branch
            Table "public.personel"
    Column     |          Type          | Modifiers
---------------+------------------------+-----------
 id       | integer | not null
 country | character varying(20)  |
 address | text  |
test=#

And we require that insert, updates on table branch with id = 1
go only to remote site (the ip of) branch  1,
and that inserts,updates on personel with branchid = 2,
in the same fashion, go only to (the ip of) branch 2.

I retain the table specialtables
test=# \d specialtables
            Table "public.specialtables"
    Column     |          Type          | Modifiers
---------------+------------------------+-----------
 tblname       | character varying(100) | not null
 siteidkeyname | character varying(20)  |
Indexes: specialtables_pkey primary key btree (tblname)
 
test=#

in which for each conditional table, the corresponding 
column name (the value of siteidkeyname) is given
which indicates against which column in the PendingData.Data
column is to be examined for equality against the site id.

The site id for each slave is defined in an additional field
in slaveInfo struct in slavedatabase.conf.

Please tell me if i should send the patches
to DBMirror.pl, MirrorSetup.sql, and slavedatabase.conf.

-- 
==================================================================
Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
Nikis 4, Glyfada
Athens 16610
Greece
tel:    +30-210-8981112
fax:    +30-210-8981877
email:  achill at matrix dot gatewaynet dot com
        mantzios at softlab dot ece dot ntua dot gr





view thread (4+ messages)  latest in thread

Message-ID: <Pine.LNX.4.44.0308080942420.11089-100000@matrix.gatewaynet.com>
Permalink:  ../Pine.LNX.4.44.0308080942420.11089-100000@matrix.gatewaynet.com/
Also on:    postgresql.org/message-id/Pine.LNX.4.44.0308080942420.11089-100000@matrix.gatewaynet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: achill@matrix.gatewaynet.com, ssinger@navtechinc.com, pgsql-general@postgresql.org
  Subject: Re: Conditional row grained replication with DBMirror
  In-Reply-To: <Pine.LNX.4.44.0308080942420.11089-100000@matrix.gatewaynet.com>
  References: <Pine.LNX.4.44.0308080942420.11089-100000@matrix.gatewaynet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox