Re: logical changeset generation v6.1

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Kevin Grittner <kgrittn(at)ymail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: logical changeset generation v6.1
Date: 2013-10-07 13:32:32
Message-ID: 20131007133232.GA15202@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2013-10-01 10:07:19 -0400, Robert Haas wrote:
> - It seems that HeapSatisfiesHOTandKeyUpdate is now
> HeapSatisfiesHOTandKeyandCandidateKeyUpdate. Considering I think this
> was merely HeapSatisfiesHOTUpdate a year ago, it's hard not to be
> afraid that something unscalable is happening to this function. On a
> related node, any overhead added here costs broadly; I'm not sure if
> there's enough to worry about.

I haven't changed anything here - ISTM so far nobody had a better
suggestion.

> - RelationIsDoingTimetravel is still a crappy name. How about
> RelationRequiredForLogicalDecoding? And maybe the reloption
> treat_as_catalog_table can become required_for_logical_decoding.

Hm. I don't really like the name, required seems to imply that it's
necessary to turn this on to get data replicated in that relation. How
about "accessible_during_logical_decoding" or "user_catalog_table"? The
latter would allow us to use it to add checks for user relations used in
indexes which need a treatment similar to enums.

> All in all, it seems to me that we shouldn't try to punt. Maybe we
> should have something that works like ALTER TABLE name CLUSTER ON
> index_name to configure which index should be used for logical
> replication. Possibly this same syntax could be used as ALTER
> MATERIALIZED VIEW to set the candidate key for that case.

How about using the current logic by default but allow to tune it
additionally with an option like that?

So, attached is the new version:
Changes:
* Fix issues you noticed except the above
* Handle multixacts on system tables
* Logical slots now are checksummed and contain a version and length
* Improve logic for increasing the "restart lsn", the point where we
start to read WAL to decode from next time round
* Wait for xids in snapbuild, during the initial build
* s/RelationIsDoingTimetravel/RelationRequiredForLogicalDecoding/
* test_logical_decoding: confirm reception of changes at the end
* prohibit rewriting schema changes for treat_as_catalog_table relations
* add tests for dropping/adding primary/candidate keys
* PROCESS_INTERRUPTS whene reading wal for SQL SRF
* cleanup old serialized snapshots at check/restart points
* Add more isolationtester changes

Todo:
* rename treat_as_catalog_table, after agreeing on the new name
* rename remaining timetravel function names
* restrict SuspendDecodingSnapshots usage to RelationInitPhysicalAddr,
that ought to be enough.
* add InLogicalDecoding() function.
* throw away older data when reading xl_running_xacts records, to deal
with immediate shutdowns/crashes

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
0001-Fix-pg_isolation_regress-to-work-outside-its-build-d.patch.gz application/x-patch-gzip 1.6 KB
0002-wal_decoding-Allow-walsender-s-to-connect-to-a-speci.patch.gz application/x-patch-gzip 4.0 KB
0003-wal_decoding-Log-xl_running_xact-s-at-a-higher-frequ.patch.gz application/x-patch-gzip 3.1 KB
0004-wal_decoding-Add-information-about-a-tables-primary-.patch.gz application/x-patch-gzip 1.9 KB
0005-wal_decoding-Add-wal_level-logical-and-log-data-requ.patch.gz application/x-patch-gzip 14.5 KB
0006-wal_decoding-Add-option-to-treat-additional-tables-a.patch.gz application/x-patch-gzip 1.5 KB
0007-wal_decoding-Introduce-wal-decoding-via-catalog-time.patch.gz application/x-patch-gzip 64.0 KB
0008-wal_decoding-logical-changeset-extraction-walsender-.patch.gz application/x-patch-gzip 9.9 KB
0009-wal_decoding-Only-peg-the-xmin-horizon-for-catalog-t.patch.gz application/x-patch-gzip 4.3 KB
0010-wal_decoding-test_decoding-Add-a-simple-decoding-mod.patch.gz application/x-patch-gzip 3.6 KB
0011-wal_decoding-pg_recvlogical-Introduce-pg_receivexlog.patch.gz application/x-patch-gzip 9.2 KB
0012-wal_decoding-test_logical_decoding-Add-extension-for.patch.gz application/x-patch-gzip 22.7 KB
0013-wal_decoding-design-document-v2.4-and-snapshot-build.patch.gz application/x-patch-gzip 12.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2013-10-07 13:44:19 Re: SSI freezing bug
Previous Message ktm@rice.edu 2013-10-07 12:50:23 Re: Re: custom hash-based COUNT(DISTINCT) aggregate - unexpectedly high memory consumption