WIP partial replication patch

From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Cc: Hans-Juergen Schoenig <hs(at)cybertec(dot)at>
Subject: WIP partial replication patch
Date: 2010-08-13 18:31:17
Message-ID: 4C658F75.4080406@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

attached is a WIP patch that will eventually implement
partial replication, with the following syntax:

CREATE REPLICA CLASS classname
[ EXCLUDING RELATION ( relname [ , ... ] ) ]
[ EXCLUDING DATABASE ( dbname [ , ... ] ) ]

ALTER REPLICA CLASS classname
[ { INCLUDING | EXCLUDING } RELATION ( relname [ , ... ] ) ]
[ { INCLUDING | EXCLUDING } DATABASE ( dbname [ , ... ] ) ]

The use case is to have a secondary server where read-only access
is allowed but (maybe for space reasons) some tables and databases
are excluded from the replication. The standby server keeps those tables
at the state of the last full backup but no further modification is done
to them.

The current patch adds two new global system tables, pg_replica and
pg_replicaitem and three new indexes to maintain the classes and their
contents.

The startup process in standby mode connects to a new database called
"replication" which is created at initdb time. This is needed because
transaction context is needed for accessing the syscache for the new tables.

There is a little nasty detail with the patch as it stands. The RelFileNode
triplet is currently treated as if it carried the relation Oid, but it's
not actually
true, the RelFileNode contains the relfilenode ID. Initially, without table
rewriting DDL, the oid equals relfilenode, which was enough for a proof of
concept patch. I will need to extend the relmapper so it can carry more than
one "database-local" mapping info, so the filter can work in all database
at once. To be able to do this, all databases' pg_class should be read
initially
and re-read during relmapper cache invalidation. As a sidenode, this work
may serve as a basis for full cross-database relation access, too.

Best regards,
Zoltán Böszörményi

Attachment Content-Type Size
partial-rep-ctxdiff.patch text/x-patch 67.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-08-13 18:43:39 Re: review: xml_is_well_formed
Previous Message Tom Lane 2010-08-13 18:21:58 Re: patch: utf8_to_unicode (trivial)