Re: pg_basebackup stream xlog to tar

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_basebackup stream xlog to tar
Date: 2016-10-25 10:12:59
Message-ID: CABUevExvpkMFuK=4_9whkr4UTyWMTz2PCTZ1NpYBOYxGZnvuGQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 24, 2016 at 7:46 AM, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
wrote:

> On Sun, Oct 23, 2016 at 10:28 PM, Magnus Hagander <magnus(at)hagander(dot)net>
> wrote:
> > It also broke the tests and invalidated some documentation. But it was
> easy
> > enough to fix.
> >
> > I've now applied this, so next time you get to do the merging :P Joking
> > aside, please review and let me know if you can spot something I messed
> up
> > in the final merge.
>
> Just had another look at it..
> +static int
> +tar_fsync(Walfile f)
> +{
> + Assert(f != NULL);
> + tar_clear_error();
> +
> + /*
> + * Always sync the whole tarfile, because that's all we can do. This
> makes
> + * no sense on compressed files, so just ignore those.
> + */
> + if (tar_data->compression)
> + return 0;
> +
> + return fsync(tar_data->fd);
> +}
> fsync() should not be called here if --no-sync is used.
>
> + /* sync the empty blocks as well, since they're after the last file */
> + fsync(tar_data->fd);
> Similarly, the fsync call of tar_finish() should not happen when
> --no-sync is used.
>

Yeah, agreed.

> + if (format == 'p')
> + stream.walmethod = CreateWalDirectoryMethod(param->xlog, do_sync);
> + else
> + stream.walmethod = CreateWalTarMethod(param->xlog,
> compresslevel, do_sync);
> LogStreamerMain() exits immediately once it is done, but I think that
> we had better be tidy here and clean up the WAL methods that have been
> allocated. I am thinking here about a potentially retry method on
> failure, though the best shot in this area would be with
> ReceiveXlogStream().
>

Wouldn't the same be needed in pg_receivexlog.c in that case?

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro HORIGUCHI 2016-10-25 10:22:52 Re: asynchronous execution
Previous Message Ashutosh Bapat 2016-10-25 09:58:07 Re: Push down more full joins in postgres_fdw