Patch for Postmaster Uptime (from the TODO)
Hello hackers,
I noticed in the TODO that there is an item requesting a function which
returns the uptime of the postmaster. I've wanted that as well. So, I've
added just such a thing: server_start_time(). This function returns the
time when the postmaster was started; a simple now() - server_start_time()
returns the uptime.
The below patches are for four files:
* postmaster.c: Now calls a new function, MarkServerStartTime(), before
calling ServerLoop().
* timestamp.h/timestamp.c: New functions: MarkServerStartTime() (called
from postmaster.c) and server_start_time(), a new SQL function which may
be called.
* pg_proc.h: Added DATA and DESCR to the very end of the list (OID=2557)
for the server_start_time function.
I didn't bother to include the generated fmgroids.h and fmgrtab.c. Since
they are small, I've attached the four unified diffs against the 8.0.1
code. Let me know if there's anything different the code should have done.
--Eric
Attachments:
pg_proc.h.diffapplication/octet-stream; name=pg_proc.h.diffDownload+3-0
postmaster.c.diffapplication/octet-stream; name=postmaster.c.diffDownload+5-0
timestamp.c.diffapplication/octet-stream; name=timestamp.c.diffDownload+28-0
timestamp.h.diffapplication/octet-stream; name=timestamp.h.diffDownload+3-0
"Eric Crampton" <escpg@eonomine.com> writes:
I noticed in the TODO that there is an item requesting a function which
returns the uptime of the postmaster. I've wanted that as well. So, I've
added just such a thing: server_start_time(). This function returns the
time when the postmaster was started; a simple now() - server_start_time()
returns the uptime.
Isn't there one of these in the patch queue already?
The patch as given won't work on Windows, because it depends on fork
inheritance of the value. I think the previous patcher fixed that.
regards, tom lane
On Feb 24, 2005, at 5:38 PM, Tom Lane wrote:
"Eric Crampton" <escpg@eonomine.com> writes:
I noticed in the TODO that there is an item requesting a function
which
returns the uptime of the postmaster. I've wanted that as well. So,
I've
added just such a thing: server_start_time(). This function returns
the
time when the postmaster was started; a simple now() -
server_start_time()
returns the uptime.Isn't there one of these in the patch queue already?
There could be, but I didn't see one because perhaps I'm looking in the
wrong place. I referenced the TODO list here:
http://developer.postgresql.org/todo.php
and I referenced the unapplied patches here:
http://momjian.postgresql.org/cgi-bin/pgpatches
Where should I be looking?
Thanks,
--Eric
Tom Lane wrote:
"Eric Crampton" <escpg@eonomine.com> writes:
I noticed in the TODO that there is an item requesting a function which
returns the uptime of the postmaster. I've wanted that as well. So, I've
added just such a thing: server_start_time(). This function returns the
time when the postmaster was started; a simple now() - server_start_time()
returns the uptime.Isn't there one of these in the patch queue already?
Yes.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Eric Crampton wrote:
On Feb 24, 2005, at 5:38 PM, Tom Lane wrote:
"Eric Crampton" <escpg@eonomine.com> writes:
I noticed in the TODO that there is an item requesting a function
which
returns the uptime of the postmaster. I've wanted that as well. So,
I've
added just such a thing: server_start_time(). This function returns
the
time when the postmaster was started; a simple now() -
server_start_time()
returns the uptime.Isn't there one of these in the patch queue already?
There could be, but I didn't see one because perhaps I'm looking in the
wrong place. I referenced the TODO list here:http://developer.postgresql.org/todo.php
and I referenced the unapplied patches here:
http://momjian.postgresql.org/cgi-bin/pgpatches
Where should I be looking?
Sure:
http://momjian.postgresql.org/cgi-bin/pgpatches2
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Hi *,
I have submitted a patch which does exactly this. Somebody edited it
and Bruce put it on
the queue for 8.1.
Now we both did the same work twice. This is a good example how a
public accessible
Bugtracker and TODO-List where one can claim things (or get assigned to
some workitem)
can save valuable time.
Image someone likes to get in touch with the codebase by fixing some
bugs first. To my
understanding, there is no Bug Database for Postgres (correct me, if I
am wrong).
Where can this volunteer lookup Bugs? I don't want to restart the
Bugzilla Discussion,
since I personally don't have any preference which Trouble-Ticket
System to use.
But I think the idea of having one is worth considering.
cheers,
Matthias
Am 25.02.2005 um 03:51 schrieb Bruce Momjian:
Eric Crampton wrote:
On Feb 24, 2005, at 5:38 PM, Tom Lane wrote:
"Eric Crampton" <escpg@eonomine.com> writes:
I noticed in the TODO that there is an item requesting a function
which
returns the uptime of the postmaster. I've wanted that as well. So,
I've
added just such a thing: server_start_time(). This function returns
the
time when the postmaster was started; a simple now() -
server_start_time()
returns the uptime.Isn't there one of these in the patch queue already?
There could be, but I didn't see one because perhaps I'm looking in
the
wrong place. I referenced the TODO list here:http://developer.postgresql.org/todo.php
and I referenced the unapplied patches here:
http://momjian.postgresql.org/cgi-bin/pgpatches
Where should I be looking?
Sure:
http://momjian.postgresql.org/cgi-bin/pgpatches2
-- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073---------------------------(end of
broadcast)---------------------------
TIP 6: Have you searched our list archives?
----------------------------------------------------------------------
Matthias Schmidt
Viehtriftstr. 49
67346 Speyer
GERMANY
Tel.: +49 6232 4867
Fax.: +49 6232 640089
Have you read the developer's FAQ. It is a requirement to get involved.
---------------------------------------------------------------------------
Matthias Schmidt wrote:
Hi *,
I have submitted a patch which does exactly this. Somebody edited it
and Bruce put it on
the queue for 8.1.Now we both did the same work twice. This is a good example how a
public accessible
Bugtracker and TODO-List where one can claim things (or get assigned to
some workitem)
can save valuable time.Image someone likes to get in touch with the codebase by fixing some
bugs first. To my
understanding, there is no Bug Database for Postgres (correct me, if I
am wrong).
Where can this volunteer lookup Bugs? I don't want to restart the
Bugzilla Discussion,
since I personally don't have any preference which Trouble-Ticket
System to use.
But I think the idea of having one is worth considering.cheers,
Matthias
Am 25.02.2005 um 03:51 schrieb Bruce Momjian:
Eric Crampton wrote:
On Feb 24, 2005, at 5:38 PM, Tom Lane wrote:
"Eric Crampton" <escpg@eonomine.com> writes:
I noticed in the TODO that there is an item requesting a function
which
returns the uptime of the postmaster. I've wanted that as well. So,
I've
added just such a thing: server_start_time(). This function returns
the
time when the postmaster was started; a simple now() -
server_start_time()
returns the uptime.Isn't there one of these in the patch queue already?
There could be, but I didn't see one because perhaps I'm looking in
the
wrong place. I referenced the TODO list here:http://developer.postgresql.org/todo.php
and I referenced the unapplied patches here:
http://momjian.postgresql.org/cgi-bin/pgpatches
Where should I be looking?
Sure:
http://momjian.postgresql.org/cgi-bin/pgpatches2
-- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073---------------------------(end of
broadcast)---------------------------
TIP 6: Have you searched our list archives?----------------------------------------------------------------------
Matthias Schmidt
Viehtriftstr. 4967346 Speyer
GERMANYTel.: +49 6232 4867
Fax.: +49 6232 640089
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Bruce Momjian wrote:
Have you read the developer's FAQ. It is a requirement to get involved.
How does the developer's FAQ address this concern?
-Neil
I have a feeling Bruce was referring to item 1.4:
http://developer.postgresql.org/readtext.php?src/FAQ/
FAQ_DEV.html+Developers-FAQ#1.4
-tfo
--
Thomas F. O'Connell
Co-Founder, Information Architect
Sitening, LLC
http://www.sitening.com/
110 30th Avenue North, Suite 6
Nashville, TN 37203-6320
615-260-0005
On Mar 1, 2005, at 5:18 PM, Neil Conway wrote:
Show quoted text
Bruce Momjian wrote:
Have you read the developer's FAQ. It is a requirement to get
involved.How does the developer's FAQ address this concern?
-Neil
---------------------------(end of
broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to
majordomo@postgresql.org
Thomas F.O'Connell wrote:
I have a feeling Bruce was referring to item 1.4:
http://developer.postgresql.org/readtext.php?src/FAQ/
FAQ_DEV.html+Developers-FAQ#1.4
It has never been standard practice to ask for comments before the
development of small features, such as this one. The recently duplicated
work on allowing multiple "-t" and "-n" options in pg_dump is another
example (although that is complex enough an RFC might be worth doing).
Anyway, I think this is missing the point. Checking "has this work
already been done and is sitting in some patch queue somewhere?" before
doing anything presupposes the existence of a sizeable queue of
unapplied patches that is hard to find. I don't think either of those
should be true. I think Matthias' comment is well-founded: the
committers, myself included, deserve some blame for not making more
rapid progress on the queue of unapplied patches for 8.1. In the
meanwhile, the queue should be easier for folks to find (why is the
"pgpatches" queue the only one linked from postgresql.org, but it is
almost empty?)
-Neil
On Thursday 03 March 2005 19:08, Neil Conway wrote:
Thomas F.O'Connell wrote:
committers, myself included, deserve some blame for not making more
rapid progress on the queue of unapplied patches for 8.1. In the
meanwhile, the queue should be easier for folks to find (why is the
"pgpatches" queue the only one linked from postgresql.org, but it is
almost empty?)
Wow, I hadn't realized just how big that queue had gotten. I've got no qualms
adding another link to the website, but can we get a scheme wrt to links for
the various patche queues? Is pgpatches for the current stable branch and
pgpatches2 for the current development branch? (Well, that can't be true
since before 8.0 release they were both for unstable branches...)
Incidentally, I think DEV_FAQ 1.4 should be modified to include mentioning the
patch queues.
--
Robert Treat
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL
Robert Treat wrote:
On Thursday 03 March 2005 19:08, Neil Conway wrote:
Thomas F.O'Connell wrote:
committers, myself included, deserve some blame for not making more
rapid progress on the queue of unapplied patches for 8.1. In the
meanwhile, the queue should be easier for folks to find (why is the
"pgpatches" queue the only one linked from postgresql.org, but it is
almost empty?)Wow, I hadn't realized just how big that queue had gotten. I've got no qualms
adding another link to the website, but can we get a scheme wrt to links for
the various patche queues? Is pgpatches for the current stable branch and
pgpatches2 for the current development branch? (Well, that can't be true
since before 8.0 release they were both for unstable branches...)Incidentally, I think DEV_FAQ 1.4 should be modified to include mentioning the
patch queues.
Done:
1.4) What do I do after choosing an item to work on?
Send an email to pgsql-hackers with a proposal for what you want to do
(assuming your contribution is not trivial). Working in isolation is not
advisable: others may be working on the same TODO item; you may have
misunderstood the TODO item; your approach may benefit from the review
of others.
A web site is maintained for patches that are ready to be applied,
http://momjian.postgresql.org/cgi-bin/pgpatches, and those that are
being kept for the next release,
http://momjian.postgresql.org/cgi-bin/pgpatches2.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073