Daniel Ng <danielng1985@gmail.com> writes:
> I am trying to enable the direct IO for the disk-resident
> hash partitions of hashjoin in postgresql.
Why would you think that's a good idea?
> Can anyone advise what's the reason and how to fix this?
Per the open(2) man page:
The O_DIRECT flag may impose alignment restrictions on the length and address of userspace buffers and
thefile offset of I/Os. In Linux alignment restrictions vary by file system and kernel version and might be
absententirely. However there is currently no file system-indepen- dent interface for an application to discover
theserestrictions for a given file or file system.
It's unlikely that the code you're hacking makes any attempt to align
the buffers it's using to read/write files.
regards, tom lane