Re: [HACKERS] double opens

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>
Cc: pgsql-hackers <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] double opens
Date: 1999-09-27 03:30:02
Message-ID: 199909270330.XAA01510@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom, can you comment on this patch. Seems you have made changes in this
area. Thanks.

[Charset iso-8859-1 unsupported, filtering to ASCII...]
> Hi all,
>
> There is a TODO item
> * Overhaul mdmgr/smgr to fix double unlinking and double opens, cleanup
>
> In Windows-NT,we could see the following error reported by
> yutaka tanida [yutaka(at)marin(dot)or(dot)jp](dot)
>
> > version
> > ------------------------------------------------------------
> > PostgreSQL 6.5.1 on i686-pc-cygwin, compiled by gcc gcc-2.95
> > (1 row)
> >
> > template1=> create table table1 ( i int,j int);
> > CREATE
> > template1=> create view view1 as select * from table1;
> > CREATE
> > template1=> drop view view1;
> > DROP
> > template1=> create view view1 as select * from table1;
> > ERROR: cannot create view1
>
> "drop view" couldn't unlink the base file of target view because
> it is doubly opened and so "create view" coundn't create the view.
>
> After applying the following patch on trial,"drop view" was able to
> unlink the base file and "create view" was able to create the view
> again.
>
> I think base files should be closed at the time of cache invalidation.
> RelationFlushRelation() invalidates the entry of relation cache but
> doesn't close the base file of target relation.
> Is there any reason ?
>
> Or why doesn't RelationCacheDelete() close the base file of
> target relation ?
>
> Regards.
>
> Hiroshi Inoue
> Inoue(at)tpf(dot)co(dot)jp
>
> *** utils/cache/relcache.c.orig Wed May 26 16:05:38 1999
> --- utils/cache/relcache.c Wed Jul 28 13:23:49 1999
> ***************
> *** 1282,1287 ****
> --- 1282,1288 ----
> oldcxt = MemoryContextSwitchTo((MemoryContext) CacheCxt);
>
> RelationCacheDelete(relation);
> + smgrclose(DEFAULT_SMGR, relation);
>
> FreeTupleDesc(relation->rd_att);
> SystemCacheRelationFlushed(RelationGetRelid(relation));
>
>
>

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ryan Mills 1999-09-27 05:03:19 question.
Previous Message Bruce Momjian 1999-09-27 03:26:05 Re: [HACKERS] A multi-lang patch for psql 6.5.1 (fwd)