On Thu, May 13, 2004 at 09:43:42AM -0400, Tom Lane wrote: > BTW, what are your plans for state saving/reversion for the lock manager > and buffer manager?
Ok, I have skimmed through the buffer manager code. At first I thought I'd have to set something up in shared memory for this, but then I noticed that every backend keeps a local reference count, and modifies the shared counter only when the local one raises from zero, or drops to zero. Also, the number of buffers does not change while the server is running. So I see two ways of handling this: 1. Keep an array of local refcounts for all buffers, for each subtrans. At subtrans start, a new array is allocated and filled with current local refcounts. At subtrans abort, we check if any count would go to zero while restoring; if so, decrement the shared counter. At subtrans commit, drop the saved array. The problem with this approach is that we allocate a large array which likely will be almost full of zeros. 2. Keep a more elaborate struct, where each buffer get its local count saved only if its nonzero. Thus we don't have to allocate a large amount of memory. Comments? Opinions? Which one do you think is better? Any completely different idea? -- Alvaro Herrera (<alvherre[a]dcc.uchile.cl>) "Coge la flor que hoy nace alegre, ufana. ¿Quién sabe si nacera otra mañana?" ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly