aboutsummaryrefslogtreecommitdiff
path: root/src/backend/tcop/postgres.c
Commit message (Collapse)AuthorAge
...
* Reimplement the linked list data structure used throughout the backend.Neil Conway2004-05-26
| | | | | | | | | | | | | | | | In the past, we used a 'Lispy' linked list implementation: a "list" was merely a pointer to the head node of the list. The problem with that design is that it makes lappend() and length() linear time. This patch fixes that problem (and others) by maintaining a count of the list length and a pointer to the tail node along with each head node pointer. A "list" is now a pointer to a structure containing some meta-data about the list; the head and tail pointers in that structure refer to ListCell structures that maintain the actual linked list of nodes. The function names of the list API have also been changed to, I hope, be more logically consistent. By default, the old function names are still available; they will be disabled-by-default once the rest of the tree has been updated to use the new API names.
* Handle impending sinval queue overflow by means of a separate signalTom Lane2004-05-23
| | | | | | | | | | | | | | | | | (SIGUSR1, which we have not been using recently) instead of piggybacking on SIGUSR2-driven NOTIFY processing. This has several good results: the processing needed to drain the sinval queue is a lot less than the processing needed to answer a NOTIFY; there's less contention since we don't have a bunch of backends all trying to acquire exclusive lock on pg_listener; backends that are sitting inside a transaction block can still drain the queue, whereas NOTIFY processing can't run if there's an open transaction block. (This last is a fairly serious issue that I don't think we ever recognized before --- with clients like JDBC that tend to sit with open transaction blocks, the sinval queue draining mechanism never really worked as intended, probably resulting in a lot of useless cache-reset overhead.) This is the last of several proposed changes in response to Philip Warner's recent report of sinval-induced performance problems.
* Integrate src/timezone library for all platforms. There is more we canTom Lane2004-05-21
| | | | | | and should do now that we control our own destiny for timezone handling, but this commit gets the bulk of the picayune diffs in place. Magnus Hagander and Tom Lane.
* Only do pkglib_path if needed.Bruce Momjian2004-05-19
|
* Only do find_my_exec if it doesn't come from the postmaster.Bruce Momjian2004-05-19
|
* Move find_my_exec lower so elog() works, per Tom.Bruce Momjian2004-05-19
|
* Move get_pkglib_path up into main.c too.Bruce Momjian2004-05-18
|
* Move find_my_exec() way up into main.c so it is available to theBruce Momjian2004-05-18
| | | | | | | | timezone code and other places. Remove elog() calls from find_my_exec; do fprintf(stderr) instead. We can then remove the exec.c handling in the makefile because it doesn't have to be built to suppress elog calls.
* Reorganize code to allow path-relative installs.Bruce Momjian2004-05-17
| | | | | | | Create new get_* functions to access compiled-in paths and adjust if relative installs are to be used. Clean up substitute_libpath_macro() code.
* Adjust find_my_exec/find_other_exec() so that the return parameter isBruce Momjian2004-05-14
| | | | last, not first. This fits our style better.
* Reorganize backend code to more cleanly manage executable names andBruce Momjian2004-05-13
| | | | backend startup.
* Rename find_my_binary/find_other_binary toBruce Momjian2004-05-12
| | | | | | | | | find_my_exec/find_other_exec(). Remove passing of progname to these functions as they can find that out from argv[0], which they already have. Make get_progname return const char *, and update all progname variables to be const char *.
* As part of the work for making relocatable installs, I have re-factoredBruce Momjian2004-05-11
| | | | | | | | | | | | all the code that looks for other binaries. I move FindExec into port/exec.c (and renamed it to find_my_binary()). I also added find_other_binary that looks for another binary in the same directory as the calling program, and checks the version string. The only behavior change was that initdb and pg_dump would look in the hard-coded bindir directory if it can't find the requested binary in the same directory as the caller. The new code throws an error. The old behavior seemed too error prone for version mismatches.
* Remove crude test for log_statement_stats in startup code now that weBruce Momjian2004-05-07
| | | | | | | have a more proper GUC based test. Also change error return code to ERRCODE_INVALID_PARAMETER_VALUE so it matches the old error return code.
* Remove the last traces of Joe Hellerstein's "xfunc" optimization. PatchNeil Conway2004-04-25
| | | | | from Alvaro Herrera. Also, removed lispsort.c, since it is no longer used.
* * Most changes are to fix warnings issued when compiling win32Bruce Momjian2004-04-19
| | | | | | | | | | | | | | | | | | | | | * removed a few redundant defines * get_user_name safe under win32 * rationalized pipe read EOF for win32 (UPDATED PATCH USED) * changed all backend instances of sleep() to pg_usleep - except for the SLEEP_ON_ASSERT in assert.c, as it would exceed a 32-bit long [Note to patcher: If a SLEEP_ON_ASSERT of 2000 seconds is acceptable, please replace with pg_usleep(2000000000L)] I added a comment to that part of the code: /* * It would be nice to use pg_usleep() here, but only does 2000 sec * or 33 minutes, which seems too short. */ sleep(1000000); Claudio Natoli
* Exit backend from SIGTERM or FATAL by simulating client EOF, rather thanBruce Momjian2004-04-11
| | | | calling proc_exit() directly. This should make SIGTERM more reliable.
* > >>1. change the type of "log_statement" option from boolean to string,Bruce Momjian2004-04-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > >>with allowed values of "all, mod, ddl, none" with default "none". OK, here is a patch that implements #1. Here is sample output: test=> set client_min_messages = 'log'; SET test=> set log_statement = 'mod'; SET test=> select 1; ?column? ---------- 1 (1 row) test=> update test set x=1; LOG: statement: update test set x=1; ERROR: relation "test" does not exist test=> update test set x=1; LOG: statement: update test set x=1; ERROR: relation "test" does not exist test=> copy test from '/tmp/x'; LOG: statement: copy test from '/tmp/x'; ERROR: relation "test" does not exist test=> copy test to '/tmp/x'; ERROR: relation "test" does not exist test=> prepare xx as select 1; PREPARE test=> prepare xx as update x set y=1; LOG: statement: prepare xx as update x set y=1; ERROR: relation "x" does not exist test=> explain analyze select 1;; QUERY PLAN ------------------------------------------------------------------------------------ Result (cost=0.00..0.01 rows=1 width=0) (actual time=0.006..0.007 rows=1 loops=1) Total runtime: 0.046 ms (2 rows) test=> explain analyze update test set x=1; LOG: statement: explain analyze update test set x=1; ERROR: relation "test" does not exist test=> explain update test set x=1; ERROR: relation "test" does not exist It checks PREPARE and EXECUTE ANALYZE too. The log_statement values are 'none', 'mod', 'ddl', and 'all'. For 'all', it prints before the query is parsed, and for ddl/mod, it does it right after parsing using the node tag (or command tag for CREATE/ALTER/DROP), so any non-parse errors will print after the log line.
* Replace max_expr_depth parameter with a max_stack_depth parameter thatTom Lane2004-03-24
| | | | | | is measured in kilobytes and checked against actual physical execution stack depth, as per my proposal of 30-Dec. This gives us a fairly bulletproof defense against crashing due to runaway recursive functions.
* Revise syntax-error reporting behavior to give pleasant results forTom Lane2004-03-21
| | | | | errors in internally-generated queries, such as those submitted by plpgsql functions. Per recent discussions with Fabien Coelho.
* Remove GUC log_statement, log_pid, log_timestamp, log_source_port.Bruce Momjian2004-03-15
| | | | | | Functionality superceeded by log_line_prefix. Andrew Dunstan
* Add:Bruce Momjian2004-03-09
| | | | | | | | | | | | | #log_line_prefix = '' # e.g. '<%u%%%d> ' # %u=user name %d=database name # %r=remote host and port # %p=PID %t=timestamp %i=command tag # %c=session id %l=session line number # %s=session start timestamp # %x=stop here in non-session processes # %%='%' Andrew Dunstan
* Fix random build breakage from log_disconnections patch.Tom Lane2004-02-21
|
* Rename function log_session_end to log_disconnections.Bruce Momjian2004-02-17
|
* Fix prototype for on_proc_exit in log_disconnections patch.Bruce Momjian2004-02-17
|
* This patch brings up to date what I did last year (now unfortunatelyBruce Momjian2004-02-17
| | | | | | | bitrotted) to allow the logging of the end of a session, enabled by the config setting "log_disconnections". Andrew Dunstan
* Cost based vacuum delay feature.Jan Wieck2004-02-06
| | | | Jan
* Rename SortMem and VacuumMem to work_mem and maintenance_work_mem.Tom Lane2004-02-03
| | | | | | | Make btree index creation and initial validation of foreign-key constraints use maintenance_work_mem rather than work_mem as their memory limit. Add some code to guc.c to allow these variables to be referenced by their old names in SHOW and SET commands, for backwards compatibility.
* Review uses of IsUnderPostmaster, change some tests to look atTom Lane2004-01-28
| | | | | | | whereToSendOutput instead because they are really inquiring about the correct client communication protocol. Update some comments. This is pointing towards supporting regular FE/BE client protocol in a standalone backend, per discussion a month or so back.
* [all] Removed call to getppid in SendPostmasterSignal, replacing with aBruce Momjian2004-01-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | PostmasterPid variable, which gets set (early) in PostmasterMain getppid would not be the postmaster? [fork/exec] Implements processCancelRequest by keeping an array of pid/cancel_key structs in shared mem [fork/exec] Moves AttachSharedMemoryAndSemaphores call for backends into SubPostmasterMain [win32] Implements reaper/waitpid by keeping an arrays of children pids,handles in postmaster local mem - this item is largely untested, for reasons which should be obvious, but appears sound [win32/all] Added extern for pgpipe in Win32 case, and changed the second pipe call (which seems to have been missed earlier) to pgpipe [win32] #define'd ftruncate to chsize in the Win32 case [win32] PG_USLEEP for Win32 has a misplaced paren. Fixed. [win32] DLLIMPORT handling for MingW case Claudio Natoli
* Back out win32 patch so we can apply it separately.Bruce Momjian2004-01-26
|
* Attached is a patch that fixes some trivial typos and alignment. PleaseBruce Momjian2004-01-26
| | | | | | apply. Alvaro Herrera
* Final rearrangement of main postgresql child process (ie.Bruce Momjian2004-01-06
| | | | | | | | BackendFork/SSDataBase/pgstat) startup, to allow fork/exec calls to closely mimic (the soon to be provided) Win32 CreateProcess equivalent calls. Claudio Natoli
* Remove unused 'noversion' command-line option processing from theNeil Conway2004-01-06
| | | | backend.
* Continued rearrangement to permit pgstat + BootstrapMain processes to beBruce Momjian2003-12-25
| | | | | | fork/exec'd, in the same mode as the previous patch for backends. Claudio Natoli
* This patch is the next step towards (re)allowing fork/exec.Bruce Momjian2003-12-20
| | | | Claudio Natoli
* Avoid assuming that type key_t is 32 bits, since it reportedly isn'tTom Lane2003-12-01
| | | | | | on 64-bit Solaris. Use a non-system-dependent datatype for UsedShmemSegID, namely unsigned long (which we were already assuming could hold a shmem key anyway, cf RecordSharedMemoryInLockFile).
* Put out a more useful version indication in the welcome banner for aTom Lane2003-11-29
| | | | | standalone backend --- the CVS revision number of postgres.c is not real useful to anyone.
* $Header: -> $PostgreSQL Changes ...PostgreSQL Daemon2003-11-29
|
* Repair missed renamings of show_statement_stats and show_executor_stats.Tom Lane2003-11-24
|
* Save_r, Save_t should be static not global variables.Tom Lane2003-10-19
|
* Cleanup on --help-config: Now called --describe-config, no further options,Peter Eisentraut2003-10-18
| | | | | machine readable, without headers, not sorted. Parameter descriptions adjusted to fit first sentence + rest convention.
* Fix bad interaction between NOTIFY processing and V3 extended queryTom Lane2003-10-16
| | | | | | | | | | protocol, per report from Igor Shevchenko. NOTIFY thought it could do its thing if transaction blockState is TBLOCK_DEFAULT, but in reality it had better check the low-level transaction state is TRANS_DEFAULT as well. Formerly it was not possible to wait for the client in a state where the first is true and the second is not ... but now we can have such a state. Minor cleanup in StartTransaction() as well.
* Change "query:" to "statement:".Bruce Momjian2003-10-09
| | | | Have log_duration print when log_min_duration_statement prints.
* Have log_min_duration_statement = 0 always print duration/statement.Bruce Momjian2003-10-08
| | | | | | Change log line to be "duration: ms query:" Indent multi-line queries with a tab in the server logs.
* Fix log_duration and log_min_duration_statement to print properly, asBruce Momjian2003-10-04
| | | | pointed out by Peter.
* Change some notices to warnings and vice versa according to criteriaPeter Eisentraut2003-10-02
| | | | developed on -hackers.
* This patch fixes an obvious bug in the "should I print the duration ofBruce Momjian2003-09-29
| | | | | | | | this query?" logic in postgres.c Also, make it print "duration:" like log_duration. Neil Conway
* More message editing, some suggested by Alvaro HerreraPeter Eisentraut2003-09-29
|
* You can't NLS-enable a program component by just putting gettext() aroundPeter Eisentraut2003-09-27
| | | | | | | every string, especially if some of the output should be fixed-format machine-readable. This needs to be more carefully sorted out. Also, make the help message generated by --help-config -h be more similar in style to the others.