Re: Backup command and functions can cause assertion failure and segmentation fault

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Backup command and functions can cause assertion failure and segmentation fault
Date: 2022-07-01 06:32:50
Message-ID: 6a759108-a02c-34fd-856c-d7c09d29d2ba@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2022/07/01 15:09, Masahiko Sawada wrote:
> The change looks good to me. I've also confirmed the change fixed the issues.

Thanks for the review and test!

> @@ -233,6 +233,12 @@ perform_base_backup(basebackup_options *opt, bbsink *sink)
> StringInfo labelfile;
> StringInfo tblspc_map_file;
> backup_manifest_info manifest;
> + SessionBackupState status = get_backup_status();
> +
> + if (status == SESSION_BACKUP_RUNNING)
> + ereport(ERROR,
> + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
> + errmsg("a backup is already in progress in this session")));
>
> I think we can move it to the beginning of SendBaseBackup() so we can
> avoid bbsink initialization and cleanup in the error case.

Sounds good idea to me. I updated the patch in that way. Attached.

Regards,

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

Attachment Content-Type Size
fix_assertion_failure_and_segv_when_backup_v2.patch text/plain 1009 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2022-07-01 06:41:42 Re: Backup command and functions can cause assertion failure and segmentation fault
Previous Message Amit Langote 2022-07-01 06:22:42 Eliminating SPI from RI triggers - take 2