RE: [HACKERS] NOTICE: LockRelease: locktable lookup failed, no lock - Mailing list pgsql-hackers

From Hiroshi Inoue
Subject RE: [HACKERS] NOTICE: LockRelease: locktable lookup failed, no lock
Date
Msg-id NDBBIJLOILGIKBGDINDFEELECBAA.Inoue@tpf.co.jp
Whole thread Raw
In response to Re: [HACKERS] NOTICE: LockRelease: locktable lookup failed, no lock  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> -----Original Message-----
> From: owner-pgsql-hackers@postgreSQL.org
> [mailto:owner-pgsql-hackers@postgreSQL.org]On Behalf Of Tom Lane
> 
> "Hiroshi Inoue" <Inoue@tpf.co.jp> writes:
> > It seems that conflicts of the initialization of some backends cause
> > above NOTICE messages.
> > Those backends would use the same XIDTAGs for the same relations
> > in case of LockAcquire()/LockRelease() because xids of those backends
> > are'nt set before starting the first command. When one of the backend
> > call LockReleaseAll(),it would release all together.
> 
> Oooh, that would nicely explain Keith's observation that it seems to
> happen at backend startup.  I guess we need to select an initial XID
> earlier during startup than we now do?
>

I'm not sure it's possible or not.
If startup sequence in InitPostgres() is changed,we may hardly
find the place to start transaction during backend startup.

Seems the unique place we could call StartTransacationCommand()
during backend startup is between InitCatalogCahe() and InitUserId()
in InitPostgres() now.
I tried the following patch and it seems work at least now.

Regards.

Hiroshi Inoue
Inoue@tpf.co.jp

Index: tcop/postgres.c
===================================================================
RCS file: /home/cvs/pgcurrent/backend/tcop/postgres.c,v
retrieving revision 1.8
diff -c -r1.8 postgres.c
*** tcop/postgres.c    1999/11/17 02:12:46    1.8
--- tcop/postgres.c    1999/12/19 02:35:12
***************
*** 1474,1480 ****      on_shmem_exit(remove_all_temp_relations, NULL); 
!     parser_input = makeStringInfo(); /* initialize input buffer */      /*       * Send this backend's cancellation
infoto the frontend. 
 
--- 1474,1486 ----      on_shmem_exit(remove_all_temp_relations, NULL); 
!     {
!         MemoryContext    oldcontext;
! 
!         oldcontext = MemoryContextSwitchTo(TopMemoryContext);
!         parser_input = makeStringInfo(); /* initialize input buffer */
!         MemoryContextSwitchTo(oldcontext);
!     }      /*       * Send this backend's cancellation info to the frontend. 
Index: utils/init/postinit.c
===================================================================
RCS file: /home/cvs/pgcurrent/backend/utils/init/postinit.c,v
retrieving revision 1.6
diff -c -r1.6 postinit.c
*** utils/init/postinit.c    1999/11/22 01:28:26    1.6
--- utils/init/postinit.c    1999/12/19 02:50:29
***************
*** 546,551 ****
--- 546,554 ----      */     InitCatalogCache(); 
+     /* Could we start transaction here ? */
+     if (!bootstrap)
+         StartTransactionCommand();     /*      * Set ourselves to the proper user id and figure out our postgres
*user id.  If we ever add security so that we check for valid
 




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] Re: [PATCHES] Lock
Next
From: Keith Parks
Date:
Subject: RE: [HACKERS] NOTICE: LockRelease: locktable lookup failed, no lock