PostgreSQL Source Code  git master
pg_test_fsync.c File Reference
#include "postgres_fe.h"
#include <limits.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <fcntl.h>
#include <unistd.h>
#include <signal.h>
#include "access/xlogdefs.h"
#include "common/logging.h"
#include "common/pg_prng.h"
#include "getopt_long.h"
Include dependency graph for pg_test_fsync.c:

Go to the source code of this file.

Macros

#define FSYNC_FILENAME   "./pg_test_fsync.out"
 
#define XLOG_BLCKSZ_K   (XLOG_BLCKSZ / 1024)
 
#define LABEL_FORMAT   " %-30s"
 
#define NA_FORMAT   "%21s\n"
 
#define OPS_FORMAT   gettext_noop("%13.3f ops/sec %6.0f usecs/op\n")
 
#define USECS_SEC   1000000
 
#define START_TIMER
 
#define STOP_TIMER
 
#define die(msg)   pg_fatal("%s: %m", _(msg))
 

Functions

static void handle_args (int argc, char *argv[])
 
static void prepare_buf (void)
 
static void test_open (void)
 
static void test_non_sync (void)
 
static void test_sync (int writes_per_op)
 
static void test_open_syncs (void)
 
static void test_open_sync (const char *msg, int writes_size)
 
static void test_file_descriptor_sync (void)
 
static void process_alarm (SIGNAL_ARGS)
 
static void signal_cleanup (SIGNAL_ARGS)
 
static void print_elapse (struct timeval start_t, struct timeval stop_t, int ops)
 
int main (int argc, char *argv[])
 
static int open_direct (const char *path, int flags, mode_t mode)
 

Variables

static const char * progname
 
static unsigned int secs_per_test = 5
 
static int needs_unlink = 0
 
static char full_buf [DEFAULT_XLOG_SEG_SIZE]
 
static char * buf
 
static char * filename = FSYNC_FILENAME
 
static struct timeval start_t stop_t
 
static bool alarm_triggered = false
 

Macro Definition Documentation

◆ die

#define die (   msg)    pg_fatal("%s: %m", _(msg))

Definition at line 95 of file pg_test_fsync.c.

◆ FSYNC_FILENAME

#define FSYNC_FILENAME   "./pg_test_fsync.out"

Definition at line 25 of file pg_test_fsync.c.

◆ LABEL_FORMAT

#define LABEL_FORMAT   " %-30s"

Definition at line 29 of file pg_test_fsync.c.

◆ NA_FORMAT

#define NA_FORMAT   "%21s\n"

Definition at line 30 of file pg_test_fsync.c.

◆ OPS_FORMAT

#define OPS_FORMAT   gettext_noop("%13.3f ops/sec %6.0f usecs/op\n")

Definition at line 32 of file pg_test_fsync.c.

◆ START_TIMER

#define START_TIMER
Value:
do { \
alarm_triggered = false; \
alarm(secs_per_test); \
gettimeofday(&start_t, NULL); \
} while (0)
static unsigned int secs_per_test
Definition: pg_test_fsync.c:64

Definition at line 37 of file pg_test_fsync.c.

◆ STOP_TIMER

#define STOP_TIMER
Value:
do { \
gettimeofday(&stop_t, NULL); \
print_elapse(start_t, stop_t, ops); \
} while (0)
static struct timeval start_t stop_t
Definition: pg_test_fsync.c:69

Definition at line 55 of file pg_test_fsync.c.

◆ USECS_SEC

#define USECS_SEC   1000000

Definition at line 33 of file pg_test_fsync.c.

◆ XLOG_BLCKSZ_K

#define XLOG_BLCKSZ_K   (XLOG_BLCKSZ / 1024)

Definition at line 27 of file pg_test_fsync.c.

Function Documentation

◆ handle_args()

static void handle_args ( int  argc,
char *  argv[] 
)
static

Definition at line 142 of file pg_test_fsync.c.

143 {
144  static struct option long_options[] = {
145  {"filename", required_argument, NULL, 'f'},
146  {"secs-per-test", required_argument, NULL, 's'},
147  {NULL, 0, NULL, 0}
148  };
149 
150  int option; /* Command line option */
151  int optindex = 0; /* used by getopt_long */
152  unsigned long optval; /* used for option parsing */
153  char *endptr;
154 
155  if (argc > 1)
156  {
157  if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0)
158  {
159  printf(_("Usage: %s [-f FILENAME] [-s SECS-PER-TEST]\n"), progname);
160  exit(0);
161  }
162  if (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-V") == 0)
163  {
164  puts("pg_test_fsync (PostgreSQL) " PG_VERSION);
165  exit(0);
166  }
167  }
168 
169  while ((option = getopt_long(argc, argv, "f:s:",
170  long_options, &optindex)) != -1)
171  {
172  switch (option)
173  {
174  case 'f':
176  break;
177 
178  case 's':
179  errno = 0;
180  optval = strtoul(optarg, &endptr, 10);
181 
182  if (endptr == optarg || *endptr != '\0' ||
183  errno != 0 || optval != (unsigned int) optval)
184  {
185  pg_log_error("invalid argument for option %s", "--secs-per-test");
186  pg_log_error_hint("Try \"%s --help\" for more information.", progname);
187  exit(1);
188  }
189 
190  secs_per_test = (unsigned int) optval;
191  if (secs_per_test == 0)
192  pg_fatal("%s must be in range %u..%u",
193  "--secs-per-test", 1, UINT_MAX);
194  break;
195 
196  default:
197  /* getopt_long already emitted a complaint */
198  pg_log_error_hint("Try \"%s --help\" for more information.", progname);
199  exit(1);
200  }
201  }
202 
203  if (argc > optind)
204  {
205  pg_log_error("too many command-line arguments (first is \"%s\")",
206  argv[optind]);
207  pg_log_error_hint("Try \"%s --help\" for more information.", progname);
208  exit(1);
209  }
210 
211  printf(ngettext("%u second per test\n",
212  "%u seconds per test\n",
213  secs_per_test),
214  secs_per_test);
215 #if defined(O_DIRECT)
216  printf(_("O_DIRECT supported on this platform for open_datasync and open_sync.\n"));
217 #elif defined(F_NOCACHE)
218  printf(_("F_NOCACHE supported on this platform for open_datasync and open_sync.\n"));
219 #else
220  printf(_("Direct I/O is not supported on this platform.\n"));
221 #endif
222 }
#define ngettext(s, p, n)
Definition: c.h:1165
#define _(x)
Definition: elog.c:90
char * pg_strdup(const char *in)
Definition: fe_memutils.c:85
int getopt_long(int argc, char *const argv[], const char *optstring, const struct option *longopts, int *longindex)
Definition: getopt_long.c:57
#define required_argument
Definition: getopt_long.h:25
exit(1)
#define pg_log_error(...)
Definition: logging.h:106
#define pg_log_error_hint(...)
Definition: logging.h:112
#define pg_fatal(...)
PGDLLIMPORT int optind
Definition: getopt.c:50
PGDLLIMPORT char * optarg
Definition: getopt.c:52
static char * filename
Definition: pg_test_fsync.c:68
static const char * progname
Definition: pg_test_fsync.c:62
#define printf(...)
Definition: port.h:240

References _, exit(), filename, getopt_long(), ngettext, optarg, optind, pg_fatal, pg_log_error, pg_log_error_hint, pg_strdup(), printf, progname, required_argument, and secs_per_test.

Referenced by main().

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 99 of file pg_test_fsync.c.

100 {
101  pg_logging_init(argv[0]);
102  set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_test_fsync"));
103  progname = get_progname(argv[0]);
104 
105  handle_args(argc, argv);
106 
107  /* Prevent leaving behind the test file */
108  pqsignal(SIGINT, signal_cleanup);
109  pqsignal(SIGTERM, signal_cleanup);
110 #ifndef WIN32
112 #endif
113 #ifdef SIGHUP
114  /* Not defined on win32 */
116 #endif
117 
118  pg_prng_seed(&pg_global_prng_state, (uint64) time(NULL));
119 
120  prepare_buf();
121 
122  test_open();
123 
124  /* Test using 1 XLOG_BLCKSZ write */
125  test_sync(1);
126 
127  /* Test using 2 XLOG_BLCKSZ writes */
128  test_sync(2);
129 
130  test_open_syncs();
131 
133 
134  test_non_sync();
135 
136  unlink(filename);
137 
138  return 0;
139 }
#define PG_TEXTDOMAIN(domain)
Definition: c.h:1198
void set_pglocale_pgservice(const char *argv0, const char *app)
Definition: exec.c:460
void pg_logging_init(const char *argv0)
Definition: logging.c:83
void pg_prng_seed(pg_prng_state *state, uint64 seed)
Definition: pg_prng.c:83
pg_prng_state pg_global_prng_state
Definition: pg_prng.c:28
static void test_file_descriptor_sync(void)
static void prepare_buf(void)
static void test_open_syncs(void)
static void handle_args(int argc, char *argv[])
static void test_sync(int writes_per_op)
static void test_open(void)
static void test_non_sync(void)
static void process_alarm(SIGNAL_ARGS)
static void signal_cleanup(SIGNAL_ARGS)
const char * get_progname(const char *argv0)
Definition: path.c:574
pqsigfunc pqsignal(int signum, pqsigfunc handler)
Definition: signal.c:197
#define SIGHUP
Definition: win32_port.h:176
#define SIGALRM
Definition: win32_port.h:182

References filename, get_progname(), handle_args(), pg_global_prng_state, pg_logging_init(), pg_prng_seed(), PG_TEXTDOMAIN, pqsignal(), prepare_buf(), process_alarm(), progname, set_pglocale_pgservice(), SIGALRM, SIGHUP, signal_cleanup(), test_file_descriptor_sync(), test_non_sync(), test_open(), test_open_syncs(), and test_sync().

◆ open_direct()

static int open_direct ( const char *  path,
int  flags,
mode_t  mode 
)
static

Definition at line 259 of file pg_test_fsync.c.

260 {
261  int fd;
262 
263 #ifdef O_DIRECT
264  flags |= O_DIRECT;
265 #endif
266 
267  fd = open(path, flags, mode);
268 
269 #if !defined(O_DIRECT) && defined(F_NOCACHE)
270  if (fd >= 0 && fcntl(fd, F_NOCACHE, 1) < 0)
271  {
272  int save_errno = errno;
273 
274  close(fd);
275  errno = save_errno;
276  return -1;
277  }
278 #endif
279 
280  return fd;
281 }
#define close(a)
Definition: win32.h:12
static PgChecksumMode mode
Definition: pg_checksums.c:65
static int fd(const char *x, int i)
Definition: preproc-init.c:105

References close, fd(), and mode.

Referenced by test_open_sync(), and test_sync().

◆ prepare_buf()

static void prepare_buf ( void  )
static

Definition at line 225 of file pg_test_fsync.c.

226 {
227  int ops;
228 
229  /* write random data into buffer */
230  for (ops = 0; ops < DEFAULT_XLOG_SEG_SIZE; ops++)
232 
233  buf = (char *) TYPEALIGN(XLOG_BLCKSZ, full_buf);
234 }
#define TYPEALIGN(ALIGNVAL, LEN)
Definition: c.h:740
#define DEFAULT_XLOG_SEG_SIZE
int32 pg_prng_int32(pg_prng_state *state)
Definition: pg_prng.c:201
static char full_buf[DEFAULT_XLOG_SEG_SIZE]
Definition: pg_test_fsync.c:66
static char * buf
Definition: pg_test_fsync.c:67

References buf, DEFAULT_XLOG_SEG_SIZE, full_buf, pg_global_prng_state, pg_prng_int32(), and TYPEALIGN.

Referenced by main().

◆ print_elapse()

static void print_elapse ( struct timeval  start_t,
struct timeval  stop_t,
int  ops 
)
static

Definition at line 623 of file pg_test_fsync.c.

624 {
625  double total_time = (stop_t.tv_sec - start_t.tv_sec) +
626  (stop_t.tv_usec - start_t.tv_usec) * 0.000001;
627  double per_second = ops / total_time;
628  double avg_op_time_us = (total_time / ops) * USECS_SEC;
629 
630  printf(_(OPS_FORMAT), per_second, avg_op_time_us);
631 }
#define USECS_SEC
Definition: pg_test_fsync.c:33
#define OPS_FORMAT
Definition: pg_test_fsync.c:32

References _, OPS_FORMAT, printf, stop_t, and USECS_SEC.

◆ process_alarm()

static void process_alarm ( SIGNAL_ARGS  )
static

Definition at line 635 of file pg_test_fsync.c.

636 {
637  alarm_triggered = true;
638 }
static bool alarm_triggered
Definition: pg_test_fsync.c:71

References alarm_triggered.

Referenced by main().

◆ signal_cleanup()

static void signal_cleanup ( SIGNAL_ARGS  )
static

Definition at line 593 of file pg_test_fsync.c.

594 {
595  /* Delete the file if it exists. Ignore errors */
596  if (needs_unlink)
597  unlink(filename);
598  /* Finish incomplete line on stdout */
599  puts("");
600  exit(1);
601 }
static int needs_unlink
Definition: pg_test_fsync.c:65

References exit(), filename, and needs_unlink.

Referenced by main().

◆ test_file_descriptor_sync()

static void test_file_descriptor_sync ( void  )
static

Definition at line 499 of file pg_test_fsync.c.

500 {
501  int tmpfile,
502  ops;
503 
504  /*
505  * Test whether fsync can sync data written on a different descriptor for
506  * the same file. This checks the efficiency of multi-process fsyncs
507  * against the same file. Possibly this should be done with writethrough
508  * on platforms which support it.
509  */
510  printf(_("\nTest if fsync on non-write file descriptor is honored:\n"));
511  printf(_("(If the times are similar, fsync() can sync data written on a different\n"
512  "descriptor.)\n"));
513 
514  /*
515  * first write, fsync and close, which is the normal behavior without
516  * multiple descriptors
517  */
518  printf(LABEL_FORMAT, "write, fsync, close");
519  fflush(stdout);
520 
521  START_TIMER;
522  for (ops = 0; alarm_triggered == false; ops++)
523  {
524  if ((tmpfile = open(filename, O_RDWR | PG_BINARY, 0)) == -1)
525  die("could not open output file");
526  if (write(tmpfile, buf, XLOG_BLCKSZ) != XLOG_BLCKSZ)
527  die("write failed");
528  if (fsync(tmpfile) != 0)
529  die("fsync failed");
530  close(tmpfile);
531 
532  /*
533  * open and close the file again to be consistent with the following
534  * test
535  */
536  if ((tmpfile = open(filename, O_RDWR | PG_BINARY, 0)) == -1)
537  die("could not open output file");
538  close(tmpfile);
539  }
540  STOP_TIMER;
541 
542  /*
543  * Now open, write, close, open again and fsync This simulates processes
544  * fsyncing each other's writes.
545  */
546  printf(LABEL_FORMAT, "write, close, fsync");
547  fflush(stdout);
548 
549  START_TIMER;
550  for (ops = 0; alarm_triggered == false; ops++)
551  {
552  if ((tmpfile = open(filename, O_RDWR | PG_BINARY, 0)) == -1)
553  die("could not open output file");
554  if (write(tmpfile, buf, XLOG_BLCKSZ) != XLOG_BLCKSZ)
555  die("write failed");
556  close(tmpfile);
557  /* reopen file */
558  if ((tmpfile = open(filename, O_RDWR | PG_BINARY, 0)) == -1)
559  die("could not open output file");
560  if (fsync(tmpfile) != 0)
561  die("fsync failed");
562  close(tmpfile);
563  }
564  STOP_TIMER;
565 }
#define PG_BINARY
Definition: c.h:1254
#define write(a, b, c)
Definition: win32.h:14
static void const char fflush(stdout)
#define START_TIMER
Definition: pg_test_fsync.c:37
#define STOP_TIMER
Definition: pg_test_fsync.c:55
#define LABEL_FORMAT
Definition: pg_test_fsync.c:29
#define die(msg)
Definition: pg_test_fsync.c:95
#define fsync(fd)
Definition: win32_port.h:85

References _, alarm_triggered, buf, close, die, fflush(), filename, fsync, LABEL_FORMAT, PG_BINARY, printf, START_TIMER, generate_unaccent_rules::stdout, STOP_TIMER, and write.

Referenced by main().

◆ test_non_sync()

static void test_non_sync ( void  )
static

Definition at line 568 of file pg_test_fsync.c.

569 {
570  int tmpfile,
571  ops;
572 
573  /*
574  * Test a simple write without fsync
575  */
576  printf(_("\nNon-sync'ed %dkB writes:\n"), XLOG_BLCKSZ_K);
577  printf(LABEL_FORMAT, "write");
578  fflush(stdout);
579 
580  if ((tmpfile = open(filename, O_RDWR | PG_BINARY, 0)) == -1)
581  die("could not open output file");
582  START_TIMER;
583  for (ops = 0; alarm_triggered == false; ops++)
584  {
585  if (pg_pwrite(tmpfile, buf, XLOG_BLCKSZ, 0) != XLOG_BLCKSZ)
586  die("write failed");
587  }
588  STOP_TIMER;
589  close(tmpfile);
590 }
#define XLOG_BLCKSZ_K
Definition: pg_test_fsync.c:27
#define pg_pwrite
Definition: port.h:222

References _, alarm_triggered, buf, close, die, fflush(), filename, LABEL_FORMAT, PG_BINARY, pg_pwrite, printf, START_TIMER, generate_unaccent_rules::stdout, STOP_TIMER, and XLOG_BLCKSZ_K.

Referenced by main().

◆ test_open()

static void test_open ( void  )
static

Definition at line 237 of file pg_test_fsync.c.

238 {
239  int tmpfile;
240 
241  /*
242  * test if we can open the target file
243  */
244  if ((tmpfile = open(filename, O_RDWR | O_CREAT | PG_BINARY, S_IRUSR | S_IWUSR)) == -1)
245  die("could not open output file");
246  needs_unlink = 1;
247  if (write(tmpfile, full_buf, DEFAULT_XLOG_SEG_SIZE) !=
249  die("write failed");
250 
251  /* fsync now so that dirty buffers don't skew later tests */
252  if (fsync(tmpfile) != 0)
253  die("fsync failed");
254 
255  close(tmpfile);
256 }
#define S_IRUSR
Definition: win32_port.h:291
#define S_IWUSR
Definition: win32_port.h:294

References close, DEFAULT_XLOG_SEG_SIZE, die, filename, fsync, full_buf, needs_unlink, PG_BINARY, S_IRUSR, S_IWUSR, and write.

Referenced by main().

◆ test_open_sync()

static void test_open_sync ( const char *  msg,
int  writes_size 
)
static

Definition at line 463 of file pg_test_fsync.c.

464 {
465 #ifdef O_SYNC
466  int tmpfile,
467  ops,
468  writes;
469 #endif
470 
471  printf(LABEL_FORMAT, msg);
472  fflush(stdout);
473 
474 #ifdef O_SYNC
475  if ((tmpfile = open_direct(filename, O_RDWR | O_SYNC | PG_BINARY, 0)) == -1)
476  printf(NA_FORMAT, _("n/a*"));
477  else
478  {
479  START_TIMER;
480  for (ops = 0; alarm_triggered == false; ops++)
481  {
482  for (writes = 0; writes < 16 / writes_size; writes++)
483  if (pg_pwrite(tmpfile,
484  buf,
485  writes_size * 1024,
486  writes * writes_size * 1024) !=
487  writes_size * 1024)
488  die("write failed");
489  }
490  STOP_TIMER;
491  close(tmpfile);
492  }
493 #else
494  printf(NA_FORMAT, _("n/a"));
495 #endif
496 }
#define NA_FORMAT
Definition: pg_test_fsync.c:30
static int open_direct(const char *path, int flags, mode_t mode)

References _, alarm_triggered, buf, close, die, fflush(), filename, LABEL_FORMAT, NA_FORMAT, open_direct(), PG_BINARY, pg_pwrite, printf, START_TIMER, generate_unaccent_rules::stdout, and STOP_TIMER.

Referenced by test_open_syncs().

◆ test_open_syncs()

static void test_open_syncs ( void  )
static

Definition at line 446 of file pg_test_fsync.c.

447 {
448  printf(_("\nCompare open_sync with different write sizes:\n"));
449  printf(_("(This is designed to compare the cost of writing 16kB in different write\n"
450  "open_sync sizes.)\n"));
451 
452  test_open_sync(_(" 1 * 16kB open_sync write"), 16);
453  test_open_sync(_(" 2 * 8kB open_sync writes"), 8);
454  test_open_sync(_(" 4 * 4kB open_sync writes"), 4);
455  test_open_sync(_(" 8 * 2kB open_sync writes"), 2);
456  test_open_sync(_("16 * 1kB open_sync writes"), 1);
457 }
static void test_open_sync(const char *msg, int writes_size)

References _, printf, and test_open_sync().

Referenced by main().

◆ test_sync()

static void test_sync ( int  writes_per_op)
static

Definition at line 284 of file pg_test_fsync.c.

285 {
286  int tmpfile,
287  ops,
288  writes;
289  bool fs_warning = false;
290 
291  if (writes_per_op == 1)
292  printf(_("\nCompare file sync methods using one %dkB write:\n"), XLOG_BLCKSZ_K);
293  else
294  printf(_("\nCompare file sync methods using two %dkB writes:\n"), XLOG_BLCKSZ_K);
295  printf(_("(in wal_sync_method preference order, except fdatasync is Linux's default)\n"));
296 
297  /*
298  * Test open_datasync if available
299  */
300  printf(LABEL_FORMAT, "open_datasync");
301  fflush(stdout);
302 
303 #ifdef O_DSYNC
304  if ((tmpfile = open_direct(filename, O_RDWR | O_DSYNC | PG_BINARY, 0)) == -1)
305  {
306  printf(NA_FORMAT, _("n/a*"));
307  fs_warning = true;
308  }
309  else
310  {
311  START_TIMER;
312  for (ops = 0; alarm_triggered == false; ops++)
313  {
314  for (writes = 0; writes < writes_per_op; writes++)
315  if (pg_pwrite(tmpfile,
316  buf,
317  XLOG_BLCKSZ,
318  writes * XLOG_BLCKSZ) != XLOG_BLCKSZ)
319  die("write failed");
320  }
321  STOP_TIMER;
322  close(tmpfile);
323  }
324 #else
325  printf(NA_FORMAT, _("n/a"));
326 #endif
327 
328 /*
329  * Test fdatasync if available
330  */
331  printf(LABEL_FORMAT, "fdatasync");
332  fflush(stdout);
333 
334  if ((tmpfile = open(filename, O_RDWR | PG_BINARY, 0)) == -1)
335  die("could not open output file");
336  START_TIMER;
337  for (ops = 0; alarm_triggered == false; ops++)
338  {
339  for (writes = 0; writes < writes_per_op; writes++)
340  if (pg_pwrite(tmpfile,
341  buf,
342  XLOG_BLCKSZ,
343  writes * XLOG_BLCKSZ) != XLOG_BLCKSZ)
344  die("write failed");
345  fdatasync(tmpfile);
346  }
347  STOP_TIMER;
348  close(tmpfile);
349 
350 /*
351  * Test fsync
352  */
353  printf(LABEL_FORMAT, "fsync");
354  fflush(stdout);
355 
356  if ((tmpfile = open(filename, O_RDWR | PG_BINARY, 0)) == -1)
357  die("could not open output file");
358  START_TIMER;
359  for (ops = 0; alarm_triggered == false; ops++)
360  {
361  for (writes = 0; writes < writes_per_op; writes++)
362  if (pg_pwrite(tmpfile,
363  buf,
364  XLOG_BLCKSZ,
365  writes * XLOG_BLCKSZ) != XLOG_BLCKSZ)
366  die("write failed");
367  if (fsync(tmpfile) != 0)
368  die("fsync failed");
369  }
370  STOP_TIMER;
371  close(tmpfile);
372 
373 /*
374  * If fsync_writethrough is available, test as well
375  */
376  printf(LABEL_FORMAT, "fsync_writethrough");
377  fflush(stdout);
378 
379 #ifdef HAVE_FSYNC_WRITETHROUGH
380  if ((tmpfile = open(filename, O_RDWR | PG_BINARY, 0)) == -1)
381  die("could not open output file");
382  START_TIMER;
383  for (ops = 0; alarm_triggered == false; ops++)
384  {
385  for (writes = 0; writes < writes_per_op; writes++)
386  if (pg_pwrite(tmpfile,
387  buf,
388  XLOG_BLCKSZ,
389  writes * XLOG_BLCKSZ) != XLOG_BLCKSZ)
390  die("write failed");
391  if (pg_fsync_writethrough(tmpfile) != 0)
392  die("fsync failed");
393  }
394  STOP_TIMER;
395  close(tmpfile);
396 #else
397  printf(NA_FORMAT, _("n/a"));
398 #endif
399 
400 /*
401  * Test open_sync if available
402  */
403  printf(LABEL_FORMAT, "open_sync");
404  fflush(stdout);
405 
406 #ifdef O_SYNC
407  if ((tmpfile = open_direct(filename, O_RDWR | O_SYNC | PG_BINARY, 0)) == -1)
408  {
409  printf(NA_FORMAT, _("n/a*"));
410  fs_warning = true;
411  }
412  else
413  {
414  START_TIMER;
415  for (ops = 0; alarm_triggered == false; ops++)
416  {
417  for (writes = 0; writes < writes_per_op; writes++)
418  if (pg_pwrite(tmpfile,
419  buf,
420  XLOG_BLCKSZ,
421  writes * XLOG_BLCKSZ) != XLOG_BLCKSZ)
422 
423  /*
424  * This can generate write failures if the filesystem has
425  * a large block size, e.g. 4k, and there is no support
426  * for O_DIRECT writes smaller than the file system block
427  * size, e.g. XFS.
428  */
429  die("write failed");
430  }
431  STOP_TIMER;
432  close(tmpfile);
433  }
434 #else
435  printf(NA_FORMAT, _("n/a"));
436 #endif
437 
438  if (fs_warning)
439  {
440  printf(_("* This file system and its mount options do not support direct\n"
441  " I/O, e.g. ext4 in journaled mode.\n"));
442  }
443 }
int fdatasync(int fildes)
int pg_fsync_writethrough(int fd)
Definition: fd.c:424
#define O_DSYNC
Definition: win32_port.h:354

References _, alarm_triggered, buf, close, die, fdatasync(), fflush(), filename, fsync, LABEL_FORMAT, NA_FORMAT, O_DSYNC, open_direct(), PG_BINARY, pg_fsync_writethrough(), pg_pwrite, printf, START_TIMER, generate_unaccent_rules::stdout, STOP_TIMER, and XLOG_BLCKSZ_K.

Referenced by main().

Variable Documentation

◆ alarm_triggered

bool alarm_triggered = false
static

◆ buf

char * buf
static

Definition at line 67 of file pg_test_fsync.c.

Referenced by _bt_binsrch(), _bt_bottomupdel_pass(), _bt_checkpage(), _bt_clear_incomplete_split(), _bt_conditionallockbuf(), _bt_dedup_pass(), _bt_delitems_delete(), _bt_delitems_delete_check(), _bt_delitems_vacuum(), _bt_endpoint(), _bt_first(), _bt_get_endpoint(), _bt_getbuf(), _bt_getstackbuf(), _bt_insert_parent(), _bt_insertonpg(), _bt_killitems(), _bt_leftsib_splitflag(), _bt_lockbuf(), _bt_moveright(), _bt_relandgetbuf(), _bt_relbuf(), _bt_rightsib_halfdeadflag(), _bt_split(), _bt_unlink_halfdead_page(), _bt_unlockbuf(), _bt_upgradelockbufcleanup(), _bt_walk_left(), _conv(), _CustomReadFunc(), _CustomWriteFunc(), _discoverArchiveFormat(), _EndBlob(), _getObjectDescription(), _hash_addovflpage(), _hash_checkpage(), _hash_doinsert(), _hash_dropbuf(), _hash_first(), _hash_getbucketbuf_from_hashkey(), _hash_getbuf(), _hash_getbuf_with_condlock_cleanup(), _hash_getbuf_with_strategy(), _hash_getinitbuf(), _hash_getnewbuf(), _hash_init(), _hash_init_metabuffer(), _hash_initbitmapbuffer(), _hash_initbuf(), _hash_kill_items(), _hash_next(), _hash_pgaddmultitup(), _hash_pgaddtup(), _hash_readpage(), _hash_relbuf(), _hash_vacuum_one_page(), _LoadBlobs(), _PG_init(), _PrintFileData(), _ReadBuf(), _scriptOut(), _skipData(), _tarAddFile(), _tarReadRaw(), _WriteBlobData(), _WriteBuf(), abbroffset(), AbortBufferIO(), add_cast_to(), add_role_attribute(), add_tablespace_footer(), AddBufferToRing(), AddFileToBackupManifest(), addFooterToPublicationDesc(), alignStringInfoInt(), AlterSequence(), append_database_pattern(), append_db_pattern_cte(), append_rel_pattern_filtered_cte(), append_rel_pattern_raw_cte(), append_with_tabs(), appendAggOrderBy(), appendArrayEscapedString(), appendByteaLiteral(), appendConditions(), appendConnStrVal(), appendContextKeyword(), appendCSVLiteral(), appendFunctionName(), appendGroupByClause(), AppendIntegerCommandOption(), appendJSONKeyValue(), appendJSONKeyValueFmt(), appendLimitClause(), appendOrderByClause(), appendOrderBySuffix(), AppendPlainCommandOption(), appendPsqlMetaConnect(), appendQualifiedRelation(), appendShellString(), appendShellStringNoError(), AppendStringCommandOption(), appendStringLiteral(), appendStringLiteralConn(), appendStringLiteralDQ(), array_dims(), array_recv(), array_send(), array_to_text_internal(), asyncQueueReadAllNotifications(), autoprewarm_database_main(), BaseBackup(), basebackup_read_file(), bbsink_copystream_archive_contents(), bbsink_copystream_begin_archive(), bbsink_copystream_begin_backup(), bbsink_copystream_begin_manifest(), bbsink_copystream_end_archive(), be_lo_export(), bind_param_error_callback(), bit_recv(), boolrecv(), boolsend(), bootstrap_template1(), box_recv(), box_send(), bpcharrecv(), bqarr_in(), brin_desc(), brin_evacuate_page(), brin_getinsertbuffer(), brin_page_cleanup(), brin_start_evacuating_page(), brin_vacuum_scan(), brin_xlog_createidx(), brin_xlog_revmap_extend(), bringetbitmap(), brinGetTupleForHeapBlock(), brininsert(), brinSetHeapBlockItemptr(), brinsummarize(), btree_desc(), btree_xlog_dedup(), btree_xlog_split(), btvacuumpage(), buf_add_txid(), buf_finalize(), buf_init(), BufferAlloc(), build_client_final_message(), build_client_first_message(), build_regexp_match_result(), build_regexp_split_result(), build_test_info_result(), build_test_match_result(), BuildIndexValueDescription(), BuildParamLogString(), buildWorkerCommand(), buildWorkerResponse(), bytearecv(), bzero2(), cache_locale_time(), calc_s2k_iter_salted(), calc_s2k_salted(), calc_s2k_simple(), cash_out(), cash_recv(), cash_send(), cash_words(), cfgets(), charrecv(), charsend(), check_default_text_search_config(), check_key_cksum(), check_ssl_key_file_permissions(), check_strxfrm_bug(), CheckPointTwoPhase(), CheckSASLAuth(), ChooseExtendedStatisticNameAddition(), ChooseForeignKeyConstraintNameAddition(), ChooseIndexColumnNames(), ChooseIndexNameAddition(), cidr_recv(), cidrecv(), cidsend(), circle_recv(), circle_send(), clog_desc(), cluster_conn_opts(), commit_ts_desc(), compile_pltcl_function(), complex_recv(), complex_send(), ConditionalLockBuffer(), conninfo_parse(), conninfo_uri_decode(), conninfo_uri_parse_options(), constructConnStr(), convert(), convert64(), convertJsonbScalar(), copy_read_data(), CopyGetInt16(), CopyGetInt32(), CopySendInt16(), CopySendInt32(), count_lines_in_buf(), count_nondeletable_pages(), crc32_sz(), create_cursor(), create_database(), create_role(), create_sql_command(), createBackupLabel(), CreateDirAndVersionFile(), cstring_recv(), cstring_send(), cube_out(), cube_recv(), cube_send(), dataBeginPlaceToPage(), dataBeginPlaceToPageInternal(), dataBeginPlaceToPageLeaf(), dataExecPlaceToPage(), dataExecPlaceToPageInternal(), dataExecPlaceToPageLeaf(), dataPlaceToPageLeafRecompress(), date_out(), date_recv(), date_send(), date_test_fmt(), datum_to_json(), dbase_desc(), dblink_close(), dblink_fetch(), dblink_open(), DecodeAbort(), DecodeCommit(), DecodeDelete(), DecodeInsert(), DecodeMultiInsert(), DecodePrepare(), DecodeSpecConfirm(), DecodeTruncate(), DecodeTXNNeedSkip(), DecodeUpdate(), decompile_column_index_array(), decrypt_read(), default_desc(), DeleteAllExportedSnapshotFiles(), deparse_expression_pretty(), deparse_lquery(), deparse_ltree(), deparseAggref(), deparseAnalyzeSizeSql(), deparseAnalyzeSql(), deparseArrayExpr(), deparseBoolExpr(), deparseCaseExpr(), deparseColumnRef(), deparseConst(), deparseDeleteSql(), deparseDirectDeleteSql(), deparseDirectUpdateSql(), deparseDistinctExpr(), deparseExplicitTargetList(), deparseFromExpr(), deparseFromExprForRel(), deparseFuncExpr(), deparseInsertSql(), deparseLockingClause(), deparseNullTest(), deparseOperatorName(), deparseOpExpr(), deparseRangeTblRef(), deparseRelation(), deparseReturningList(), deparseScalarArrayOpExpr(), deparseSelectSql(), deparseSelectStmtForRel(), deparseSortGroupClause(), deparseStringLiteral(), deparseSubqueryTargetList(), deparseSubscriptingRef(), deparseTargetList(), deparseTruncateSql(), deparseUpdateSql(), desc_recompress_leaf(), describeAccessMethods(), describeAggregates(), describeConfigurationParameters(), describeDumpableObject(), describeFunctions(), DescribeLockTag(), describeOneTableDetails(), describeOneTSConfig(), describeOneTSParser(), describeOperators(), describePublications(), DescribeQuery(), describeRoles(), describeSubscriptions(), describeTableDetails(), describeTablespaces(), describeTypes(), dir_write(), DispatchJobForTocEntry(), do_analyze_rel(), do_compile(), do_setval(), domain_recv(), drain(), drop_database_if_exists(), drop_role_if_exists(), dropRoles(), dsm_cleanup_for_mmap(), dummy_ssl_passwd_cb(), dump_binary(), dump_lo_buf(), dumpBlobs(), dumpDatabaseConfig(), dumpRoleGUCPrivs(), dumpRoleMembership(), dumpRoles(), dumpTablespaces(), dumpTimestamp(), dumpUserConfig(), ean13_out(), ean2isn(), entryBeginPlaceToPage(), entryExecPlaceToPage(), entryIsEnoughSpace(), enum_recv(), enum_send(), err_sendstring(), escape_json(), escape_param_str(), escape_xml(), escape_yaml(), ExceptionalCondition(), exec_command_password(), exec_command_sf_sv(), ExecBuildSlotPartitionKeyDescription(), ExecBuildSlotValueDescription(), ExecEvalXmlExpr(), ExecQueryUsingCursor(), executeMetaCommand(), ExecuteSimpleCommands(), ExecuteSqlCommandBuf(), ExplainPropertyFloat(), ExplainPropertyInteger(), ExplainPropertyUInteger(), explicit_bzero(), exportFile(), ExportSnapshot(), fe_recvint64(), fe_sendint64(), fill_seq_fork_with_data(), find_provider(), FindStreamingStart(), FinishPreparedTransaction(), flatten_reloptions(), flatten_set_variable_args(), flattenJsonPathParseItem(), float4_numeric(), float4recv(), float4send(), float8_numeric(), float8recv(), float8send(), flush_pipe_input(), FlushBuffer(), fmtlong(), format_aggregate_signature(), format_operator_extended(), format_procedure_extended(), format_type_extended(), formatPGVersionNumber(), FreePageManagerDump(), FreePageManagerDumpBtree(), FreePageManagerDumpSpans(), FreeSpaceMapPrepareTruncateRel(), fsm_readbuf(), fsm_search(), fsm_search_avail(), fsm_set_and_search(), fsm_vacuum_page(), generate_opclass_name(), generate_operator_clause(), generate_operator_name(), generate_trgm_only(), generate_wildcard_trgm(), generic_desc(), get_agg_expr(), get_basic_select_query(), get_coercion_expr(), get_collation_actual_version(), get_column_alias_list(), get_connect_string(), get_const_collation(), get_const_expr(), get_create_object_cmd(), get_delete_query_def(), get_from_clause(), get_from_clause_coldeflist(), get_from_clause_item(), get_func_expr(), get_func_sql_syntax(), get_insert_query_def(), get_modifiers(), get_opclass_name(), get_oper_expr(), get_parallel_object_list(), get_prompt(), get_query_def(), get_range_partbound_string(), get_raw_page_internal(), get_reloptions(), get_rule_expr(), get_rule_expr_funccall(), get_rule_groupingset(), get_rule_orderby(), get_rule_sortgroupclause(), get_rule_windowclause(), get_rule_windowspec(), get_select_query_def(), get_setop_query(), get_special_variable(), get_sql_delete(), get_sql_insert(), get_sql_update(), get_sublink_expr(), get_tablefunc(), get_tablesample_def(), get_target_list(), get_tuple_of_interest(), get_update_query_def(), get_update_query_targetlist_def(), get_utility_query_def(), get_values_def(), get_variable(), get_wildcard_part(), get_windowfunc_expr(), get_with_clause(), GetBufferFromRing(), GetHugePageSize(), GetRecordedFreeSpace(), gin_desc(), ginCompressPostingList(), gist_desc(), gistcheckpage(), gistfixsplit(), gistformdownlink(), gnuish_strerror_r(), handleCopyIn(), handleCopyOut(), hash_desc(), hash_xlog_split_page(), hashbpchar(), hashbpcharextended(), hashbucketcleanup(), hashbulkdelete(), hashtext(), hashtextextended(), heap2_decode(), heap2_desc(), heap_decode(), heap_desc(), heap_force_common(), heap_index_delete_tuples(), heap_lock_updated_tuple_rec(), heap_page_is_all_visible(), heap_vacuum_rel(), heapam_relation_copy_for_cluster(), helpVariables(), hladdword(), hlfinditem(), hlparsetext(), hmac_finish(), hstore_recv(), hstore_send(), hstorePairs(), ignore_boolean_expression(), importFile(), indent_lines(), inet_recv(), infile(), InitBufferPool(), initialize_SSL(), initialize_worker_spi(), InitializeShmemGUCs(), InitLocalBuffers(), int2recv(), int2send(), int2vectorrecv(), int4recv(), int4send(), int8_avg_deserialize(), int8_avg_serialize(), int8out(), int8recv(), int8send(), interval_out(), interval_recv(), interval_send(), inv_read(), inv_write(), InvalidateBuffer(), is_true_boolean_expression(), isn_out(), json_recv(), json_send(), jsonb_agg_transfn(), jsonb_object_agg_transfn(), jsonb_recv(), jsonb_send(), JsonEncodeDateTime(), jsonpath_recv(), jsonpath_send(), jsonPathFromCstring(), jsonPathToCstring(), KnownAssignedXidsDisplay(), lazy_scan_heap(), lazy_scan_new_or_empty(), lazy_scan_noprune(), lazy_scan_prune(), lazy_vacuum_heap_rel(), libpqrcv_get_conninfo(), line_recv(), line_send(), listAllDbs(), listCasts(), listCollations(), listConversions(), listDbRoleSettings(), listDefaultACLs(), listDomains(), listEventTriggers(), listExtendedStats(), listExtensionContents(), listExtensions(), listForeignDataWrappers(), listForeignServers(), listForeignTables(), listLanguages(), listLargeObjects(), listOneExtensionContents(), listOperatorClasses(), listOperatorFamilies(), listOpFamilyFunctions(), listOpFamilyOperators(), listPartitionedTables(), listPublications(), listSchemas(), listTables(), listTSConfigs(), listTSConfigsVerbose(), listTSDictionaries(), listTSParsers(), listTSParsersVerbose(), listTSTemplates(), listUserMappings(), llvm_create_types(), lo_export(), lo_import_internal(), lo_read(), lo_write(), load_module(), load_resultmap(), local_queue_fetch_file(), local_queue_fetch_range(), locale_date_order(), LockBuffer(), log_line_prefix(), log_newpage_range(), log_split_page(), log_status_format(), LogicalDecodingProcessRecord(), logicalmsg_decode(), logicalmsg_desc(), LogicalRepApplyLoop(), LogRecoveryConflict(), LookupGXact(), lquery_in(), lquery_recv(), lquery_send(), lseg_recv(), lseg_send(), ltree_crc32_sz(), ltree_in(), ltree_recv(), ltree_send(), ltxtq_recv(), ltxtq_send(), macaddr8_recv(), macaddr8_send(), macaddr_recv(), macaddr_send(), main(), make_absolute_path(), make_ruledef(), make_viewdef(), makeAlterConfigCommand(), makeMultirangeTypeName(), map_sql_identifier_to_xml_name(), map_sql_value_to_xml_value(), map_xml_name_to_sql_identifier(), mbuf_append(), multirange_out(), multirange_recv(), multirange_send(), multixact_desc(), mxid_to_string(), my_sock_read(), my_sock_write(), namerecv(), namesend(), network_recv(), network_send(), next_field_expand(), next_token(), nextval_internal(), NotifyMyFrontEnd(), num_word(), numeric_abbrev_convert(), numeric_avg_deserialize(), numeric_avg_serialize(), numeric_deserialize(), numeric_poly_deserialize(), numeric_poly_serialize(), numeric_recv(), numeric_send(), numeric_serialize(), numericvar_deserialize(), numericvar_serialize(), objectDescription(), OidReceiveFunctionCall(), oidrecv(), oidsend(), oidvectorrecv(), out_gistxlogDelete(), out_gistxlogPageDelete(), out_gistxlogPageReuse(), out_gistxlogPageSplit(), out_infobits(), out_member(), outDouble(), overwrite(), pad_eme_pkcs1_v15(), parse_literal_data(), parse_lquery(), parse_ltree(), parse_snapshot(), parse_tsquery(), parseAclItem(), parseServiceFile(), parsetext(), passwordFromFile(), path_recv(), path_send(), patternToSQLRegex(), PerformWalRecovery(), permissionsList(), pg_armor(), pg_b64_decode(), pg_b64_encode(), pg_base64_decode(), pg_base64_encode(), pg_dearmor(), pg_gen_salt(), pg_gen_salt_rounds(), pg_get_constraintdef_worker(), pg_get_function_arguments(), pg_get_function_identity_arguments(), pg_get_function_result(), pg_get_function_sqlbody(), pg_get_functiondef(), pg_get_indexdef_worker(), pg_get_line(), pg_get_line_append(), pg_get_line_buf(), pg_get_partkeydef_worker(), pg_get_querydef(), pg_get_ruledef_worker(), pg_get_statisticsobj_worker(), pg_get_triggerdef_worker(), pg_get_viewdef_worker(), pg_local_sendauth(), pg_log_generic_v(), pg_lsn_mi(), pg_lsn_mii(), pg_lsn_out(), pg_lsn_pli(), pg_lsn_recv(), pg_lsn_send(), pg_md5_encrypt(), pg_popcount(), pg_pread(), pg_prewarm(), pg_pwrite(), pg_saslprep(), pg_sequence_last_value(), pg_size_pretty(), pg_snapshot_recv(), pg_snapshot_send(), pg_stat_get_wal(), pg_stat_statements_internal(), pg_strerror_r(), pg_strong_random(), pgp_armor_decode(), pgp_encrypt(), pgp_extract_armor_headers(), pgp_key_id_w(), pgp_mpi_hash(), pgp_mpi_write(), pgrowlocks(), pgstat_btree_page(), pgstat_gist_page(), pgstat_hash_page(), pgstathashindex(), PGTYPESdate_to_asc(), PGTYPESinterval_to_asc(), PGTYPESnumeric_div(), PGTYPEStimestamp_to_asc(), pgwin32_recv(), pgwin32_select(), pgwin32_send(), pgwin32_waitforsinglesocket(), pgxmlNodeSetToText(), pickout(), PinBuffer(), PinBuffer_Locked(), plpgsql_append_source_text(), PLy_exception_set(), PLy_exception_set_plural(), point_recv(), point_send(), poly_recv(), poly_send(), populate_scalar(), postgresImportForeignSchema(), PostgresMain(), pq_beginmessage(), pq_beginmessage_reuse(), pq_begintypsend(), pq_copymsgbytes(), pq_endmessage(), pq_endmessage_reuse(), pq_endtypsend(), pq_send_ascii_string(), pq_sendbyte(), pq_sendbytes(), pq_sendcountedtext(), pq_sendfloat4(), pq_sendfloat8(), pq_sendint(), pq_sendint16(), pq_sendint32(), pq_sendint64(), pq_sendint8(), pq_sendstring(), pq_sendtext(), pq_writeint16(), pq_writeint32(), pq_writeint64(), pq_writeint8(), pq_writestring(), PQcancel(), PQdefaultSSLKeyPassHook_OpenSSL(), pqGetHomeDirectory(), pqGets(), pqGets_append(), pqGets_internal(), PQoidStatus(), pqPacketSend(), pqPutMsgBytes(), PQssl_passwd_cb(), prepare_buf(), PrepareRedoAdd(), PrescanPreparedTransactions(), print_function_arguments(), print_function_rettype(), print_function_sqlbody(), print_function_trftypes(), print_wchar_str(), printACLColumn(), PrintBufferLeakWarning(), printJsonPathItem(), PrintQueryStatus(), printRemoteParam(), printRemotePlaceholder(), printsimple(), printsimple_startup(), printSubscripts(), printtup(), printVerboseErrorMessages(), process_file(), process_pgfdw_appname(), process_pipe_input(), processIndirection(), processSQLNamePattern(), ProcessStartupPacket(), ProcessTwoPhaseBuffer(), ProcSleep(), psql_add_command(), psql_end_command(), psql_get_variable(), psql_start_command(), puttzcode(), puttzcodepass(), pvsnprintf(), pwdfMatchesString(), px_debug(), px_find_combo(), px_gen_salt(), qtext_load_file(), queryin(), quote_qualified_identifier(), range_bound_escape(), range_deparse(), range_parse_bound(), range_recv(), range_send(), read_binary_file(), read_file_contents(), read_seq_tuple(), read_text_file(), read_whole_file(), ReadArrayBinary(), ReadBufferExtended(), ReadDataFromArchiveNone(), ReadStr(), ReadTwoPhaseFile(), ReadyForQuery(), rebuildInsertSql(), ReceiveBackupManifestInMemory(), ReceiveBackupManifestInMemoryChunk(), ReceiveCopyBegin(), ReceiveFunctionCall(), ReceiveTarFile(), record_in(), record_out(), record_recv(), record_send(), RecoverPreparedTransactions(), recv_password_packet(), regression_main(), RelationCopyStorage(), RelationCopyStorageUsingBuffer(), relmap_desc(), repairDependencyLoop(), replace_text_regexp(), replorigin_desc(), report_invalid_encoding(), report_untranslatable_char(), reserveSpaceForItemPointer(), ResetSequence(), resolve_symlinks(), restore(), restoreTwoPhaseData(), revmap_physical_extend(), ri_GenerateQual(), ri_GenerateQualCollation(), rm_redo_error_callback(), rot13_passphrase(), run_crypt_des(), run_crypt_md5(), run_ssl_passphrase_command(), sanitize_char(), sanitize_str(), scan_file(), ScanSourceDatabasePgClass(), ScanSourceDatabasePgClassPage(), scram_get_mechanisms(), search_directory(), send_message_to_frontend(), send_message_to_server_log(), sendAuthRequest(), SendCopyBegin(), SendCopyOutResponse(), SendFunctionResult(), SendNegotiateProtocolVersion(), SendQuery(), SendRowDescriptionMessage(), SendTimeLineHistory(), sepgsql_audit_log(), seq_desc(), SequenceChangePersistence(), serialize_deflist(), set_backtrace(), setFilePath(), shell_construct_command(), show_data_directory_mode(), show_log_file_mode(), show_sortorder_options(), show_unix_socket_permissions(), ShowTransactionStateRec(), simple_quote_literal(), slashUsage(), smgr_desc(), spg_desc(), SPI_result_code_string(), SplitToVariants(), ssl_extension_info(), ssl_external_passwd_cb(), SSLerrfree(), standby_decode(), standby_desc(), standby_desc_invalidations(), standby_desc_running_xacts(), StandbyRecoverPreparedTransactions(), StandbyTransactionIdIsPrepared(), StartBufferIO(), StartLogicalReplication(), StartReplication(), statapprox_heap(), stop_postmaster(), str_time(), StrategyFreeBuffer(), StrategyGetBuffer(), StrategyRejectBuffer(), string2ean(), stringinfo_to_xmltype(), syntax_error(), tar_write(), tarRead(), tarWrite(), tblspc_desc(), TerminateBufferIO(), test_file_descriptor_sync(), test_non_sync(), test_open_sync(), test_sync(), text_format_append_string(), text_format_string_conversion(), textrecv(), textsend(), tidout(), tidrecv(), tidsend(), time_out(), time_recv(), time_send(), timeofday(), timestamp_out(), timestamp_recv(), timestamp_send(), timestamptz_out(), timestamptz_recv(), timestamptz_send(), timestamptz_to_str(), timetz_out(), timetz_recv(), timetz_send(), to_hex32(), to_hex64(), tokenize_auth_file(), try_complete_step(), ts_stat_sql(), tsquery_rewrite_query(), tsqueryrecv(), tsquerysend(), tsvectorin(), tsvectorrecv(), tsvectorsend(), tuplesort_readtup_alloc(), unaccent_lexize(), unicode_normalize_func(), uniqueentry(), unknownrecv(), unknownsend(), UnlockBuffers(), unpack_sql_state(), UnpinBuffer(), usage(), uuid_generate_v1mc(), uuid_out(), vacuum_one_database(), vacuumlo(), validate_exec(), validateSQLNamePattern(), varbit_recv(), varbit_send(), varcharrecv(), verifyBackupPageConsistency(), vm_readbuf(), void_send(), WaitBufHdrUnlocked(), WaitForCommands(), WaitIO(), WALRead(), WalReceiverMain(), WordEntryCMP(), write_auto_conf_file(), write_csvlog(), write_jsonlog(), write_target_range(), xact_decode(), xact_desc(), xact_desc_abort(), xact_desc_assignment(), xact_desc_commit(), xact_desc_prepare(), xact_desc_relations(), xact_desc_stats(), xact_desc_subxacts(), xid8recv(), xid8send(), xidrecv(), xidsend(), xlog_block_info(), xlog_decode(), xlog_desc(), xlog_outdesc(), XLogInitBufferForRedo(), XLogInsertRecord(), XLogReadBufferForRedo(), XLogReadBufferForRedoExtended(), XlogReadTwoPhaseData(), XLogRecGetBlockRefInfo(), XLogRecordPageWithFreeSpace(), XLOGShmemSize(), XLogWalRcvProcessMsg(), XLogWalRcvWrite(), xml_out_internal(), xml_recv(), xml_send(), xmlcomment(), xmlconcat(), xmlelement(), xmlpi(), and xmlroot().

◆ filename

◆ full_buf

char full_buf[DEFAULT_XLOG_SEG_SIZE]
static

Definition at line 66 of file pg_test_fsync.c.

Referenced by prepare_buf(), and test_open().

◆ needs_unlink

int needs_unlink = 0
static

Definition at line 65 of file pg_test_fsync.c.

Referenced by signal_cleanup(), and test_open().

◆ progname

const char* progname
static

Definition at line 62 of file pg_test_fsync.c.

Referenced by handle_args(), and main().

◆ secs_per_test

unsigned int secs_per_test = 5
static

Definition at line 64 of file pg_test_fsync.c.

Referenced by handle_args().

◆ stop_t

struct timeval start_t stop_t
static

Definition at line 68 of file pg_test_fsync.c.

Referenced by print_elapse().