Re: Defaulting wal_sync_method to fdatasync on Linux for 9.1?
От | Marti Raudsepp |
---|---|
Тема | Re: Defaulting wal_sync_method to fdatasync on Linux for 9.1? |
Дата | |
Msg-id | AANLkTimhNzer1TOEnL55P-Un9TPp8fAeyOzX09259RxN@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Defaulting wal_sync_method to fdatasync on Linux for 9.1? (Greg Smith <greg@2ndquadrant.com>) |
Ответы |
Re: Defaulting wal_sync_method to fdatasync on Linux for
9.1?
|
Список | pgsql-performance |
On Sat, Nov 6, 2010 at 00:06, Greg Smith <greg@2ndquadrant.com> wrote: > Please refrain from making changes to popular documents like the > tuning guide on the wiki based on speculation about what's happening. I will grant you that the details were wrong, but I stand by the conclusion. I can state for a fact that PostgreSQL's default wal_sync_method varies depending on the <fcntl.h> header. I have two PostgreSQL 9.0.1 builds, one with older /usr/include/bits/fcntl.h and one with newer. When I run "show wal_sync_method;" on one instance, I get fdatasync. On the other one I get open_datasync. So let's get down to code. Older fcntl.h has: #define O_SYNC 010000 # define O_DSYNC O_SYNC /* Synchronize data. */ Newer has: #define O_SYNC 04010000 # define O_DSYNC 010000 /* Synchronize data. */ So you can see that in the older header, O_DSYNC and O_SYNC are equal. src/include/access/xlogdefs.h does: #if defined(O_SYNC) #define OPEN_SYNC_FLAG O_SYNC ... #if defined(OPEN_SYNC_FLAG) /* O_DSYNC is distinct? */ #if O_DSYNC != OPEN_SYNC_FLAG #define OPEN_DATASYNC_FLAG O_DSYNC ^ it's comparing O_DSYNC != O_SYNC #if defined(OPEN_DATASYNC_FLAG) #define DEFAULT_SYNC_METHOD SYNC_METHOD_OPEN_DSYNC #elif defined(HAVE_FDATASYNC) #define DEFAULT_SYNC_METHOD SYNC_METHOD_FDATASYNC ^ depending on whether O_DSYNC and O_SYNC were equal, the default wal_sync_method will change. Regards, Marti
В списке pgsql-performance по дате отправления: