diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2001-02-18 04:39:42 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2001-02-18 04:39:42 +0000 |
| commit | 33cc5d8a4d0dd7cdf78c6a6851b37799854191d4 (patch) | |
| tree | 8d9334993e788eb21dd4c3374174effabaedd43c /src/include | |
| parent | 58c4ab9d6265102d949a0d9035e48a752b3b457f (diff) | |
| download | postgresql-33cc5d8a4d0dd7cdf78c6a6851b37799854191d4.tar.gz | |
Change s_lock to not use any zero-delay select() calls; these are just a
waste of cycles on single-CPU machines, and of dubious utility on multi-CPU
machines too.
Tweak s_lock_stuck so that caller can specify timeout interval, and
increase interval before declaring stuck spinlock for buffer locks and XLOG
locks.
On systems that have fdatasync(), use that rather than fsync() to sync WAL
log writes. Ensure that WAL file is entirely allocated during XLogFileInit.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/config.h.in | 18 | ||||
| -rw-r--r-- | src/include/storage/fd.h | 3 | ||||
| -rw-r--r-- | src/include/storage/s_lock.h | 17 |
3 files changed, 25 insertions, 13 deletions
diff --git a/src/include/config.h.in b/src/include/config.h.in index 5c2dc088ef..68e15d067b 100644 --- a/src/include/config.h.in +++ b/src/include/config.h.in @@ -8,7 +8,7 @@ * or in config.h afterwards. Of course, if you edit config.h, then your * changes will be overwritten the next time you run configure. * - * $Id: config.h.in,v 1.157 2001/01/22 23:28:52 tgl Exp $ + * $Id: config.h.in,v 1.158 2001/02/18 04:39:42 tgl Exp $ */ #ifndef CONFIG_H @@ -548,6 +548,19 @@ extern void srandom(unsigned int seed); */ #define MAX_RANDOM_VALUE (0x7FFFFFFF) +/* Define if you have dlopen() */ +#undef HAVE_DLOPEN + +/* Define if you have fdatasync() */ +#undef HAVE_FDATASYNC + +/* Define if the standard header unistd.h declares fdatasync() */ +#undef HAVE_FDATASYNC_DECL + +#if defined(HAVE_FDATASYNC) && !defined(HAVE_FDATASYNC_DECL) +extern int fdatasync(int fildes); +#endif + /* Set to 1 if you have libz.a */ #undef HAVE_LIBZ @@ -611,9 +624,6 @@ extern void srandom(unsigned int seed); /* Define if C++ compiler accepts "#include <string>" */ #undef HAVE_CXX_STRING_HEADER -/* Define if you have dlopen() */ -#undef HAVE_DLOPEN - /* Define if you have the optreset variable */ #undef HAVE_INT_OPTRESET diff --git a/src/include/storage/fd.h b/src/include/storage/fd.h index fb8486b075..46ec1fdb94 100644 --- a/src/include/storage/fd.h +++ b/src/include/storage/fd.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: fd.h,v 1.26 2001/01/24 19:43:27 momjian Exp $ + * $Id: fd.h,v 1.27 2001/02/18 04:39:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -71,5 +71,6 @@ extern int BasicOpenFile(FileName fileName, int fileFlags, int fileMode); extern void closeAllVfds(void); extern void AtEOXact_Files(void); extern int pg_fsync(int fd); +extern int pg_fdatasync(int fd); #endif /* FD_H */ diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h index 9cf73163d6..5e3a15524b 100644 --- a/src/include/storage/s_lock.h +++ b/src/include/storage/s_lock.h @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.89 2001/02/16 23:50:40 tgl Exp $ + * $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.90 2001/02/18 04:39:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -48,11 +48,12 @@ * unsigned spins = 0; * * while (TAS(lock)) - * S_LOCK_SLEEP(lock, spins++); + * S_LOCK_SLEEP(lock, spins++, timeout); * } * * where S_LOCK_SLEEP() checks for timeout and sleeps for a short - * interval. Callers that want to perform useful work while waiting + * interval. (The timeout is expressed in microseconds, or can be 0 for + * "infinity".) Callers that want to perform useful work while waiting * can write out this entire loop and insert the "useful work" inside * the loop. * @@ -86,7 +87,7 @@ /* Platform-independent out-of-line support routines */ extern void s_lock(volatile slock_t *lock, const char *file, const int line); -extern void s_lock_sleep(unsigned spins, int microsec, +extern void s_lock_sleep(unsigned spins, int timeout, int microsec, volatile slock_t *lock, const char *file, const int line); @@ -518,13 +519,13 @@ extern int tas_sema(volatile slock_t *lock); #endif /* S_LOCK */ #if !defined(S_LOCK_SLEEP) -#define S_LOCK_SLEEP(lock,spins) \ - s_lock_sleep((spins), 0, (lock), __FILE__, __LINE__) +#define S_LOCK_SLEEP(lock,spins,timeout) \ + s_lock_sleep((spins), (timeout), 0, (lock), __FILE__, __LINE__) #endif /* S_LOCK_SLEEP */ #if !defined(S_LOCK_SLEEP_INTERVAL) -#define S_LOCK_SLEEP_INTERVAL(lock,spins,microsec) \ - s_lock_sleep((spins), (microsec), (lock), __FILE__, __LINE__) +#define S_LOCK_SLEEP_INTERVAL(lock,spins,timeout,microsec) \ + s_lock_sleep((spins), (timeout), (microsec), (lock), __FILE__, __LINE__) #endif /* S_LOCK_SLEEP_INTERVAL */ #if !defined(S_LOCK_FREE) |
