Thread: pgsql: Split off functions related to timeline history files and XLOG a

pgsql: Split off functions related to timeline history files and XLOG a

From
Heikki Linnakangas
Date:
Split off functions related to timeline history files and XLOG archiving.

This is just refactoring, to make the functions accessible outside xlog.c.
A followup patch will make use of that, to allow fetching timeline history
files over streaming replication.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/d5497b95f3ca2fc50c6eef46d3394ab6e6855956

Modified Files
--------------
src/backend/access/transam/Makefile      |    3 +-
src/backend/access/transam/timeline.c    |  378 ++++++++++++
src/backend/access/transam/xlog.c        |  988 ++----------------------------
src/backend/access/transam/xlogarchive.c |  572 +++++++++++++++++
src/include/access/timeline.h            |   23 +
src/include/access/xlog_internal.h       |   23 +
6 files changed, 1058 insertions(+), 929 deletions(-)


Re: pgsql: Split off functions related to timeline history files and XLOG a

From
Simon Riggs
Date:
On 2 October 2012 11:39, Heikki Linnakangas <heikki.linnakangas@iki.fi> wrote:
> Split off functions related to timeline history files and XLOG archiving.
>
> This is just refactoring, to make the functions accessible outside xlog.c.
> A followup patch will make use of that, to allow fetching timeline history
> files over streaming replication.

Looks good.

--
 Simon Riggs                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


Heikki Linnakangas <heikki.linnakangas@iki.fi> writes:
> Split off functions related to timeline history files and XLOG archiving.

A large fraction of the buildfarm doesn't like this patch --- looks like
you omitted some system headers that are required on only some
platforms.

            regards, tom lane


Re: pgsql: Split off functions related to timeline history files and XLOG a

From
Heikki Linnakangas
Date:
On 02.10.2012 16:50, Tom Lane wrote:
> Heikki Linnakangas<heikki.linnakangas@iki.fi>  writes:
>> Split off functions related to timeline history files and XLOG archiving.
>
> A large fraction of the buildfarm doesn't like this patch --- looks like
> you omitted some system headers that are required on only some
> platforms.

Fixed, I hope..

- Heikki


Re: pgsql: Split off functions related to timeline history files and XLOG a

From
Fujii Masao
Date:
On Tue, Oct 2, 2012 at 7:39 PM, Heikki Linnakangas
<heikki.linnakangas@iki.fi> wrote:
> Split off functions related to timeline history files and XLOG archiving.
>
> This is just refactoring, to make the functions accessible outside xlog.c.
> A followup patch will make use of that, to allow fetching timeline history
> files over streaming replication.

+ * The files are named like "<WAL segment>.history". For example, if the
+ * database starts up and switches to timeline 5, while processing WAL
+ * segment 000000030000002A00000006 (the old timeline was 3), the timeline
+ * history file would be called "000000050000002A00000006.history".

This comment is incorrect. Correctly the name of the timeline history file is
like "<first eight digits of WAL segment>.history". So in that example,
the timeline history file would be called "00000005.history". Or, are you
planning to change the name of the timeline history file in the followup
patch?

The call of XLogArchiveNotify() for the timeline history file was removed
from writeTimelineHistory(). Why do we need to do this? This change
seems to prevent the timeline history file from being archived at all.

Regards,

--
Fujii Masao


Re: pgsql: Split off functions related to timeline history files and XLOG a

From
Heikki Linnakangas
Date:
On 02.10.2012 21:12, Fujii Masao wrote:
> + * The files are named like "<WAL segment>.history". For example, if the
> + * database starts up and switches to timeline 5, while processing WAL
> + * segment 000000030000002A00000006 (the old timeline was 3), the timeline
> + * history file would be called "000000050000002A00000006.history".
>
> This comment is incorrect. Correctly the name of the timeline history file is
> like "<first eight digits of WAL segment>.history". So in that example,
> the timeline history file would be called "00000005.history". Or, are you
> planning to change the name of the timeline history file in the followup
> patch?
>
> The call of XLogArchiveNotify() for the timeline history file was removed
> from writeTimelineHistory(). Why do we need to do this? This change
> seems to prevent the timeline history file from being archived at all.

Hmm, I moved that call to the caller of writeTimeLineHistory at some
point, but seems it was lost altogether in the end. I didn't mean to
change behavior.

Fixed both issues, thanks.

- Heikki