From: | Tallat Mahmood <tallat(dot)mahmood(at)gmail(dot)com> |
---|---|
To: | David Fetter <david(at)fetter(dot)org> |
Cc: | fazool mein <fazoolmein(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: xlog.c: WALInsertLock vs. WALWriteLock |
Date: | 2010-10-24 05:34:51 |
Message-ID: | AANLkTimPejdzScjxq9rJ8C4kLB_YVhmnO+gsAmUnMNwK@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> I'm writing a function that will read data from the buffer in xlog
> > (i.e. from XLogCtl->pages and XLogCtl->xlblocks). I want to make
> > sure that I am doing it correctly.
>
> Got an example of what the function might look like?
>
Say something like this:
bool ReadLogFromBuffer(char *buf, int len, XLogRecPtr p)
which will mean that we want to read the log (records) into buf at position
p of length len.
>
> > For reading from the buffer, do I need to lock WALInsertLock or
> > WALWriteLock? Also, can you explain a bit the usage of 'LW_SHARED'.
> > Can we use it for read purposes?
>
> Help me understand. Do you foresee some kind of concurrency issue,
> and if so, what?
>
Yes. For example, while a process is reading from the buffer, another
process may insert new records into the buffer. To give a specific example,
walsender might want to read data from the buffer instead of reading log
from disk. In parallel, there might be transactions on the server that
modify the buffer.
Regards,
Tallat
From | Date | Subject | |
---|---|---|---|
Next Message | Terry Laurenzo | 2010-10-24 06:21:27 | Re: patch: Add JSON datatype to PostgreSQL (GSoC, WIP) |
Previous Message | Robert Haas | 2010-10-24 05:11:13 | Re: WIP: extensible enums |