Re: Catalog/Metadata consistency during changeset extraction from wal - Mailing list pgsql-hackers
From | Robert Haas |
---|---|
Subject | Re: Catalog/Metadata consistency during changeset extraction from wal |
Date | |
Msg-id | CA+TgmoYJevRaDb1mmWf0KpOkhJUsADGc6WR45_TPMymnK=9D7Q@mail.gmail.com Whole thread Raw |
In response to | Re: Catalog/Metadata consistency during changeset extraction from wal (Andres Freund <andres@2ndquadrant.com>) |
Responses |
Re: Catalog/Metadata consistency during changeset extraction from wal
|
List | pgsql-hackers |
On Mon, Jun 25, 2012 at 1:50 PM, Andres Freund <andres@2ndquadrant.com> wrote: > Its an argument why related infrastructure would be interesting to more than > that patch and thats not bad. > If the garbage collecting is done in a very simplistic manner it doesn't sound > too hard... The biggest problem is probably crash-recovery of that knowledge > and how to hook knowledge into it that logical rep needs that data... I suppose the main reason we haven't done it already is that it increases the period of time during which we're using 2X the disk space. >> > I don't think its that easy. If you e.g. have multiple ALTER's in the >> > same transaction interspersed with inserted rows they will all have >> > different TupleDesc's. >> >> If new columns were added, then tuples created with those older >> tuple-descriptors can still be interpreted with the latest >> tuple-descriptor. > But you need to figure that out. If you have just the before-after images of > the tupledescs you don't know what happened in there... That would mean either > doing special things on catalog changes or reassembling the meaning from the > changed pg_* rows. Neither seems enticing. I think there is absolutely nothing wrong with doing extra things in ALTER TABLE when logical replication is enabled. We've got code that's conditional on Hot Standby being enabled in many places in the system; why should logical replication be any different? If we set the bar for logical replication at "the system can't do anything differently when logical replication is enabled" then I cheerfully submit that we are doomed. You've already made WAL format changes to support logging the pre-image of the tuple, which is a hundred times more likely to cause a performance problem than any monkeying around we might want to do in ALTER TABLE. >> Can we just agree to punt all this complexity for version 1 (and maybe >> versions 2, 3, and 4)? I'm not sure what Slony does in situations >> like this but I bet for a lot of replication systems, the answer is >> "do a full resync". In other words, we either forbid the operation >> outright when the table is enabled for logical replication, or else we >> emit an LCR that says, in effect, "transaction 12345 monkeyed with the >> table, please resync". It strikes me that it's really the job of some >> higher-level control logic to decide what the "correct" behavior is in >> these cases; the decoding process doesn't really have enough >> information about what the user is trying to do to make a sensible >> decision anyway. It would be nice to be able to support some simple >> cases like "adding a column that has no default" or "dropping a >> column" without punting, but going much further than that seems like >> it will require embedding policy decisions that should really be >> happening at a higher level. > I am totally fine with saying that we do not support everything from the > start. But we need to choose an architecture where its possible to add that > support gradually and I don't think without looking inside transaction makes > that possible. I am deeply skeptical that we need to look inside of transactions that do full-table rewrites. But even if we do, I don't see that what I'm proposing precludes it. For example, I think we could have ALTER TABLE emit WAL records specifically for logical replication that allow us to disentangle which tuple descriptor to use at which point in the transaction. I don't see that that would even be very difficult to set up. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
pgsql-hackers by date: