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 (int sig)
 
static void signal_cleanup (int sig)
 
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:1179
#define _(x)
Definition: elog.c:89
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:231

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:1212
void set_pglocale_pgservice(const char *argv0, const char *app)
Definition: exec.c:446
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 process_alarm(int sig)
static void test_open_syncs(void)
static void handle_args(int argc, char *argv[])
static void signal_cleanup(int sig)
static void test_sync(int writes_per_op)
static void test_open(void)
static void test_non_sync(void)
const char * get_progname(const char *argv0)
Definition: path.c:574
pqsigfunc pqsignal(int signum, pqsigfunc handler)
Definition: signal.c:180
#define SIGHUP
Definition: win32_port.h:167
#define SIGALRM
Definition: win32_port.h:173

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:750
#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 627 of file pg_test_fsync.c.

628 {
629  double total_time = (stop_t.tv_sec - start_t.tv_sec) +
630  (stop_t.tv_usec - start_t.tv_usec) * 0.000001;
631  double per_second = ops / total_time;
632  double avg_op_time_us = (total_time / ops) * USECS_SEC;
633 
634  printf(_(OPS_FORMAT), per_second, avg_op_time_us);
635 }
#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 ( int  sig)
static

Definition at line 639 of file pg_test_fsync.c.

640 {
641  alarm_triggered = true;
642 }
static bool alarm_triggered
Definition: pg_test_fsync.c:71

References alarm_triggered.

Referenced by main().

◆ signal_cleanup()

static void signal_cleanup ( int  sig)
static

Definition at line 597 of file pg_test_fsync.c.

598 {
599  /* Delete the file if it exists. Ignore errors */
600  if (needs_unlink)
601  unlink(filename);
602  /* Finish incomplete line on stdout */
603  puts("");
604  exit(signum);
605 }
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 503 of file pg_test_fsync.c.

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

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

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

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:288
#define S_IWUSR
Definition: win32_port.h:291

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

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

451 {
452  printf(_("\nCompare open_sync with different write sizes:\n"));
453  printf(_("(This is designed to compare the cost of writing 16kB in different write\n"
454  "open_sync sizes.)\n"));
455 
456  test_open_sync(_(" 1 * 16kB open_sync write"), 16);
457  test_open_sync(_(" 2 * 8kB open_sync writes"), 8);
458  test_open_sync(_(" 4 * 4kB open_sync writes"), 4);
459  test_open_sync(_(" 8 * 2kB open_sync writes"), 2);
460  test_open_sync(_("16 * 1kB open_sync writes"), 1);
461 }
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 OPEN_DATASYNC_FLAG
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 #ifdef HAVE_FDATASYNC
335  if ((tmpfile = open(filename, O_RDWR | PG_BINARY, 0)) == -1)
336  die("could not open output file");
337  START_TIMER;
338  for (ops = 0; alarm_triggered == false; ops++)
339  {
340  for (writes = 0; writes < writes_per_op; writes++)
341  if (pg_pwrite(tmpfile,
342  buf,
343  XLOG_BLCKSZ,
344  writes * XLOG_BLCKSZ) != XLOG_BLCKSZ)
345  die("write failed");
346  fdatasync(tmpfile);
347  }
348  STOP_TIMER;
349  close(tmpfile);
350 #else
351  printf(NA_FORMAT, _("n/a"));
352 #endif
353 
354 /*
355  * Test fsync
356  */
357  printf(LABEL_FORMAT, "fsync");
358  fflush(stdout);
359 
360  if ((tmpfile = open(filename, O_RDWR | PG_BINARY, 0)) == -1)
361  die("could not open output file");
362  START_TIMER;
363  for (ops = 0; alarm_triggered == false; ops++)
364  {
365  for (writes = 0; writes < writes_per_op; writes++)
366  if (pg_pwrite(tmpfile,
367  buf,
368  XLOG_BLCKSZ,
369  writes * XLOG_BLCKSZ) != XLOG_BLCKSZ)
370  die("write failed");
371  if (fsync(tmpfile) != 0)
372  die("fsync failed");
373  }
374  STOP_TIMER;
375  close(tmpfile);
376 
377 /*
378  * If fsync_writethrough is available, test as well
379  */
380  printf(LABEL_FORMAT, "fsync_writethrough");
381  fflush(stdout);
382 
383 #ifdef HAVE_FSYNC_WRITETHROUGH
384  if ((tmpfile = open(filename, O_RDWR | PG_BINARY, 0)) == -1)
385  die("could not open output file");
386  START_TIMER;
387  for (ops = 0; alarm_triggered == false; ops++)
388  {
389  for (writes = 0; writes < writes_per_op; writes++)
390  if (pg_pwrite(tmpfile,
391  buf,
392  XLOG_BLCKSZ,
393  writes * XLOG_BLCKSZ) != XLOG_BLCKSZ)
394  die("write failed");
395  if (pg_fsync_writethrough(tmpfile) != 0)
396  die("fsync failed");
397  }
398  STOP_TIMER;
399  close(tmpfile);
400 #else
401  printf(NA_FORMAT, _("n/a"));
402 #endif
403 
404 /*
405  * Test open_sync if available
406  */
407  printf(LABEL_FORMAT, "open_sync");
408  fflush(stdout);
409 
410 #ifdef OPEN_SYNC_FLAG
411  if ((tmpfile = open_direct(filename, O_RDWR | OPEN_SYNC_FLAG | PG_BINARY, 0)) == -1)
412  {
413  printf(NA_FORMAT, _("n/a*"));
414  fs_warning = true;
415  }
416  else
417  {
418  START_TIMER;
419  for (ops = 0; alarm_triggered == false; ops++)
420  {
421  for (writes = 0; writes < writes_per_op; writes++)
422  if (pg_pwrite(tmpfile,
423  buf,
424  XLOG_BLCKSZ,
425  writes * XLOG_BLCKSZ) != XLOG_BLCKSZ)
426 
427  /*
428  * This can generate write failures if the filesystem has
429  * a large block size, e.g. 4k, and there is no support
430  * for O_DIRECT writes smaller than the file system block
431  * size, e.g. XFS.
432  */
433  die("write failed");
434  }
435  STOP_TIMER;
436  close(tmpfile);
437  }
438 #else
439  printf(NA_FORMAT, _("n/a"));
440 #endif
441 
442  if (fs_warning)
443  {
444  printf(_("* This file system and its mount options do not support direct\n"
445  " I/O, e.g. ext4 in journaled mode.\n"));
446  }
447 }
int pg_fsync_writethrough(int fd)
Definition: fd.c:426
#define O_DSYNC
Definition: win32_port.h:336

References _, alarm_triggered, buf, close, die, 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_key_cksum(), check_ssl_key_file_permissions(), check_strxfrm_bug(), check_TSCurrentConfig(), 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_fdw_validator(), 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(), 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(), ExecPrepareJsonItemCoercion(), ExecQueryUsingCursor(), executeMetaCommand(), ExecuteSimpleCommands(), ExecuteSqlCommandBuf(), ExplainPropertyFloat(), ExplainPropertyInteger(), ExplainPropertyUInteger(), explicit_bzero(), exportFile(), ExportSnapshot(), fe_recvint64(), fe_sendint64(), file_fdw_validator(), 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_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_json_constructor(), get_json_constructor_options(), get_json_format(), get_json_returning(), get_json_table(), get_json_table_columns(), 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_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(), getaddrinfo(), 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(), 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_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(), 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(), 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(), postgres_fdw_validator(), postgresImportForeignSchema(), PostgresMain(), postgresql_fdw_validator(), 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(), readtup_alloc(), ReadTwoPhaseFile(), ReadyForQuery(), rebuildInsertSql(), ReceiveBackupManifestInMemory(), ReceiveBackupManifestInMemoryChunk(), ReceiveCopyBegin(), ReceiveFunctionCall(), ReceiveTarFile(), record_in(), record_out(), record_recv(), record_send(), RecoverPreparedTransactions(), recv_password_packet(), regression_main(), RelationCopyStorage(), 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_int8_string(), send_message_to_frontend(), send_message_to_server_log(), sendAuthRequest(), SendCopyBegin(), SendCopyOutResponse(), SendFunctionResult(), SendNegotiateProtocolVersion(), SendQuery(), SendRowDescriptionMessage(), SendTablespaceList(), SendTimeLineHistory(), SendXlogRecPtrResult(), 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(), 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(), unaccent_lexize(), unicode_normalize_func(), uniqueentry(), unknownrecv(), unknownsend(), UnlockBuffers(), unpack_sql_state(), UnpinBuffer(), uuid_generate_v1mc(), uuid_out(), vacuum_one_database(), vacuumlo(), validate_exec(), validateSQLNamePattern(), varbit_recv(), varbit_send(), varcharrecv(), verifyBackupPageConsistency(), visibilitymap_clear(), visibilitymap_get_status(), visibilitymap_pin(), visibilitymap_pin_ok(), 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().