Re: pg_basebackup stream xlog to tar - Mailing list pgsql-hackers

From Magnus Hagander
Subject Re: pg_basebackup stream xlog to tar
Date
Msg-id CABUevExvpkMFuK=4_9whkr4UTyWMTz2PCTZ1NpYBOYxGZnvuGQ@mail.gmail.com
Whole thread Raw
In response to Re: pg_basebackup stream xlog to tar  (Michael Paquier <michael.paquier@gmail.com>)
Responses Re: pg_basebackup stream xlog to tar
List pgsql-hackers
On Mon, Oct 24, 2016 at 7:46 AM, Michael Paquier <michael.paquier@gmail.com> wrote:
On Sun, Oct 23, 2016 at 10:28 PM, Magnus Hagander <magnus@hagander.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?

--

pgsql-hackers by date:

Previous
From: Ashutosh Bapat
Date:
Subject: Re: Push down more full joins in postgres_fdw
Next
From: Kyotaro HORIGUCHI
Date:
Subject: Re: asynchronous execution