to enable O_DIRECT within postgresql

From: Daniel Ng <danielng1985(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: to enable O_DIRECT within postgresql
Date: 2010-06-11 06:31:41
Message-ID: AANLkTinOYAKY-g0l3aIvofjgM_TlHiUpzTx4eqwwCfzi@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear all,
I am trying to enable the direct IO for the disk-resident
hash partitions of hashjoin in postgresql. The basic postgres
environment settings are:
centos 5.5
kernel 2.6.18
ext3 fs
PostgreSQL 8.4.3

Previously I added the O_DIRECT flag to the "fileFlags"
parameter of open() within BasicOpenFile() (line 505 in
src/backend/storage/file/fd.c), but strangely I cannot even
start the server, with error:

PANIC: could not read from control file: Invalid argument
Aborted

So far what I did is to add the O_DIRECT flag to the
"fileFlags" parameter of PathNameOpenFile() (line 992 & 1007 in
src/backend/storage/file/fd.c), which calls the BasicOpenFIle()
and passes the "fileFlags". This time, I can start the sever,
but when I submit a hashjoin query from the client, it happens

ERROR: could not write to hash-join temporary file: Invalid argument

Can anyone advise what's the reason and how to fix this?
Or what's the correct way to enable the direct disk IO within
postgres? I appreciate the suggestions and thanks very much!

Regards
Daniel

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2010-06-11 06:51:55 Re: hstore ==> and deprecate =>
Previous Message Peter Eisentraut 2010-06-11 06:03:49 Re: LLVM / clang