FW: More than 1 pg_database Entry for Database - Thread #2

FW: More than 1 pg_database Entry for Database - Thread #2

am 16.04.2010 03:33:11 von Samuel Stearns

--_000_68B59BEDCD36854AADBDF17E91B2937AB89DE7F7EXCHMAILstaff in_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi,

Does anyone have any ideas how I can keep from getting into this duplicate =
database scenario? Any advice would be greatly appreciated.

Thanks,

Sam

________________________________
From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql=
..org] On Behalf Of Samuel Stearns
Sent: Wednesday, 14 April 2010 10:11 AM
To: pgsql-admin@postgresql.org
Subject: [ADMIN] More than 1 pg_database Entry for Database - Thread #2

Howdy,

I am running version 8.3.3 and encountered a problem with my pg_dump failin=
g a couple weeks back with the following error:

pg_dump: query returned more than one (2) pg_database entry for database "s=
qlsnbs"
pg_dumpall: pg_dump failed on database "sqlsnbs", exiting

I followed your thread here:

http://www.mail-archive.com/pgsql-admin@postgresql.org/msg25 978.html

in an attempt to resolve the problem and in the end, just like was stated i=
n the above thread, I ended up dumping the old Postgres environment into a =
new initialized one to resolve the problem.

I did not capture the queries I was running at the time of diagnosing but I=
can summarize. I ran the following query:

select xmin, cmin, xmax, cmax, oid, ctid, datname from pg_database;

which returned the same oid and different xmax for each row of the duplicat=
e database. One xmax was 0 and the other was 3.7 billion. In your thread =
above it was stated by Tom Lane that the large xmax number may indicate a p=
roblem with xid wraparound and that the problem row was never vacuumed away=
due to broken vacuuming procedures. We were running with auto-vacuum turn=
ed on and I verified that it was working by querying pg_stat_all_tables.

I was wondering if you could please answer the following for me to help mit=
igate this in the future:

1. Should I be running a scheduled vacuum analyze in addition to the auto-=
vacuum?
2. Should I be running a scheduled vacuum full?
3. Does 8.4 address this problem?

Thank you,

Sam

--_000_68B59BEDCD36854AADBDF17E91B2937AB89DE7F7EXCHMAILstaff in_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:st1=3D"urn:schemas-microsoft-com:office:smarttags" xmlns=3D"http://ww=
w.w3.org/TR/REC-html40">




namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags" name=3D"Street=
"/>
name=3D"address"/>
name=3D"PersonName"/>









=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Hi,



=3D'font-size:
10.0pt;font-family:Arial;color:navy'> 



=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Does anyone have any ideas how I can k=
eep
from getting into this duplicate database scenario?  Any advice would =
be
greatly appreciated.



=3D'font-size:
10.0pt;font-family:Arial;color:navy'> 



=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Thanks,



=3D'font-size:
10.0pt;font-family:Arial;color:navy'> 



=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Sam



=3D'font-size:
10.0pt;font-family:Arial;color:navy'> 





e=3D3
face=3D"Times New Roman">






style=3D'font-size:10.0pt;font-family:Tahoma;font-weight:bol d'>From:=
size=3D2 face=3DTahoma> mily:Tahoma'>
pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org] =
style=3D'font-weight:bold'>On Behalf Of
Samuel Stearns

Sent: Wednesday, 14 April 20=
10
10:11 AM

To: on">pgsql-admin@postgresql.org

Subject: [ADMIN] More than 1
pg_database Entry for Database - Thread #2=





'font-size:
12.0pt'> 



0.0pt;
font-family:Arial'>Howdy,



0.0pt;
font-family:Arial'> 



0.0pt;
font-family:Arial'>I am running version 8.3.3 and encountered a problem wit=
h my
pg_dump failing a couple weeks back with the following error: pan>



0.0pt;
font-family:Arial'> 



ourier New"> style=3D'font-size:10.0pt;font-family:"Courier New"'>pg_dump: query returne=
d more
than one (2) pg_database entry for database "sqlsnbs"<=
/span>



ourier New"> style=3D'font-size:10.0pt;font-family:"Courier New"'>pg_dumpall: pg_dump fa=
iled
on database "sqlsnbs", exiting



0.0pt;
font-family:Arial'> 



0.0pt;
font-family:Arial'>I followed your thread here:
>

0.0pt;
font-family:Arial'> 



0.0pt;
font-family:Arial'> href=3D"http://www.mail-archive.com/pgsql-admin@postgresql.o rg/msg25978.htm=
l">http://www.mail-archive.com/pgsql-admin@postgresql.org/ms g25978.html=



0.0pt;
font-family:Arial'> 



0.0pt;
font-family:Arial'>in an attempt to resolve the problem and in the end, jus=
t
like was stated in the above thread, I ended up dumping the old Postgres
environment into a new initialized one to resolve the problem. span>



0.0pt;
font-family:Arial'> 



0.0pt;
font-family:Arial'>I did not capture the queries I was running at the time =
of
diagnosing but I can summarize.  I ran the following query:=



0.0pt;
font-family:Arial'> 



0.0pt;
font-family:Arial'>select xmin, cmin, xmax, cmax, oid, ctid, datname from
pg_database;



0.0pt;
font-family:Arial'> 



0.0pt;
font-family:Arial'>which returned the same oid and different xmax for each =
row
of the duplicate database.  One xmax was 0 and the other was 3.7
billion.  In your thread above it was stated by "> w:st=3D"on">Tom Lane that the large xmax number=
may
indicate a problem with xid wraparound and that the problem row was never
vacuumed away due to broken vacuuming procedures.  We were running wit=
h
auto-vacuum turned on and I verified that it was working by querying
pg_stat_all_tables.



0.0pt;
font-family:Arial'> 



0.0pt;
font-family:Arial'>I was wondering if you could please answer the following=
for
me to help mitigate this in the future:



0.0pt;
font-family:Arial'> 



0.0pt;
font-family:Arial'>1.  Should I be running a scheduled vacuum analyze =
in
addition to the auto-vacuum?



0.0pt;
font-family:Arial'>2.  Should I be running a scheduled vacuum full? p>



0.0pt;
font-family:Arial'>3.  Does 8.4 address this problem? >



0.0pt;
font-family:Arial'> 



0.0pt;
font-family:Arial'>Thank you,



0.0pt;
font-family:Arial'> 



0.0pt;
font-family:Arial'>Sam









--_000_68B59BEDCD36854AADBDF17E91B2937AB89DE7F7EXCHMAILstaff in_--

Re: FW: More than 1 pg_database Entry for Database -

am 16.04.2010 18:05:32 von Kevin Grittner

Samuel Stearns wrote:

> I am running version 8.3.3 and encountered a problem

> Does anyone have any ideas how I can keep from getting into this
> duplicate database scenario? Any advice would be greatly
> appreciated.

> it was stated by Tom Lane that the large xmax number may indicate
> a problem with xid wraparound and that the problem row was never
> vacuumed away due to broken vacuuming procedures.

Applying the last 22 months of bug fixes would be a good start.

http://www.postgresql.org/support/versioning

http://www.postgresql.org/docs/8.3/static/release.html

http://www.postgresql.org/download/

Autovacuum is supposed to protect you from wraparound, so it appears
to have fallen down somehow. There were fixes for autovacuum bugs
in 8.3.4 and 8.3.6, so it's entirely possible that just moving to
8.3.somethingrecent will prevent a recurrence.

-Kevin

--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Re: FW: More than 1 pg_database Entry for Database -

am 18.04.2010 05:21:18 von Samuel Stearns

Thanks very much for the advice, Kevin. I'll be raising a request with our=
sysadmins to upgrade to 8.3.10.

Sam

-----Original Message-----
From: Kevin Grittner [mailto:Kevin.Grittner@wicourts.gov]=20
Sent: Saturday, 17 April 2010 1:36 AM
To: Samuel Stearns
Cc: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] FW: More than 1 pg_database Entry for Database - Threa=
d #2

Samuel Stearns wrote:
=20
> I am running version 8.3.3 and encountered a problem
=20
> Does anyone have any ideas how I can keep from getting into this
> duplicate database scenario? Any advice would be greatly
> appreciated.
=20
> it was stated by Tom Lane that the large xmax number may indicate
> a problem with xid wraparound and that the problem row was never
> vacuumed away due to broken vacuuming procedures.
=20
Applying the last 22 months of bug fixes would be a good start.
=20
http://www.postgresql.org/support/versioning
=20
http://www.postgresql.org/docs/8.3/static/release.html
=20
http://www.postgresql.org/download/
=20
Autovacuum is supposed to protect you from wraparound, so it appears
to have fallen down somehow. There were fixes for autovacuum bugs
in 8.3.4 and 8.3.6, so it's entirely possible that just moving to
8.3.somethingrecent will prevent a recurrence.
=20
-Kevin

--=20
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin