From: | pgsql-bugs(at)postgresql(dot)org |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Bug #807: Sequence currupted on recovery after kill -9 |
Date: | 2002-10-29 15:36:20 |
Message-ID: | 20021029153620.0973B4758FE@postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Matt Thompson (mthomp(at)tierfleet(dot)com) reports a bug with a severity of 2
The lower the number the more severe it is.
Short Description
Sequence currupted on recovery after kill -9
Long Description
If you create a file with an implied sequence and do a couple of inserts, then do a kill -9, when you start up again, the sequence will have a corrupted next_value field. In the example, the value of last_value is 4 before the kill -9 and 34 when it comes back up.
Sample Code
[root(at)hawk temp]# cat list.txt
[postgres(at)buzzard tf]$ cat ins2.sh
psql testdb -c "create table test (id serial,name text);"
psql testdb -c "insert into test (name) values ('name1')"
psql testdb -c "insert into test (name) values ('name2')"
psql testdb -c "insert into test (name) values ('name3')"
psql testdb -c "insert into test (name) values ('name4')"
psql testdb -c "select * from test"
psql testdb -c "select * from test_id_seq"
cat data/postmaster.pid
[postgres(at)buzzard tf]$
[postgres(at)buzzard tf]$ ins2.sh
NOTICE: CREATE TABLE will create implicit sequence 'test_id_seq' for SERIAL column 'test.id'
NOTICE: CREATE TABLE / UNIQUE will create implicit index 'test_id_key' for table 'test'
CREATE
INSERT 41140 1
INSERT 41141 1
INSERT 41142 1
INSERT 41143 1
id | name
----+-------
1 | name1
2 | name2
3 | name3
4 | name4
(4 rows)
sequence_name | last_value | increment_by | max_value | min_value | cache_value | log_cnt | is_cycled | is_called
---------------+------------+--------------+---------------------+-----------+-------------+---------+-----------+-----------
test_id_seq | 4 | 1 | 9223372036854775807 | 1 | 1 | 30 | f | t
(1 row)
19177
/home/tf/data
5432001 3342354
[postgres(at)buzzard tf]$ kill -9 19177
[postgres(at)buzzard tf]$ pg_ctl -l logfile start
pg_ctl: Another postmaster may be running. Trying to start postmaster anyway.
postmaster successfully started
[postgres(at)buzzard tf]$ psql testdb -c "select * from test_id_seq"
sequence_name | last_value | increment_by | max_value | min_value | cache_value | log_cnt | is_cycled | is_called
---------------+------------+--------------+---------------------+-----------+-------------+---------+-----------+-----------
test_id_seq | 34 | 1 | 9223372036854775807 | 1 | 1 | 0 | f | t
(1 row)
No file was uploaded with this report
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Enbom | 2002-10-29 15:41:42 | Wrong order of rows in result during regression test. |
Previous Message | Vincent Lim | 2002-10-29 10:07:10 | Re: Postgresql 7.2.3 |