Mailing List Archive

Patch: pgsql streaming replication
Hello -

Attached is a patch for pgsql that adds support streaming replication
developed by Mr. Takatoshi MATSUO. It's a huge overhaul for the current
version of the script though it's backward compatible and doesn't change
existing functionality. However I'd like to ask everybody who currently
uses pgsql RA to give this version of RA a thorough test before putting it
into production.

This version support synchronous and asynchronous version of streaming
replication but requires PostgreSQL 9.1 at least. Due some limits on how
replication is implemented in PostgreSQL currently there is no way to
demote current master into a slave to the new master so it always stops
PostgreSQL on demote and it's administrator responsibility to resync
stopped node the new master. Same is true for the failed master, before
putting it back administrator has to sync it to the new master.


--
Serge Dubrouski.
Re: Patch: pgsql streaming replication [ In reply to ]
Hi Serge,

On Sun, Mar 18, 2012 at 10:02:39AM -0600, Serge Dubrouski wrote:
> Hello -
>
> Attached is a patch for pgsql that adds support streaming replication
> developed by Mr. Takatoshi MATSUO. It's a huge overhaul for the current
> version of the script though it's backward compatible and doesn't change
> existing functionality. However I'd like to ask everybody who currently
> uses pgsql RA to give this version of RA a thorough test before putting it
> into production.
>
> This version support synchronous and asynchronous version of streaming
> replication but requires PostgreSQL 9.1 at least. Due some limits on how
> replication is implemented in PostgreSQL currently there is no way to
> demote current master into a slave to the new master so it always stops
> PostgreSQL on demote and it's administrator responsibility to resync
> stopped node the new master. Same is true for the failed master, before
> putting it back administrator has to sync it to the new master.
>
>
> --
> Serge Dubrouski.

> diff --git a/heartbeat/pgsql b/heartbeat/pgsql
> index 8b6ea10..b75e525 100755
> --- a/heartbeat/pgsql
> +++ b/heartbeat/pgsql
> @@ -1,12 +1,13 @@
> -#!/bin/sh
> +#!/bin/bash

Our policy is not to change shell. Is that absolutely necessary?

Cheers,

Dejan
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
Re: Patch: pgsql streaming replication [ In reply to ]
On 2012-03-19T11:09:16, Dejan Muhamedagic <dejan@suse.de> wrote:

> > --- a/heartbeat/pgsql
> > +++ b/heartbeat/pgsql
> > @@ -1,12 +1,13 @@
> > -#!/bin/sh
> > +#!/bin/bash
> Our policy is not to change shell. Is that absolutely necessary?

He sends in many patches. bash is a <1MB install. I can't believe that
in 2012 we're still having this discussion ;-)



Regards,
Lars

--
Architect Storage/HA
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 21284 (AG Nürnberg)
"Experience is the name everyone gives to their mistakes." -- Oscar Wilde

_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
Re: Patch: pgsql streaming replication [ In reply to ]
I believe that the reason for not using #bash is that it is it NOT part of the default install on non Linux systems.


Matthew Soffen
Principal Software Testing Coordinator
ISO New England - http://www.iso-ne.com/



-----Original Message-----
From: linux-ha-dev-bounces@lists.linux-ha.org [mailto:linux-ha-dev-bounces@lists.linux-ha.org] On Behalf Of Lars Marowsky-Bree
Sent: Monday, March 19, 2012 4:24 PM
To: High-Availability Linux Development List
Subject: Re: [Linux-ha-dev] Patch: pgsql streaming replication

On 2012-03-19T11:09:16, Dejan Muhamedagic <dejan@suse.de> wrote:

> > --- a/heartbeat/pgsql
> > +++ b/heartbeat/pgsql
> > @@ -1,12 +1,13 @@
> > -#!/bin/sh
> > +#!/bin/bash
> Our policy is not to change shell. Is that absolutely necessary?

He sends in many patches. bash is a <1MB install. I can't believe that in 2012 we're still having this discussion ;-)



Regards,
Lars

--
Architect Storage/HA
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 21284 (AG Nürnberg) "Experience is the name everyone gives to their mistakes." -- Oscar Wilde

_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
Re: Patch: pgsql streaming replication [ In reply to ]
Sorry, we'll rework the patch.
On Mar 19, 2012 2:39 PM, "Soffen, Matthew" <msoffen@iso-ne.com> wrote:

> I believe that the reason for not using #bash is that it is it NOT part of
> the default install on non Linux systems.
>
>
> Matthew Soffen
> Principal Software Testing Coordinator
> ISO New England - http://www.iso-ne.com/
>
>
>
> -----Original Message-----
> From: linux-ha-dev-bounces@lists.linux-ha.org [mailto:
> linux-ha-dev-bounces@lists.linux-ha.org] On Behalf Of Lars Marowsky-Bree
> Sent: Monday, March 19, 2012 4:24 PM
> To: High-Availability Linux Development List
> Subject: Re: [Linux-ha-dev] Patch: pgsql streaming replication
>
> On 2012-03-19T11:09:16, Dejan Muhamedagic <dejan@suse.de> wrote:
>
> > > --- a/heartbeat/pgsql
> > > +++ b/heartbeat/pgsql
> > > @@ -1,12 +1,13 @@
> > > -#!/bin/sh
> > > +#!/bin/bash
> > Our policy is not to change shell. Is that absolutely necessary?
>
> He sends in many patches. bash is a <1MB install. I can't believe that in
> 2012 we're still having this discussion ;-)
>
>
>
> Regards,
> Lars
>
> --
> Architect Storage/HA
> SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix
> Imendörffer, HRB 21284 (AG Nürnberg) "Experience is the name everyone gives
> to their mistakes." -- Oscar Wilde
>
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
>
Re: Patch: pgsql streaming replication [ In reply to ]
There is a report that it dosen't work on debian's dash,
because it uses "echo -e" to treat line break.

We'll use "printf" instead of "echo -e ".

2012/3/20 Serge Dubrouski <sergeyfd@gmail.com>:
> Sorry, we'll rework the patch.
>
> On Mar 19, 2012 2:39 PM, "Soffen, Matthew" <msoffen@iso-ne.com> wrote:
>>
>> I believe that the reason for not using #bash is that it is it NOT part of
>> the default install on non Linux systems.
>>
>>
>> Matthew Soffen
>> Principal Software Testing Coordinator
>> ISO New England - http://www.iso-ne.com/
>>
>>
>>
>> -----Original Message-----
>> From: linux-ha-dev-bounces@lists.linux-ha.org
>> [mailto:linux-ha-dev-bounces@lists.linux-ha.org] On Behalf Of Lars
>> Marowsky-Bree
>> Sent: Monday, March 19, 2012 4:24 PM
>> To: High-Availability Linux Development List
>> Subject: Re: [Linux-ha-dev] Patch: pgsql streaming replication
>>
>> On 2012-03-19T11:09:16, Dejan Muhamedagic <dejan@suse.de> wrote:
>>
>> > > --- a/heartbeat/pgsql
>> > > +++ b/heartbeat/pgsql
>> > > @@ -1,12 +1,13 @@
>> > > -#!/bin/sh
>> > > +#!/bin/bash
>> > Our policy is not to change shell. Is that absolutely necessary?
>>
>> He sends in many patches. bash is a <1MB install. I can't believe that in
>> 2012 we're still having this discussion ;-)
>>
>>
>>
>> Regards,
>>    Lars
>>
>> --
>> Architect Storage/HA
>> SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix
>> Imendörffer, HRB 21284 (AG Nürnberg) "Experience is the name everyone gives
>> to their mistakes." -- Oscar Wilde
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
Re: Patch: pgsql streaming replication [ In reply to ]
On 2012-03-19T16:29:23, "Soffen, Matthew" <msoffen@iso-ne.com> wrote:

> I believe that the reason for not using #bash is that it is it NOT part of the default install on non Linux systems.

That is what package dependencies are for.

--
Architect Storage/HA
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 21284 (AG Nürnberg)
"Experience is the name everyone gives to their mistakes." -- Oscar Wilde

_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
Re: Patch: pgsql streaming replication [ In reply to ]
On 03/20/2012 03:40 AM, Lars Marowsky-Bree wrote:
> On 2012-03-19T16:29:23, "Soffen, Matthew"<msoffen@iso-ne.com> wrote:
>
>> I believe that the reason for not using #bash is that it is it NOT part of the default install on non Linux systems.
> That is what package dependencies are for.
Matt's point is simple: Avoiding dependencies is far better than
declaring them.

There is nothing in bash which cannot be easily done in the standard
POSIX shell.

We have avoided these things in most of our RAs - and there is no reason
to change that.

--
Alan Robertson<alanr@unix.sh> - @OSSAlanR

"Openness is the foundation and preservative of friendship... Let me claim from you at all times your undisguised opinions." - William Wilberforce
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
Re: Patch: pgsql streaming replication [ In reply to ]
Hello

I fixed it.
It works well with dash.

If you need a sample setting, please see
https://github.com/t-matsuo/resource-agents/wiki/Resource-Agent-for-PostgreSQL-9.1-streaming-replication
(See "sample setting of crm" section)

Regards,
Takatoshi MATSUO

2012/3/27 Alan Robertson <alanr@unix.sh>:
> On 03/20/2012 03:40 AM, Lars Marowsky-Bree wrote:
>> On 2012-03-19T16:29:23, "Soffen, Matthew"<msoffen@iso-ne.com>  wrote:
>>
>>> I believe that the reason for not using #bash is that it is it NOT part of the default install on non Linux systems.
>> That is what package dependencies are for.
> Matt's point is simple:  Avoiding dependencies is far better than
> declaring them.
>
> There is nothing in bash which cannot be easily done in the standard
> POSIX shell.
>
> We have avoided these things in most of our RAs - and there is no reason
> to change that.
>
> --
>     Alan Robertson<alanr@unix.sh>  - @OSSAlanR
>
> "Openness is the foundation and preservative of friendship...  Let me claim from you at all times your undisguised opinions." - William Wilberforce
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
Re: Patch: pgsql streaming replication [ In reply to ]
Actually it doesn't matter what bash can or cannot do. The main point is
that we can't change shell for RA that's been around for 6 years for the
reasons of backward compatibility. It was completely my mistake that I
didn't notice it.

Attached is the fixed patch.

Takatoshi, I also replace $HOSTNAME with $NODENAME to avoid confusion with
embedded bash variable and make checkbashism script happy.

On Mon, Mar 26, 2012 at 2:22 PM, Alan Robertson <alanr@unix.sh> wrote:

> On 03/20/2012 03:40 AM, Lars Marowsky-Bree wrote:
> > On 2012-03-19T16:29:23, "Soffen, Matthew"<msoffen@iso-ne.com> wrote:
> >
> >> I believe that the reason for not using #bash is that it is it NOT part
> of the default install on non Linux systems.
> > That is what package dependencies are for.
> Matt's point is simple: Avoiding dependencies is far better than
> declaring them.
>
> There is nothing in bash which cannot be easily done in the standard
> POSIX shell.
>
> We have avoided these things in most of our RAs - and there is no reason
> to change that.
>
> --
> Alan Robertson<alanr@unix.sh> - @OSSAlanR
>
> "Openness is the foundation and preservative of friendship... Let me
> claim from you at all times your undisguised opinions." - William
> Wilberforce
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
>



--
Serge Dubrouski.
Re: Patch: pgsql streaming replication [ In reply to ]
Hi Serge

2012/3/28 Serge Dubrouski <sergeyfd@gmail.com>:
> Actually it doesn't matter what bash can or cannot do. The main point is
> that we can't change shell for RA that's been around for 6 years for the
> reasons of backward compatibility. It was completely my mistake that I
> didn't notice it.
>
> Attached is the fixed patch.
>
> Takatoshi, I also replace $HOSTNAME with $NODENAME to avoid confusion with
> embedded bash variable and make checkbashism script happy.

Thanks.
I applied it to my repository.

Please consider this patch too.
https://github.com/t-matsuo/resource-agents/commit/c279b83d3590b8f9bd6c6e1c150008da1121a760

Regards,
Takatoshi MATSUO
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/