Re: Error while copying a large file in pg_rewind
Dilip Kumar <dilipbalaut@gmail.com>
From: Dilip Kumar <dilipbalaut@gmail.com>
To: Kuntal Ghosh <kuntalghosh.2007@gmail.com>
Cc: Michael Paquier <michael.paquier@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2017-07-06T11:51:21Z
Lists: pgsql-hackers
On Thu, Jul 6, 2017 at 4:18 PM, Kuntal Ghosh <kuntalghosh.2007@gmail.com> wrote:
> On Wed, Jul 5, 2017 at 9:35 AM, Michael Paquier
> <michael.paquier@gmail.com> wrote:
>> On Tue, Jul 4, 2017 at 4:41 PM, Kuntal Ghosh <kuntalghosh.2007@gmail.com> wrote:
>>> I've not yet started the patch and it may take some time for me to
>>> understand and write
>>> the patch in a correct way. Since, you've almost written the patch,
>>> IMHO, please go ahead
>>> and submit the patch. I'll happily review and test it. :-)
>>>
>>> Thanks for the notes.
>>
>> OK, thanks. Here you go.
>>
> Thanks for the patch. It looks good and it solves the existing issues.
>
> But, I'm little concerned/doubt regarding the following part of the code.
> +/*
> + * Converts an int64 from network byte order to native format.
> + */
> +static int64
> +pg_recvint64(int64 value)
> +{
> + union
> + {
> + int64 i64;
> + uint32 i32[2];
> + } swap;
> + int64 result;
> +
> + swap.i64 = value;
> +
> + result = (uint32) ntohl(swap.i32[0]);
> + result <<= 32;
> + result |= (uint32) ntohl(swap.i32[1]);
> +
> + return result;
> +}
> Does this always work correctly irrespective of the endianess of the
> underlying system?
I think this will have problem, we may need to do like
union
{
int64 i64;
uint8 i8[8];
} swap;
....
and reverse complete array if byte order is changed
or we can use something like "be64toh"
>
>
> --
> Thanks & Regards,
> Kuntal Ghosh
> EnterpriseDB: http://www.enterprisedb.com
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
--
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com
Commits
-
pg_rewind: Fix some problems when copying files >2GB.
- ed367be64b11 9.5.8 landed
- 73fbf3d3d0a5 9.6.4 landed
- a46fe6e8be02 10.0 landed
-
pg_rewind: Fix busted sanity check.
- c54e4a55f468 9.5.8 landed
- 0fe21602e27f 9.6.4 landed
- 063ff9210c54 10.0 landed
-
Code review for 64-bit-large-object patch.
- 26fe56481c0f 9.3.0 cited