Putting code in main of src/backend/main/main.c

Started by S -over 22 years ago5 messages
#1S -
nat_lazy@hotmail.com

HI,
We are working on a project where we want to create a single linked list
that holds information of all the locks taken or being waited for by
transactions in Postgresql. Since main in src/backend/main/main.c will be
run just once when the Postgresql starts up, can declaration and
initialization of this single linked list be put in this main?
Thank you
Sumaira

_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: S - (#1)
Re: Putting code in main of src/backend/main/main.c

"S -" <nat_lazy@hotmail.com> writes:

We are working on a project where we want to create a single linked list
that holds information of all the locks taken or being waited for by
transactions in Postgresql.

How will you maintain such a list, when the underlying state is
constantly being changed by many different processes?

Perhaps more to the point, why would you want to? The existing lock
status data structures in shared memory can be traversed at need.

regards, tom lane

#3Sumaira Ali -
nat_lazy@hotmail.com
In reply to: Tom Lane (#2)
Re: Putting code in main of src/backend/main/main.c

<html><div style='background-color:'><DIV>
<DIV></DIV>&gt;"S -" <NAT_LAZY@HOTMAIL.COM>writes: </DIV>
<DIV></DIV>&gt; &gt; We are working on a project where we want to create a single linked list
<DIV></DIV>&gt; &gt; that holds information of all the locks taken or being waited for by
<DIV></DIV>&gt; &gt; transactions in Postgresql.
<DIV></DIV>&gt;
<DIV></DIV>&gt;How will you maintain such a list, when the underlying state is
<DIV></DIV>
<P>&gt;constantly being changed by many different processes? </P>
<P>What do you mean by underlying state? And also, each each time any process (transaction)wants to acqure a lock it calls LockAcquire (and if we put our code to update our linkedlist)and won't that ways each processes's actions be recorded in the linkedlist.</P>
<P>thanks</P>
<P>-sumaira</P>
<DIV></DIV>
<DIV></DIV></div><br clear=all><hr>The new <a href="http://g.msn.com/8HMAENUS/2737&quot;&gt;MSN 8:</a> smart spam protection and 2 months FREE* </html>

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Sumaira Ali - (#3)
Re: Putting code in main of src/backend/main/main.c

"Sumaira Ali -" <nat_lazy@hotmail.com> writes:

<P>What do you mean by underlying state? And also, each each time any process (transaction)wants to acqure a lock it calls LockAcquire (and if we put our code to update our linkedlist)and won't that ways each processes's actions be recorded in the linkedlist.</P>

Not unless you keep the linked list in shared memory --- at which point
it is surely duplicative of the lists the lock manager already maintains.

regards, tom lane

#5Sumaira Ali -
nat_lazy@hotmail.com
In reply to: Tom Lane (#4)
Re: Putting code in main of src/backend/main/main.c

<html><div style='background-color:'><DIV>
<P><BR><BR></P></DIV>
<DIV></DIV>
<DIV></DIV>&gt;From: Tom Lane <TGL@SSS.PGH.PA.US>
<DIV></DIV>&gt;To: "Sumaira Ali -" <NAT_LAZY@HOTMAIL.COM>
<DIV></DIV>&gt;CC: pgsql-hackers@postgresql.org
<DIV></DIV>&gt;Subject: Re: [HACKERS] Putting code in main of src/backend/main/main.c
<DIV></DIV>&gt;Date: Fri, 25 Apr 2003 00:28:19 -0400
<DIV></DIV>&gt;
<DIV></DIV>&gt;"Sumaira Ali -" <NAT_LAZY@HOTMAIL.COM>writes:
<DIV></DIV>&gt; &gt;
<P>What do you mean by underlying state? And also, each each time any process (transaction)wants to acqure a lock it calls LockAcquire (and if we put our code to update our linkedlist)and won't that ways each processes's actions be recorded in the linkedlist.</P>
<DIV></DIV>&gt;
<DIV></DIV>&gt;Not unless you keep the linked list in shared memory --- at which point
<DIV></DIV>&gt;it is surely duplicative of the lists the lock manager already maintains.
<DIV></DIV>&gt;
<DIV></DIV>&gt; regards, tom lane
<DIV>Is LockData the data structure of Lock.h and <FONT size=2>GetLockStatusData(</FONT><FONT color=#0000ff size=2>void</FONT><FONT size=2>) the funciton that returns the all hte information relating to locks (being waited for and taken up by differnt transactions) in postgresql?</FONT></DIV>
<DIV><FONT size=2>thanks</FONT></DIV>
<DIV><FONT size=2>sumaira</FONT></DIV></div><br clear=all><hr>Add photos to your e-mail with <a href="http://g.msn.com/8HMVENUS/2746&quot;&gt;MSN 8.</a> Get 2 months FREE*.</html>