From: Fujii Masao <masao.fujii@gmail.com>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Andrew Dunstan <andrew@dunslane.net>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: Re: [COMMITTERS] pgsql: Map basebackup tablespaces using a tablespace_map file
Date: Wed, 9 Sep 2015 22:13:04 +0900
Message-ID: <CAHGQGwE1D_JD7Uc7ny_9ScaMn8VQf2uL6YZ2v_FsTi2J7oZmAg@mail.gmail.com> (raw)
In-Reply-To: <CAA4eK1+KD3g3WLQUgEfqY+ApxQ=_0ygXt=SR91Tp72KEbqH1Aw@mail.gmail.com>
References: <E1YsASW-0000Aa-Ut@gemulon.postgresql.org>
<CAHGQGwFB+qR+y8r3Gjv+ZCGgU+J_G8ECPQOf5+Nanm9eGXmOTg@mail.gmail.com>
<CAA4eK1Lb1j8BpT9SgKviZRMVPbZxiFcni1CtYgG6TW6ynAjDtQ@mail.gmail.com>
<CAHGQGwHjBvnqiqMc1Gn3Qywk4ZUMX51_XikreKj7Jthpc2euVQ@mail.gmail.com>
<CAA4eK1+yA6d4EVXt3VWBVJ6hg-yU2Y+Q6qZNYwoVCR4-SAWGmw@mail.gmail.com>
<CAHGQGwHFXyZuNd-_aev+L6-FJwqk50vKyy1jmY0eNy0dEQZbiQ@mail.gmail.com>
<CAA4eK1+VAikW56kD1cV=237K8+XPatw0VXT_UNeab8T+Y0z2XA@mail.gmail.com>
<CAA4eK1Lf7qBgKmRYbs1hje9i8RBYe5-nO_a1TT+TY_Aj-6O1Mw@mail.gmail.com>
<CA+Tgmoa66DQy=LYYr7vSVpkUEK79ec-uRC3p3VL+iwwe1KbEgg@mail.gmail.com>
<CAA4eK1Lb1DLNf9HB-TZho4N92BvtTBaqCHh+0JwCWwtATi9qEw@mail.gmail.com>
<20150702141409.GL3289@postgresql.org>
<CAA4eK1JNhY6UhH5VQXDWvGYHd3VGyBDT+wqbyvH6BrXEZufotg@mail.gmail.com>
<CAHGQGwEd2an6Cv2ikXHnf37XG53RQicEBqGuW+Bi0YkWYezNiw@mail.gmail.com>
<CA+TgmoY=ad64xAhfEU_s2mQ0atwTW4T=QNaftvyTrZXqR8X_uA@mail.gmail.com>
<CAA4eK1+UroR1-Qf-u93KbvNWe9mXj4rVhupri9t8oQFxtRSG8w@mail.gmail.com>
<CAHGQGwG6YPSvYZHPFxQY+zUe3EN_Xz77FLgTKe5yxXCC44VOTw@mail.gmail.com>
<CAA4eK1Kh9WCgG4Uhu3QzEoJVDOrNB=DKEu3HeYOy0dE03uSAiA@mail.gmail.com>
<CAHGQGwEetDpbVwuYMmfgUg9CHY5XF6hAFLgH6Rc8zpc2qtrssA@mail.gmail.com>
<CAA4eK1+KD3g3WLQUgEfqY+ApxQ=_0ygXt=SR91Tp72KEbqH1Aw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
On Fri, Sep 4, 2015 at 4:48 PM, Amit Kapila <amit.kapila16@gmail.com> wrote:
> On Thu, Sep 3, 2015 at 6:07 PM, Fujii Masao <masao.fujii@gmail.com> wrote:
>>
>> On Tue, Aug 4, 2015 at 12:15 PM, Amit Kapila <amit.kapila16@gmail.com>
>> wrote:
>> > On Mon, Aug 3, 2015 at 7:44 PM, Fujii Masao <masao.fujii@gmail.com>
>> > wrote:
>> >> ISTM that we can
>> >> see that the online backup mode has already been canceled if
>> >> backup_label
>> >> file
>> >> is successfully removed whether tablespace_map file remains or not. No?
>> >>
>> >
>> > I think what we should do is that display successful cancellation
>> > message
>> > only when both the files are renamed.
>>
>> Please imagine the case where backup_label was successfully renamed
>> but tablespace_map was not. Even in this case, I think that we can see
>> that the backup mode was canceled because the remaining tablespace_map
>> file will be ignored in the subsequent recovery.
>
> Right.
>
>>
>> So we should emit
>> the successful cancellation message when backup_label is renamed
>> whether tablespace_map is successfully renamed or not?
>>
>
> You mean to say, just try renaming tablespace_map and don't display any
> message whether that is successful or not-successful?
>
> I see some user inconvenience if we do this way, which is even after the
> backup is cancelled, on next recovery, there will be a log message
> indicating
> either rename of tablespace_map successful or unsuccessful. Also, don't you
> think it is better to let user know that the tablespace_map file is
> successfully
> renamed as we do for backup_label file. Shall we change the patch such that
> if backup_label is successfully renamed and renaming of tablespace_map
> gets failed, then display a log message to something like below:
>
> LOG: online backup mode canceled
> DETAIL: "backup_label" was renamed to "backup_label.old", could not rename
> "tablespace_map" to "tablespace_map.old"
Agreed with this direction. So what about the attached patch?
Regards,
--
Fujii Masao
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackersAttachments:improve_cancelbackup_messages_v1.patch (text/x-patch, 2.3K) downloaddiff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.cindex 127bc58..c2a1d51 100644--- a/src/backend/access/transam/xlog.c+++ b/src/backend/access/transam/xlog.c@@ -10911,32 +10911,32 @@ CancelBackup(void)
{
struct stat stat_buf;
- /* if the file is not there, return */+ /* if the backup_label file is not there, return */
if (stat(BACKUP_LABEL_FILE, &stat_buf) < 0)
return;
/* remove leftover file from previously canceled backup if it exists */
unlink(BACKUP_LABEL_OLD);
- if (rename(BACKUP_LABEL_FILE, BACKUP_LABEL_OLD) == 0)- {- ereport(LOG,- (errmsg("online backup mode canceled"),- errdetail("\"%s\" was renamed to \"%s\".",- BACKUP_LABEL_FILE, BACKUP_LABEL_OLD)));- }- else+ if (rename(BACKUP_LABEL_FILE, BACKUP_LABEL_OLD) != 0)
{
ereport(WARNING,
(errcode_for_file_access(),
errmsg("online backup mode was not canceled"),
- errdetail("Could not rename \"%s\" to \"%s\": %m.",+ errdetail("\"%s\" could not be renamed to \"%s\": %m.",
BACKUP_LABEL_FILE, BACKUP_LABEL_OLD)));
+ return;
}
/* if the tablespace_map file is not there, return */
if (stat(TABLESPACE_MAP, &stat_buf) < 0)
+ {+ ereport(LOG,+ (errmsg("online backup mode canceled"),+ errdetail("\"%s\" was renamed to \"%s\".",+ BACKUP_LABEL_FILE, BACKUP_LABEL_OLD)));
return;
+ }
/* remove leftover file from previously canceled backup if it exists */
unlink(TABLESPACE_MAP_OLD);
@@ -10945,15 +10945,19 @@ CancelBackup(void)
{
ereport(LOG,
(errmsg("online backup mode canceled"),
- errdetail("\"%s\" was renamed to \"%s\".",- TABLESPACE_MAP, TABLESPACE_MAP_OLD)));+ errdetail("\"%s\" and \"%s\" were renamed to "+ "\"%s\" and \"%s\", respectively.",+ BACKUP_LABEL_FILE, TABLESPACE_MAP,+ BACKUP_LABEL_OLD, TABLESPACE_MAP_OLD)));
}
else
{
ereport(WARNING,
(errcode_for_file_access(),
- errmsg("online backup mode was not canceled"),- errdetail("Could not rename \"%s\" to \"%s\": %m.",+ errmsg("online backup mode canceled"),+ errdetail("\"%s\" was renamed to \"%s\", "+ "but \"%s\" could not be renamed to \"%s\": %m.",+ BACKUP_LABEL_FILE, BACKUP_LABEL_OLD,
TABLESPACE_MAP, TABLESPACE_MAP_OLD)));
}
}
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: masao.fujii@gmail.com, amit.kapila16@gmail.com, robertmhaas@gmail.com, alvherre@2ndquadrant.com, andrew@dunslane.net, pgsql-hackers@postgresql.org
Subject: Re: [COMMITTERS] pgsql: Map basebackup tablespaces using a tablespace_map file
In-Reply-To: <CAHGQGwE1D_JD7Uc7ny_9ScaMn8VQf2uL6YZ2v_FsTi2J7oZmAg@mail.gmail.com>
References: <E1YsASW-0000Aa-Ut@gemulon.postgresql.org> <CAA4eK1+VAikW56kD1cV=237K8+XPatw0VXT_UNeab8T+Y0z2XA@mail.gmail.com> <CAA4eK1Lf7qBgKmRYbs1hje9i8RBYe5-nO_a1TT+TY_Aj-6O1Mw@mail.gmail.com> <CA+Tgmoa66DQy=LYYr7vSVpkUEK79ec-uRC3p3VL+iwwe1KbEgg@mail.gmail.com> <CAA4eK1Lb1DLNf9HB-TZho4N92BvtTBaqCHh+0JwCWwtATi9qEw@mail.gmail.com> <20150702141409.GL3289@postgresql.org> <CAA4eK1JNhY6UhH5VQXDWvGYHd3VGyBDT+wqbyvH6BrXEZufotg@mail.gmail.com> <CAHGQGwEd2an6Cv2ikXHnf37XG53RQicEBqGuW+Bi0YkWYezNiw@mail.gmail.com> <CA+TgmoY=ad64xAhfEU_s2mQ0atwTW4T=QNaftvyTrZXqR8X_uA@mail.gmail.com> <CAA4eK1+UroR1-Qf-u93KbvNWe9mXj4rVhupri9t8oQFxtRSG8w@mail.gmail.com> <CAHGQGwG6YPSvYZHPFxQY+zUe3EN_Xz77FLgTKe5yxXCC44VOTw@mail.gmail.com> <CAA4eK1Kh9WCgG4Uhu3QzEoJVDOrNB=DKEu3HeYOy0dE03uSAiA@mail.gmail.com> <CAHGQGwEetDpbVwuYMmfgUg9CHY5XF6hAFLgH6Rc8zpc2qtrssA@mail.gmail.com> <CAA4eK1+KD3g3WLQUgEfqY+ApxQ=_0ygXt=SR91Tp72KEbqH1Aw@mail.gmail.com> <CAHGQGwE1D_JD7Uc7ny_9ScaMn8VQf2uL6YZ2v_FsTi2J7oZmAg@mail.gmail.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