Thread: Streaming Replication: sql error on standby

Streaming Replication: sql error on standby

From
"Sander, Ingo (NSN - DE/Munich)"
Date:
<p><font face="Arial" size="2">Hi, </font><p><font face="Arial" size="2">Sql query "select
pg_last_xlog_receive_location();" does not work during startup of standby database. </font><br /><font face="Arial"
size="2">TestScenario;</font><br/><font face="Arial" size="2">We have a active-standby system with PostgreSQL Streaming
Replicationbeta2. If the active database is up the database is in use (read/write queries will be performed). Then the
standbyPostgreSQL SR will be started (the complete database from the active side is copied to the standby side; nec.
Filesfor starting streaming replication are created). Directly after the possibility to connect to the standby system,
theabove given sql query will be executed. To this timepoint the sql query delivers an error. To a later timepoint (all
walsegments are completly incooperated) the query delivers a valid result. </font><p><font face="Arial"
size="2">Question:</font><br /><font face="Arial" size="2">What is the reason for the error?</font><br /><font
face="Arial"size="2">Exists a command to find out if the standby database is really active to accept/can work with sql
commands?</font><p><font face="Arial" size="2">BR</font><br /><font face="Arial" size="2">Ingo</font><p><i><font
color="#000000"face="Brush Script MT" size="4">Best Regards/mfG</font></i><br /><i><b><font color="#FF0000" face="Brush
ScriptMT" size="6">Ingo Sander</font></b></i><br /><font face="Times New Roman"
size="2">=========================================================</font><br/><font face="Arial Black" size="2">Nokia
SiemensNetworks GmbH &Co. KG</font><br /><span lang="en-us"><font face="Courier New" size="2">NWS EP CP SVSS
PlatformTech Support DE</font></span><br /><span lang="en-us"><font face="Courier New" size="2">St.-Martin-Str.
76</font></span><br/><span lang="en-us"><font face="Courier New" size="2">D-81541 München</font></span><br /><span
lang="de"><fontcolor="#008080" face="Wingdings" size="5">(</font><font face="Tahoma" size="2">Tel.: 
+49-89-515938390</font></span><br/><span lang="de"><font color="#008080" face="Wingdings"
size="5">+</font><u></u><u></u><u><fontcolor="#0000FF" face="Tahoma"
size="2">ingo.sander@nsn.com</font></u></span><p><spanlang="de"><b><font color="#808080" face="Times New Roman"
size="1">Nokia</font></b><fontcolor="#808080" face="Times New Roman" size="1"></font><b> <font color="#808080"
face="TimesNew Roman" size="1">Siemens Networks GmbH & Co. KG</font><br /><font color="#808080" face="Arial"
size="1">Sitzder Gesellschaft: München / Registered office: Munich</font></b></span><br /><span lang="de"><b><font
color="#808080"face="Arial" size="1">Registergericht: München / Commercial registry: Munich, HRA
88537</font></b></span><br/><span lang="de"><b><font color="#808080" face="Arial" size="1">WEEE-Reg.-Nr.: DE
52984304</font></b></span><p><spanlang="de"><b><font color="#808080" face="Arial" size="1">Persönlich haftende
Gesellschafterin/ General Partner: Nokia Siemens Networks Management GmbH</font></b></span><br /><span
lang="de"><b><fontcolor="#808080" face="Arial" size="1">Geschäftsleitung / Board of Directors: Lydia Sommer, Olaf
Horsthemke</font></b></span><br/><span lang="de"><b><font color="#808080" face="Arial" size="1">Vorsitzender des
Aufsichtsrats/ Chairman of supervisory board: Herbert Merz</font></b></span><br /><span lang="de"><b><font
color="#808080"face="Arial" size="1">Sitz der Gesellschaft: München / Registered office: Munich</font></b></span><br
/><spanlang="de"><b><font color="#808080" face="Arial" size="1">Registergericht: München / Commercial registry: Munich,
HRB163416</font></b></span><br /> 

Re: Streaming Replication: sql error on standby

From
Robert Haas
Date:
On Wed, Jun 23, 2010 at 4:48 AM, Sander, Ingo (NSN - DE/Munich)
<ingo.sander@nsn.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


Re: Streaming Replication: sql error on standby

From
Simon Riggs
Date:
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.comPostgreSQL Development, 24x7 Support, Training and Services