From: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
---|---|
To: | hlinnaka(at)iki(dot)fi |
Cc: | Venkata Balaji N <nag1010(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Borodin Vladimir <root(at)simply(dot)name>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Streaming replication and WAL archive interactions |
Date: | 2015-04-21 06:53:22 |
Message-ID: | CAB7nPqQE179yogtg+nKvdwt9KROxTyt-EjumKOMbuXQtea5r3w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Apr 16, 2015 at 8:57 PM, Heikki Linnakangas wrote:
> Oh, hang on, that's not necessarily true. On promotion, the standby
archives
> the last, partial WAL segment from the old timeline. That's just wrong
> (http://www.postgresql.org/message-id/52FCD37C.3070806@vmware.com) and in
> fact I somehow thought I changed that already, but apparently not. So
let's
> stop doing that.
Er. Are you planning to prevent the standby from archiving the last partial
segment from the old timeline at promotion? I thought from previous
discussions that we should do it as master (be it crashed, burned, burried
or dead) may not have the occasion to do it. By preventing its archiving
you close the door to the case where master did not have the occasion to
archive it.
+/* */
+static char primary_last_archived[MAX_XFN_CHARS + 1];
This is visibly missing a comment.
As primary_last_archived is used only by ProcessArchivalReport(), wouldn't
it be better to pass it as argument to this function?
+ /* Check that the filename the primary reported looks valid */
+ if (strlen(primary_last_archived) < 24 ||
+ strspn(primary_last_archived, "0123456789ABCDEF") != 24)
+ return;
Not related to this patch, but we had better have a macro doing this job I
think... It keeps spreading around.
People may be surprised that a base backup taken from a node that has
archive_mode = on set (that's the case in a very large number of cases)
will not be able to work as-is as node startup will fail as follows:
FATAL: archive_mode='on' cannot be used in archive recovery
HINT: Use 'shared' or 'always' mode instead.
One idea would be to simply ignore the fact that archive_mode = on on nodes
in recovery instead of dropping an error. Note that I like the fact that it
drops an error as that's clear, I just point the fact that people may be
surprised that base backups are not working anymore now in this case.
Are both WalSndArchivalReport() and WalSndArchivalReportIfNecessary()
really necessary? I think that for simplicity you could merge them and use
last_archival_report as a local variable.
Creating a dependency between the pgstat machinery and the WAL sender looks
weak to me. For example with this patch a master cannot stop, as it waits
indefinitely:
LOG: using stale statistics instead of current ones because stats
collector is not responding
LOG: sending archival report:
You could scan archive_status/ but that would be costly if there are many
entries to scan and I think that walsender should be highly responsive. Or
you could directly store the name of the lastly archived WAL segment marked
as .done in let's say archive_status/last_archived. An entry for that in
the control file does not seem the right place as a node may not have
archive_mode enabled that's why I am not mentioning it.
Regards,
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2015-04-21 07:19:00 | Re: PATCH: Add 'pid' column to pg_replication_slots |
Previous Message | Andres Freund | 2015-04-21 06:39:37 | Re: Freeze avoidance of very large table. |