Commit Graph

102 Commits

Author SHA1 Message Date
Tom Lane e2e19ca0cd Seems like we should not hold off cancel/die interrupts while we are
running deferred triggers.  They are really part of the regular
transaction, and they could take awhile.
2001-05-04 18:39:16 +00:00
Bruce Momjian 0686d49da0 Remove dashes in comments that don't need them, rewrap with pgindent. 2001-03-22 06:16:21 +00:00
Bruce Momjian 9e1552607a pgindent run. Make it all clean. 2001-03-22 04:01:46 +00:00
Tom Lane 4d14fe0048 XLOG (and related) changes:
* Store two past checkpoint locations, not just one, in pg_control.
  On startup, we fall back to the older checkpoint if the newer one
  is unreadable.  Also, a physical copy of the newest checkpoint record
  is kept in pg_control for possible use in disaster recovery (ie,
  complete loss of pg_xlog).  Also add a version number for pg_control
  itself.  Remove archdir from pg_control; it ought to be a GUC
  parameter, not a special case (not that it's implemented yet anyway).

* Suppress successive checkpoint records when nothing has been entered
  in the WAL log since the last one.  This is not so much to avoid I/O
  as to make it actually useful to keep track of the last two
  checkpoints.  If the things are right next to each other then there's
  not a lot of redundancy gained...

* Change CRC scheme to a true 64-bit CRC, not a pair of 32-bit CRCs
  on alternate bytes.  Polynomial borrowed from ECMA DLT1 standard.

* Fix XLOG record length handling so that it will work at BLCKSZ = 32k.

* Change XID allocation to work more like OID allocation.  (This is of
  dubious necessity, but I think it's a good idea anyway.)

* Fix a number of minor bugs, such as off-by-one logic for XLOG file
  wraparound at the 4 gig mark.

* Add documentation and clean up some coding infelicities; move file
  format declarations out to include files where planned contrib
  utilities can get at them.

* Checkpoint will now occur every CHECKPOINT_SEGMENTS log segments or
  every CHECKPOINT_TIMEOUT seconds, whichever comes first.  It is also
  possible to force a checkpoint by sending SIGUSR1 to the postmaster
  (undocumented feature...)

* Defend against kill -9 postmaster by storing shmem block's key and ID
  in postmaster.pid lockfile, and checking at startup to ensure that no
  processes are still connected to old shmem block (if it still exists).

* Switch backends to accept SIGQUIT rather than SIGUSR1 for emergency
  stop, for symmetry with postmaster and xlog utilities.  Clean up signal
  handling in bootstrap.c so that xlog utilities launched by postmaster
  will react to signals better.

* Standalone bootstrap now grabs lockfile in target directory, as added
  insurance against running it in parallel with live postmaster.
2001-03-13 01:17:06 +00:00
Tom Lane 9c9936587c Implement COMMIT_SIBLINGS parameter to allow pre-commit delay to occur
only if at least N other backends currently have open transactions.  This
is not a great deal of intelligence about whether a delay might be
profitable ... but it beats no intelligence at all.  Note that the default
COMMIT_DELAY is still zero --- this new code does nothing unless that
setting is changed.
Also, mark ENABLEFSYNC as a system-wide setting.  It's no longer safe to
allow that to be set per-backend, since we may be relying on some other
backend's fsync to have synced the WAL log.
2001-02-26 00:50:08 +00:00
Tom Lane 57e0847180 Change default commit_delay to zero, update documentation. 2001-02-18 04:50:43 +00:00
Bruce Momjian 623bf843d2 Change Copyright from PostgreSQL, Inc to PostgreSQL Global Development Group. 2001-01-24 19:43:33 +00:00
Tom Lane 6ce0ed2813 Make critical sections (elog->crash) and interrupt holdoff sections
into distinct concepts, per recent discussion on pghackers.
2001-01-19 22:08:47 +00:00
Vadim B. Mikheev 0a12767004 Comment out xlrec in xact_redo - no support for file unlinking on
commit yet.
2001-01-18 18:33:45 +00:00
Tom Lane 36839c1927 Restructure backend SIGINT/SIGTERM handling so that 'die' interrupts
are treated more like 'cancel' interrupts: the signal handler sets a
flag that is examined at well-defined spots, rather than trying to cope
with an interrupt that might happen anywhere.  See pghackers discussion
of 1/12/01.
2001-01-14 05:08:17 +00:00
Tom Lane 6162432de9 Add more critical-section calls: all code sections that hold spinlocks
are now critical sections, so as to ensure die() won't interrupt us while
we are munging shared-memory data structures.  Avoid insecure intermediate
states in some code that proc_exit will call, like palloc/pfree.  Rename
START/END_CRIT_CODE to START/END_CRIT_SECTION, since that seems to be
what people tend to call them anyway, and make them be called with () like
a function call, in hopes of not confusing pg_indent.
I doubt that this is sufficient to make SIGTERM safe anywhere; there's
just too much code that could get invoked during proc_exit().
2001-01-12 21:54:01 +00:00
Vadim B. Mikheev 7ceeeb662f New WAL version - CRC and data blocks backup. 2000-12-28 13:00:29 +00:00
Tom Lane 6cc842abd3 Revise lock manager to support "session level" locks as well as "transaction
level" locks.  A session lock is not released at transaction commit (but it
is released on transaction abort, to ensure recovery after an elog(ERROR)).
In VACUUM, use a session lock to protect the master table while vacuuming a
TOAST table, so that the TOAST table can be done in an independent
transaction.

I also took this opportunity to do some cleanup and renaming in the lock
code.  The previously noted bug in ProcLockWakeup, that it couldn't wake up
any waiters beyond the first non-wakeable waiter, is now fixed.  Also found
a previously unknown bug of the same kind (failure to scan all members of
a lock queue in some cases) in DeadLockCheck.  This might have led to failure
to detect a deadlock condition, resulting in indefinite waits, but it's
difficult to characterize the conditions required to trigger a failure.
2000-12-22 00:51:54 +00:00
Tom Lane a626b78c89 Clean up backend-exit-time cleanup behavior. Use on_shmem_exit callbacks
to ensure that we have released buffer refcounts and so forth, rather than
putting ad-hoc operations before (some of the calls to) proc_exit.  Add
commentary to discourage future hackers from repeating that mistake.
2000-12-18 00:44:50 +00:00
Hiroshi Inoue 8bb4dab94d RecordTransactionAbort() shouldn't log XLOG_XACT_ABORT
if the transaction has already been committed ?
2000-12-07 10:03:46 +00:00
Vadim B. Mikheev 65b362fae1 Disable elog(ERROR|FATAL) in signal handlers in
critical sections of code.
2000-12-03 10:27:29 +00:00
Vadim B. Mikheev 81c8c244b2 No more #ifdef XLOG. 2000-11-30 08:46:26 +00:00
Vadim B. Mikheev 741510521c XLOG stuff for sequences.
CommitDelay in guc.c
2000-11-30 01:47:33 +00:00
Peter Eisentraut a70e74b060 Put external declarations into header files. 2000-11-21 21:16:06 +00:00
Tom Lane a933ee38bb Change SearchSysCache coding conventions so that a reference count is
maintained for each cache entry.  A cache entry will not be freed until
the matching ReleaseSysCache call has been executed.  This eliminates
worries about cache entries getting dropped while still in use.  See
my posting to pg-hackers of even date for more info.
2000-11-16 22:30:52 +00:00
Tom Lane ddeab22565 Clean up syscache so that recursive invocation is safe, and remove error
message about recursive use of a syscache.  Also remove most of the
specialized indexscan routines in indexing.c --- it turns out that
catcache.c is perfectly able to perform the indexscan for itself,
in fact has already looked up all the information needed to do so!
This should be faster as well as needing far less boilerplate code.
2000-11-10 00:33:12 +00:00
Tom Lane 3908473c80 Make DROP TABLE rollback-able: postpone physical file delete until commit.
(WAL logging for this is not done yet, however.)  Clean up a number of really
crufty things that are no longer needed now that DROP behaves nicely.  Make
temp table mapper do the right things when drop or rename affecting a temp
table is rolled back.  Also, remove "relation modified while in use" error
check, in favor of locking tables at first reference and holding that lock
throughout the statement.
2000-11-08 22:10:03 +00:00
Vadim B. Mikheev f0e37a8531 New CHECKPOINT command.
Auto removing of offline log files and creating new file
at checkpoint time.
2000-11-05 22:50:21 +00:00
Vadim B. Mikheev e3ba543525 WAL fixes. 2000-10-29 18:33:41 +00:00
Vadim B. Mikheev 5b0740d3fc WAL 2000-10-28 16:21:00 +00:00
Tom Lane fa9357d0b7 Fix AbortOutOfAnyTransaction logic to avoid notice about
'AbortTransaction and not in in-progress state' when client disconnects
just after an error.  Notice seems pretty harmless, so I'm not going
to worry about back-patching this into 7.0.* ...
2000-10-24 20:06:39 +00:00
Vadim B. Mikheev db2faa943a WAL misc 2000-10-24 09:56:23 +00:00
Vadim B. Mikheev 4b65a2840b New relcache hash table with RelFileNode as key to be used
from bufmgr - it would be nice to have separate hash in smgr
for node <--> fd mappings, but for the moment it's easy to
add new hash to relcache.
Fixed small bug in xlog.c:ReadRecord.
2000-10-23 04:10:24 +00:00
Vadim B. Mikheev a7fcadd10a WAL 2000-10-21 15:43:36 +00:00
Vadim B. Mikheev b58c0411ba redo/undo support functions and cleanups. 2000-10-20 11:01:21 +00:00
Bruce Momjian f41f8eebe7 Fix temp relation handling for indexes, cleanup 2000-10-11 21:28:19 +00:00
Peter Eisentraut 64610a82f2 Reset current user id to session user id during transaction abort 2000-09-27 10:41:55 +00:00
Tom Lane 925418d2fa Ensure that catcache 'busy' flags are reset at transaction abort.
Without this, an elog during cache-entry load leaves that catcache
unusable.  elog in that segment of code is pretty unusual but it can
happen.
2000-08-06 04:17:47 +00:00
Tom Lane 57eeb0d315 New memmgr logic in xact.c failed if AbortTransaction() is called when
there is no open transaction.
2000-07-02 02:28:38 +00:00
Tom Lane 1aebc3618a First phase of memory management rewrite (see backend/utils/mmgr/README
for details).  It doesn't really do that much yet, since there are no
short-term memory contexts in the executor, but the infrastructure is
in place and long-term contexts are handled reasonably.  A few long-
standing bugs have been fixed, such as 'VACUUM; anything' in a single
query string crashing.  Also, out-of-memory is now considered a
recoverable ERROR, not FATAL.
Eliminate a large amount of crufty, now-dead code in and around
memory management.
Fix problem with holding off SIGTRAP, SIGSEGV, etc in postmaster and
backend startup.
2000-06-28 03:33:33 +00:00
Tom Lane 1ee26b7764 Reimplement nodeMaterial to use a temporary BufFile (or even memory, if the
materialized tupleset is small enough) instead of a temporary relation.
This was something I was thinking of doing anyway for performance, and Jan
says he needs it for TOAST because he doesn't want to cope with toasting
noname relations.  With this change, the 'noname table' support in heap.c
is dead code, and I have accordingly removed it.  Also clean up 'noname'
plan handling in planner --- nonames are either sort or materialize plans,
and it seems less confusing to handle them separately under those names.
2000-06-18 22:44:35 +00:00
Bruce Momjian 20ad43b576 Mark functions as static and ifdef NOT_USED as appropriate. 2000-06-08 22:38:00 +00:00
Bruce Momjian a12a23f0d0 Remove unused include files. Do not touch /port or includes used by defines. 2000-05-30 00:49:57 +00:00
Bruce Momjian 52f77df613 Ye-old pgindent run. Same 4-space tabs. 2000-04-12 17:17:23 +00:00
Tom Lane 1f6d8b90b8 Buffer manager modifications to keep a local buffer-dirtied bit as well
as a shared dirtybit for each shared buffer.  The shared dirtybit still
controls writing the buffer, but the local bit controls whether we need
to fsync the buffer's file.  This arrangement fixes a bug that allowed
some required fsyncs to be missed, and should improve performance as well.
For more info see my post of same date on pghackers.
2000-04-09 04:43:20 +00:00
Tom Lane 341b328b18 Fix a bunch of minor portability problems and maybe-bugs revealed by
running gcc and HP's cc with warnings cranked way up.  Signed vs unsigned
comparisons, routines declared static and then defined not-static,
that kind of thing.  Tedious, but perhaps useful...
2000-03-17 02:36:41 +00:00
Hiroshi Inoue e3a97b370c Implement reindex command 2000-02-18 09:30:20 +00:00
Peter Eisentraut 2b84cbb60f A few minor psql enhancements
Initdb help correction
Changed end/abort to commit/rollback and changed related notices
Commented out way old printing functions in libpq
Fixed a typo in alter table / alter column
2000-01-29 16:58:54 +00:00
Bruce Momjian 5c25d60244 Add:
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc

to all files copyright Regents of Berkeley.  Man, that's a lot of files.
2000-01-26 05:58:53 +00:00
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