pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Backup command and functions can cause assertion failure and segmentation fault
Date: Fri, 1 Jul 2022 14:02:14 +0900
Message-ID: <26aa6466-5a85-6f63-dfc9-24cd1cf36502@oss.nttdata.com> (raw)
In-Reply-To: <20220701.120537.503466015850285563.horikyota.ntt@gmail.com>
References: <3374718f-9fbf-a950-6d66-d973e027f44c@oss.nttdata.com>
	<20220701.114653.401585706513489837.horikyota.ntt@gmail.com>
	<20220701.115614.908767952051113921.horikyota.ntt@gmail.com>
	<20220701.120537.503466015850285563.horikyota.ntt@gmail.com>



On 2022/07/01 12:05, Kyotaro Horiguchi wrote:
> At Fri, 01 Jul 2022 11:56:14 +0900 (JST), Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote in
>> At Fri, 01 Jul 2022 11:46:53 +0900 (JST), Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote in
>>> Please find the attached.
>>
>> Mmm. It forgot the duplicate-call prevention and query-cancel
>> handling... The first one is the same as you posted but the second one
>> is still a problem..
> 
> So this is the first cut of that.

Thanks for reviewing the patch!

+	PG_FINALLY();
+	{
  		endptr = do_pg_backup_stop(labelfile->data, !opt->nowait, &endtli);
  	}
-	PG_END_ENSURE_ERROR_CLEANUP(do_pg_abort_backup, BoolGetDatum(false));
-
+	PG_END_TRY();

This change makes perform_base_backup() call do_pg_backup_stop() even when an error is reported while taking a backup, i.e., between PG_TRY() and PG_FINALLY(). Why do_pg_backup_stop() needs to be called in such an error case? It not only cleans up the backup state but also writes the backup-end WAL record, waits for WAL archiving. In an error case, I think that only the cleanup of the backup state is necessary. So it seems ok to use do_pg_abort_backup() in that case, as it is for now.

So I'm still thinking that the patch I posted is simpler and enough.

Regards,

-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION





view thread (18+ messages)  latest in thread

Message-ID: <26aa6466-5a85-6f63-dfc9-24cd1cf36502@oss.nttdata.com>
Permalink:  ../26aa6466-5a85-6f63-dfc9-24cd1cf36502@oss.nttdata.com/
Also on:    postgresql.org/message-id/26aa6466-5a85-6f63-dfc9-24cd1cf36502@oss.nttdata.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: masao.fujii@oss.nttdata.com, horikyota.ntt@gmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: Backup command and functions can cause assertion failure and segmentation fault
  In-Reply-To: <26aa6466-5a85-6f63-dfc9-24cd1cf36502@oss.nttdata.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox