Re: fixing LISTEN/NOTIFY - Mailing list pgsql-hackers

From Tom Lane
Subject Re: fixing LISTEN/NOTIFY
Date
Msg-id 736.1128805162@sss.pgh.pa.us
Whole thread Raw
In response to Re: fixing LISTEN/NOTIFY  ("Jim C. Nasby" <jnasby@pervasive.com>)
Responses Re: fixing LISTEN/NOTIFY
Re: fixing LISTEN/NOTIFY
List pgsql-hackers
"Jim C. Nasby" <jnasby@pervasive.com> writes:
> Maybe I'm missing something, but is it possible to ensure notifications
> aren't lost using Heikki's method, since everything's only in shared
> memory? Or is the idea that stuff would not survive a backend crash?

Listen/notify state has never survived a crash (since it is defined in
terms of PIDs that will no longer exist after a DB restart), and I don't
really see any reason why we'd want it to.  An application reconnecting
after a DB crash would have to assume it might have missed some
notifications occurring before it could reconnect, and would have to
re-determine what the database state is anyway.

But I think you might be confusing that with the feature-or-bug
(depending on one's point of view) that duplicate notifications can be
merged into one event.  I'm inclined to preserve that behavior,
primarily because not doing so would create a tremendous penalty on
applications that expect it to work that way.  With addition of payload
data it'd be easy for apps that don't want merging to prevent it: just
add an otherwise-uninteresting serial number to the payload string.
We'd certainly want to define the "duplicate" test to consider the
payload string as well as the topic name.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Jim C. Nasby"
Date:
Subject: Re: Vote needed: revert beta2 changes or not?
Next
From: "Jim C. Nasby"
Date:
Subject: Re: Vote needed: revert beta2 changes or not?