Transaction log file screwed up

From: "Kevin Schroeder" <kschroeder(at)mirageworks(dot)com>
To: <pgsql-admin(at)postgresql(dot)org>
Subject: Transaction log file screwed up
Date: 2004-04-22 13:29:53
Message-ID: 019d01c4286d$e51c25f0$0200a8c0@WORKSTATION
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hello,
A client database crashed last night and I think I found the solution to
the problem at http://www.varlena.com/varlena/GeneralBits/45.php "Database
Recovery Procedures ". The solution was to append the file with enough
zeros to get the file size correct. The solution was to run

dd bs=8k count=1 < /dev/zero >> $PGDATA/pg_clog/0005

which added the zeros to the end. However my error values are a little
different from ones in the example and the person who posted this noted that
this should NOT be tried haphazardly. Since I'd rather not crash a client's
database to the point of no recovery I wouldn't mind having someone with
more knowledge of PostgreSQL post the command with the correct arguments to
fix the problem, or tell me I'm off my rocker trying to fix it this way.

Following is pg_ctl's output when trying to start the database. Following
that is the directory listing for the pg_clog directory.

LOG: checkpoint record is at 1/383BDFC0
LOG: redo record is at 1/383BDFC0; undo record is at 0/0; shutdown TRUE
LOG: next transaction id: 15038948; next oid: 3293693
LOG: database system was not properly shut down; automatic recovery in
progress
LOG: ReadRecord: unexpected pageaddr 1/363BE000 in log file 1, segment 56,
offset 3923968
LOG: redo is not required
PANIC: XLogWrite: write request 1/383BE000 is past end of log 1/383BE000
LOG: startup process (pid 1555) was terminated by signal 6
LOG: aborting startup due to startup process failure

pgsql/data/pg_clog/*

-rw------- 1 postgres postgres 262144 Mar 14 13:10 0000
-rw------- 1 postgres postgres 262144 Mar 24 15:35 0001
-rw------- 1 postgres postgres 262144 Mar 27 00:04 0002
-rw------- 1 postgres postgres 262144 Mar 29 18:06 0003
-rw------- 1 postgres postgres 262144 Apr 1 00:39 0004
-rw------- 1 postgres postgres 262144 Apr 3 09:54 0005
-rw------- 1 postgres postgres 262144 Apr 5 21:39 0006
-rw------- 1 postgres postgres 262144 Apr 8 03:26 0007
-rw------- 1 postgres postgres 262144 Apr 10 10:15 0008
-rw------- 1 postgres postgres 262144 Apr 12 21:05 0009
-rw------- 1 postgres postgres 262144 Apr 15 00:32 000A
-rw------- 1 postgres postgres 262144 Apr 17 03:38 000B
-rw------- 1 postgres postgres 262144 Apr 19 13:07 000C
-rw------- 1 postgres postgres 262144 Apr 21 13:38 000D
-rw------- 1 postgres postgres 90112 Apr 22 07:01 000E

Thanks

Kevin

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Peter Eisentraut 2004-04-22 13:32:06 Re: Problems with select lower()
Previous Message Tom Lane 2004-04-22 12:52:28 Re: Problems with select lower()