Re: 9.4 pg_control corruption

From: 李海龙 <hailong(dot)li(at)qunar(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, "steve(at)ssinger(dot)info" <steve(at)ssinger(dot)info>
Subject: Re: 9.4 pg_control corruption
Date: 2014-07-27 12:21:56
Message-ID: 53D4EEE2.2050807@qunar.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hi,dear steven && pgsql-hackers

I've encountered the similar phenonmenon with 9.4 .

1. environment

1.1 OS version

postgres(at)lhl-Latitude-E5420:~$ cat /etc/issue
Ubuntu 13.10 \n \l

postgres(at)lhl-Latitude-E5420:~$ uname -av
Linux lhl-Latitude-E5420 3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9
16:20:46 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

1.2 PostgreSQL version

postgres(at)lhl-Latitude-E5420:~$ /opt/pg94/bin/pg_controldata --version
pg_controldata (PostgreSQL) 9.4beta2
postgres(at)lhl-Latitude-E5420:~$ /opt/pg94/bin/pg_config
BINDIR = /opt/pg94/bin
DOCDIR = /opt/pg94/share/doc/postgresql
HTMLDIR = /opt/pg94/share/doc/postgresql
INCLUDEDIR = /opt/pg94/include
PKGINCLUDEDIR = /opt/pg94/include/postgresql
INCLUDEDIR-SERVER = /opt/pg94/include/postgresql/server
LIBDIR = /opt/pg94/lib
PKGLIBDIR = /opt/pg94/lib/postgresql
LOCALEDIR = /opt/pg94/share/locale
MANDIR = /opt/pg94/share/man
SHAREDIR = /opt/pg94/share/postgresql
SYSCONFDIR = /opt/pg94/etc/postgresql
PGXS = /opt/pg94/lib/postgresql/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--prefix=/opt/pg94' '--with-perl' '--with-libxml'
'--with-libxslt' '--with-ossp-uuid'
CC = gcc
CPPFLAGS = -D_GNU_SOURCE -I/usr/include/libxml2
CFLAGS = -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute
-Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard
CFLAGS_SL = -fpic
LDFLAGS = -L../../../src/common -Wl,--as-needed
-Wl,-rpath,'/opt/pg94/lib',--enable-new-dtags
LDFLAGS_EX =
LDFLAGS_SL =
LIBS = -lpgcommon -lpgport -lxslt -lxml2 -lz -lreadline -lrt -lcrypt
-ldl -lm
VERSION = PostgreSQL 9.4beta2

2. phenonmenon

I have a PostgreSQL datadir named /export/pg94beta1_data/ which was
initialized with PostgreSQL 9.4beta1,

postgres(at)lhl-Latitude-E5420:~$ /opt/pg94/bin/pg_controldata
/export/pg94beta1_data/
WARNING: Calculated CRC checksum does not match value stored in file.
Either the file is corrupt, or it has a different layout than this program
is expecting. The results below are untrustworthy.

pg_control version number: 937
Catalog version number: 201405111
Database system identifier: 6014427290583411360
Database cluster state: in production
pg_control last modified: 2014年07月27日 星期日 16时36分50秒
Latest checkpoint location: 0/17462890
Prior checkpoint location: 0/17462828
Latest checkpoint's REDO location: 0/17462890
Latest checkpoint's REDO WAL file: 000000010000000000000017
Latest checkpoint's TimeLineID: 1
Latest checkpoint's PrevTimeLineID: 1
Latest checkpoint's full_page_writes: off
Latest checkpoint's NextXID: 0/1387
Latest checkpoint's NextOID: 22220
Latest checkpoint's NextMultiXactId: 1
Latest checkpoint's NextMultiOffset: 0
Latest checkpoint's oldestXID: 715
Latest checkpoint's oldestXID's DB: 1
Latest checkpoint's oldestActiveXID: 0
Latest checkpoint's oldestMultiXid: 1
Latest checkpoint's oldestMulti's DB: 1
Time of latest checkpoint: 2014年07月27日 星期日 16时36分50秒
Fake LSN counter for unlogged rels: 0/1
Minimum recovery ending location: 0/0
Min recovery ending loc's timeline: 0
Backup start location: 0/0
Backup end location: 0/0
End-of-backup record required: no
Current wal_level setting: minimal
Current wal_log_hints setting: off
Current max_connections setting: 100
Current max_worker_processes setting: 8
Current max_prepared_xacts setting: 0
Current max_locks_per_xact setting: 64
Maximum data alignment: 8
Database block size: 8192
Blocks per segment of large relation: 131072
WAL block size: 8192
Bytes per WAL segment: 16777216
Maximum length of identifiers: 64
Maximum columns in an index: 32
Maximum size of a TOAST chunk: 1996
Size of a large-object chunk: 65793
Date/time type storage: floating-point numbers
Float4 argument passing: by reference
Float8 argument passing: by reference
Data page checksum version: 307500851

but the server complained about the following when I started it with
PostgreSQL 9.4beta2,

postgres(at)lhl-Latitude-E5420:~$ /opt/pg94/bin/pg_ctl -D
/export/pg94beta1_data/ start
server starting
postgres(at)lhl-Latitude-E5420:~$ [ 2014-07-27 19:23:57.922 CST 27983
53d4e14d.6d4f 1 0]FATAL: database files are incompatible with server
[ 2014-07-27 19:23:57.922 CST 27983 53d4e14d.6d4f 2 0]DETAIL: The
database cluster was initialized with PG_CONTROL_VERSION 937, but the
server was compiled with PG_CONTROL_VERSION 942.
[ 2014-07-27 19:23:57.922 CST 27983 53d4e14d.6d4f 3 0]HINT: It looks
like you need to initdb.

I always think that it should not come up the PG_CONTROL_VERSION
mismatch when the PostgreSQL version upgrade between the small version .

Is there some important differences in PostgreSQL 9.4 ?

Thanks

Best Regards!

于 2014年07月09日 10:36, Steve Singer 写道:
> On 07/08/2014 10:14 PM, Tom Lane wrote:
>> Steve Singer <steve(at)ssinger(dot)info> writes:
>>> I've encountered a corrupt pg_control file on my 9.4 development
>>> cluster. I've mostly been using the cluster for changeset extraction /
>>> slony testing.
>>> This is a 9.4 (currently commit 6ad903d70a440e + a walsender change
>>> discussed in another thread) but would have had the initdb done with an
>>> earlier 9.4 snapshot.
>> Somehow or other you missed the update to pg_control version number 942.
>> There's no obvious reason to think that this pg_control file is corrupt
>> on its own terms, but the pg_controldata version you're using expects
>> the 942 layout. The fact that the server wasn't complaining about this
>> suggests that you've not recompiled the server, or at least not xlog.c.
>> Possibly the odd failure to restart indicates that you have a partially
>> updated server executable?
>
>
> The server is complaining about that, it started to after the crash
> (which is why I ran pg_controldata)
>
> ssinger(at)ssinger-laptop:/usr/local/pgsql94wal/bin$ ./postgres -D ../data
> 2014-07-08 22:28:57.796 EDTFATAL: database files are incompatible
> with server
> 2014-07-08 22:28:57.796 EDTDETAIL: The database cluster was
> initialized with PG_CONTROL_VERSION 937, but the server was compiled
> with PG_CONTROL_VERSION 942.
> 2014-07-08 22:28:57.796 EDTHINT: It looks like you need to initdb.
> ssinger(at)ssinger-laptop:/usr/local/pgsql94wal/bin$
>
>
> The server seemed fine (and it was 9.4 because I was using 9.4 features)
> The server crashed
> The server performed crash recovery
> The server server wouldn't start and pg_controldata shows the attached
> output
>
> I wasn't recompiling or reinstalling around this time either.
>
>
>
>> regards, tom lane
>>
>>
>
>
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2014-07-27 13:31:41 Re: SKIP LOCKED DATA (work in progress)
Previous Message David Rowley 2014-07-27 12:00:51 Re: get_loop_count() fails to ignore RELOPT_DEADREL rels