contrib/pg_buffercache

Started by Andrew Dunstanalmost 21 years ago19 messages
#1Andrew Dunstan
andrew@dunslane.net

... is apparently broken for Windows and Cygwin. See for example
http://www.pgbuildfarm.org/cgi-bin/show_log.pl?nm=loris&dt=2005-03-16%2001:55:33
cheers

andrew

#2Mark Kirkwood
markir@paradise.net.nz
In reply to: Andrew Dunstan (#1)
Re: contrib/pg_buffercache

Andrew Dunstan wrote:

... is apparently broken for Windows and Cygwin. See for example
http://www.pgbuildfarm.org/cgi-bin/show_log.pl?nm=loris&dt=2005-03-16%2001:55:33
cheers

hmmm - never tried to compile it on win32! I am getting http 502 from
the above url, so I will have a go at building on win32 tomorrow.

cheers

Mark

#3Mark Kirkwood
markir@paradise.net.nz
In reply to: Andrew Dunstan (#1)
1 attachment(s)
Re: contrib/pg_buffercache

Andrew Dunstan wrote:

... is apparently broken for Windows and Cygwin. See for example
http://www.pgbuildfarm.org/cgi-bin/show_log.pl?nm=loris&dt=2005-03-16%2001:55:33

Andrew,

The attached patch seems to sort it for me, can you give it try on win32
and cygwin?

cheers

Mark

Attachments:

pg_buffercache_pages.c.patchtext/plain; name=pg_buffercache_pages.c.patchDownload
--- pg_buffercache_pages.c.orig	Sun Mar 13 04:36:24 2005
+++ pg_buffercache_pages.c	Wed Mar 16 20:57:52 2005
@@ -17,6 +17,11 @@
 
 #define NUM_BUFFERCACHE_PAGES_ELEM	6
 
+#ifdef WIN32
+extern DLLIMPORT BufferDesc		*BufferDescriptors;
+extern DLLIMPORT volatile uint32	InterruptHoldoffCount;
+#endif
+
 
 /*
  * Record structure holding the to be exposed cache data.
#4Andrew Dunstan
andrew@dunslane.net
In reply to: Mark Kirkwood (#3)
Re: contrib/pg_buffercache

It fixes the build error on Windows - haven't tried because i don't have
time, but I know it won't work on Cygwin, because WIN32 isn't (usually)
defined on Cygwin - see previous almost endless discussions.

cheers

andrew

Mark Kirkwood wrote:

Show quoted text

Andrew Dunstan wrote:

... is apparently broken for Windows and Cygwin. See for example
http://www.pgbuildfarm.org/cgi-bin/show_log.pl?nm=loris&dt=2005-03-16%2001:55:33

Andrew,

The attached patch seems to sort it for me, can you give it try on
win32 and cygwin?

cheers

Mark

------------------------------------------------------------------------

--- pg_buffercache_pages.c.orig	Sun Mar 13 04:36:24 2005
+++ pg_buffercache_pages.c	Wed Mar 16 20:57:52 2005
@@ -17,6 +17,11 @@

#define NUM_BUFFERCACHE_PAGES_ELEM 6

+#ifdef WIN32
+extern DLLIMPORT BufferDesc		*BufferDescriptors;
+extern DLLIMPORT volatile uint32	InterruptHoldoffCount;
+#endif
+

/*
* Record structure holding the to be exposed cache data.

------------------------------------------------------------------------

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

#5Mark Kirkwood
markir@paradise.net.nz
In reply to: Andrew Dunstan (#4)
1 attachment(s)
Re: contrib/pg_buffercache

Andrew Dunstan wrote:

It fixes the build error on Windows - haven't tried because i don't have
time, but I know it won't work on Cygwin, because WIN32 isn't (usually)
defined on Cygwin - see previous almost endless discussions.

Yes - I recall that discussion a while ago.

This patch should sort the issue.

One question, should I be using defined(__MINGW32__) as opposed to
defined(WIN32)? I figured I didn't as in this case it is not necessary
to distinguish between native and cygwin.

regards

Mark

Attachments:

pg_buffercache_pages.h.difftext/plain; name=pg_buffercache_pages.h.diffDownload
*** pg_buffercache_pages.h.orig	Thu Mar 17 10:12:20 2005
--- pg_buffercache_pages.h	Thu Mar 17 13:44:45 2005
***************
*** 15,18 ****
--- 15,24 ----
  
  extern Datum pg_buffercache_pages(PG_FUNCTION_ARGS);
  
+ /* A little hackery for Windows and Cygwin */
+ #if defined (WIN32) || defined (__CYGWIN__)
+ extern DLLIMPORT BufferDesc			*BufferDescriptors;
+ extern DLLIMPORT volatile uint32	InterruptHoldoffCount;
+ #endif
+ 
  #endif  /* PG_BUFFERCACHE_PAGES_H */

#6Andrew Dunstan
andrew@dunslane.net
In reply to: Mark Kirkwood (#5)
Re: contrib/pg_buffercache

Mark Kirkwood wrote:

Andrew Dunstan wrote:

It fixes the build error on Windows - haven't tried because i don't have
time, but I know it won't work on Cygwin, because WIN32 isn't (usually)
defined on Cygwin - see previous almost endless discussions.

Yes - I recall that discussion a while ago.

This patch should sort the issue.

One question, should I be using defined(__MINGW32__) as opposed to
defined(WIN32)? I figured I didn't as in this case it is not necessary
to distinguish between native and cygwin.

You figured correctly.

cheers

andrew

#7Mark Kirkwood
markir@paradise.net.nz
In reply to: Andrew Dunstan (#6)
Re: contrib/pg_buffercache

Andrew Dunstan wrote:

Mark Kirkwood wrote:

Andrew Dunstan wrote:

It fixes the build error on Windows - haven't tried because i don't have
time, but I know it won't work on Cygwin, because WIN32 isn't (usually)
defined on Cygwin - see previous almost endless discussions.

Yes - I recall that discussion a while ago.

This patch should sort the issue.

One question, should I be using defined(__MINGW32__) as opposed to
defined(WIN32)? I figured I didn't as in this case it is not necessary
to distinguish between native and cygwin.

You figured correctly.

Oh, and thanks to your efforts with the automated build system this gets
picked up now instead of lurking till after release - great work!

cheers

Mark

#8Andrew Dunstan
andrew@dunslane.net
In reply to: Andrew Dunstan (#4)
1 attachment(s)
Re: [HACKERS] contrib/pg_buffercache

I have confirmed that the attached patch works on Cygwin as well as
Windows. Please apply.

cheers

andrew

Andrew Dunstan wrote:

Show quoted text

It fixes the build error on Windows - haven't tried because i don't have
time, but I know it won't work on Cygwin, because WIN32 isn't (usually)
defined on Cygwin - see previous almost endless discussions.

cheers

andrew

Mark Kirkwood wrote:

Andrew Dunstan wrote:

... is apparently broken for Windows and Cygwin. See for example
http://www.pgbuildfarm.org/cgi-bin/show_log.pl?nm=loris&dt=2005-03-16%2001:55:33

Andrew,

The attached patch seems to sort it for me, can you give it try on
win32 and cygwin?

cheers

Mark

Attachments:

buffercache.patchtext/x-patch; name=buffercache.patchDownload
Index: contrib/pg_buffercache/pg_buffercache_pages.c
===================================================================
RCS file: /home/cvsmirror/pgsql/contrib/pg_buffercache/pg_buffercache_pages.c,v
retrieving revision 1.1
diff -c -r1.1 pg_buffercache_pages.c
*** contrib/pg_buffercache/pg_buffercache_pages.c	12 Mar 2005 15:36:24 -0000	1.1
--- contrib/pg_buffercache/pg_buffercache_pages.c	30 Mar 2005 19:35:59 -0000
***************
*** 17,22 ****
--- 17,27 ----
  
  #define NUM_BUFFERCACHE_PAGES_ELEM	6
  
+ #if defined(WIN32) || defined(__CYGWIN__)
+ extern DLLIMPORT BufferDesc	*BufferDescriptors;
+ extern DLLIMPORT volatile uint32	InterruptHoldoffCount;
+ #endif
+ 
  
  /*
   * Record structure holding the to be exposed cache data.
#9Neil Conway
neilc@samurai.com
In reply to: Andrew Dunstan (#8)
Re: [HACKERS] contrib/pg_buffercache

Andrew Dunstan wrote:

I have confirmed that the attached patch works on Cygwin as well as
Windows. Please apply.

Applied, thanks.

-Neil

#10Mark Kirkwood
markir@paradise.net.nz
In reply to: Neil Conway (#9)
1 attachment(s)
Re: [HACKERS] contrib/pg_buffercache

Neil Conway wrote:

Andrew Dunstan wrote:

I have confirmed that the attached patch works on Cygwin as well as
Windows. Please apply.

Applied, thanks.

Great that it fixes it... however, I had submitted a tidier patch that
puts the macro in the header (probably after asking Andrew to test the
first one, oops - sorry Andrew). I have tested it on win32 native.

Do you want to back out the first one and use this instead?

regards

Mark

Attachments:

pg_buffercache_pages.h.difftext/plain; name=pg_buffercache_pages.h.diffDownload
*** pg_buffercache_pages.h.orig	Thu Mar 17 10:12:20 2005
--- pg_buffercache_pages.h	Thu Mar 17 13:44:45 2005
***************
*** 15,18 ****
--- 15,24 ----
  
  extern Datum pg_buffercache_pages(PG_FUNCTION_ARGS);
  
+ /* A little hackery for Windows and Cygwin */
+ #if defined (WIN32) || defined (__CYGWIN__)
+ extern DLLIMPORT BufferDesc			*BufferDescriptors;
+ extern DLLIMPORT volatile uint32	InterruptHoldoffCount;
+ #endif
+ 
  #endif  /* PG_BUFFERCACHE_PAGES_H */

#11Neil Conway
neilc@samurai.com
In reply to: Mark Kirkwood (#10)
Re: [HACKERS] contrib/pg_buffercache

Mark Kirkwood wrote:

Great that it fixes it... however, I had submitted a tidier patch that
puts the macro in the header

How is this tidier?

(I don't see a reason for pg_buffercache_pages.h at all, actually.)

-Neil

#12Mark Kirkwood
markir@paradise.net.nz
In reply to: Neil Conway (#11)
Re: [HACKERS] contrib/pg_buffercache

Neil Conway wrote:

Mark Kirkwood wrote:

Great that it fixes it... however, I had submitted a tidier patch that
puts the macro in the header

How is this tidier?

err... puts the macro in the header....

(I don't see a reason for pg_buffercache_pages.h at all, actually.)

(chuckles) - well, that puts a different complexion on it, best leave it
as is then! (in fact, feel free to move the declaration from
pg_buffercache_pages.h to pg_buffercache_pages.c, and eliminate the
header altogether)

cheers

Mark

#13Andrew Dunstan
andrew@dunslane.net
In reply to: Mark Kirkwood (#10)
Re: [HACKERS] contrib/pg_buffercache

Mark Kirkwood wrote:

Neil Conway wrote:

Andrew Dunstan wrote:

I have confirmed that the attached patch works on Cygwin as well as
Windows. Please apply.

Applied, thanks.

Great that it fixes it... however, I had submitted a tidier patch that
puts the macro in the header (probably after asking Andrew to test the
first one, oops - sorry Andrew). I have tested it on win32 native.

Do you want to back out the first one and use this instead?

I didn't see the original of the later patch, which is why I sent in
mine. I honestly don't care that much either way, although I'm inclined
to agree that the header file is just unnecessary noise.

cheers

andrew

#14Mark Kirkwood
markir@paradise.net.nz
In reply to: Andrew Dunstan (#13)
1 attachment(s)
Re: [HACKERS] contrib/pg_buffercache

Andrew Dunstan wrote:

I didn't see the original of the later patch, which is why I sent in
mine. I honestly don't care that much either way, although I'm inclined
to agree that the header file is just unnecessary noise.

Well, looks like a strong feeling for no header :-). I didn't really
think about *not* having one to be honest. So, anyway - instead of
inviting Neil to spend valuable time eliminating it, I should do it
myself...

So, please ignore my previous patch to the header file, and consider
this one - which eliminates it completely.

best wishes

Mark

Attachments:

pg_buffercache-noheader.patchtext/plain; name=pg_buffercache-noheader.patchDownload
diff -Nacr pg_buffercache.orig/pg_buffercache_pages.c pg_buffercache/pg_buffercache_pages.c
*** pg_buffercache.orig/pg_buffercache_pages.c	Fri Apr  1 11:25:49 2005
--- pg_buffercache/pg_buffercache_pages.c	Fri Apr  1 11:28:22 2005
***************
*** 12,18 ****
  #include "storage/buf_internals.h"
  #include "storage/bufmgr.h"
  #include "utils/relcache.h"
- #include "pg_buffercache_pages.h"
  
  
  #define NUM_BUFFERCACHE_PAGES_ELEM	6
--- 12,17 ----
***************
*** 21,26 ****
--- 20,27 ----
  extern DLLIMPORT BufferDesc	*BufferDescriptors;
  extern DLLIMPORT volatile uint32	InterruptHoldoffCount;
  #endif
+ 
+ Datum	pg_buffercache_pages(PG_FUNCTION_ARGS);
  
  
  /*
diff -Nacr pg_buffercache.orig/pg_buffercache_pages.h pg_buffercache/pg_buffercache_pages.h
*** pg_buffercache.orig/pg_buffercache_pages.h	Fri Apr  1 11:25:49 2005
--- pg_buffercache/pg_buffercache_pages.h	Thu Jan  1 12:00:00 1970
***************
*** 1,18 ****
- /*-------------------------------------------------------------------------
-  *
-  * pg_buffercache_pages.h
-  *    Prototypes for pg_buffercache_pages
-  *
-  *
-  *    $PostgreSQL: pgsql/contrib/pg_buffercache/pg_buffercache_pages.h,v 1.1 2005/03/12 15:36:24 neilc Exp $
-  *
-  *-------------------------------------------------------------------------
-  */
- 
- 
- #ifndef PG_BUFFERCACHE_PAGES_H
- #define PG_BUFFERCACHE_PAGES_H
- 
- extern Datum pg_buffercache_pages(PG_FUNCTION_ARGS);
- 
- #endif  /* PG_BUFFERCACHE_PAGES_H */
--- 0 ----
#15Neil Conway
neilc@samurai.com
In reply to: Mark Kirkwood (#14)
Re: [HACKERS] contrib/pg_buffercache

Mark Kirkwood wrote:

So, please ignore my previous patch to the header file, and consider
this one - which eliminates it completely.

Thanks, applied.

-Neil

#16Ioannis Theoharis
theohari@ics.forth.gr
In reply to: Andrew Dunstan (#1)
Transitive Closure and 'pg_inherits'

Hi,

in case one use 'inherits' relationship to create a hierarchy of
tables, table 'pg_inherits' stores for each table the information of which
is its parent table.

During the evaluation of a query like
select * from Root;
where Root is the 'root' table of our hierarchy, postgreSQL needs to
find which tables are involved in the result (which tables belong to the
hierarchy).

My question is whether the way, in wich postgresql do this task, is a
transitive closure on table 'pg_inherits' or there is a better approach
implemented (like numbering scheme techniques etc.) ?

If there is a related url, please send it to me.

#17Ioannis Theoharis
theohari@ics.forth.gr
In reply to: Andrew Dunstan (#1)
Recursive SQL

Also i'd like to answer you if postgresQL has implemented rcursive queries
proposed from SQL99 standard?

If yes, are there any restrictions of the model on your implementation?

#18Tom Lane
tgl@sss.pgh.pa.us
In reply to: Ioannis Theoharis (#16)
Re: Transitive Closure and 'pg_inherits'

Ioannis Theoharis <theohari@ics.forth.gr> writes:

My question is whether the way, in wich postgresql do this task, is a
transitive closure on table 'pg_inherits' or there is a better approach
implemented (like numbering scheme techniques etc.) ?

It's a transitive closure, and not a very bright one at that; see
find_all_inheritors(), find_inheritance_children(), and particularly
the comments to the latter. However, we've not heard reports indicating
that this is a serious bottleneck in any real-world situation, so
no one has spent time to improve it. (I'd expect the per-table planning
costs to vastly outweigh the cost of finding those tables, anyway.)

regards, tom lane

#19Euler Taveira de Oliveira
eulerto@yahoo.com.br
In reply to: Ioannis Theoharis (#17)
Re: Recursive SQL

Hi Ioannis,

Also i'd like to answer you if postgresQL has implemented rcursive
queries
proposed from SQL99 standard?

Not yet. But there is a patch around that implement it. See
http://gppl.moonbone.ru/

If yes, are there any restrictions of the model on your
implementation?

The patch the way it is, it wasn't accept. Search in the archives for
"recursive sql", "hierarchical queries" or "Evgen Potemkin" (its
author) to know more about this topic.

Euler Taveira de Oliveira
euler[at]yahoo_com_br

Yahoo! Acesso Gr�tis - Internet r�pida e gr�tis.
Instale o discador agora! http://br.acesso.yahoo.com/