Re: [PATCH] Initial progress reporting for COPY command
От | Josef Šimánek |
---|---|
Тема | Re: [PATCH] Initial progress reporting for COPY command |
Дата | |
Msg-id | CAFp7QwrcoxXNokBR1d9O=uM3QdH=W3cxhYxNEtkVufeUd1nONw@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: [PATCH] Initial progress reporting for COPY command (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>) |
Ответы |
Re: [PATCH] Initial progress reporting for COPY command
|
Список | pgsql-hackers |
po 15. 6. 2020 v 7:34 odesílatel Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> napsal:
> I'm using ftell to get current position in file to populate file_bytes_processed without error handling (ftell can return -1L and also populate errno on problems).
>
> 1. Is that a good way to get progress of file processing?
IMO, it's better to handle the error cases. One possible case where
ftell can return -1 and set errno is when the total bytes processed is
more than LONG_MAX.
Will your patch handle file_bytes_processed reporting for COPY FROM
STDIN cases? For this case, ftell can't be used.
Instead of using ftell and worrying about the errors, a simple
approach could be to have a uint64 variable in CopyStateData to track
the number of bytes read whenever CopyGetData is called. This approach
can also handle the case of COPY FROM STDIN.
Thanks for suggestion. I used this approach and latest patch supports both STDIN and STDOUT now.
With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com
В списке pgsql-hackers по дате отправления: