Re: Improve WALRead() to suck data directly from WAL buffers when possible
От
Dilip Kumar
Тема
Re: Improve WALRead() to suck data directly from WAL buffers when possible
Дата
Msg-id
CAFiTN-vqPbOV-5wv=QgvoOdi4Gtx09oa-gkbgiAEF5XFULm54A@mail.gmail.com
Ответ на
Re: Improve WALRead() to suck data directly from WAL buffers when possible (Bharath Rupireddy)
Список
Дерево обсуждения
Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Dilip Kumar <dilipbalaut@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Jeff Davis <pgsql@j-davis.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Andres Freund <andres@anarazel.de>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Jeff Davis <pgsql@j-davis.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Andres Freund <andres@anarazel.de>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Jeff Davis <pgsql@j-davis.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Nathan Bossart <nathandbossart@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Jeff Davis <pgsql@j-davis.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Andres Freund <andres@anarazel.de>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Andres Freund <andres@anarazel.de>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Jeff Davis <pgsql@j-davis.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Jeff Davis <pgsql@j-davis.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Andres Freund <andres@anarazel.de>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Jeff Davis <pgsql@j-davis.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Jeff Davis <pgsql@j-davis.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Jeff Davis <pgsql@j-davis.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Alvaro Herrera <alvherre@alvh.no-ip.org>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Alvaro Herrera <alvherre@alvh.no-ip.org>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Jeff Davis <pgsql@j-davis.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Andres Freund <andres@anarazel.de>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Jeff Davis <pgsql@j-davis.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Andres Freund <andres@anarazel.de>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Jeff Davis <pgsql@j-davis.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Jeff Davis <pgsql@j-davis.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Andres Freund <andres@anarazel.de>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Jeff Davis <pgsql@j-davis.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Jeff Davis <pgsql@j-davis.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible "Andrey M. Borodin" <x4mmm@yandex-team.ru>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Michael Paquier <michael@paquier.xyz>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Michael Paquier <michael@paquier.xyz>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Jeff Davis <pgsql@j-davis.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Andres Freund <andres@anarazel.de>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Jeff Davis <pgsql@j-davis.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Melih Mutlu <m.melihmutlu@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Jeff Davis <pgsql@j-davis.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Andres Freund <andres@anarazel.de>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Jeff Davis <pgsql@j-davis.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Jeff Davis <pgsql@j-davis.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Andres Freund <andres@anarazel.de>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Masahiko Sawada <sawada.mshk@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Andres Freund <andres@anarazel.de>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Masahiko Sawada <sawada.mshk@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Dilip Kumar <dilipbalaut@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Dilip Kumar <dilipbalaut@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Nathan Bossart <nathandbossart@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Nathan Bossart <nathandbossart@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Nathan Bossart <nathandbossart@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Nathan Bossart <nathandbossart@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Nitin Jadhav <nitinjadhavpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Kuntal Ghosh <kuntalghosh.2007@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: Improve WALRead() to suck data directly from WAL buffers when possible Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
On Mon, Dec 26, 2022 at 2:20 PM Bharath Rupireddy
wrote:
>
I have gone through this patch, I have some comments (mostly cosmetic
and comments)
1.
+ /*
+ * We have found the WAL buffer page holding the given LSN. Read from a
+ * pointer to the right offset within the page.
+ */
+ memcpy(page, (XLogCtl->pages + idx * (Size) XLOG_BLCKSZ),
+ (Size) XLOG_BLCKSZ);
From the above comments, it appears that we are reading from the exact
pointer we are interested to read, but actually, we are reading
the complete page. I think this comment needs to be fixed and we can
also explain why we read the complete page here.
2.
+static char *
+GetXLogBufferForRead(XLogRecPtr ptr, TimeLineID tli, char *page)
+{
+ XLogRecPtr expectedEndPtr;
+ XLogRecPtr endptr;
+ int idx;
+ char *recptr = NULL;
Generally, we use the name 'recptr' to represent XLogRecPtr type of
variable, but in your case, it is actually data at that recptr, so
better use some other name like 'buf' or 'buffer'.
3.
+ if ((recptr + nbytes) <= (page + XLOG_BLCKSZ))
+ {
+ /* All the bytes are in one page. */
+ memcpy(dst, recptr, nbytes);
+ dst += nbytes;
+ *read_bytes += nbytes;
+ ptr += nbytes;
+ nbytes = 0;
+ }
+ else if ((recptr + nbytes) > (page + XLOG_BLCKSZ))
+ {
+ /* All the bytes are not in one page. */
+ Size bytes_remaining;
Why do you have this 'else if ((recptr + nbytes) > (page +
XLOG_BLCKSZ))' check in the else part? why it is not directly else
without a condition in 'if'?
4.
+XLogReadFromBuffers(XLogRecPtr startptr,
+ TimeLineID tli,
+ Size count,
+ char *buf,
+ Size *read_bytes)
I think we do not need 2 separate variables 'count' and '*read_bytes',
just one variable for input/output is sufficient. The original value
can always be stored in some temp variable
instead of the function argument.
--
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com
В списке pgsql-hackers по дате отправления