=?ISO-8859-1?Q?Hans-J=FCrgen_Sch=F6nig?= <postgres(at)cybertec(dot)at> writes:
> My question is: What happens if the system is killed inside
> rebuild_relation or inside swap_relfilenodes which is called by
> rebuild_relation?
Nothing at all, because the system catalog updates aren't committed yet,
and we haven't done anything to the relation's old physical file.
If I were you I'd be looking into whether your disk hardware honors
write ordering properly. This sounds like something allowed the
directory change to reach disk before the transaction commit WAL record
did; which is impossible if fsync is doing what it's supposed to.
regards, tom lane