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 sig_atomic_t alarm_triggered = false
 

Macro Definition Documentation

◆ die

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

Definition at line 101 of file pg_test_fsync.c.

◆ FSYNC_FILENAME

#define FSYNC_FILENAME   "./pg_test_fsync.out"

Definition at line 31 of file pg_test_fsync.c.

◆ LABEL_FORMAT

#define LABEL_FORMAT   " %-30s"

Definition at line 35 of file pg_test_fsync.c.

◆ NA_FORMAT

#define NA_FORMAT   "%21s\n"

Definition at line 36 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 38 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:70

Definition at line 43 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:75

Definition at line 61 of file pg_test_fsync.c.

◆ USECS_SEC

#define USECS_SEC   1000000

Definition at line 39 of file pg_test_fsync.c.

◆ XLOG_BLCKSZ_K

#define XLOG_BLCKSZ_K   (XLOG_BLCKSZ / 1024)

Definition at line 33 of file pg_test_fsync.c.

Function Documentation

◆ handle_args()

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

Definition at line 148 of file pg_test_fsync.c.

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

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 105 of file pg_test_fsync.c.

106 {
107  pg_logging_init(argv[0]);
108  set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_test_fsync"));
109  progname = get_progname(argv[0]);
110 
111  handle_args(argc, argv);
112 
113  /* Prevent leaving behind the test file */
114  pqsignal(SIGINT, signal_cleanup);
115  pqsignal(SIGTERM, signal_cleanup);
116 #ifndef WIN32
118 #endif
119 #ifdef SIGHUP
120  /* Not defined on win32 */
122 #endif
123 
124  pg_prng_seed(&pg_global_prng_state, (uint64) time(NULL));
125 
126  prepare_buf();
127 
128  test_open();
129 
130  /* Test using 1 XLOG_BLCKSZ write */
131  test_sync(1);
132 
133  /* Test using 2 XLOG_BLCKSZ writes */
134  test_sync(2);
135 
136  test_open_syncs();
137 
139 
140  test_non_sync();
141 
142  unlink(filename);
143 
144  return 0;
145 }
#define PG_TEXTDOMAIN(domain)
Definition: c.h:1217
void set_pglocale_pgservice(const char *argv0, const char *app)
Definition: exec.c:429
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:89
pg_prng_state pg_global_prng_state
Definition: pg_prng.c:34
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:575
pqsigfunc pqsignal(int signo, pqsigfunc func)
#define SIGHUP
Definition: win32_port.h:168
#define SIGALRM
Definition: win32_port.h:174

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 265 of file pg_test_fsync.c.

266 {
267  int fd;
268 
269 #ifdef O_DIRECT
270  flags |= O_DIRECT;
271 #endif
272 
273  fd = open(path, flags, mode);
274 
275 #if !defined(O_DIRECT) && defined(F_NOCACHE)
276  if (fd >= 0 && fcntl(fd, F_NOCACHE, 1) < 0)
277  {
278  int save_errno = errno;
279 
280  close(fd);
281  errno = save_errno;
282  return -1;
283  }
284 #endif
285 
286  return fd;
287 }
#define close(a)
Definition: win32.h:12
static PgChecksumMode mode
Definition: pg_checksums.c:56
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 231 of file pg_test_fsync.c.

232 {
233  int ops;
234 
235  /* write random data into buffer */
236  for (ops = 0; ops < DEFAULT_XLOG_SEG_SIZE; ops++)
238 
239  buf = (char *) TYPEALIGN(XLOG_BLCKSZ, full_buf);
240 }
#define TYPEALIGN(ALIGNVAL, LEN)
Definition: c.h:807
#define DEFAULT_XLOG_SEG_SIZE
int32 pg_prng_int32(pg_prng_state *state)
Definition: pg_prng.c:243
static char full_buf[DEFAULT_XLOG_SEG_SIZE]
Definition: pg_test_fsync.c:72
static char * buf
Definition: pg_test_fsync.c:73

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 630 of file pg_test_fsync.c.

631 {
632  double total_time = (stop_t.tv_sec - start_t.tv_sec) +
633  (stop_t.tv_usec - start_t.tv_usec) * 0.000001;
634  double per_second = ops / total_time;
635  double avg_op_time_us = (total_time / ops) * USECS_SEC;
636 
637  printf(_(OPS_FORMAT), per_second, avg_op_time_us);
638 }
#define USECS_SEC
Definition: pg_test_fsync.c:39
#define OPS_FORMAT
Definition: pg_test_fsync.c:38

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

◆ process_alarm()

static void process_alarm ( SIGNAL_ARGS  )
static

Definition at line 642 of file pg_test_fsync.c.

643 {
644  alarm_triggered = true;
645 }
static sig_atomic_t alarm_triggered
Definition: pg_test_fsync.c:77

References alarm_triggered.

Referenced by main().

◆ signal_cleanup()

static void signal_cleanup ( SIGNAL_ARGS  )
static

Definition at line 599 of file pg_test_fsync.c.

600 {
601  int rc;
602 
603  /* Delete the file if it exists. Ignore errors */
604  if (needs_unlink)
605  unlink(filename);
606  /* Finish incomplete line on stdout */
607  rc = write(STDOUT_FILENO, "\n", 1);
608  (void) rc; /* silence compiler warnings */
609  _exit(1);
610 }
#define write(a, b, c)
Definition: win32.h:14
static int needs_unlink
Definition: pg_test_fsync.c:71
#define STDOUT_FILENO
Definition: unistd.h:8

References filename, needs_unlink, STDOUT_FILENO, and write.

Referenced by main().

◆ test_file_descriptor_sync()

static void test_file_descriptor_sync ( void  )
static

Definition at line 505 of file pg_test_fsync.c.

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

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

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 243 of file pg_test_fsync.c.

244 {
245  int tmpfile;
246 
247  /*
248  * test if we can open the target file
249  */
250  if ((tmpfile = open(filename, O_RDWR | O_CREAT | PG_BINARY, S_IRUSR | S_IWUSR)) == -1)
251  die("could not open output file");
252  needs_unlink = 1;
253  if (write(tmpfile, full_buf, DEFAULT_XLOG_SEG_SIZE) !=
255  die("write failed");
256 
257  /* fsync now so that dirty buffers don't skew later tests */
258  if (fsync(tmpfile) != 0)
259  die("fsync failed");
260 
261  close(tmpfile);
262 }
#define S_IRUSR
Definition: win32_port.h:289
#define S_IWUSR
Definition: win32_port.h:292

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 469 of file pg_test_fsync.c.

470 {
471 #ifdef O_SYNC
472  int tmpfile,
473  ops,
474  writes;
475 #endif
476 
477  printf(LABEL_FORMAT, msg);
478  fflush(stdout);
479 
480 #ifdef O_SYNC
481  if ((tmpfile = open_direct(filename, O_RDWR | O_SYNC | PG_BINARY, 0)) == -1)
482  printf(NA_FORMAT, _("n/a*"));
483  else
484  {
485  START_TIMER;
486  for (ops = 0; alarm_triggered == false; ops++)
487  {
488  for (writes = 0; writes < 16 / writes_size; writes++)
489  if (pg_pwrite(tmpfile,
490  buf,
491  writes_size * 1024,
492  writes * writes_size * 1024) !=
493  writes_size * 1024)
494  die("write failed");
495  }
496  STOP_TIMER;
497  close(tmpfile);
498  }
499 #else
500  printf(NA_FORMAT, _("n/a"));
501 #endif
502 }
#define NA_FORMAT
Definition: pg_test_fsync.c:36
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 452 of file pg_test_fsync.c.

453 {
454  printf(_("\nCompare open_sync with different write sizes:\n"));
455  printf(_("(This is designed to compare the cost of writing 16kB in different write\n"
456  "open_sync sizes.)\n"));
457 
458  test_open_sync(_(" 1 * 16kB open_sync write"), 16);
459  test_open_sync(_(" 2 * 8kB open_sync writes"), 8);
460  test_open_sync(_(" 4 * 4kB open_sync writes"), 4);
461  test_open_sync(_(" 8 * 2kB open_sync writes"), 2);
462  test_open_sync(_("16 * 1kB open_sync writes"), 1);
463 }
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 290 of file pg_test_fsync.c.

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

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

sig_atomic_t alarm_triggered = false
static

◆ buf

char * buf
static

Definition at line 73 of file pg_test_fsync.c.

Referenced by _bt_allocbuf(), _bt_binsrch(), _bt_blnewpage(), _bt_blwritepage(), _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(), _EndLO(), _fileExistsInDirectory(), _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(), _LoadLOs(), _PG_init(), _pgfstat64(), _pglstat64(), _pgstat64(), _PrintFileData(), _ReadBuf(), _scriptOut(), _skipData(), _tarAddFile(), _tarReadRaw(), _WriteBuf(), _WriteLOData(), abbroffset(), add_cast_to(), add_role_attribute(), add_tablespace_footer(), AddBufferToRing(), AddFileToBackupManifest(), addFooterToPublicationDesc(), alignStringInfoInt(), AlterSequence(), append_database_pattern(), append_db_pattern_cte(), append_num_word(), append_rel_pattern_filtered_cte(), append_rel_pattern_raw_cte(), append_with_tabs(), appendAggOrderBy(), appendArrayEscapedString(), appendByteaLiteral(), appendConditions(), appendConnStrItem(), appendConnStrVal(), appendContextKeyword(), appendCSVLiteral(), appendFunctionName(), appendGroupByClause(), AppendIntegerCommandOption(), appendJSONKeyValue(), appendJSONKeyValueFmt(), appendLimitClause(), appendOrderByClause(), appendOrderBySuffix(), AppendPlainCommandOption(), appendPsqlMetaConnect(), appendQualifiedRelation(), appendShellString(), appendShellStringNoError(), AppendStringCommandOption(), appendStringLiteral(), appendStringLiteralConn(), appendStringLiteralDQ(), appendWhereClause(), array_agg_array_deserialize(), array_agg_array_serialize(), array_agg_deserialize(), array_agg_serialize(), array_desc(), array_dims(), array_recv(), array_send(), array_to_text_internal(), asyncQueueReadAllNotifications(), auth_peer(), 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_minmax_multi_summary_out(), 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(), BufferManagerShmemInit(), 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(), charrecv(), charsend(), check_backup_label_files(), check_default_text_search_config(), check_key_cksum(), check_ssl_key_file_permissions(), CheckPointTwoPhase(), CheckSASLAuth(), ChooseExtendedStatisticNameAddition(), ChooseForeignKeyConstraintNameAddition(), ChooseIndexColumnNames(), ChooseIndexNameAddition(), cidr_recv(), cidrecv(), cidsend(), circle_recv(), circle_send(), clog_desc(), CLOGShmemInit(), cluster_conn_opts(), commit_ts_desc(), CommitTsShmemInit(), compile_pltcl_function(), complex_recv(), complex_send(), concat_conninfo_dbname(), ConditionalLockBuffer(), conninfo_parse(), conninfo_uri_decode(), conninfo_uri_parse_options(), constructConnStr(), convert(), convert64(), convert_to_base(), convertJsonbScalar(), copy_read_data(), CopyGetInt16(), CopyGetInt32(), CopySendInt16(), CopySendInt32(), count_lines_in_buf(), count_nondeletable_pages(), count_spaces_until(), 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_internal(), dbase_desc(), dblink_close(), dblink_fetch(), dblink_open(), DebugPrintBufferRefcount(), DecodeAbort(), DecodeCommit(), DecodeDelete(), DecodeInsert(), DecodeMultiInsert(), DecodePrepare(), DecodeSpecConfirm(), DecodeTruncate(), DecodeTXNNeedSkip(), DecodeUpdate(), decompile_column_index_array(), decrypt_read(), default_desc(), DeleteAllExportedSnapshotFiles(), delvacuum_desc(), deparse_expression_pretty(), deparse_lquery(), deparse_ltree(), deparseAggref(), deparseAnalyzeInfoSql(), 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(), describeRoleGrants(), 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(), dumpDatabaseConfig(), dumpLOs(), dumpRoleGUCPrivs(), dumpRoleMembership(), dumpRoles(), dumpTablespaces(), dumpTimestamp(), dumpUserConfig(), ean13_out(), ean2isn(), entryBeginPlaceToPage(), entryExecPlaceToPage(), entryIsEnoughSpace(), enum_recv(), enum_send(), err_sendstring(), escape_json(), escape_json_char(), escape_json_text(), escape_json_with_len(), escape_param_str(), escape_xml(), escape_yaml(), EvictUnpinnedBuffer(), ExceptionalCondition(), exec_command_password(), exec_command_sf_sv(), ExecBuildSlotPartitionKeyDescription(), ExecBuildSlotValueDescription(), ExecEvalXmlExpr(), ExecQueryAndProcessResults(), executeItemOptUnwrapTarget(), executeMetaCommand(), ExecuteSimpleCommands(), ExecuteSqlCommandBuf(), ExplainPropertyFloat(), ExplainPropertyInteger(), ExplainPropertyUInteger(), explicit_bzero(), exportFile(), ExportSnapshot(), ExtendBufferedRel(), ExtendBufferedRelLocal(), ExtendBufferedRelShared(), fe_recvint64(), fe_sendint64(), fileinfo_to_stat(), 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_helper(), get_base_conninfo(), 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_eol_offset(), get_from_clause(), get_from_clause_coldeflist(), get_from_clause_item(), get_func_expr(), get_func_sql_syntax(), get_home_path(), get_insert_query_def(), get_json_constructor(), get_json_constructor_options(), get_json_format(), get_json_returning(), get_json_table(), get_json_table_columns(), get_merge_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_sub_conninfo(), get_sublink_expr(), 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_helper(), get_with_clause(), get_xmltable(), GetBufferFromRing(), GetHugePageSize(), GetRecordedFreeSpace(), GetVictimBuffer(), GetWALBlockInfo(), gin_desc(), ginCompressPostingList(), gist_desc(), gist_indexsortbuild_levelstate_flush(), gist_page_items(), gistcheckpage(), gistfixsplit(), gistformdownlink(), gnuish_strerror_r(), handleCopyIn(), handleCopyOut(), HandleUploadManifestPacket(), 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(), hladdword(), hlfinditem(), hlparsetext(), hmac_finish(), hstore_recv(), hstore_send(), hstorePairs(), ignore_boolean_expression(), importFile(), indent_lines(), inet_recv(), infile(), infobits_desc(), initialize_SSL(), initialize_worker_spi(), InitializeShmemGUCs(), InitLocalBuffers(), int2recv(), int2send(), int2vectorrecv(), int4recv(), int4send(), int8_avg_deserialize(), int8_avg_serialize(), int8out(), int8recv(), int8send(), internal_flush_buffer(), interval_avg_deserialize(), interval_avg_serialize(), interval_out(), interval_recv(), interval_send(), inv_read(), inv_write(), InvalidateBuffer(), is_true_boolean_expression(), isn_out(), IssueACLPerBlob(), IssueCommandPerBlob(), json_recv(), json_send(), jsonb_agg_transfn_worker(), jsonb_object_agg_transfn_worker(), 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(), 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(), offset_elem_desc(), oid_elem_desc(), OidReceiveFunctionCall(), oidrecv(), oidsend(), oidvectorrecv(), out_gistxlogDelete(), out_gistxlogPageDelete(), out_gistxlogPageReuse(), out_gistxlogPageSplit(), out_member(), outDouble(), overwrite(), pad_eme_pkcs1_v15(), parse_backup_label(), 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_buffercache_evict(), pg_dearmor(), pg_fe_getusername(), 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_sequence_data(), pg_get_statisticsobj_worker(), pg_get_triggerdef_worker(), pg_get_viewdef_worker(), pg_get_wait_events(), pg_log_filter_error(), 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_popcount_masked(), pg_popcount_masked_optimized(), pg_popcount_masked_slow(), pg_popcount_optimized(), pg_popcount_slow(), pg_pread(), pg_prewarm(), pg_pwrite(), pg_saslprep(), pg_sequence_last_value(), pg_size_pretty(), pg_snapshot_recv(), pg_snapshot_send(), pg_split_walfile_name(), 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(), plan_elem_desc(), 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(), PQchangePassword(), PQdefaultSSLKeyPassHook_OpenSSL(), pqGetHomeDirectory(), pqGetNegotiateProtocolVersion3(), 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(), 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_pg_version_file(), 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(), redirect_elem_desc(), regression_main(), RelationCopyStorage(), RelationCopyStorageUsingBuffer(), relmap_desc(), repairDependencyLoop(), replace_text_regexp(), replorigin_desc(), report_invalid_encoding(), report_untranslatable_char(), ReportWalSummaryError(), reserveSpaceForItemPointer(), ResetSequence(), 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(), scan_profile(), ScanSourceDatabasePgClass(), ScanSourceDatabasePgClassPage(), scram_get_mechanisms(), search_directory(), secure_open_server(), 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(), serializeAnalyzeReceive(), set_backtrace(), setFilePath(), SetShellResultVariables(), show_data_directory_mode(), show_log_file_mode(), show_sortorder_options(), show_unix_socket_permissions(), ShowTransactionStateRec(), simple_quote_literal(), slashUsage(), slurp_file(), smgr_bulk_write(), smgr_desc(), spg_desc(), spgbuildempty(), 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(), string_agg_deserialize(), string_agg_serialize(), stringinfo_to_xmltype(), strncoll_libc(), strnxfrm_libc(), SUBTRANSShmemInit(), syntax_error(), tar_write(), tarRead(), tarWrite(), tblspc_desc(), TerminateBufferIO(), test_dsa_basic(), test_file_descriptor_sync(), test_non_sync(), test_open_sync(), test_sync(), testcustomrmgrs_desc(), 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(), tokenize_auth_file(), truncate_flags_desc(), 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(), UnpinBufferNoOwner(), UploadManifest(), usage(), uuid_generate_v1mc(), uuid_out(), vacuum_one_database(), vacuumlo(), validate_exec(), validateSQLNamePattern(), varbit_recv(), varbit_send(), varcharrecv(), verifyBackupPageConsistency(), vm_extend(), vm_readbuf(), void_send(), WaitBufHdrUnlocked(), WaitForCommands(), WaitIO(), WALRead(), WalReceiverMain(), WordEntryCMP(), worker_spi_main(), write_auto_conf_file(), write_backup_label(), 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(), XLogRecordSaveFPWs(), XLOGShmemSize(), XLogWalRcvProcessMsg(), XLogWalRcvWrite(), xml_out_internal(), xml_recv(), xml_send(), xmlcomment(), xmlconcat(), xmlelement(), xmlpi(), xmlroot(), and xmltotext_with_options().

◆ filename

◆ full_buf

char full_buf[DEFAULT_XLOG_SEG_SIZE]
static

Definition at line 72 of file pg_test_fsync.c.

Referenced by prepare_buf(), and test_open().

◆ needs_unlink

int needs_unlink = 0
static

Definition at line 71 of file pg_test_fsync.c.

Referenced by signal_cleanup(), and test_open().

◆ progname

const char* progname
static

Definition at line 68 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 70 of file pg_test_fsync.c.

Referenced by handle_args().

◆ stop_t

struct timeval start_t stop_t
static

Definition at line 74 of file pg_test_fsync.c.

Referenced by print_elapse().