pg_recvlogical, stdout and SIGHUP
pg_recvlogical re-opens the output file on SIGHUP. If the output goes to
stdout, it will close stdout on SIGHUP. That's a bug, isn't it?
Another thing I noticed is that if when the output goes to a file, the
file isn't re-opened immediately on SIGHUP. Only after receiving some
data from the server. I believe that's also not intentional.
- Heikki
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 2014-05-13 16:31:25 +0300, Heikki Linnakangas wrote:
pg_recvlogical re-opens the output file on SIGHUP. If the output goes to
stdout, it will close stdout on SIGHUP. That's a bug, isn't it?
Yes. An annoying one at that because it'll mean a a new connection will
use that fd and we'll start writing stdout stuff to it...
Another thing I noticed is that if when the output goes to a file, the file
isn't re-opened immediately on SIGHUP. Only after receiving some data from
the server. I believe that's also not intentional.
Hm. I can't really get excited about that one. Not doing that seems to
complicate matters unneccessarily. What's the problem here?
Greetings,
Andres Freund
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 05/13/2014 04:35 PM, Andres Freund wrote:
On 2014-05-13 16:31:25 +0300, Heikki Linnakangas wrote:
Another thing I noticed is that if when the output goes to a file, the file
isn't re-opened immediately on SIGHUP. Only after receiving some data from
the server. I believe that's also not intentional.Hm. I can't really get excited about that one. Not doing that seems to
complicate matters unneccessarily. What's the problem here?
Not sure if it matters in any real-world scenario, but I found it pretty
surprising while playing with it. It should be trivial to fix; ISTM the
problem is that there is a "continue" in the loop when select() is
interrupted by signal, but the re-opening is done after the select() in
the loop. I think all you need to do is move the check for output_reopen
to the beginning of the loop.
- Heikki
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 2014-05-13 17:43:47 +0300, Heikki Linnakangas wrote:
On 05/13/2014 04:35 PM, Andres Freund wrote:
On 2014-05-13 16:31:25 +0300, Heikki Linnakangas wrote:
Another thing I noticed is that if when the output goes to a file, the file
isn't re-opened immediately on SIGHUP. Only after receiving some data from
the server. I believe that's also not intentional.Hm. I can't really get excited about that one. Not doing that seems to
complicate matters unneccessarily. What's the problem here?Not sure if it matters in any real-world scenario, but I found it pretty
surprising while playing with it. It should be trivial to fix; ISTM the
problem is that there is a "continue" in the loop when select() is
interrupted by signal, but the re-opening is done after the select() in the
loop. I think all you need to do is move the check for output_reopen to the
beginning of the loop.
Thanks for fixing and sorry for being slow :(.
Any reason you didn't also move the opening of the output file up? It
seems a bit odd to not have an output file existing every now and
then...
Greetings,
Andres Freund
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 05/15/2014 07:59 PM, Andres Freund wrote:
On 2014-05-13 17:43:47 +0300, Heikki Linnakangas wrote:
On 05/13/2014 04:35 PM, Andres Freund wrote:
On 2014-05-13 16:31:25 +0300, Heikki Linnakangas wrote:
Another thing I noticed is that if when the output goes to a file, the file
isn't re-opened immediately on SIGHUP. Only after receiving some data from
the server. I believe that's also not intentional.Hm. I can't really get excited about that one. Not doing that seems to
complicate matters unneccessarily. What's the problem here?Not sure if it matters in any real-world scenario, but I found it pretty
surprising while playing with it. It should be trivial to fix; ISTM the
problem is that there is a "continue" in the loop when select() is
interrupted by signal, but the re-opening is done after the select() in the
loop. I think all you need to do is move the check for output_reopen to the
beginning of the loop.Thanks for fixing and sorry for being slow :(.
Any reason you didn't also move the opening of the output file up? It
seems a bit odd to not have an output file existing every now and
then...
No particular reason. But that would actually be a great idea, because
currently you won't get any error you give pg_recvlogical an invalid
path, until it receives the first piece of data from the server and
tries to write it to the file. I'll go and do that.
- Heikki
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers