On Apr 14, 2016, at 8:41 AM, Craig Ringer wrote:
Actually we already have working implementation of multimaster... There is a pool of pglogical executors. pglogical_receiver just reads transaction body from connection and append it to ready-for-execution queue. Any vacant worker form this pool can dequeue this work and proceed it. To provide correct replication session context, I have to setup replication session for each transaction. It looks dummy but fortunately has no effect on performance. It is certainly possible with this approach that order of applying transactions can be not the same at different nodes. But it is not a problem if we have DTM. The only exception is recovery of multimaster node. In this case we have to apply transaction exactly in the same order as them were applied at the original node performing recovery. It is done by applying changes in recovery mode by pglogical_receiver itself.
We have also alternative implementation done by Artur Zakirov <a.zakirov@xxxxxxxxxxxxxx> which is using custom WAL records: https://gitlab.postgrespro.ru/pgpro-dev/postgrespro/tree/logical_deparse Patch for custom WAL records was committed in 9.6, so we are going to switch to this approach. Right now we are trying to run all Postgres regression tests for multimaster. Currently about 50 tests are failed. There are a lot of different issues: with temporary tables, GUC variables, ... Some we have fixed, investigation of others is in progress...
Well, recently I have made attempt to merge our code with the latest version of pglogical plugin (because our original implementation of multimaster was based on the code partly taken fro BDR) but finally have to postpone most of changes. My primary intention was to support metadata caching. But presence of multiple apply workers make it not possible to implement it in the same way as it is done node in pglogical plugin. Also now pglogical plugin contains a lot of code which performs mapping between source and target database schemas. So it it is assumed that them may be different. But it is not true in case of multimaster and I do not want to pay extra cost for the functionality we do not need. Frankly speaking I do not wan to spent much time on integration of multimaster with pglogical plugin right now, because both of them are actively developed now. We should definitely do it, but when we have stable version, so there is no need to repeat this work once and once again. We can try to prepare our "wish list" for pglogical plugin.
|