aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1998-07-21 04:17:30 +0000
committerBruce Momjian <bruce@momjian.us>1998-07-21 04:17:30 +0000
commite0058b61728438469898845be0a7afb73f2ebc86 (patch)
tree0345a599406f6476478094ddfaf096c0df6a348a /src/backend/access
parent7702d7aa4b7ac61cad6538ce62de395cd04dfbe9 (diff)
downloadpostgresql-e0058b61728438469898845be0a7afb73f2ebc86.tar.gz
postgresql-e0058b61728438469898845be0a7afb73f2ebc86.zip
Theses buffer leaks are caused by indexes that are kept open between
calls. Outside a transaction, the backend detects them as buffer leaks; it sends a NOTICE, and frees them. This sometimes cause a segmentation fault (at least on Linux). These indexes are initialized on the first lo_read/lo_write/lo_tell call, and (normally) closed on a lo_close call. Thus the buffer leaks appear when lo direct access functions are used, and not with lo_import/lo_export functions (libpq version calls lo_close before ending the command, and the backend version uses another path). The included patches (against recent snapshot, and against 6.3.2) cause indexes to be closed on transaction end (that is on explicit 'END' statment, or on command termination outside trasaction blocks), thus preventing the buffer leaks while increasing performance inside transactions. Some (all?) 'classic' memory leaks are also removed. I hope it will be ok. --- Pascal ANDRE, graduated from Ecole Centrale Paris andre@via.ecp.fr
Diffstat (limited to 'src/backend/access')
-rw-r--r--src/backend/access/transam/xact.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index fb888640a99..f32a7fb00b5 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.20 1998/06/15 19:28:02 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.21 1998/07/21 04:17:21 momjian Exp $
*
* NOTES
* Transaction aborts can now occur two ways:
@@ -137,6 +137,11 @@
*-------------------------------------------------------------------------
*/
+/*
+ * Large object clean up added in CommitTransaction() to prevent buffer leaks.
+ * [PA, 7/17/98]
+ * [PA] is Pascal André <andre@via.ecp.fr>
+ */
#include <postgres.h>
#include <access/xact.h>
@@ -151,6 +156,9 @@
#include <commands/async.h>
#include <commands/sequence.h>
+/* included for _lo_commit [PA, 7/17/98] */
+#include <libpq/be-fsstubs.h>
+
static void AbortTransaction(void);
static void AtAbort_Cache(void);
static void AtAbort_Locks(void);
@@ -889,6 +897,10 @@ CommitTransaction()
* do commit processing
* ----------------
*/
+
+ /* handle commit for large objects [ PA, 7/17/98 ] */
+ _lo_commit();
+
CloseSequences();
DestroyTempRels();
AtEOXact_portals();