Re: [DOCS] pg_total_relation_size() and CHECKPOINT

From: "Zubkovsky, Sergey" <Sergey(dot)Zubkovsky(at)transas(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Andrew Dunstan" <andrew(at)dunslane(dot)net>
Cc: "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>, "Gregory Stark" <stark(at)enterprisedb(dot)com>, <pgsql-hackers(at)postgresql(dot)org>, "Magnus Hagander" <magnus(at)hagander(dot)net>
Subject: Re: [DOCS] pg_total_relation_size() and CHECKPOINT
Date: 2008-03-27 12:30:01
Message-ID: 528853D3C5ED2C4AA8990B504BA7FB850106DF2A@sol.transas.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-hackers


Maybe this helps:

"It is not an error to set a file pointer to a position beyond the end
of the file. The size of the file does not increase until you call the
SetEndOfFile, WriteFile, or WriteFileEx function. A write operation
increases the size of the file to the file pointer position plus the
size of the buffer written, which results in the intervening bytes
uninitialized."

http://msdn2.microsoft.com/en-us/library/aa365541(VS.85).aspx

According to Windows' lseek implementation (attached) SetEndOfFile()
isn't called for this case.

Thanks,
Sergey Zubkovsky

-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: Thursday, March 27, 2008 7:14 AM
To: Andrew Dunstan
Cc: Alvaro Herrera; Gregory Stark; Zubkovsky, Sergey;
pgsql-hackers(at)postgresql(dot)org; Magnus Hagander
Subject: Re: [HACKERS] [DOCS] pg_total_relation_size() and CHECKPOINT

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> I suspect that the size reported by stat() is a little delayed here,
but
> the file system is keeping proper track of it, so the lseek that tries

> to extend the file fails at the right spot.

Hmm. If it really works that way, one would hope Microsoft would've
documented that someplace. Can anyone find a statement that Windows'
stat() is not current?

regards, tom lane

Attachment Content-Type Size
lseek.c application/octet-stream 3.9 KB

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Andrew Dunstan 2008-03-27 12:54:02 Re: [DOCS] pg_total_relation_size() and CHECKPOINT
Previous Message Alvaro Herrera 2008-03-27 11:14:57 Re: [DOCS] pg_total_relation_size() and CHECKPOINT

Browse pgsql-hackers by date

  From Date Subject
Next Message Zdenek Kotala 2008-03-27 12:35:16 Re: Fix pg_dump dependency on postgres.h
Previous Message Zdenek Kotala 2008-03-27 12:15:48 Re: Script binaries renaming