Re: Streaming Replication: sql error on standby

Lists: pgsql-hackers
From: "Sander, Ingo (NSN - DE/Munich)" <ingo(dot)sander(at)nsn(dot)com>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: Streaming Replication: sql error on standby
Date: 2010-06-23 08:48:01
Message-ID: 9EB22E4572ECF74AAFEAE743C74D26B203430A95@DEMUEXC005.nsn-intra.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

Sql query "select pg_last_xlog_receive_location(); " does not work during startup of standby database.
TestScenario;
We have a active-standby system with PostgreSQL Streaming Replication beta2. If the active database is up the database is in use (read/write queries will be performed). Then the standby PostgreSQL SR will be started (the complete database from the active side is copied to the standby side; nec. Files for starting streaming replication are created). Directly after the possibility to connect to the standby system, the above given sql query will be executed. To this timepoint the sql query delivers an error. To a later timepoint (all wal segments are completly incooperated) the query delivers a valid result.
Question:
What is the reason for the error?
Exists a command to find out if the standby database is really active to accept/can work with sql commands?

BR
Ingo

Best Regards/mfG
Ingo Sander
=========================================================
Nokia Siemens Networks GmbH &Co. KG
NWS EP CP SVSS Platform Tech Support DE
St.-Martin-Str. 76
D-81541 München
*Tel.: +49-89-515938390
*ingo(dot)sander(at)nsn(dot)com

Nokia Siemens Networks GmbH & Co. KG
Sitz der Gesellschaft: München / Registered office: Munich
Registergericht: München / Commercial registry: Munich, HRA 88537
WEEE-Reg.-Nr.: DE 52984304

Persönlich haftende Gesellschafterin / General Partner: Nokia Siemens Networks Management GmbH
Geschäftsleitung / Board of Directors: Lydia Sommer, Olaf Horsthemke
Vorsitzender des Aufsichtsrats / Chairman of supervisory board: Herbert Merz
Sitz der Gesellschaft: München / Registered office: Munich
Registergericht: München / Commercial registry: Munich, HRB 163416


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: "Sander, Ingo (NSN - DE/Munich)" <ingo(dot)sander(at)nsn(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Streaming Replication: sql error on standby
Date: 2010-06-25 15:49:57
Message-ID: AANLkTikgG2U0e_MMOMia16HI2PSStgXEzCBCBK6Qe0Om@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Jun 23, 2010 at 4:48 AM, Sander, Ingo (NSN - DE/Munich)
<ingo(dot)sander(at)nsn(dot)com> wrote:
> Sql query "select pg_last_xlog_receive_location(); " does not work during
> startup of standby database.
> TestScenario;
> We have a active-standby system with PostgreSQL Streaming Replication beta2.
> If the active database is up the database is in use (read/write queries will
> be performed). Then the standby PostgreSQL SR will be started (the complete
> database from the active side is copied to the standby side; nec. Files for
> starting streaming replication are created). Directly after the possibility
> to connect to the standby system, the above given sql query will be
> executed. To this timepoint the sql query delivers an error.

What is the error message?

> To a later
> timepoint (all wal segments are completly incooperated) the query delivers a
> valid result.
>
> Question:
> What is the reason for the error?
> Exists a command to find out if the standby database is really active to
> accept/can work with sql commands?

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


From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: "Sander, Ingo (NSN - DE/Munich)" <ingo(dot)sander(at)nsn(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Streaming Replication: sql error on standby
Date: 2010-06-27 11:46:56
Message-ID: 1277639216.25074.56529.camel@ebony
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, 2010-06-23 at 10:48 +0200, Sander, Ingo (NSN - DE/Munich) wrote:

> Sql query "select pg_last_xlog_receive_location(); " does not work
> during startup of standby database.

Thanks for the report.

We need to understand more about what you are saying. There is no error
message with that text.

> TestScenario;
> We have a active-standby system with PostgreSQL Streaming Replication
> beta2. If the active database is up the database is in use (read/write
> queries will be performed). Then the standby PostgreSQL SR will be
> started (the complete database from the active side is copied to the
> standby side; nec. Files for starting streaming replication are
> created). Directly after the possibility to connect to the standby
> system, the above given sql query will be executed. To this timepoint
> the sql query delivers an error. To a later timepoint (all wal
> segments are completly incooperated) the query delivers a valid
> result.
>
> Question:
> What is the reason for the error?
> Exists a command to find out if the standby database is really active
> to accept/can work with sql commands?

Could you show us the log?

--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Training and Services