Re: Using pg_rewind for differential backup

Lists: pgsql-hackers
From: Sameer Kumar <sameer(dot)kumar(at)ashnik(dot)com>
To: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>, heikki(dot)linnakangas(at)iki(dot)fi
Subject: Using pg_rewind for differential backup
Date: 2014-11-27 12:39:12
Message-ID: CADp-Sm7D4dN6Ntjt_-4xiv17C0TVOT19HMUjSDJnX9-yextJFQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Can we tweak pg_rewind to take differential backups in PostgreSQL?

I was wondering can we hack the pg_rewind code to print the details of the
file which have been modified compared to a target server.
The list output can then be used for taking differential backups.

Or perhaps we can add an option/switch in pg_rewind --action

--action=print ---> would print the files which have changed
--action=sync ---> would sync them
--action=copy ---> with this option I can specify an additional optino
--target-dir where I can copy the files which have changed blocks

pg_rewind-
https://github.com/vmware/pg_rewind

Best Regards,

*Sameer Kumar | Database Consultant*

*ASHNIK PTE. LTD.*

101 Cecil Street, #11-11 Tong Eng Building, Singapore 069533

M: *+65 8110 0350 <%2B65%208110%200350>* T: +65 6438 3504 | www.ashnik.com

*[image: icons]*

[image: Email patch] <http://www.ashnik.com/>

This email may contain confidential, privileged or copyright material and
is solely for the use of the intended recipient(s).


From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Sameer Kumar <sameer(dot)kumar(at)ashnik(dot)com>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>, heikki(dot)linnakangas(at)iki(dot)fi
Subject: Re: Using pg_rewind for differential backup
Date: 2014-11-28 07:30:02
Message-ID: CAB7nPqQEJmXMkq8ENaY+k8dL9nmC8GQEXHaYL5zU+Oi814TV1A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Nov 27, 2014 at 9:39 PM, Sameer Kumar <sameer(dot)kumar(at)ashnik(dot)com>
wrote:

> Can we tweak pg_rewind to take differential backups in PostgreSQL?
> I was wondering can we hack the pg_rewind code to print the details of the
> file which have been modified compared to a target server. The list output
> can then be used for taking differential backups.
>
> Or perhaps we can add an option/switch in pg_rewind --action
>
> --action=print ---> would print the files which have changed
> --action=sync ---> would sync them
> --action=copy ---> with this option I can specify an additional optino
> --target-dir where I can copy the files which have changed
>

This discussion is not really adapted on hackers as pg_rewind is not
included in Postgres core code. Please let's discuss your proposal there.
Btw, pg_rewind is not aimed to be used as a tool for a backup facility. You
may find easier to use existing backup solutions instead, or help out with
an in-core solution. There was actually not so long ago a patch to
implement in-core differential backups, with a part called profiles able to
fetch back the list of files modified since a given LSN point (only an
improvement of the core feature though as that's not mandatory to make the
machinery work). The patch has not been added to any of the recent commit
fests though.
Regards,
--
Michael


From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Sameer Kumar <sameer(dot)kumar(at)ashnik(dot)com>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>, <heikki(dot)linnakangas(at)iki(dot)fi>
Subject: Re: Using pg_rewind for differential backup
Date: 2014-11-28 07:49:55
Message-ID: 54782923.6010503@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 11/28/2014 09:30 AM, Michael Paquier wrote:
> On Thu, Nov 27, 2014 at 9:39 PM, Sameer Kumar <sameer(dot)kumar(at)ashnik(dot)com>
> wrote:
>
>> Can we tweak pg_rewind to take differential backups in PostgreSQL?
>> I was wondering can we hack the pg_rewind code to print the details of the
>> file which have been modified compared to a target server. The list output
>> can then be used for taking differential backups.
>>
>> Or perhaps we can add an option/switch in pg_rewind --action
>>
>> --action=print ---> would print the files which have changed
>> --action=sync ---> would sync them
>> --action=copy ---> with this option I can specify an additional optino
>> --target-dir where I can copy the files which have changed
>>
>
> This discussion is not really adapted on hackers as pg_rewind is not
> included in Postgres core code. Please let's discuss your proposal there.
> Btw, pg_rewind is not aimed to be used as a tool for a backup facility. You
> may find easier to use existing backup solutions instead, or help out with
> an in-core solution.

It also would be quite straightforward to write a separate tool to do
just that. Would be better than conflating pg_rewind with this. You
could use pg_rewind as the basis for it - it's under the same license as
PostgreSQL.

- Heikki


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Sameer Kumar <sameer(dot)kumar(at)ashnik(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>, "heikki(dot)linnakangas" <heikki(dot)linnakangas(at)iki(dot)fi>
Subject: Re: Using pg_rewind for differential backup
Date: 2014-12-02 17:32:46
Message-ID: CA+TgmoZkRJPtXJg-fVEVC7w7cft4gY5T9nFp93dKnVL6bC9H=w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Nov 28, 2014 at 2:49 AM, Heikki Linnakangas
<hlinnakangas(at)vmware(dot)com> wrote:
> It also would be quite straightforward to write a separate tool to do just
> that. Would be better than conflating pg_rewind with this. You could use
> pg_rewind as the basis for it - it's under the same license as PostgreSQL.

If we had such a tool in core, would that completely solve the
differential backup problem, or would more be needed?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Sameer Kumar <sameer(dot)kumar(at)ashnik(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>, "heikki(dot)linnakangas" <heikki(dot)linnakangas(at)iki(dot)fi>
Subject: Re: Using pg_rewind for differential backup
Date: 2014-12-03 15:23:27
Message-ID: CADp-Sm572kYx7nxP0P9r8i8wOdwzgDS3+-i-aMyQa4XWM3tUHQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Dec 3, 2014 at 1:32 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:

> On Fri, Nov 28, 2014 at 2:49 AM, Heikki Linnakangas
> <hlinnakangas(at)vmware(dot)com> wrote:
> > It also would be quite straightforward to write a separate tool to do
> just
> > that. Would be better than conflating pg_rewind with this. You could use
> > pg_rewind as the basis for it - it's under the same license as
> PostgreSQL.
>
> ​Agree. I would want to work on that.​

> If we had such a tool in core, would that completely solve the
> differential backup problem, or would more be needed?

​In my opinion​ yes.


> ​This discussion is not really adapted on hackers as pg_rewind is not
> included in Postgres core code. Please let's discuss your proposal there.​

​Got it​. But given the above, can we keep this discussion thread here?

Best Regards,

*Sameer Kumar | Database Consultant*

*ASHNIK PTE. LTD.*

101 Cecil Street, #11-11 Tong Eng Building, Singapore 069533

M: *+65 8110 0350* T: +65 6438 3504 | www.ashnik.com

*[image: icons]*

[image: Email patch] <http://www.ashnik.com/>

This email may contain confidential, privileged or copyright material and
is solely for the use of the intended recipient(s).