Commit Graph

58 Commits

Author SHA1 Message Date
Hiroshi Inoue 0f2e7948e2 Improve cache invalidation handling. Eespecially
this would fix TODO
* elog() flushes cache, try invalidating just entries from
  current xact, perhaps using invalidation cache
2000-01-10 06:30:56 +00:00
Bruce Momjian b78769fda2 Fix it's and its to be correct. 2000-01-05 18:23:54 +00:00
Bruce Momjian 97dec77fab Rename several destroy* functions/tags to drop*. 1999-12-10 03:56:14 +00:00
Jan Wieck 1547ee017c This is part #1 for of the DEFERRED CONSTRAINT TRIGGER support.
Implements the CREATE CONSTRAINT TRIGGER and SET CONSTRAINTS commands.

TODO:
    Generic builtin trigger procedures
    Automatic execution of appropriate CREATE CONSTRAINT... at CREATE TABLE
    Support of new trigger type in pg_dump
    Swapping of huge # of events to disk

Jan
1999-09-29 16:06:40 +00:00
Vadim B. Mikheev 3fea625e9d Make tree compilable (+WAL). 1999-09-28 11:41:09 +00:00
Tom Lane e812458b27 Several changes here, not very related but touching some of the same files.
* Buffer refcount cleanup (per my "progress report" to pghackers, 9/22).
* Add links to backend PROC structs to sinval's array of per-backend info,
and use these links for routines that need to check the state of all
backends (rather than the slow, complicated search of the ShmemIndex
hashtable that was used before).  Add databaseOID to PROC structs.
* Use this to implement an interlock that prevents DESTROY DATABASE of
a database containing running backends.  (It's a little tricky to prevent
a concurrently-starting backend from getting in there, since the new
backend is not able to lock anything at the time it tries to look up
its database in pg_database.  My solution is to recheck that the DB is
OK at the end of InitPostgres.  It may not be a 100% solution, but it's
a lot better than no interlock at all...)
* In ALTER TABLE RENAME, flush buffers for the relation before doing the
rename of the physical files, to ensure we don't get failures later from
mdblindwrt().
* Update TRUNCATE patch so that it actually compiles against current
sources :-(.
You should do "make clean all" after pulling these changes.
1999-09-24 00:25:33 +00:00
Tatsuo Ishii 2d0eee32c4 Changes made by Hiroshi Inoue and approved by Vadim.
See attached mail for more details.

-------------------------------------------------------------------
From: "Vadim Mikheev" <vadim@krs.ru>
To: "Hiroshi Inoue" <Inoue@tpf.co.jp>
References: <000201befa94$42fe04c0$2801007e@cadzone.tpf.co.jp>
Subject: Re: elog(ERROR) in vacuum
Date: Fri, 10 Sep 1999 10:27:10 +0900
Organization: OJSC Rostelecom (Krasnoyarsk)
Message-ID: <37D85E6E.5AFA126D@krs.ru>

Hiroshi Inoue wrote:
>
> Hello Vadim,
>
> I have a question about vacuum.
>
> VACUUM has a phase like commit which calls TransactionIdCommit().
> But if elog(ERROR) occured after that,the status of transaction is
> changed from XID_COMMIT to XID_ABORT.
>
> Seems to me this causes inconsistency.
> Shoudn't AbortTransaction() be changed not to call TransacionIdAbort()
> in case of vacuum.

You're right!
As usual -:)

Vadim
1999-09-16 09:08:56 +00:00
Tom Lane 5bc0d31ae8 Repair incorrect cleanup of heap memory allocation during
transaction abort --- before it only worked if there was exactly one level
of allocation context stacked in the blank portal.  Now it does the right
thing for any depth, including zero...
1999-09-09 16:25:35 +00:00
Tom Lane 6645a73863 IsTransactionBlock() should return true in TBLOCK_ABORT state. 1999-09-05 17:12:34 +00:00
Bruce Momjian fb7548f4db Invalidate temp entries for aborted transactions. 1999-09-04 19:55:50 +00:00
Tom Lane b4a607c9e0 Modify RelationFlushRelation so that if the relcache entry
has positive refcount, it is rebuilt from pg_class data.  This ensures
that relcache entries will track changes made by other backends.  Formerly,
a shared inval report would just be ignored if it happened to arrive while
the relcache entry was in use.  Also, fix relcache to reset ref counts
to zero during transaction abort.  Finally, change LockRelation() so that
it checks for shared inval reports after obtaining the lock.  In this way,
once any kind of lock has been obtained on a rel, we can trust the relcache
entry to be up-to-date.
1999-09-04 18:42:15 +00:00
Tom Lane 4488b69b4c Fix nbtree's failure to clear BTScans list during xact abort.
Also, move responsibility for calling vc_abort into main xact.c list of
things-to-call-at-abort.  What in the world was it doing down inside of
TransactionIdAbort()?
1999-08-08 20:12:52 +00:00
Bruce Momjian a71802e12e Final cleanup. 1999-07-16 05:00:38 +00:00
Bruce Momjian a9591ce66a Change #include's to use <> and "" as appropriate. 1999-07-15 23:04:24 +00:00
Bruce Momjian 2e6b1e63a3 Remove unused #includes in *.c files. 1999-07-15 22:40:16 +00:00
Bruce Momjian 4b2c2850bf Clean up #include in /include directory. Add scripts for checking includes. 1999-07-15 15:21:54 +00:00
Vadim B. Mikheev 49f68a8584 Avoid disk writes for read-only transactions. 1999-06-29 04:54:49 +00:00
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