Re: Load distributed checkpoint

From: "Takayuki Tsunakawa" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>
To: "Jim C(dot) Nasby" <jim(at)nasby(dot)net>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>, "ITAGAKI Takahiro" <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Load distributed checkpoint
Date: 2006-12-13 09:27:38
Message-ID: 023301c71e98$eea3e850$19527c0a@OPERAO
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Hello,

From: "Jim C. Nasby" <jim(at)nasby(dot)net>
Also, I have a dumb question... BgBufferSync uses buf_id1 to keep
track
> of what buffer the bgwriter_all scan is looking at, which means that
> it should remember where it was at the end of the last scan; yet
it's
> initialized to 0 every time BgBufferSync is called. Is there
someplace
> else that is remembering where the complete scan is leaving off when
> bgwriter_all_percent or bgwriter_all_maxpages is hit? Or does the
scan
> in fact just keep re-scanning the beginning of the buffers?

No. BgBufferSync() correctly keeps track of the position to restart
scanning at. bufid1 is not initialized to 0 every time BgBufferSync()
is called, because bufid1 is a static local variable. Please see the
following code. It prints:

a=0
a=1
a=2

#include <stdio.h>

void func(void)
{
static int a = 0;

printf("a=%d\n", a);
a++;
}

int main(void)
{
func();
func();
func();

return 0;
}

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2006-12-13 11:29:44 TOAST table names
Previous Message Dave Page 2006-12-13 08:33:33 Re: libpq.a in a universal binary

Browse pgsql-patches by date

  From Date Subject
Next Message Andrew Dunstan 2006-12-13 14:00:16 Re: psql commandline conninfo
Previous Message Jim C. Nasby 2006-12-13 06:32:43 Re: Load distributed checkpoint