From: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com> |
---|---|
To: | Magnus Hagander <magnus(at)hagander(dot)net> |
Cc: | Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: pg_basebackup for streaming base backups |
Date: | 2011-01-21 08:35:07 |
Message-ID: | AANLkTi=Rg6dSV14WbFp7QXOarhhzKECoq9eRurcdsvFQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Jan 19, 2011 at 1:12 PM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>>> + r = PQgetCopyData(conn, ©buf, 0);
>>> + if (r == -1)
>>>
>>> Since -1 of PQgetCopyData might indicate an error, in this case,
>>> we would need to call PQgetResult?.
>>
>> Uh, -1 means end of data, no? -2 means error?
>
> The comment in pqGetCopyData3 says
>
> /*
> * On end-of-copy, exit COPY_OUT or COPY_BOTH mode and let caller
> * read status with PQgetResult(). The normal case is that it's
> * Copy Done, but we let parseInput read that. If error, we expect
> * the state was already changed.
> */
>
> Also the comment in getCopyDataMessage says
>
> /*
> * If it's a legitimate async message type, process it. (NOTIFY
> * messages are not currently possible here, but we handle them for
> * completeness.) Otherwise, if it's anything except Copy Data,
> * report end-of-copy.
> */
>
> So I thought that. BTW, walreceiver has already done that.
When PQgetCopyData returns -1, PQgetResult should be called. This is true.
But when I read the patch again, I found that Magnus has already done that.
So my comment missed the point :( Sorry for noise.
+ res = PQgetResult(conn);
+ if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
+ {
+ fprintf(stderr, _("%s: final receive failed: %s\n"),
+ progname, PQerrorMessage(conn));
+ exit(1);
+ }
Regards,
--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center
From | Date | Subject | |
---|---|---|---|
Next Message | Joseph Adams | 2011-01-21 08:58:53 | Re: JSON data type status? |
Previous Message | Dan Ports | 2011-01-21 07:32:05 | Re: SSI and Hot Standby |