Re: [BUGS] NOTICE:AbortTransaction and not in in-progress state

Vadim Mikheev <vadim@krs.ru>

From: Vadim Mikheev <vadim@krs.ru>
To: Bruce Momjian <maillist@candle.pha.pa.us>
Cc: "Vadim B. Mikheev" <vadim@sable.krasnoyarsk.su>, t-ishii@sra.co.jp, hackers@postgreSQL.org
Date: 1998-06-13T06:18:05Z
Lists: pgsql-hackers
Bruce Momjian wrote:
> 
> > > QUERY: drop table test;
> > > WARN:Relation test Does Not Exist!
> > > QUERY: create table test (i int4);
> > > QUERY: create index iindex on test using btree(i);
> > > QUERY: begin;
> > > QUERY: insert into test values (100);

There will be dirty heap & index buffers in the pool after insertion ...

> > > QUERY: select * from test;
> > >   i
> > > ---
> > > 100
> > > (1 row)
> > >
> > > QUERY: rollback;

They are still marked as dirty...

> > > QUERY: drop table test;

heap_destroy_with_catalog () calls ReleaseRelationBuffers:

 *      this function unmarks all the dirty pages of a relation
 *      in the buffer pool so that at the end of transaction
 *      these pages will not be flushed.

before unlinking relation, BUT index_destroy() unlinks index
and DOESN'T call this func ...

> > > NOTICE:AbortTransaction and not in in-progress state
> > > NOTICE:AbortTransaction and not in in-progress state

COMMIT (of drop table) tries to flush all dirty buffers
from pool but there is no index file any more ...

> ERROR:  cannot write block 1 of iindex [test] blind

smgrblindwrt () fails.

> NOTICE:  AbortTransaction and not in in-progress state
> NOTICE:  EndTransactionBlock and not inprogress/abort state

...transaction state is IN_COMMIT...

Seems that ReleaseRelationBuffers() should be called by
index_destroy() ... Note that heap_destroy() also calls

    /* ok - flush the relation from the relcache */
    RelationForgetRelation(rid);

at the end...

Vadim