Re: odd problem ! - Mailing list pgsql-hackers

From Oleg Bartunov
Subject Re: odd problem !
Date
Msg-id Pine.GSO.4.62.0503230106400.5508@ra.sai.msu.su
Whole thread Raw
In response to odd problem !  (Oleg Bartunov <oleg@sai.msu.su>)
List pgsql-hackers
OK, here is more cleaner cut and paste from my notebook:

pg@zen:~/test$ initdb -D ./t1
pg@zen:~/test$  pg_ctl -D ./t1 start
postmaster starting
pg@zen:~/test$ LOG:  database system was shut down at 2005-03-23 01:09:34 MSK
LOG:  checkpoint record is at 0/A2C844
LOG:  redo record is at 0/A2C844; undo record is at 0/0; shutdown TRUE
LOG:  next transaction ID: 544; next OID: 17230
LOG:  database system is ready

pg@zen:~/test$ createdb test
CREATE DATABASE
pg@zen:~/test$ psql test -c "create table a (f integer);"
CREATE TABLE

$i); commit;"; done
COMMIT
COMMIT
COMMIT
COMMIT
COMMIT
COMMIT
COMMIT
COMMIT
COMMIT
COMMIT
pg@zen:~/test$ cp -a ./t1 ./t2
pg@zen:~/test$ rm ./t2/postmaster.pid 
rm: remove regular file ./t2/postmaster.pid'? y
pg@zen:~/test$ pg_ctl -D ./t1 stop
LOG:  received smart shutdown request
LOG:  shutting down
waiting for postmaster to shut down....LOG:  database system is shut down done
postmaster stopped
pg@zen:~/test$ LOG:  database system was interrupted at 2005-03-23 01:10:06 MSK
LOG:  checkpoint record is at 0/A2C844
LOG:  redo record is at 0/A2C844; undo record is at 0/0; shutdown TRUE
LOG:  next transaction ID: 544; next OID: 17230
LOG:  database system was not properly shut down; automatic recovery in progress
LOG:  redo starts at 0/A2C880
LOG:  record with zero length at 0/A4FD38
LOG:  redo done at 0/A4FD10
LOG:  database system is ready

pg@zen:~/test$ psql test -c "select count(*) from a;" count 
-------    10
(1 row)

pg@zen:~/test$ pg_ctl -D ./t2 stop
waiting for postmaster to shut down....LOG:  received smart shutdown request
LOG:  shutting down
LOG:  database system is shut down done
postmaster stopped

pg@zen:~/test$ pg_ctl -D ./t1 start
postmaster starting
pg@zen:~/test$ LOG:  database system was shut down at 2005-03-23 01:11:40 MSK
LOG:  checkpoint record is at 0/A4FD38
LOG:  redo record is at 0/A4FD38; undo record is at 0/0; shutdown TRUE
LOG:  next transaction ID: 568; next OID: 17243
LOG:  database system is ready

pg@zen:~/test$ psql test -c "select count(*) from a;"
ERROR:  relation "a" does not exist
ERROR:  relation "a" does not exist

So, where is my table 'a' ?

    Oleg

On Wed, 23 Mar 2005, Oleg Bartunov wrote:

> Hi there,
>
> below is the problem I just bitten when play with toy db. I did:
>
> 1.initdb -D ./t1
> 2. pg_ctl -D ./t1 start
> 3. createdb test
> 4. psql test -c "create table a (f integer);"
> 5. run script which populates table a in background
>   perl bgupdate.pl &
> 6. cp -a ./t1 ./t2
> 6. pg_ctl -D ./t1 stop
>   it's waiting for bgupdate.pl, so I killed script
> 7. pg_ct -D ./t2 start
>   see, that everything is fine.
> 8. pg_ctl -D ./t2 stop
> 9. pg_ctl -D ./t1 start
> 10.
>
> pg@zen:~/test$ psql -l
>        List of databases
>   Name    |  Owner   | Encoding -----------+----------+----------
> template0 | postgres | KOI8
> template1 | postgres | KOI8
> test      | postgres | KOI8
> (3 rows)
>
> 11.
> pg@zen:~/test$ psql test
> FATAL:  database "test" does not exist
> psql: FATAL:  database "test" does not exist
>
> So, how it's possible ?
>
>
>     Regards,
>         Oleg
> _____________________________________________________________
> Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
> Sternberg Astronomical Institute, Moscow University (Russia)
> Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
> phone: +007(095)939-16-83, +007(095)939-23-83
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
    Regards,        Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83


pgsql-hackers by date:

Previous
From: Juan Pablo Espino
Date:
Subject: Another history question
Next
From: Tom Lane
Date:
Subject: Re: odd problem !