aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xlog.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2011-10-22 18:22:45 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2011-10-22 18:23:30 -0400
commitbb446b689b6681eb57a8a50605e119743190c4db (patch)
tree2605250c0d2a465c4ff6ef7454df4c56902759cd /src/backend/access/transam/xlog.c
parentb436c72f61adf5efab435c282bfb13a29508d475 (diff)
downloadpostgresql-bb446b689b6681eb57a8a50605e119743190c4db.tar.gz
postgresql-bb446b689b6681eb57a8a50605e119743190c4db.zip
Support synchronization of snapshots through an export/import procedure.
A transaction can export a snapshot with pg_export_snapshot(), and then others can import it with SET TRANSACTION SNAPSHOT. The data does not leave the server so there are not security issues. A snapshot can only be imported while the exporting transaction is still running, and there are some other restrictions. I'm not totally convinced that we've covered all the bases for SSI (true serializable) mode, but it works fine for lesser isolation modes. Joachim Wieland, reviewed by Marko Tiikkaja, and rather heavily modified by Tom Lane
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r--src/backend/access/transam/xlog.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 1c17348472e..5fec88691a3 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -58,6 +58,7 @@
#include "utils/guc.h"
#include "utils/ps_status.h"
#include "utils/relmapper.h"
+#include "utils/snapmgr.h"
#include "utils/timestamp.h"
#include "pg_trace.h"
@@ -6382,6 +6383,12 @@ StartupXLOG(void)
ResetUnloggedRelations(UNLOGGED_RELATION_CLEANUP);
/*
+ * Likewise, delete any saved transaction snapshot files that got
+ * left behind by crashed backends.
+ */
+ DeleteAllExportedSnapshotFiles();
+
+ /*
* Initialize for Hot Standby, if enabled. We won't let backends in
* yet, not until we've reached the min recovery point specified in
* control file and we've established a recovery snapshot from a