Hi,
I noticed that the BufferDesc structure contains the following field
and a comment :
/*
* Buffer's index number (from 0). The field never changes after
* initialization, so does not need locking.
*/
int buf_id;
Actually, the comment is wrong, because we are using negative ids for
local buffers (i.e. "buf_id" field contains values -1, -2, and so on). We
have a comment about it in localbuf.c :
/*
* negative to indicate local buffer. This is tricky: shared buffers
* start with 0. We have to start with -2. (Note that the routine
* BufferDescriptorGetBuffer adds 1 to buf_id so our first buffer id
* is -1.)
*/
Maybe we should place this note in buf_internals.h? Anyone who
wants to know what this field means will look at the comment in
buf_internals.h and be misled.
I have attached a patch with my suggestion. What do you think?
--
Best regards,
Daniil Davydov