On 03/12/2015 08:49 AM, Amit Kapila wrote:
> With attached modified script, I am able to reproduce the
> error (I have used the latest pg_rewind patch (pg_rewind-bin-8))
Thanks! That reproduced the error for me too. Not sure why I couldn't
reproduce it earlier.
The cause was a silly typo in truncate_target_file:
> @@ -397,7 +397,7 @@ truncate_target_file(const char *path, off_t newsize)
>
> snprintf(dstpath, sizeof(dstpath), "%s/%s", datadir_target, path);
>
> - fd = open(path, O_WRONLY, 0);
> + fd = open(dstpath, O_WRONLY, 0);
> if (fd < 0)
> pg_fatal("could not open file \"%s\" for truncation: %s\n",
> dstpath, strerror(errno));
Attached is a new version of the patch, including that fix, and rebased
over current git master.
- Heikki