From: | Adam Lee <ali(at)pivotal(dot)io> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Cc: | Heikki Linnakangas <hlinnakangas(at)pivotal(dot)io>, Daniel Gustafsson <dgustafsson(at)pivotal(dot)io>, Ming Li <mli(at)pivotal(dot)io> |
Subject: | Should we nonblocking open FIFO files in COPY? |
Date: | 2017-12-22 06:10:36 |
Message-ID: | 20171222061036.GH1335@rmbp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
I have an issue that COPY from a FIFO, which has no writers, could not be
canceled, because COPY invokes AllocateFile() -> fopen() -> blocking open().
```
[postgres(at)s1 ~]$ mkfifo /tmp/test0
[postgres(at)s1 ~]$ /usr/local/pgsql/bin/psql test
psql (11devel)
Type "help" for help.
test=# create table test(t text);
CREATE TABLE
test=# copy test from '/tmp/test0';
^CCancel request sent
^CCancel request sent
^CCancel request sent
^CCancel request sent
^CCancel request sent
^CCancel request sent
...
```
Should we nonblocking open FIFO files?
And a following question if we nonblocking open them, say there is a
FIFO file, no one will write into it, and a utility calls `COPY FROM`
it, should we just return `COPY 0` or wait writers? If we wait, then
users have to interrupt or write an EOF into the FIFO after a timeout,
I see some utilities do that, gptransfer for instance, just seems not
right.
My plan is to write a new function which nonblocking opens FIFOs just
for COPY, and not waits writers, what do you think?
--
Adam Lee
From | Date | Subject | |
---|---|---|---|
Next Message | Feike Steenbergen | 2017-12-22 06:49:34 | Re: Fix permissions check on pg_stat_get_wal_senders |
Previous Message | Michael Paquier | 2017-12-22 06:07:00 | Re: reassure me that it's good to copy pg_control last in a base backup |