Re: [PATCH] Initial progress reporting for COPY command - Mailing list pgsql-hackers

From Bharath Rupireddy
Subject Re: [PATCH] Initial progress reporting for COPY command
Date
Msg-id CALj2ACUnPKtKTgL9BmvT0FjFR5UTUA46pbyRDsq0wu_AkFRh+w@mail.gmail.com
Whole thread Raw
In response to [PATCH] Initial progress reporting for COPY command  (Josef Šimánek <josef.simanek@gmail.com>)
Responses Re: [PATCH] Initial progress reporting for COPY command  (Josef Šimánek <josef.simanek@gmail.com>)
List pgsql-hackers
> 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.

With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Ashutosh Bapat
Date:
Subject: Re: [POC] Fast COPY FROM command for the table with foreign partitions
Next
From: Jeff Davis
Date:
Subject: Re: hashagg slowdown due to spill changes