Thread
-
postgres startup script modification (Linux RedHat)
Daniel Péder <dpeder@infoset.cz> — 1999-09-24T09:45:32Z
This modification eleminates the case described below: If PostgreSQL (probaly with Linux) was shut down wrong way (power off, any other damage, kill, etc... ) it left opened the file(socket) /tmp/.s.PGSQL.5432 . It is found by Postmaster's next start with message: === Starting postgresql service: FATAL: StreamServerPort: bind() failed: errno=98 Is another postmaster already running on that port? If not, remove socket node (/tmp/.s.PGSQL.<portnr>)and retry. /usr/bin/postmaster: cannot create UNIX stream port === so, You are in situation that Linux was completely started, all services are running ok except the postgres - and if You miss it, Your server can be running hours without poperly serving the database. = = = = = If You find it usefull, make following modification to the file: /etc/rc.d/init.d/postgresql on Your RedHat Linux (other Linux or Unix versions will probably need some changes in locations, filenames etc...) Begin of the changed lines is marked # [B] added by daniel.peder@infoset.cz End is marked # [E] added by daniel.peder@infoset.cz other text stuff was left for Your better orientation where put the changes... so here we are: ====================================================== #!/bin/sh ... ... [ -f /usr/bin/postmaster ] || exit 0 # See how we were called. case "$1" in start) # [B] added by daniel.peder@infoset.cz echo -n "Checking status of last postgresql service shutdown: " psql_socket="/tmp/.s.PGSQL.5432" if [ -e $psql_socket -a "`pidof postmaster`" = "" ]; then rm -f $psql_socket echo "incorrect" else echo "correct" fi # [E] added by daniel.peder@infoset.cz echo -n "Starting postgresql service: " su postgres -c '/usr/bin/postmaster -S -D/var/lib/pgsql' sleep 1 pid=`pidof postmaster` echo -n "postmaster [$pid]" touch /var/lock/subsys/postmaster echo ;; stop) echo -n "Stopping postgresql service: " killproc postmaster sleep 2 rm -f /var/lock/subsys/postmaster echo ;;... ... ====================================================== -- dpeder@infoset.cz Daniel Peder http://shop.culture.cz >From bouncefilter Fri Sep 24 09:11:15 1999 Received: from trends.net (clio.trends.ca [209.47.148.2]) by hub.org (8.9.3/8.9.3) with ESMTP id JAA02617 for <pgsql-hackers@postgresql.org>; Fri, 24 Sep 1999 09:11:10 -0400 (EDT) (envelope-from Inoue@tpf.co.jp) Received: from sd.tpf.co.jp (sd.tpf.co.jp [210.161.239.34]) by trends.net (8.8.8/8.8.8) with ESMTP id FAA15539 for <pgsql-hackers@postgresql.org>; Fri, 24 Sep 1999 05:45:05 -0400 (EDT) Received: from cadzone ([126.0.1.40] (may be forged)) by sd.tpf.co.jp (2.5 Build 2640 (Berkeley 8.8.6)/8.8.4) with SMTP id SAA13729; Fri, 24 Sep 1999 18:42:04 +0900 From: "Hiroshi Inoue" <Inoue@tpf.co.jp> To: "Tom Lane" <tgl@sss.pgh.pa.us> Cc: "pgsql-hackers" <pgsql-hackers@postgresql.org> Subject: RE: [HACKERS] couldn't rollback cache ? Date: Fri, 24 Sep 1999 18:45:38 +0900 Message-ID: <000f01bf0671$8ece0240$2801007e@cadzone.tpf.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Importance: Normal > -----Original Message----- > From: Hiroshi Inoue [mailto:Inoue@tpf.co.jp] > Sent: Wednesday, September 22, 1999 7:12 PM > To: Tom Lane > Cc: pgsql-hackers > Subject: RE: [HACKERS] couldn't rollback cache ? > I thought about the way which neither calls HeapTupleSatis- fies() in SearchSysCache() nor invalidates syscache entry by OID. In this case,we would need the information as follows. 1. To_be_rollbacked info for the backend A list of being inserted system tuples. This list is held till end of transaction. In case of commit,this list is ignored and discarded. In case of rollback,tuples inserted after the specified savepoint are rollbacked and discarded. Syscache and relcache entries for the backend which correspond to the tuples are invalidated. 2, To_be_invalidated info for the backend A list of being deleted system tuples. This list is discarded at every command. In case of rollback this list is ignored. Otherwise,syscache and relcache entries for the backend which correspond to the tuples in this list are invalidated before execution of each command. 3. To_be_invalidated info for other backends A list of being deleted system tuples. This list is held till end of transaction. In case of commit,this list is sent to other backends and discarded. In case of rollback,tuples deleted after the specified savepoint are discarded. 4. Immediate registrarion of to_be_invalidated relcache for all backends Currently SI messages aren't sent in case of elog(ERROR/FATAL). Seems the following commands have to register relcache invali- dation for all backends just when we call smgrunlink()/smgrtruncate(). DROP TABLE/INDEX TRUNCATE TABLE(implemented by Mike Mascari) VACUUM Comments ? Hiroshi Inoue Inoue@tpf.co.jp