MCPcopy Create free account
hub / github.com/apache/cloudberry / test_open_sync

Function test_open_sync

src/bin/pg_test_fsync/pg_test_fsync.c:444–478  ·  view source on GitHub ↗

* Test open_sync with different size files */

Source from the content-addressed store, hash-verified

442 * Test open_sync with different size files
443 */
444static void
445test_open_sync(const char *msg, int writes_size)
446{
447#ifdef OPEN_SYNC_FLAG
448 int tmpfile,
449 ops,
450 writes;
451#endif
452
453 printf(LABEL_FORMAT, msg);
454 fflush(stdout);
455
456#ifdef OPEN_SYNC_FLAG
457 if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG | PG_O_DIRECT | PG_BINARY, 0)) == -1)
458 printf(NA_FORMAT, _("n/a*"));
459 else
460 {
461 START_TIMER;
462 for (ops = 0; alarm_triggered == false; ops++)
463 {
464 for (writes = 0; writes < 16 / writes_size; writes++)
465 if (pg_pwrite(tmpfile,
466 buf,
467 writes_size * 1024,
468 writes * writes_size * 1024) !=
469 writes_size * 1024)
470 die("write failed");
471 }
472 STOP_TIMER;
473 close(tmpfile);
474 }
475#else
476 printf(NA_FORMAT, _("n/a"));
477#endif
478}
479
480static void
481test_file_descriptor_sync(void)

Callers 1

test_open_syncsFunction · 0.85

Calls 2

pg_pwriteFunction · 0.85
dieFunction · 0.85

Tested by

no test coverage detected