Hi, Thank you for your response. On 17.04.2016 15:30, Craig Ringer
wrote:
In case of multimaster "too far behind" scenario can never happen. So here is yet another difference in asynchronous and synchronous replication approaches. For asynchronous replication situation when replica is far behind master is quite normal and has to be addressed without blocking master. For synchronous replication it is not possible all this "spill to disk" adds just extra overhead. It seems to me that pglogical plugin is now becoming too universal, trying to address a lot of different issues and play different roles. Here are some use cases for logical replication which I see (I am quite sure that you know more): 1. Asynchronous replication (including georeplication) - this is actually BDR. 2. Logical backup: transfer data to different database (including new version of Postgres) 3. Change notification: there are many different subscribers which can be interested in receiving notifications about database changes. As far as I know new JDBC driver is going to use logical replication to receive update streams. It can be also used for update/invalidation of caches in ORMs. 4. Synchronous replication: multimaster
We are not enforcing order of commits as Galera does. Consistency is enforces by DTM, which enforce that transactions at all nodes are given consistent snapshots and assigned same CSNs. We have also global deadlock detection algorithm which build global lock graph (but still false positives are possible because this graphs is build incrementally and so it doesn't correspond to some global snapshot).
We should definitely perform more testing here, but right now we do not have any tests causing some synchronization anomalies.
Multimaster is just particular (and simplest) case of distributed transactions. Specific of multimaster is that the same transaction has to be applied at all nodes and that selects can be executed at any node. The goal of DTM is to provide consistent execution of distributed transactions. If it is able to do for arbitrary transactions then, definitely, it can do it for multimaster. I can not give you here formal prove that our DTM is able to solve all this problems. Certainly there are may be bugs in implementation and this is why we need to perform more testing. But actually we are not "reinventing the wheel", our DTM is based on the existed approaches.
Sorry for unclearness. I just said that normally transactions are applied concurrently by multiple workers and DTM is used to enforce consistency. But in case of recovery (when some node is crashed and then reconnect to the cluster), we perform recovery of this node sequentially, by single worker. In this case DTM is not used (because other nodes are far ahead) and to restore the same state of node we need to apply changes exactly in the same order and at the source node. In this case case content of target (recovered) node should be the same as of source node.
It is more straightforward approach, isn't it? You can either try to restore DDL from low level sequence of updates of system catalogue. But it is difficult and not always possible. Or need to add to somehow add original DDL statements to the log. It can be done using some special table or store this information directly in the log (if custom WAL records are supported). Certainly in the last case logical protocol should be extended to support playback of user-defined WAl records. But it seems to be universal mechanism which can be used not only for DDL. I agree, that custom WAL adds no performance or functionality advantages over using a table. This is why we still didn't switch to it. But IMHO approach with inserting DDL (or any other user-defined information) in special table looks like hack.
Really? Why then you send all table metadata (information about attributes) and handle invalidation messages? What is the purpose of "mapping to local relation, filled as needed" fields in PGLogicalRelation if are are not going to perform such mapping? Multimater really needs to map local or remote OIDs. We do not need to provide any attribute mapping and handle catalog invalidations. -- -- Konstantin Knizhnik Postgres Professional: http://www.postgrespro.com The Russian Postgres Company |