From: Joachim Wieland on 8 Jan 2010 14:36 The attached patch implements the idea of Heikki / Simon published in http://archives.postgresql.org/pgsql-hackers/2009-11/msg00271.php Since nobody objected to the idea in general, I have implemented it. As this is not currently used anywhere it doesn't give immediate benefit, it is however a prerequisite for a parallel version of pg_dump that quite some people (including myself) seem to be interested in. Here's the comment from the patch explaining it in more detail: /* * This function is for synchronization of snapshots: It can be called by * new transactions to get the same snapshots. It's signature is * * pg_synchronize_snapshots(text, int, int); * * The first parameter is an identifier so that several groups can request * synchronized snapshots concurrently. * * The second parameter is the number of backends that are expected to connect * in the current group (i.e. same identifier). * * The third parameter is the timeout in milliseconds. * * Note that once we are holding the ProcArrayLock in shared mode we are * severely hitting the usability of the database server: for example, nobody * can commit nontrivial transactions during that time nor can you establish a * new connection! This is why you need to be superuser to use this function. * * The idea is that from one connection you call for example * * pg_synchronize_snapshot('7bd0320c4ff9252716972e160fb33b8a', 4, 1000) * * and then have 1000ms to call with some other four (already connected) * sessions * * BEGIN TRANSACTION; * SELECT pg_synchronize_snapshot_taken('7bd0320c4ff9252716972e160fb33b8a'); * * If all four pg_synchronize_snapshot_taken() calls return true and the * function pg_synchronize_snapshot() returns true as well, you can go on and * all four transactions now see the same snapshot (which in general is not the * snapshot that the transaction saw that has initially called * pg_synchronize_snapshot()). */ Thoughts? Joachim
|
Pages: 1 Prev: Streaming replication and triggering failover Next: Streaming replication status |