[GENERAL] Acting on dropped/timed-out connections

2005-09-08 Thread Milen A. Radev
Hi list!

We have a daemon programme that acts as a pgsql client. It writes in a
DB the status of its own clients. And we have a different daemon that
needs to read that status information and decide upon it. The problem
is that the first daemon is a little fragile and from time to time it
crashes. I need to be able to monitor its connection to the PgSQL and
if it drops (times-out) to mark the status of all of its clients as
unavailable or unknown.

At first I thought about attaching a trigger to pg_stat_activity
table, so on delete I could take action. The only problem was it is
not a table.

Any ideas?


-- 
Milen A. Radev

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


Re: [GENERAL] Acting on dropped/timed-out connections

2005-09-08 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2005-09-08 11:31:25 +0300:
 We have a daemon programme that acts as a pgsql client. It writes in a
 DB the status of its own clients. And we have a different daemon that
 needs to read that status information and decide upon it. The problem
 is that the first daemon is a little fragile and from time to time it
 crashes. I need to be able to monitor its connection to the PgSQL and
 if it drops (times-out) to mark the status of all of its clients as
 unavailable or unknown.

Do you prefer knowing that the daemon failed, or having it
automaticly restarted the very same moment it crashes? If the
latter, take a look at djb's daemontools, or one of its open source
lookalikes (http://smarden.org/runit/,
http://offog.org/code/freedt.html).

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [GENERAL] Acting on dropped/timed-out connections

2005-09-08 Thread Milen A. Radev
On 08/09/05, Roman Neuhauser [EMAIL PROTECTED] wrote:
 # [EMAIL PROTECTED] / 2005-09-08 11:31:25 +0300:
  We have a daemon programme that acts as a pgsql client. It writes in a
  DB the status of its own clients. And we have a different daemon that
  needs to read that status information and decide upon it. The problem
  is that the first daemon is a little fragile and from time to time it
  crashes. I need to be able to monitor its connection to the PgSQL and
  if it drops (times-out) to mark the status of all of its clients as
  unavailable or unknown.
 
 Do you prefer knowing that the daemon failed, or having it
 automaticly restarted the very same moment it crashes? If the
 latter, take a look at djb's daemontools, or one of its open source
 lookalikes (http://smarden.org/runit/,
 http://offog.org/code/freedt.html).
 

It's the former - in this case I'm not responsible (read I don't
care) about the daemon. I care about the (reasonable) veracity of the
data in the DB.


-- 
Milen A. Radev

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq