From owner-freebsd-bugs@FreeBSD.ORG Tue Nov 8 21:40:19 2005 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DE9CB16A423 for ; Tue, 8 Nov 2005 21:40:18 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 357B043D5D for ; Tue, 8 Nov 2005 21:40:17 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id jA8LeHOk002164 for ; Tue, 8 Nov 2005 21:40:17 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id jA8LeHUj002163; Tue, 8 Nov 2005 21:40:17 GMT (envelope-from gnats) Resent-Date: Tue, 8 Nov 2005 21:40:17 GMT Resent-Message-Id: <200511082140.jA8LeHUj002163@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Danny Howard Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 519A016A420 for ; Tue, 8 Nov 2005 21:31:45 +0000 (GMT) (envelope-from djh@nebcorp.com) Received: from ratchet.nebcorp.com (ratchet.nebcorp.com [205.217.153.72]) by mx1.FreeBSD.org (Postfix) with ESMTP id AB0D543D68 for ; Tue, 8 Nov 2005 21:31:43 +0000 (GMT) (envelope-from djh@nebcorp.com) Received: by ratchet.nebcorp.com (Postfix, from userid 1014) id 77CD1D9849; Tue, 8 Nov 2005 13:31:43 -0800 (PST) Message-Id: <20051108213143.77CD1D9849@ratchet.nebcorp.com> Date: Tue, 8 Nov 2005 13:31:43 -0800 (PST) From: Danny Howard To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: conf/88692: Amend /etc/periodic/daily/502.pgsql to restart X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Danny Howard List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2005 21:40:19 -0000 >Number: 88692 >Category: conf >Synopsis: Amend /etc/periodic/daily/502.pgsql to restart >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Nov 08 21:40:16 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Danny Howard >Release: FreeBSD 4.10-RELEASE-p3 i386 >Organization: >Environment: System: FreeBSD ratchet.nebcorp.com 4.10-RELEASE-p3 FreeBSD 4.10-RELEASE-p3 #1: Thu Nov 4 22:42:42 PST 2004 root@ratchet.nebcorp.com:/usr/obj/usr/src/sys/RATCHET i386 postgresql-client-8.0.2 PostgreSQL database (client) postgresql-server-8.0.2 The most advanced open-source database available anywhere >Description: Hello, I have several times run in to this and hear its a common problem. During regular operation, the Postgres DB server slowly leaks connections until it runs out. The simple "fix" is to up the number of connections, but this means lowering the per-connection resources available, reducing performance. Another fix is to occasionally restart the database engine, freeing up any open connections, and restoring the engine to a good state. I have accomplished this by adding the functionality to /etc/periodic/daily/502.pgsql. The attached patch should be self-explanatory. >How-To-Repeat: >Fix: *** /tmp/502.pgsql.ORIG Tue Nov 8 13:18:34 2005 --- /etc/periodic/daily/502.pgsql Tue Nov 8 13:21:22 2005 *************** *** 19,24 **** --- 19,25 ---- # daily_pgsql_vacuum_enable="YES" # do vacuum daily_pgsql_vacuum_enable="YES" + daily_pgsql_restart_enable="YES" daily_pgsql_backup_enable="NO" daily_pgsql_vacuum_args="-z" *************** *** 89,94 **** --- 90,110 ---- then echo echo "Errors were reported during vacuum." + rc=3 + fi + ;; + esac + + case "$daily_pgsql_restart_enable" in + [Yy][Ee][Ss]) + + echo + echo "restarting..." + /usr/local/etc/rc.d/010.pgsql.sh restart + if [ $? -gt 0 ] + then + echo + echo "Errors were reported during restart." rc=3 fi ;; >Release-Note: >Audit-Trail: >Unformatted: