PostgreSQL Source Code
git master
|
#include "postgres_fe.h"
#include <sys/stat.h>
#include <sys/time.h>
#include <fcntl.h>
#include <unistd.h>
#include <signal.h>
#include "getopt_long.h"
#include "access/xlogdefs.h"
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 |
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) |
static void | die (const char *str) |
int | main (int argc, char *argv[]) |
Variables | |
static const char * | progname |
static 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 |
#define FSYNC_FILENAME "./pg_test_fsync.out" |
Definition at line 23 of file pg_test_fsync.c.
#define LABEL_FORMAT " %-30s" |
Definition at line 27 of file pg_test_fsync.c.
Referenced by test_file_descriptor_sync(), test_non_sync(), test_open_sync(), and test_sync().
#define NA_FORMAT "%21s\n" |
Definition at line 28 of file pg_test_fsync.c.
Referenced by test_open_sync(), and test_sync().
#define OPS_FORMAT gettext_noop("%13.3f ops/sec %6.0f usecs/op\n") |
Definition at line 30 of file pg_test_fsync.c.
Referenced by print_elapse().
#define START_TIMER |
Definition at line 35 of file pg_test_fsync.c.
Referenced by test_file_descriptor_sync(), test_non_sync(), test_open_sync(), and test_sync().
#define STOP_TIMER |
Definition at line 56 of file pg_test_fsync.c.
Referenced by test_file_descriptor_sync(), test_non_sync(), test_open_sync(), and test_sync().
#define USECS_SEC 1000000 |
Definition at line 31 of file pg_test_fsync.c.
Referenced by print_elapse().
#define XLOG_BLCKSZ_K (XLOG_BLCKSZ / 1024) |
Definition at line 25 of file pg_test_fsync.c.
Referenced by test_non_sync(), and test_sync().
|
static |
Definition at line 606 of file pg_test_fsync.c.
References _, and strerror().
Referenced by test_file_descriptor_sync(), test_non_sync(), test_open(), test_open_sync(), and test_sync().
|
static |
Definition at line 139 of file pg_test_fsync.c.
References _, filename, getopt_long(), ngettext, optarg, optind, progname, required_argument, and secs_per_test.
Referenced by main().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 99 of file pg_test_fsync.c.
References filename, get_progname(), handle_args(), 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().
|
static |
Definition at line 207 of file pg_test_fsync.c.
References buf, DEFAULT_XLOG_SEG_SIZE, full_buf, random(), and TYPEALIGN.
Referenced by main().
|
static |
|
static |
Definition at line 590 of file pg_test_fsync.c.
References alarm_triggered, and secs_per_test.
Referenced by main().
|
static |
Definition at line 548 of file pg_test_fsync.c.
References fd(), filename, needs_unlink, and pg_fsync_writethrough().
Referenced by main().
|
static |
Definition at line 454 of file pg_test_fsync.c.
References _, alarm_triggered, buf, close, die(), filename, fsync, LABEL_FORMAT, START_TIMER, STOP_TIMER, and write.
Referenced by main().
|
static |
Definition at line 523 of file pg_test_fsync.c.
References _, alarm_triggered, buf, close, die(), filename, LABEL_FORMAT, START_TIMER, STOP_TIMER, write, and XLOG_BLCKSZ_K.
Referenced by main().
|
static |
Definition at line 219 of file pg_test_fsync.c.
References close, DEFAULT_XLOG_SEG_SIZE, die(), filename, fsync, full_buf, needs_unlink, S_IRUSR, S_IWUSR, and write.
Referenced by main().
|
static |
Definition at line 419 of file pg_test_fsync.c.
References _, alarm_triggered, buf, close, die(), filename, LABEL_FORMAT, NA_FORMAT, PG_O_DIRECT, START_TIMER, STOP_TIMER, and write.
Referenced by test_open_syncs().
|
static |
Definition at line 402 of file pg_test_fsync.c.
References _, and test_open_sync().
Referenced by main().
|
static |
Definition at line 241 of file pg_test_fsync.c.
References _, alarm_triggered, buf, close, die(), filename, fsync, LABEL_FORMAT, NA_FORMAT, O_DSYNC, pg_fsync_writethrough(), PG_O_DIRECT, START_TIMER, STOP_TIMER, write, and XLOG_BLCKSZ_K.
Referenced by main().
Definition at line 72 of file pg_test_fsync.c.
Referenced by process_alarm(), test_file_descriptor_sync(), test_non_sync(), test_open_sync(), and test_sync().
|
static |
Definition at line 67 of file pg_test_fsync.c.
Referenced by _bt_clear_incomplete_split(), _bt_doinsert(), _bt_endpoint(), _bt_findinsertloc(), _bt_first(), _bt_get_endpoint(), _bt_getbuf(), _bt_getstackbuf(), _bt_is_page_halfdead(), _bt_killitems(), _bt_moveright(), _bt_relandgetbuf(), _bt_unlink_halfdead_page(), _bt_walk_left(), _conv(), _discoverArchiveFormat(), _EndBlob(), _hash_doinsert(), _hash_first(), _hash_getbucketbuf_from_hashkey(), _hash_getbuf(), _hash_getbuf_with_condlock_cleanup(), _hash_getbuf_with_strategy(), _hash_getinitbuf(), _hash_getnewbuf(), _hash_init(), _hash_kill_items(), _hash_next(), _hash_readpage(), _LoadBlobs(), _PG_init(), _PrintFileData(), _skipData(), _tarAddFile(), _tarPositionTo(), _WriteBlobData(), abbroffset(), AbortBufferIO(), abstimeout(), abstimerecv(), abstimesend(), add_tablespace_footer(), aes_cbc_decrypt(), AlterSequence(), appendAggOrderBy(), appendConditions(), appendContextKeyword(), appendFunctionName(), appendGroupByClause(), appendOrderByClause(), array_dims(), array_recv(), array_send(), array_to_text_internal(), asyncQueueReadAllNotifications(), autoprewarm_database_main(), BasicOpenFilePerm(), be_lo_export(), big5_to_euc_tw(), bit_recv(), boolrecv(), boolsend(), bootstrap_template1(), box_recv(), box_send(), bpcharrecv(), bqarr_in(), brin_getinsertbuffer(), brin_vacuum_scan(), brin_xlog_createidx(), brin_xlog_revmap_extend(), bringetbitmap(), brininsert(), brinsummarize(), BSD44_derived_dlsym(), btvacuumpage(), btvacuumscan(), buf_init(), BufferAlloc(), build_client_final_message(), build_client_first_message(), BuildIndexValueDescription(), bytearecv(), cache_single_time(), calc_s2k_iter_salted(), calc_s2k_salted(), calc_s2k_simple(), cash_out(), cash_recv(), cash_send(), cash_words(), charrecv(), charsend(), check_key_cksum(), check_strxfrm_bug(), check_TSCurrentConfig(), CheckForExternalTrigger(), CheckPointTwoPhase(), CheckSCRAMAuth(), checkXLogConsistency(), ChooseExtendedStatisticNameAddition(), ChooseIndexColumnNames(), ChooseIndexNameAddition(), cidr_recv(), cidrecv(), cidsend(), circle_recv(), circle_send(), cluster_conn_opts(), compile_pltcl_function(), complex_recv(), complex_send(), ConditionalLockBuffer(), conninfo_parse(), conninfo_uri_decode(), conninfo_uri_parse_options(), constructConnStr(), ConvertTriggerToFK(), copy_heap_data(), copy_read_data(), copy_relation_data(), CopyGetInt16(), CopyGetInt32(), CopySendInt16(), CopySendInt32(), count_nondeletable_pages(), create_cursor(), createBackupLabel(), cstring_recv(), cstring_send(), cube_out(), date_out(), date_recv(), date_send(), date_test_fmt(), datum_to_json(), dblink_close(), dblink_fdw_validator(), dblink_fetch(), dblink_open(), DebugFileOpen(), decrypt_read(), DeleteAllExportedSnapshotFiles(), deparse_expression_pretty(), deparseAggref(), deparseArrayExpr(), deparseArrayRef(), deparseBoolExpr(), deparseConst(), deparseDirectDeleteSql(), deparseDirectUpdateSql(), deparseDistinctExpr(), deparseExplicitTargetList(), deparseFromExpr(), deparseFromExprForRel(), deparseFuncExpr(), deparseLockingClause(), deparseNullTest(), deparseOpExpr(), deparseScalarArrayOpExpr(), deparseSelectSql(), deparseSelectStmtForRel(), deparseSortGroupClause(), deparseSubqueryTargetList(), describeAccessMethods(), describeAggregates(), describeFunctions(), describeOneTableDetails(), describeOneTSConfig(), describeOneTSParser(), describeOperators(), describePublications(), DescribeQuery(), describeRoles(), describeSubscriptions(), describeTableDetails(), describeTablespaces(), describeTypes(), DispatchJobForTocEntry(), do_compile(), do_lo_list(), do_setval(), domain_recv(), drainSelfPipe(), DropDatabaseBuffers(), dropRoles(), dsm_cleanup_for_mmap(), dump_lo_buf(), dumpBlobs(), dumpDatabaseConfig(), dumpGroups(), dumpRoleMembership(), dumpRoles(), dumpTablespaces(), dumpTimestamp(), dumpUserConfig(), ean13_out(), ean2isn(), EndCompressor(), enum_recv(), enum_send(), escape_param_str(), escape_xml(), euc_tw_to_big5(), exec_command_password(), exec_command_sf_sv(), ExecBuildSlotPartitionKeyDescription(), ExecBuildSlotValueDescription(), ExecEvalXmlExpr(), ExecQueryUsingCursor(), ExecuteSimpleCommands(), expand_fmt_string(), expand_grouping_sets(), ExplainPropertyFloat(), ExplainPropertyInteger(), exportFile(), ExportSnapshot(), file_fdw_validator(), fill_seq_with_data(), find_provider(), FindStreamingStart(), FinishPreparedTransaction(), flatten_reloptions(), flatten_set_variable_args(), float4_numeric(), float4recv(), float4send(), float8_numeric(), float8recv(), float8send(), flush_pipe_input(), fmtlong(), format_aggregate_signature(), format_operator_internal(), format_procedure_internal(), format_type_extended(), formatPGVersionNumber(), FreePageManagerDump(), FreeSpaceMapTruncateRel(), fsm_readbuf(), fsm_search(), fsm_set_and_search(), fsm_vacuum_page(), generate_operator_name(), generate_trgm_only(), generate_wildcard_trgm(), 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_delete_query_def(), get_from_clause(), get_from_clause_coldeflist(), get_from_clause_item(), get_func_expr(), get_insert_query_def(), get_oper_expr(), get_prompt(), get_query_def(), get_range_partbound_string(), get_raw_page_internal(), 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(), getaddrinfo(), GetBufferFromRing(), GetRecordedFreeSpace(), ginCompressPostingList(), gistfixsplit(), handleCopyIn(), handleCopyOut(), hash_xlog_split_page(), hashbucketcleanup(), hashbulkdelete(), heap_lock_updated_tuple_rec(), hmac_finish(), hstore_recv(), hstore_send(), hstorePairs(), ignore_boolean_expression(), importFile(), inet_recv(), infile(), init_params(), InitBufferPool(), initialize_worker_spi(), InitLocalBuffers(), int2recv(), int2send(), int2vectorrecv(), int4recv(), int4send(), int8_avg_deserialize(), int8_avg_serialize(), int8out(), int8recv(), int8send(), interval_out(), interval_recv(), interval_send(), is_true_boolean_expression(), isn_out(), json_recv(), json_send(), jsonb_agg_transfn(), jsonb_object_agg_transfn(), jsonb_recv(), jsonb_send(), JsonEncodeDateTime(), KnownAssignedXidsDisplay(), l_bb_append_v(), l_bb_before_v(), lazy_scan_heap(), lazy_vacuum_heap(), lazy_vacuum_rel(), libpqrcv_get_conninfo(), line_recv(), line_send(), listAllDbs(), listCasts(), listCollations(), listConversions(), listDbRoleSettings(), listDefaultACLs(), listDomains(), listEventTriggers(), listExtensionContents(), listExtensions(), listForeignDataWrappers(), listForeignServers(), listForeignTables(), listLanguages(), listOneExtensionContents(), listPublications(), listSchemas(), listTables(), listTSConfigs(), listTSConfigsVerbose(), listTSDictionaries(), listTSParsers(), listTSParsersVerbose(), listTSTemplates(), listUserMappings(), llvm_create_types(), lo_export(), lo_import_internal(), load_module(), load_resultmap(), locale_date_order(), LockBuffer(), LogicalDecodingProcessRecord(), LogicalRepApplyLoop(), lquery_in(), lquery_out(), lseg_recv(), lseg_send(), ltree_crc32_sz(), ltree_in(), ltree_out(), ltxtq_in(), macaddr8_recv(), macaddr8_send(), macaddr_recv(), macaddr_send(), main(), make_absolute_path(), make_ruledef(), map_sql_identifier_to_xml_name(), map_sql_value_to_xml_value(), map_xml_name_to_sql_identifier(), MemoryContextSwitchTo(), merge_children(), mp_px_rand(), mxid_to_string(), namerecv(), namesend(), 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(), objectDescription(), oidrecv(), oidsend(), oidvectorrecv(), output(), overwrite(), packArcInfoCmp(), pad_eme_pkcs1_v15(), parse_literal_data(), parse_snapshot(), parseAclItem(), parseServiceFile(), passwordFromFile(), path_recv(), path_send(), perform_base_backup(), permissionsList(), pg_armor(), pg_b64_decode(), pg_b64_encode(), pg_base64_decode(), pg_base64_encode(), pg_collation_actual_version(), 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_functiondef(), pg_get_indexdef_worker(), pg_get_partkeydef_worker(), pg_get_ruledef_worker(), pg_get_statisticsobj_worker(), pg_get_triggerdef_worker(), pg_get_viewdef_worker(), pg_local_sendauth(), pg_lsn_mi(), pg_lsn_out(), pg_lsn_recv(), pg_lsn_send(), pg_prewarm(), pg_random_uuid(), pg_saslprep(), pg_sequence_last_value(), pg_size_pretty(), pgp_armor_decode(), pgp_extract_armor_headers(), pgp_key_id_w(), pgp_mpi_hash(), pgp_mpi_write(), pgrowlocks(), PGSharedMemoryIsInUse(), 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_waitforsinglesocket(), pgxmlNodeSetToText(), pickout(), PLy_exception_set(), PLy_exception_set_plural(), PLyObject_ToJsonbValue(), point_recv(), point_send(), poly_recv(), poly_send(), postgres_fdw_validator(), postgresImportForeignSchema(), PostgresMain(), postgresql_fdw_validator(), pq_sendint(), PQoidStatus(), prefix_init(), prepare_buf(), PrescanPreparedTransactions(), print_wchar_str(), PrintBufferLeakWarning(), PrintQueryStatus(), printRemoteParam(), printRemotePlaceholder(), printsimple(), printsimple_startup(), printSubscripts(), printtup(), printtup_20(), printtup_internal_20(), process_file(), process_pipe_input(), processIndirection(), ProcessStartupPacket(), ProcessTwoPhaseBuffer(), ProcSleep(), prompt_for_password(), psql_get_variable(), puttzcode(), puttzcode64(), pwdfMatchesString(), px_debug(), px_find_combo(), 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_text_file(), read_whole_file(), ReadBufferExtended(), ReadDataFromArchiveNone(), readMessageFromPipe(), ReadStr(), readtup_alloc(), ReadTwoPhaseFile(), ReadyForQuery(), ReceiveCopyBegin(), record_in(), record_out(), record_recv(), record_send(), RecoverPreparedTransactions(), recv_password_packet(), regression_main(), RelationFindReplTupleByIndex(), RelationFindReplTupleSeq(), reltimeout(), reltimerecv(), reltimesend(), repairDependencyLoop(), replace_text_regexp(), report_invalid_encoding(), report_untranslatable_char(), ResetSequence(), restore(), restoreTwoPhaseData(), revmap_physical_extend(), rewind_copy_file_range(), rm_redo_error_callback(), rstacktoodeep(), run_crypt_des(), s_tobin(), sanitize_char(), scan_file(), search_directory(), send_message_to_frontend(), send_message_to_server_log(), sendAuthRequest(), SendBackupHeader(), SendCopyBegin(), sendFile(), sendFileWithContent(), SendFunctionResult(), SendNegotiateProtocolVersion(), SendQuery(), SendTimeLineHistory(), SendXlogRecPtrResult(), sepgsql_audit_log(), serialize_deflist(), SetWALSegSize(), sha224_bytea(), sha256_bytea(), sha384_bytea(), sha512_bytea(), show_data_directory_mode(), show_log_file_mode(), show_unix_socket_permissions(), ShowTransactionStateRec(), simple_prompt(), SortTocFromFile(), SPI_result_code_string(), SPI_sql_row_to_xmlelement(), SplitToVariants(), ssl_extension_info(), StandbyRecoverPreparedTransactions(), StandbyTransactionIdIsPrepared(), StartBufferIO(), StartLogicalReplication(), StartReplication(), StartupXLOG(), statapprox_heap(), stop_postmaster(), str_time(), StrategyGetBuffer(), strerror(), string2ean(), t_readline(), tar_getlasterror(), tar_write(), tarClose(), test_file_descriptor_sync(), test_non_sync(), test_open_sync(), test_sync(), 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(), tintervalrecv(), tintervalsend(), to_hex32(), to_hex64(), truncate_identifier(), try_complete_step(), ts_stat_sql(), tsquery_rewrite_query(), tsvectorin(), tsvectorrecv(), tsvectorsend(), txid_snapshot_recv(), txid_snapshot_send(), typeStringToTypeName(), unaccent_lexize(), unknownrecv(), unknownsend(), UnlockBuffers(), unpack_sql_state(), uuid_generate_v1mc(), uuid_out(), vacuum_one_database(), vacuumlo(), varbit_recv(), varbit_send(), varcharrecv(), vm_readbuf(), void_send(), WaitEventSetWait(), WaitForCommands(), WalReceiverMain(), write_auto_conf_file(), write_csvlog(), write_target_range(), xidrecv(), xidsend(), xlog_redo(), XLogDumpXLogRead(), XLogInitBufferForRedo(), XLogInsertRecord(), XLogRead(), XLogRecordPageWithFreeSpace(), XLOGShmemSize(), xml_out_internal(), xml_send(), xmlcomment(), xmlconcat(), xmlpi(), xmlroot(), and yearistype().
|
static |
Definition at line 69 of file pg_test_fsync.c.
Referenced by handle_args(), main(), signal_cleanup(), test_file_descriptor_sync(), test_non_sync(), test_open(), test_open_sync(), and test_sync().
|
static |
Definition at line 67 of file pg_test_fsync.c.
Referenced by prepare_buf(), and test_open().
|
static |
Definition at line 66 of file pg_test_fsync.c.
Referenced by signal_cleanup(), and test_open().
|
static |
Definition at line 63 of file pg_test_fsync.c.
Referenced by handle_args(), and main().
|
static |
Definition at line 65 of file pg_test_fsync.c.
Referenced by handle_args(), and process_alarm().
|
static |
Definition at line 70 of file pg_test_fsync.c.