Re: initdb -S and tablespaces
От | Abhijit Menon-Sen |
---|---|
Тема | Re: initdb -S and tablespaces |
Дата | |
Msg-id | 20141030090027.GA1214@toroid.org обсуждение исходный текст |
Ответ на | Re: initdb -S and tablespaces (Andres Freund <andres@2ndquadrant.com>) |
Ответы |
Re: initdb -S and tablespaces
Re: initdb -S and tablespaces |
Список | pgsql-hackers |
At 2014-09-29 11:54:10 +0200, andres@2ndquadrant.com wrote: > > On 2014-09-29 14:09:01 +0530, Abhijit Menon-Sen wrote: > > > > I just noticed that initdb -S ("Safely write all database files to disk > > and exit") does (only) the following in perform_fsync: > > > > pre_sync_fname(pdir, true); > > walkdir(pg_data, pre_sync_fname); > > > > fsync_fname(pdir, true); > > walkdir(pg_data, fsync_fname); > > > > walkdir() reads the directory and calls itself recursively for S_ISDIR > > entries, or calls the function for S_ISREG entries… which means it > > doesn't follow links. > > > > Which means it doesn't fsync the contents of tablespaces. > > Which means at least pg_upgrade is unsafe right > now... c.f. 630cd14426dc1daf85163ad417f3a224eb4ac7b0. Here's a proposed patch to initdb to make initdb -S fsync everything under pg_tblspc. It introduces a new function that calls walkdir on every entry under pg_tblspc. This is only one approach: I could have also changed walkdir to follow links, but that would have required a bunch of #ifdefs for Windows (because it doesn't have symlinks), and I guessed a separate function with two calls might be easier to patch into back branches. I've tested this patch under various conditions on Linux, but it could use some testing on Windows. -- Abhijit
Вложения
В списке pgsql-hackers по дате отправления: