WIP partial replication patch - Mailing list pgsql-hackers

From Boszormenyi Zoltan
Subject WIP partial replication patch
Date
Msg-id 4C658F75.4080406@cybertec.at
Whole thread Raw
Responses Re: WIP partial replication patch  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: patch: utf8_to_unicode (trivial)
Next
From: Tom Lane
Date:
Subject: Re: review: xml_is_well_formed