| From: | Alex Ignatov <a(dot)ignatov(at)postgrespro(dot)ru> | 
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> | 
| Cc: | Bruce Momjian <bruce(at)momjian(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp> | 
| Subject: | Re: Is pg_control file crashsafe? | 
| Date: | 2016-05-04 10:32:01 | 
| Message-ID: | 5729CFA1.7080604@postgrespro.ru | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
On 03.05.2016 2:17, Tom Lane wrote:
> Alex Ignatov <a(dot)ignatov(at)postgrespro(dot)ru> writes:
>> I think that rename can help a little bit. At least on some FS it is
>> atomic operation.
>
> Writing a single sector ought to be atomic too.  I'm very skeptical that
> it'll be an improvement to just move the risk from one filesystem
> operation to another; especially not to one where there's not even a
> terribly portable way to request fsync.
>
> 			regards, tom lane
>
>
pg_control is 8k long(i think it is legth of one page in default PG 
compile settings).
I also think that 8k recording can be atomic. Even if recording of one 
sector is atomic nobody can say about what sector from 8k record of 
pg_control  should be written first. It can be last sector or say sector 
number 10 from 16. That why i mentioned renaming from tmp file to 
pg_control. Renaming in FS usually is atomic operation. And after power 
loss we have either old version of pg_control or new version of it. But 
not torn pg_control file.
Alex Ignatov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Thom Brown | 2016-05-04 10:42:40 | Re: [BUGS] Breakage with VACUUM ANALYSE + partitions | 
| Previous Message | Alex Ignatov | 2016-05-04 10:10:45 | Re: Is pg_control file crashsafe? |