Re: [PATCHES] Display Pg buffer cache (WIP)

2005-03-12 Thread Neil Conway
Mark Kirkwood wrote: A couple of minor amendments here: - remove link to libpq (from cut+past of dblnk's Makefile) - add comment for pg_buffercache module in contrib/README - change my listed email to this one (I have resigned) Applied, thanks for the patch. BTW, I removed the REGRESS=... line

Re: [PATCHES] Display Pg buffer cache (WIP)

2005-03-10 Thread Mark Kirkwood
A couple of minor amendments here: - remove link to libpq (from cut+past of dblnk's Makefile) - add comment for pg_buffercache module in contrib/README - change my listed email to this one (I have resigned) regards Mark diff -Nacr pgsql.orig/contrib/Makefile pgsql/contrib/Makefile ***

Re: [PATCHES] Display Pg buffer cache (WIP)

2005-03-08 Thread Mark Kirkwood
Tom Lane wrote: I would rather see this as a contrib module. There has been *zero* consensus that we need this in core, nor any discussion about whether it might be a security hole. Hmmm, I guess my motivation for thinking it might be useful in core was that it was similar to 'pg_locks' and

Re: [PATCHES] Display Pg buffer cache (WIP)

2005-03-08 Thread Mark Kirkwood
Neil Conway wrote: Mark Kirkwood wrote: + TupleDescInitEntry(tupledesc, (AttrNumber) 5, relblockbumber, + NUMERICOID, -1, 0); I think this should be an int4, not numeric. I was looking for an UINT4OID :-), but numeric seemed the best compromise (safer

Re: [PATCHES] Display Pg buffer cache (WIP)

2005-03-08 Thread Mark Kirkwood
Tom Lane wrote: One reason for making it contrib is that I don't think you've got it entirely right yet, and there will be several iterations before it settles down. In a contrib module that is no problem, in core it's a forced initdb each time. Yeah - certainly less intrusive as a contrib if

Re: [PATCHES] Display Pg buffer cache (WIP)

2005-03-08 Thread Mark Kirkwood
Mark Kirkwood wrote: Tom Lane wrote: One reason for making it contrib is that I don't think you've got it entirely right yet, and there will be several iterations before it settles down. In a contrib module that is no problem, in core it's a forced initdb each time. Yeah - certainly less

Re: [PATCHES] Display Pg buffer cache (WIP)

2005-03-07 Thread Mark Kirkwood
The latest iteration. I have added documentation and updated the expected output so that the regression tests pass. In addition, after looking at the various system view names, I decided that 'pg_cache_dump' does not fit in nicely - so chose an more Pg suitable name of 'pg_buffercache'. Some

Re: [PATCHES] Display Pg buffer cache (WIP)

2005-03-07 Thread Neil Conway
Mark Kirkwood wrote: + tupledesc = CreateTemplateTupleDesc(NUM_BUFFERCACHE_PAGES_ELEM, false); + TupleDescInitEntry(tupledesc, (AttrNumber) 1, bufferid, + INT4OID, -1, 0); +

Re: [PATCHES] Display Pg buffer cache (WIP)

2005-03-07 Thread Tom Lane
Neil Conway [EMAIL PROTECTED] writes: Mark Kirkwood wrote: +TupleDescInitEntry(tupledesc, (AttrNumber) 5, relblockbumber, + NUMERICOID, -1, 0); I think this should be an int4, not numeric. needs spell check too

Re: [PATCHES] Display Pg buffer cache (WIP)

2005-03-07 Thread Neil Conway
Tom Lane wrote: Perhaps OID would be a good choice even though it's horribly wrong on one level. Either that or add unsigned numeric types to PG :-) I would rather see this as a contrib module. I don't really have an opinion either way. Does anyone else have thoughts on this? There has been

Re: [PATCHES] Display Pg buffer cache (WIP)

2005-03-06 Thread Neil Conway
Tom Lane wrote: It'd be possible to dispense with the per-buffer spinlocks so long as you look only at the tag (and perhaps the TAG_VALID flag bit). The tags can't be changing while you hold the BufMappingLock. That's what I had thought at first, but this comment in buf_internals.h dissuaded

Re: [PATCHES] Display Pg buffer cache (WIP)

2005-03-06 Thread Neil Conway
Only two things to add: you forgot to add `cachedump.o' to the list of OBJS in the utils/adt Makefile. Mark Kirkwood wrote: +typedef struct +{ + uint32 bufferid; + Oid relfilenode; + Oid reltablespace; + Oid

Re: [PATCHES] Display Pg buffer cache (WIP)

2005-03-06 Thread Mark Kirkwood
Neil Conway wrote: Tom Lane wrote: It'd be possible to dispense with the per-buffer spinlocks so long as you look only at the tag (and perhaps the TAG_VALID flag bit). The tags can't be changing while you hold the BufMappingLock. That's what I had thought at first, but this comment in

Re: [PATCHES] Display Pg buffer cache (WIP)

2005-03-05 Thread Mark Kirkwood
Neil Conway wrote: If you do decide to hold the BufMappingLock, it might make sense to: 1. allocate an array of NBuffers elements 2. acquire BufferMappingLock in share mode 3. sequentially scan through the buffer pool, copying data into the array 4. release the lock 5. on each subsequent call to

Re: [PATCHES] Display Pg buffer cache (WIP)

2005-03-05 Thread Tom Lane
Mark Kirkwood [EMAIL PROTECTED] writes: In addition to holding the BufMappingLock, each buffer header is (spin) locked before examining it, hopefully this is correct - BTW, I like the new buffer lock design. It'd be possible to dispense with the per-buffer spinlocks so long as you look only at

Re: [PATCHES] Display Pg buffer cache (WIP)

2005-03-04 Thread Mark Kirkwood
Tom Lane wrote: Mark Kirkwood [EMAIL PROTECTED] writes: I am using anoncvs from yesterday, so if Tom's new scheme is *very* new I may be missing it. It's not committed yet ;-) Yep - that's pretty new, apologies for slow grey matter... I have been following the discussion about the new buffer

Re: [PATCHES] Display Pg buffer cache (WIP)

2005-03-03 Thread Mark Kirkwood
Neil Conway wrote: I don't like accessing shared data structures without acquiring the appropriate locks; even if it doesn't break anything, it seems like just asking for trouble. In order to be able to inspect a buffer's tag in Tom's new locking scheme (not yet in HEAD, but will be in 8.1),

Re: [PATCHES] Display Pg buffer cache (WIP)

2005-03-03 Thread Neil Conway
Mark Kirkwood wrote: If so, it looks like I need to do some stuff with ResourceOwners, otherwise ReleaseBuffer will fail (or am I wandering up the wrong track here?). I am using anoncvs from yesterday, so if Tom's new scheme is *very* new I may be missing it. It's so new, in fact, it's not in CVS

Re: [PATCHES] Display Pg buffer cache (WIP)

2005-03-03 Thread Tom Lane
Mark Kirkwood [EMAIL PROTECTED] writes: I am using anoncvs from yesterday, so if Tom's new scheme is *very* new I may be missing it. It's not committed yet ;-) regards, tom lane ---(end of broadcast)--- TIP 5: Have you

[PATCHES] Display Pg buffer cache (WIP)

2005-03-02 Thread Mark Kirkwood
I found it useful to be able to look at what relations are occupying the cache (mainly for debugging and comparing with page estimates). I am wondering if it might be a useful addition generally? How it works a SRF called dump_cache() is created, which is then exposed as system view pg_dump_cache.

Re: [PATCHES] Display Pg buffer cache (WIP)

2005-03-02 Thread Neil Conway
Mark Kirkwood wrote: does not worry too much about a consistent view of the buffer contents (as I didn't want it to block all other activity!). I don't like accessing shared data structures without acquiring the appropriate locks; even if it doesn't break anything, it seems like just asking for