Commit Graph

41 Commits

Author SHA1 Message Date
Vadim B. Mikheev 78f7ccc982 1. Fix for elog(ERROR, "EvalPlanQual: t_xmin is uncommitted ?!")
and possibly for other cases too:

   DO NOT cache status of transaction in unknown state
   (i.e. non-committed and non-aborted ones)

   Example:
   T1 reads row updated/inserted by running T2 and cache T2 status.
   T2 commits.
   Now T1 reads a row updated by T2 and with HEAP_XMAX_COMMITTED
   in t_infomask (so cached T2 status is not changed).
   Now T1 EvalPlanQual gets updated row version without HEAP_XMIN_COMMITTED
   -> TransactionIdDidCommit(t_xmin) and TransactionIdDidAbort(t_xmin)
   return FALSE and T2 decides that t_xmin is not committed and gets
   ERROR above.

   It's too late to find more smart way to handle such cases and so
   I just changed xact status caching and got rid TransactionIdFlushCache()
   from code.

   Changed: transam.c, xact.c, lmgr.c and transam.h - last three
   just because of TransactionIdFlushCache() is removed.

2. heapam.c:

   T1 marked a row for update. T2 waits for T1 commit/abort.
   T1 commits. T3 updates the row before T2 locks row page.
   Now T2 sees that new row t_xmax is different from xact id (T1)
   T2 was waiting for. Old code did Assert here. New one goes to
   HeapTupleSatisfiesUpdate. Obvious changes too.

3. Added Assert to vacuum.c
4. bufmgr.c: break
   Assert(buf->r_locks == 0 && !buf->ri_lock)
   into two Asserts.
1999-06-10 14:17:12 +00:00
Vadim B. Mikheev 1b812d9358 1. xact.c: update comments about changing MyProc->xid and MyProc->xmin.
2. varsup.c:ReadNewTransactionId(): don't read nextXid from disk -
   this func doesn't allocate next xid, so ShmemVariableCache->nextXid
   may be used (but GetNewTransactionId() must be called first).
3. vacuum.c: change elog(ERROR, "Child item....") to elog(NOTICE) -
   this is not ERROR, proper handling is just not implemented, yet.
4. s_lock.c: increase S_MAX_BUSY by 2 times.
5. shmem.c:GetSnapshotData(): have to call ReadNewTransactionId()
   _after_ SpinAcquire(ShmemIndexLock).
1999-06-06 20:19:35 +00:00
Vadim B. Mikheev 5541abee0d 1. Additional fix against ERROR: Child itemid marked as unused
in CommitTransaction().
2. Changes in GetSnapshotData().
1999-06-03 13:33:13 +00:00
Vadim B. Mikheev 9680a71205 1. MyProc->xid assignment is moved to GetNewTransactionId so newer
transactions will not assume that MyProc transaction was committed
   before snapshot calculations. With old MyProc->xid assignment
   (in xact.c:StartTransaction()) there was ability to see the same
   row twice (I used gdb for this)!...
2. Assignments of InvalidTransactionId to MyProc->xid and MyProc->xmin
   are moved from xact.c:CommitTransaction() to
   xact.c:RecordTransactionCommit() - this invalidation must be done
   before releasing transaction locks or bad (too high) XmaxRecent value
   might be used by vacuum ("ERROR:  Child itemid marked as unused"
   reported by "Hiroshi Inoue" <Inoue@tpf.co.jp>; once again, gdb
   allowed me reproduce this error).
1999-06-03 04:41:41 +00:00
Tom Lane 2a44383a2d Clean up memory leaks in LO operations by freeing LO's private
memory context at transaction commit or abort.
1999-05-31 22:53:59 +00:00
Bruce Momjian 07842084fe pgindent run over code. 1999-05-25 16:15:34 +00:00
Tom Lane 0b885e2397 Release allocated memory during AtAbort_Memory. 1999-05-13 00:34:57 +00:00
Tom Lane c1167a08ca Add 'temporary file' facility to fd.c, and arrange for temp
files to be closed automatically at transaction abort or commit, should
they still be open.  Also close any still-open stdio files allocated with
AllocateFile at abort/commit.  This should eliminate problems with leakage
of file descriptors after an error.  Also, put in some primitive buffered-IO
support so that psort.c can use virtual files without severe performance
penalties.
1999-05-09 00:52:08 +00:00
Vadim B. Mikheev fdf6be80f9 1. Vacuum is updated for MVCC.
2. Much faster btree tuples deletion in the case when first on page
   index tuple is deleted (no movement to the left page(s)).
3. Remember blkno of new root page in BTPageOpaque of
   left/right siblings when root page is splitted.
1999-03-28 20:32:42 +00:00
Bruce Momjian 6724a50787 Change my-function-name-- to my_function_name, and optimizer renames. 1999-02-13 23:22:53 +00:00
Bruce Momjian 9322950aa4 Cleanup of source files where 'return' or 'var =' is alone on a line. 1999-02-03 21:18:02 +00:00
Bruce Momjian 4390b0bfbe Add TEMP tables/indexes. Add COPY pfree(). Other cleanups. 1999-02-02 03:45:56 +00:00
Vadim B. Mikheev e3a1ab764e READ COMMITTED isolevel is implemented and is default now. 1999-01-29 09:23:17 +00:00
Vadim B. Mikheev 3498d878cb SET TRANSACTION ISOLATION LEVEL ...
LOCK TABLE IN ... MODE
...implemented
1998-12-18 09:10:39 +00:00
Vadim B. Mikheev c13a64d7fb Serialized mode works! 1998-12-16 11:53:55 +00:00
Vadim B. Mikheev 3f7fbf85dc Initial MVCC code.
New code for locking buffer' context.
1998-12-15 12:47:01 +00:00
Bruce Momjian 173c555948 Make functions static or ifdef NOT_USED. Prevent pg_version creation. 1998-10-08 18:30:52 +00:00
Tom Lane c77a29a14e Substantial rewrite of async.c to avoid problems with non-reentrant stdio
and possibly other problems.  Minor changes in xact.c and postgres.c's
main loop to support new handling of async NOTIFY.
1998-10-06 02:40:09 +00:00
Bruce Momjian fa1a8d6a97 OK, folks, here is the pgindent output. 1998-09-01 04:40:42 +00:00
Bruce Momjian af74855a60 Renaming cleanup, no pgindent yet. 1998-09-01 03:29:17 +00:00
Bruce Momjian e0058b6172 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
1998-07-21 04:17:30 +00:00
Bruce Momjian 6bd323c6b3 Remove un-needed braces around single statements. 1998-06-15 19:30:31 +00:00
Bruce Momjian 679d39b9c8 Goodbye ABORT. Hello ERROR for all errors. 1998-01-07 21:07:04 +00:00
Bruce Momjian 0d9fc5afd6 Change elog(WARN) to elog(ERROR) and elog(ABORT). 1998-01-05 03:35:55 +00:00
Vadim B. Mikheev 32cd09ac6d Good Bye, Time Travel! 1997-11-02 15:27:14 +00:00
Bruce Momjian 59f6a57e59 Used modified version of indent that understands over 100 typedefs. 1997-09-08 21:56:23 +00:00
Bruce Momjian 319dbfa736 Another PGINDENT run that changes variable indenting and case label indenting. Also static variable indenting. 1997-09-08 02:41:22 +00:00
Bruce Momjian 1ccd423235 Massive commit to run PGINDENT on all *.c and *.h files. 1997-09-07 05:04:48 +00:00
Vadim B. Mikheev 3152996ffb Fix very old bug which made tuples changed/inserted by a commnd
visible to command itself (so we had multiple update of updated tuples,
etc).
1997-08-29 09:05:25 +00:00
Bruce Momjian 1d8bbfd2e7 Make functions static where possible, enclose unused functions in #ifdef NOT_USED. 1997-08-19 21:40:56 +00:00
Bruce Momjian ea5b5357cd Remove more (void) and fix -Wall warnings. 1997-08-12 22:55:25 +00:00
Vadim B. Mikheev 076f7286be CloseSequences () at xact commit/abort. 1997-04-02 03:38:02 +00:00
Vadim B. Mikheev 1a63f48b28 Free memory allocated by command in the BlankPortal' HeapMemory context
(#ifdef-ed).
1997-03-25 04:10:21 +00:00
Marc G. Fournier 53d8be3bbf Date/Time updates from Thomas... 1997-03-14 23:21:12 +00:00
Marc G. Fournier 51844146e5 From: Dan McGuirk <mcguirk@indirect.com>
Subject: [HACKERS] abort failed transaction patch

This patch allows you to end a transaction that has failed on an error
using the 'ABORT' statement without generating another error message.
(By default you get an error unless you use 'END' to terminate the
transaction, which has already been aborted anyway.)
1997-03-12 20:41:14 +00:00
Vadim B. Mikheev 713b65e19c Setting MyProc->xid to current transaction' id in StartTransaction
and to InvalidTransactionId in CommitTransaction & AbortTransaction
(it's for new TransactionIdIsInProgress func).
1996-11-27 07:14:51 +00:00
Bruce Momjian aaeef4d17d All external function definitions now have prototypes that are checked. 1996-11-10 03:06:38 +00:00
Marc G. Fournier 03eb5a50e7 There, that cleans *that* out 1996-11-05 11:12:33 +00:00
Marc G. Fournier ca112038ab More include file cleanups 1996-11-03 22:58:26 +00:00
Marc G. Fournier c9f8bad182 -Wall'd
That finishes access/*
1996-10-21 07:15:18 +00:00
Marc G. Fournier d31084e9d1 Postgres95 1.01 Distribution - Virgin Sources 1996-07-09 06:22:35 +00:00