PostgreSQL Source Code git master
|
#include "postgres_fe.h"
#include <ctype.h>
#include <float.h>
#include <limits.h>
#include <math.h>
#include <signal.h>
#include <time.h>
#include <sys/resource.h>
#include <sys/select.h>
#include "catalog/pg_class_d.h"
#include "common/int.h"
#include "common/logging.h"
#include "common/pg_prng.h"
#include "common/string.h"
#include "common/username.h"
#include "fe_utils/cancel.h"
#include "fe_utils/conditional.h"
#include "fe_utils/option_utils.h"
#include "fe_utils/string_utils.h"
#include "getopt_long.h"
#include "libpq-fe.h"
#include "pgbench.h"
#include "port/pg_bitutils.h"
#include "portability/instr_time.h"
#include "port/pg_pthread.h"
Go to the source code of this file.
Data Structures | |
struct | socket_set |
struct | Variable |
struct | Variables |
struct | SimpleStats |
struct | StatsData |
struct | CState |
struct | TState |
struct | Command |
struct | ParsedScript |
struct | BuiltinScript |
Macros | |
#define | POLL_USING_SELECT |
#define | M_PI 3.14159265358979323846 |
#define | ERRCODE_T_R_SERIALIZATION_FAILURE "40001" |
#define | ERRCODE_T_R_DEADLOCK_DETECTED "40P01" |
#define | ERRCODE_UNDEFINED_TABLE "42P01" |
#define | FNV_PRIME UINT64CONST(0x100000001b3) |
#define | FNV_OFFSET_BASIS UINT64CONST(0xcbf29ce484222325) |
#define | MM2_MUL UINT64CONST(0xc6a4a7935bd1e995) |
#define | MM2_MUL_TIMES_8 UINT64CONST(0x35253c9ade8f4ca8) |
#define | MM2_ROT 47 |
#define | SOCKET_WAIT_METHOD "select" |
#define | THREAD_T pthread_t |
#define | THREAD_FUNC_RETURN_TYPE void * |
#define | THREAD_FUNC_RETURN return NULL |
#define | THREAD_FUNC_CC |
#define | THREAD_CREATE(handle, function, arg) pthread_create((handle), NULL, (function), (arg)) |
#define | THREAD_JOIN(handle) pthread_join((handle), NULL) |
#define | THREAD_BARRIER_T pthread_barrier_t |
#define | THREAD_BARRIER_INIT(barrier, n) pthread_barrier_init((barrier), NULL, (n)) |
#define | THREAD_BARRIER_WAIT(barrier) pthread_barrier_wait((barrier)) |
#define | THREAD_BARRIER_DESTROY(barrier) pthread_barrier_destroy((barrier)) |
#define | DEFAULT_INIT_STEPS "dtgvp" /* default -I setting */ |
#define | ALL_INIT_STEPS "dtgGvpf" /* all possible steps */ |
#define | LOG_STEP_SECONDS 5 /* seconds between log messages */ |
#define | DEFAULT_NXACTS 10 /* default nxacts */ |
#define | MIN_GAUSSIAN_PARAM 2.0 /* minimum parameter for gauss */ |
#define | MIN_ZIPFIAN_PARAM 1.001 /* minimum parameter for zipfian */ |
#define | MAX_ZIPFIAN_PARAM 1000.0 /* maximum parameter for zipfian */ |
#define | nbranches |
#define | ntellers 10 |
#define | naccounts 100000 |
#define | SCALE_32BIT_THRESHOLD 20000 |
#define | WSEP '@' /* weight separator */ |
#define | VARIABLES_ALLOC_MARGIN 8 |
#define | MAX_SCRIPTS 128 /* max number of SQL scripts allowed */ |
#define | SHELL_COMMAND_SIZE 256 /* maximum size allowed for shell command */ |
#define | SQL_COMMAND 1 |
#define | META_COMMAND 2 |
#define | MAX_ARGS 256 |
#define | PG_TIME_GET_DOUBLE(t) (0.000001 * (t)) |
#define | PARAMS_ARRAY_SIZE 7 |
#define | MAX_FARGS 16 |
#define | COMMANDS_ALLOC_NUM 128 |
Typedefs | |
typedef struct socket_set | socket_set |
typedef struct SimpleStats | SimpleStats |
typedef int64 | pg_time_usec_t |
typedef struct StatsData | StatsData |
typedef enum EStatus | EStatus |
typedef enum TStatus | TStatus |
typedef enum MetaCommand | MetaCommand |
typedef enum QueryMode | QueryMode |
typedef struct Command | Command |
typedef struct ParsedScript | ParsedScript |
typedef struct BuiltinScript | BuiltinScript |
typedef void(* | initRowMethod) (PQExpBufferData *sql, int64 curr) |
Enumerations | |
enum | partition_method_t { PART_NONE , PART_RANGE , PART_HASH } |
enum | EStatus { ESTATUS_NO_ERROR = 0 , ESTATUS_META_COMMAND_ERROR , ESTATUS_SERIALIZATION_ERROR , ESTATUS_DEADLOCK_ERROR , ESTATUS_OTHER_SQL_ERROR } |
enum | TStatus { TSTATUS_IDLE , TSTATUS_IN_BLOCK , TSTATUS_CONN_ERROR , TSTATUS_OTHER_ERROR } |
enum | ConnectionStateEnum { CSTATE_CHOOSE_SCRIPT , CSTATE_START_TX , CSTATE_PREPARE_THROTTLE , CSTATE_THROTTLE , CSTATE_START_COMMAND , CSTATE_WAIT_RESULT , CSTATE_SLEEP , CSTATE_END_COMMAND , CSTATE_SKIP_COMMAND , CSTATE_ERROR , CSTATE_WAIT_ROLLBACK_RESULT , CSTATE_RETRY , CSTATE_FAILURE , CSTATE_END_TX , CSTATE_ABORTED , CSTATE_FINISHED } |
enum | MetaCommand { META_NONE , META_SET , META_SETSHELL , META_SHELL , META_SLEEP , META_GSET , META_ASET , META_IF , META_ELIF , META_ELSE , META_ENDIF , META_STARTPIPELINE , META_SYNCPIPELINE , META_ENDPIPELINE } |
enum | QueryMode { QUERY_SIMPLE , QUERY_EXTENDED , QUERY_PREPARED , NUM_QUERYMODE } |
Functions | |
static void | setNullValue (PgBenchValue *pv) |
static void | setBoolValue (PgBenchValue *pv, bool bval) |
static void | setIntValue (PgBenchValue *pv, int64 ival) |
static void | setDoubleValue (PgBenchValue *pv, double dval) |
static bool | evaluateExpr (CState *st, PgBenchExpr *expr, PgBenchValue *retval) |
static ConnectionStateEnum | executeMetaCommand (CState *st, pg_time_usec_t *now) |
static void | doLog (TState *thread, CState *st, StatsData *agg, bool skipped, double latency, double lag) |
static void | processXactStats (TState *thread, CState *st, pg_time_usec_t *now, bool skipped, StatsData *agg) |
static void | addScript (const ParsedScript *script) |
static THREAD_FUNC_RETURN_TYPE THREAD_FUNC_CC | threadRun (void *arg) |
static void | finishCon (CState *st) |
static void | setalarm (int seconds) |
static socket_set * | alloc_socket_set (int count) |
static void | free_socket_set (socket_set *sa) |
static void | clear_socket_set (socket_set *sa) |
static void | add_socket_to_set (socket_set *sa, int fd, int idx) |
static int | wait_on_socket_set (socket_set *sa, int64 usecs) |
static bool | socket_has_input (socket_set *sa, int fd, int idx) |
static char | get_table_relkind (PGconn *con, const char *table) |
static pg_time_usec_t | pg_time_now (void) |
static void | pg_time_now_lazy (pg_time_usec_t *now) |
static void | usage (void) |
static bool | is_an_int (const char *str) |
bool | strtoint64 (const char *str, bool errorOK, int64 *result) |
bool | strtodouble (const char *str, bool errorOK, double *dv) |
static void | initRandomState (pg_prng_state *state) |
static int64 | getrand (pg_prng_state *state, int64 min, int64 max) |
static int64 | getExponentialRand (pg_prng_state *state, int64 min, int64 max, double parameter) |
static int64 | getGaussianRand (pg_prng_state *state, int64 min, int64 max, double parameter) |
static int64 | getPoissonRand (pg_prng_state *state, double center) |
static int64 | computeIterativeZipfian (pg_prng_state *state, int64 n, double s) |
static int64 | getZipfianRand (pg_prng_state *state, int64 min, int64 max, double s) |
static int64 | getHashFnv1a (int64 val, uint64 seed) |
static int64 | getHashMurmur2 (int64 val, uint64 seed) |
static int64 | permute (const int64 val, const int64 isize, const int64 seed) |
static void | initSimpleStats (SimpleStats *ss) |
static void | addToSimpleStats (SimpleStats *ss, double val) |
static void | mergeSimpleStats (SimpleStats *acc, SimpleStats *ss) |
static void | initStats (StatsData *sd, pg_time_usec_t start) |
static void | accumStats (StatsData *stats, bool skipped, double lat, double lag, EStatus estatus, int64 tries) |
static void | executeStatement (PGconn *con, const char *sql) |
static void | tryExecuteStatement (PGconn *con, const char *sql) |
static PGconn * | doConnect (void) |
static int | compareVariableNames (const void *v1, const void *v2) |
static Variable * | lookupVariable (Variables *variables, char *name) |
static char * | getVariable (Variables *variables, char *name) |
static bool | makeVariableValue (Variable *var) |
static bool | valid_variable_name (const char *name) |
static void | enlargeVariables (Variables *variables, int needed) |
static Variable * | lookupCreateVariable (Variables *variables, const char *context, char *name) |
static bool | putVariable (Variables *variables, const char *context, char *name, const char *value) |
static bool | putVariableValue (Variables *variables, const char *context, char *name, const PgBenchValue *value) |
static bool | putVariableInt (Variables *variables, const char *context, char *name, int64 value) |
static char * | parseVariable (const char *sql, int *eaten) |
static char * | replaceVariable (char **sql, char *param, int len, char *value) |
static char * | assignVariables (Variables *variables, char *sql) |
static void | getQueryParams (Variables *variables, const Command *command, const char **params) |
static char * | valueTypeName (PgBenchValue *pval) |
static bool | coerceToBool (PgBenchValue *pval, bool *bval) |
static bool | valueTruth (PgBenchValue *pval) |
static bool | coerceToInt (PgBenchValue *pval, int64 *ival) |
static bool | coerceToDouble (PgBenchValue *pval, double *dval) |
static bool | isLazyFunc (PgBenchFunction func) |
static bool | evalLazyFunc (CState *st, PgBenchFunction func, PgBenchExprLink *args, PgBenchValue *retval) |
static bool | evalStandardFunc (CState *st, PgBenchFunction func, PgBenchExprLink *args, PgBenchValue *retval) |
static bool | evalFunc (CState *st, PgBenchFunction func, PgBenchExprLink *args, PgBenchValue *retval) |
static MetaCommand | getMetaCommand (const char *cmd) |
static bool | runShellCommand (Variables *variables, char *variable, char **argv, int argc) |
static void | commandFailed (CState *st, const char *cmd, const char *message) |
static void | commandError (CState *st, const char *message) |
static int | chooseScript (TState *thread) |
static void | allocCStatePrepared (CState *st) |
static void | prepareCommand (CState *st, int command_num) |
static void | prepareCommandsInPipeline (CState *st) |
static bool | sendCommand (CState *st, Command *command) |
static EStatus | getSQLErrorStatus (const char *sqlState) |
static bool | canRetryError (EStatus estatus) |
static bool | readCommandResponse (CState *st, MetaCommand meta, char *varprefix) |
static bool | evaluateSleep (Variables *variables, int argc, char **argv, int *usecs) |
static bool | doRetry (CState *st, pg_time_usec_t *now) |
static int | discardUntilSync (CState *st) |
static TStatus | getTransactionStatus (PGconn *con) |
static void | printVerboseErrorMessages (CState *st, pg_time_usec_t *now, bool is_retry) |
static void | advanceConnectionState (TState *thread, CState *st, StatsData *agg) |
static int64 | getFailures (const StatsData *stats) |
static const char * | getResultString (bool skipped, EStatus estatus) |
static void | disconnect_all (CState *state, int length) |
static void | initDropTables (PGconn *con) |
static void | createPartitions (PGconn *con) |
static void | initCreateTables (PGconn *con) |
static void | initTruncateTables (PGconn *con) |
static void | initBranch (PQExpBufferData *sql, int64 curr) |
static void | initTeller (PQExpBufferData *sql, int64 curr) |
static void | initAccount (PQExpBufferData *sql, int64 curr) |
static void | initPopulateTable (PGconn *con, const char *table, int64 base, initRowMethod init_row) |
static void | initGenerateDataClientSide (PGconn *con) |
static void | initGenerateDataServerSide (PGconn *con) |
static void | initVacuum (PGconn *con) |
static void | initCreatePKeys (PGconn *con) |
static void | initCreateFKeys (PGconn *con) |
static void | checkInitSteps (const char *initialize_steps) |
static void | runInitSteps (const char *initialize_steps) |
static void | GetTableInfo (PGconn *con, bool scale_given) |
static bool | parseQuery (Command *cmd) |
void | syntax_error (const char *source, int lineno, const char *line, const char *command, const char *msg, const char *more, int column) |
static char * | skip_sql_comments (char *sql_command) |
static Command * | create_sql_command (PQExpBuffer buf, const char *source) |
static void | free_command (Command *command) |
static void | postprocess_sql_command (Command *my_command) |
static Command * | process_backslash_command (PsqlScanState sstate, const char *source, int lineno, int start_offset) |
static void | ConditionError (const char *desc, int cmdn, const char *msg) |
static void | CheckConditional (const ParsedScript *ps) |
static void | ParseScript (const char *script, const char *desc, int weight) |
static char * | read_file_contents (FILE *fd) |
static void | process_file (const char *filename, int weight) |
static void | process_builtin (const BuiltinScript *bi, int weight) |
static void | listAvailableScripts (void) |
static const BuiltinScript * | findBuiltin (const char *name) |
static int | parseScriptWeight (const char *option, char **script) |
static void | printProgressReport (TState *threads, int64 test_start, pg_time_usec_t now, StatsData *last, int64 *last_report) |
static void | printSimpleStats (const char *prefix, SimpleStats *ss) |
static void | printVersion (PGconn *con) |
static void | printResults (StatsData *total, pg_time_usec_t total_duration, pg_time_usec_t conn_total_duration, pg_time_usec_t conn_elapsed_duration, int64 latency_late) |
static bool | set_random_seed (const char *seed) |
int | main (int argc, char **argv) |
static void | handle_sig_alarm (SIGNAL_ARGS) |
Variables | |
static int | nxacts = 0 |
static int | duration = 0 |
static int64 | end_time = 0 |
static int | scale = 1 |
static int | fillfactor = 100 |
static bool | unlogged_tables = false |
static double | sample_rate = 0.0 |
static double | throttle_delay = 0 |
static int64 | latency_limit = 0 |
static char * | tablespace = NULL |
static char * | index_tablespace = NULL |
static int | partitions = 0 |
static partition_method_t | partition_method = PART_NONE |
static const char *const | PARTITION_METHOD [] = {"none", "range", "hash"} |
static int64 | random_seed = -1 |
static bool | use_log |
static bool | use_quiet |
static int | agg_interval |
static bool | per_script_stats = false |
static int | progress = 0 |
static bool | progress_timestamp = false |
static int | nclients = 1 |
static int | nthreads = 1 |
static bool | is_connect |
static bool | report_per_command = false |
static int | main_pid |
static uint32 | max_tries = 1 |
static bool | failures_detailed = false |
static const char * | pghost = NULL |
static const char * | pgport = NULL |
static const char * | username = NULL |
static const char * | dbName = NULL |
static char * | logfile_prefix = NULL |
static const char * | progname |
static volatile sig_atomic_t | timer_exceeded = false |
static pg_time_usec_t | epoch_shift |
static pg_prng_state | base_random_sequence |
static THREAD_BARRIER_T | barrier |
static QueryMode | querymode = QUERY_SIMPLE |
static const char *const | QUERYMODE [] = {"simple", "extended", "prepared"} |
static ParsedScript | sql_script [MAX_SCRIPTS] |
static int | num_scripts |
static int64 | total_weight = 0 |
static bool | verbose_errors = false |
static bool | exit_on_abort = false |
static const BuiltinScript | builtin_script [] |
static const PsqlScanCallbacks | pgbench_callbacks |
#define COMMANDS_ALLOC_NUM 128 |
#define DEFAULT_INIT_STEPS "dtgvp" /* default -I setting */ |
#define FNV_OFFSET_BASIS UINT64CONST(0xcbf29ce484222325) |
#define FNV_PRIME UINT64CONST(0x100000001b3) |
#define LOG_STEP_SECONDS 5 /* seconds between log messages */ |
#define MAX_SCRIPTS 128 /* max number of SQL scripts allowed */ |
#define MAX_ZIPFIAN_PARAM 1000.0 /* maximum parameter for zipfian */ |
#define MIN_GAUSSIAN_PARAM 2.0 /* minimum parameter for gauss */ |
#define MIN_ZIPFIAN_PARAM 1.001 /* minimum parameter for zipfian */ |
#define MM2_MUL UINT64CONST(0xc6a4a7935bd1e995) |
#define MM2_MUL_TIMES_8 UINT64CONST(0x35253c9ade8f4ca8) |
#define nbranches |
#define PARAMS_ARRAY_SIZE 7 |
#define SHELL_COMMAND_SIZE 256 /* maximum size allowed for shell command */ |
#define THREAD_BARRIER_DESTROY | ( | barrier | ) | pthread_barrier_destroy((barrier)) |
#define THREAD_BARRIER_INIT | ( | barrier, | |
n | |||
) | pthread_barrier_init((barrier), NULL, (n)) |
#define THREAD_BARRIER_T pthread_barrier_t |
#define THREAD_BARRIER_WAIT | ( | barrier | ) | pthread_barrier_wait((barrier)) |
#define THREAD_JOIN | ( | handle | ) | pthread_join((handle), NULL) |
typedef struct BuiltinScript BuiltinScript |
typedef void(* initRowMethod) (PQExpBufferData *sql, int64 curr) |
typedef enum MetaCommand MetaCommand |
typedef struct ParsedScript ParsedScript |
typedef int64 pg_time_usec_t |
typedef struct SimpleStats SimpleStats |
typedef struct socket_set socket_set |
enum ConnectionStateEnum |
Definition at line 486 of file pgbench.c.
enum EStatus |
Enumerator | |
---|---|
ESTATUS_NO_ERROR | |
ESTATUS_META_COMMAND_ERROR | |
ESTATUS_SERIALIZATION_ERROR | |
ESTATUS_DEADLOCK_ERROR | |
ESTATUS_OTHER_SQL_ERROR |
enum MetaCommand |
enum partition_method_t |
Enumerator | |
---|---|
PART_NONE | |
PART_RANGE | |
PART_HASH |
Definition at line 227 of file pgbench.c.
enum QueryMode |
Enumerator | |
---|---|
QUERY_SIMPLE | |
QUERY_EXTENDED | |
QUERY_PREPARED | |
NUM_QUERYMODE |
Definition at line 706 of file pgbench.c.
enum TStatus |
Enumerator | |
---|---|
TSTATUS_IDLE | |
TSTATUS_IN_BLOCK | |
TSTATUS_CONN_ERROR | |
TSTATUS_OTHER_ERROR |
|
static |
Definition at line 1477 of file pgbench.c.
References addToSimpleStats(), StatsData::cnt, StatsData::deadlock_failures, ESTATUS_DEADLOCK_ERROR, ESTATUS_NO_ERROR, ESTATUS_SERIALIZATION_ERROR, StatsData::lag, StatsData::latency, pg_fatal, StatsData::retried, StatsData::retries, StatsData::serialization_failures, StatsData::skipped, and throttle_delay.
Referenced by doLog(), and processXactStats().
|
static |
Definition at line 7933 of file pgbench.c.
References fd(), pg_log_error, and pg_log_error_hint.
Referenced by threadRun().
|
static |
Definition at line 6227 of file pgbench.c.
References CheckConditional(), ParsedScript::commands, ParsedScript::desc, MAX_SCRIPTS, num_scripts, pg_fatal, and sql_script.
Referenced by ParseScript().
|
static |
Definition at line 1429 of file pgbench.c.
References SimpleStats::count, SimpleStats::max, SimpleStats::min, SimpleStats::sum, SimpleStats::sum2, and val.
Referenced by accumStats(), and advanceConnectionState().
Definition at line 3610 of file pgbench.c.
References addToSimpleStats(), Assert(), canRetryError(), chooseScript(), CState::cnt, CState::command, commandFailed(), ParsedScript::commands, CState::con, conditional_active(), conditional_stack_empty(), conditional_stack_peek(), conditional_stack_poke(), conditional_stack_pop(), conditional_stack_push(), conditional_stack_reset(), TState::conn_duration, CState::cs_func_rs, CState::cstack, CSTATE_ABORTED, CSTATE_CHOOSE_SCRIPT, CSTATE_END_COMMAND, CSTATE_END_TX, CSTATE_ERROR, CSTATE_FAILURE, CSTATE_FINISHED, CSTATE_PREPARE_THROTTLE, CSTATE_RETRY, CSTATE_SKIP_COMMAND, CSTATE_SLEEP, CSTATE_START_COMMAND, CSTATE_START_TX, CSTATE_THROTTLE, CSTATE_WAIT_RESULT, CSTATE_WAIT_ROLLBACK_RESULT, ParsedScript::desc, discardUntilSync(), doConnect(), doRetry(), duration, end_time, CState::estatus, ESTATUS_META_COMMAND_ERROR, ESTATUS_NO_ERROR, executeMetaCommand(), Command::failures, finishCon(), getPoissonRand(), getTransactionStatus(), CState::id, IFSTATE_ELSE_FALSE, IFSTATE_ELSE_TRUE, IFSTATE_FALSE, IFSTATE_IGNORED, IFSTATE_NONE, IFSTATE_TRUE, is_connect, latency_limit, Command::meta, META_ASET, META_COMMAND, META_ELIF, META_ELSE, META_ENDIF, META_GSET, META_IF, now(), nxacts, pg_free(), pg_log_debug, pg_log_error, PG_TIME_GET_DOUBLE, pg_time_now(), pg_time_now_lazy(), PGRES_COMMAND_OK, PQ_PIPELINE_OFF, PQ_PIPELINE_ON, PQclear(), PQconsumeInput(), PQerrorMessage(), PQgetResult(), PQisBusy(), PQpipelineStatus(), PQresultStatus(), PQsendQuery(), CState::prepared, printVerboseErrorMessages(), processXactStats(), CState::random_state, readCommandResponse(), report_per_command, Command::retries, sendCommand(), SQL_COMMAND, sql_script, start, CState::state, Command::stats, CState::stmt_begin, throttle_delay, TState::throttle_trigger, timer_exceeded, CState::tries, TState::ts_throttle_rs, TSTATUS_CONN_ERROR, TSTATUS_IDLE, TSTATUS_IN_BLOCK, CState::txn_begin, CState::txn_scheduled, Command::type, CState::use_file, Command::varprefix, and verbose_errors.
Referenced by threadRun().
|
static |
Definition at line 7914 of file pgbench.c.
References pg_malloc0().
Referenced by threadRun().
|
static |
Definition at line 3090 of file pgbench.c.
References Assert(), ParsedScript::commands, i, num_scripts, pg_malloc(), pg_malloc0(), CState::prepared, and sql_script.
Referenced by prepareCommand(), and prepareCommandsInPipeline().
|
static |
Definition at line 1962 of file pgbench.c.
References free, getVariable(), name, parseVariable(), replaceVariable(), and val.
Referenced by sendCommand().
|
static |
Definition at line 3246 of file pgbench.c.
References ESTATUS_DEADLOCK_ERROR, and ESTATUS_SERIALIZATION_ERROR.
Referenced by advanceConnectionState(), doRetry(), and readCommandResponse().
|
static |
Definition at line 5885 of file pgbench.c.
References conditional_stack_create(), conditional_stack_destroy(), conditional_stack_empty(), conditional_stack_peek(), conditional_stack_poke(), conditional_stack_pop(), conditional_stack_push(), ConditionError(), i, IFSTATE_ELSE_FALSE, IFSTATE_FALSE, Command::meta, META_COMMAND, META_ELIF, META_ELSE, META_ENDIF, META_IF, ps, and Command::type.
Referenced by addScript().
|
static |
Definition at line 5242 of file pgbench.c.
References ALL_INIT_STEPS, pg_fatal, pg_log_error, and pg_log_error_detail.
Referenced by main().
|
static |
Definition at line 3068 of file pgbench.c.
References getrand(), i, num_scripts, sql_script, total_weight, TState::ts_choose_rs, and ParsedScript::weight.
Referenced by advanceConnectionState().
|
static |
Definition at line 7926 of file pgbench.c.
Referenced by threadRun().
|
static |
Definition at line 2030 of file pgbench.c.
References PgBenchValue::bval, pg_log_error, PGBT_BOOLEAN, PgBenchValue::type, PgBenchValue::u, and valueTypeName().
Referenced by evalLazyFunc(), and evalStandardFunc().
|
static |
Definition at line 2099 of file pgbench.c.
References PgBenchValue::dval, PgBenchValue::ival, pg_log_error, PGBT_DOUBLE, PGBT_INT, PgBenchValue::type, PgBenchValue::u, and valueTypeName().
Referenced by evalStandardFunc().
|
static |
Definition at line 2071 of file pgbench.c.
References PgBenchValue::dval, FLOAT8_FITS_IN_INT64, PgBenchValue::ival, pg_log_error, PGBT_DOUBLE, PGBT_INT, PgBenchValue::type, PgBenchValue::u, and valueTypeName().
Referenced by evalStandardFunc().
|
static |
Definition at line 3059 of file pgbench.c.
References Assert(), CState::command, ParsedScript::commands, CState::id, pg_log_info, SQL_COMMAND, sql_script, Command::type, and CState::use_file.
Referenced by readCommandResponse().
|
static |
Definition at line 3049 of file pgbench.c.
References CState::command, CState::id, pg_log_error, and CState::use_file.
Referenced by advanceConnectionState(), and executeMetaCommand().
|
static |
Definition at line 1622 of file pgbench.c.
References name.
Referenced by lookupVariable().
|
static |
Definition at line 1227 of file pgbench.c.
References b, pg_prng_double(), and x.
Referenced by getZipfianRand().
|
static |
|
static |
Definition at line 5588 of file pgbench.c.
References appendPQExpBufferStr(), Command::argc, Command::argv, buf, Command::expr, Command::failures, Command::first_line, initPQExpBuffer(), initSimpleStats(), Command::lines, Command::meta, META_NONE, pg_malloc(), Command::prepname, Command::retries, skip_sql_comments(), SQL_COMMAND, Command::stats, Command::type, and Command::varprefix.
Referenced by ParseScript().
|
static |
Definition at line 4762 of file pgbench.c.
References appendPQExpBuffer(), appendPQExpBufferChar(), appendPQExpBufferStr(), Assert(), PQExpBufferData::data, executeStatement(), fillfactor, fprintf, initPQExpBuffer(), INT64_FORMAT, naccounts, PART_HASH, PART_RANGE, partition_method, partitions, printfPQExpBuffer(), scale, termPQExpBuffer(), and unlogged_tables.
Referenced by initCreateTables().
|
static |
Definition at line 3495 of file pgbench.c.
References Assert(), CState::con, CState::id, pg_log_error, PGRES_PIPELINE_SYNC, PQclear(), PQexitPipelineMode(), PQgetResult(), PQpipelineSync(), and PQresultStatus().
Referenced by advanceConnectionState().
|
static |
|
static |
Definition at line 1557 of file pgbench.c.
References conn, CONNECTION_BAD, dbName, keywords, PARAMS_ARRAY_SIZE, password, pg_log_error, pghost, pgport, PQconnectdbParams(), PQconnectionNeedsPassword(), PQerrorMessage(), PQfinish(), PQstatus(), progname, simple_prompt(), username, and values.
Referenced by advanceConnectionState(), main(), runInitSteps(), and threadRun().
|
static |
Definition at line 4569 of file pgbench.c.
References accumStats(), agg_interval, Assert(), StatsData::cnt, CState::cnt, StatsData::deadlock_failures, epoch_shift, CState::estatus, ESTATUS_NO_ERROR, failures_detailed, fprintf, getResultString(), CState::id, initStats(), INT64_FORMAT, INT64CONST, StatsData::lag, StatsData::latency, latency_limit, TState::logfile, logfile, SimpleStats::max, max_tries, SimpleStats::min, next, now(), pg_prng_double(), pg_time_now(), StatsData::retried, StatsData::retries, sample_rate, StatsData::serialization_failures, StatsData::skipped, StatsData::start_time, SimpleStats::sum, SimpleStats::sum2, throttle_delay, CState::tries, TState::ts_sample_rs, CState::use_file, and use_log.
Referenced by processXactStats(), and threadRun().
|
static |
Definition at line 3449 of file pgbench.c.
References Assert(), canRetryError(), duration, CState::estatus, ESTATUS_NO_ERROR, latency_limit, max_tries, now(), pg_time_now_lazy(), timer_exceeded, CState::tries, and CState::txn_scheduled.
Referenced by advanceConnectionState().
|
static |
Definition at line 1799 of file pgbench.c.
References Variables::max_vars, Variables::nvars, pg_realloc(), VARIABLES_ALLOC_MARGIN, and Variables::vars.
Referenced by lookupCreateVariable().
|
static |
Definition at line 2842 of file pgbench.c.
References generate_unaccent_rules::args, evalLazyFunc(), evalStandardFunc(), and isLazyFunc().
Referenced by evaluateExpr().
|
static |
Definition at line 2158 of file pgbench.c.
References a1, a2, generate_unaccent_rules::args, Assert(), coerceToBool(), evalLazyFunc(), evaluateExpr(), isLazyFunc(), PGBENCH_AND, PGBENCH_CASE, PGBENCH_OR, PGBT_NULL, setBoolValue(), setNullValue(), and valueTruth().
Referenced by evalFunc(), and evalLazyFunc().
|
static |
Definition at line 2275 of file pgbench.c.
References generate_unaccent_rules::args, Assert(), b, PgBenchValue::bval, coerceToBool(), coerceToDouble(), coerceToInt(), CState::command, CState::cs_func_rs, PgBenchValue::dval, evaluateExpr(), PgBenchExprLink::expr, fprintf, getExponentialRand(), getGaussianRand(), getHashFnv1a(), getHashMurmur2(), getrand(), getZipfianRand(), i, INT64_FORMAT, PgBenchValue::ival, M_PI, Max, MAX_FARGS, MAX_ZIPFIAN_PARAM, Min, MIN_GAUSSIAN_PARAM, MIN_ZIPFIAN_PARAM, PgBenchExprLink::next, permute(), pg_add_s64_overflow(), PG_INT64_MIN, pg_log_error, pg_mul_s64_overflow(), pg_sub_s64_overflow(), PGBENCH_ABS, PGBENCH_ADD, PGBENCH_BITAND, PGBENCH_BITOR, PGBENCH_BITXOR, PGBENCH_DEBUG, PGBENCH_DIV, PGBENCH_DOUBLE, PGBENCH_EQ, PGBENCH_EXP, PGBENCH_GREATEST, PGBENCH_HASH_FNV1A, PGBENCH_HASH_MURMUR2, PGBENCH_INT, PGBENCH_IS, PGBENCH_LE, PGBENCH_LEAST, PGBENCH_LN, PGBENCH_LSHIFT, PGBENCH_LT, PGBENCH_MOD, PGBENCH_MUL, PGBENCH_NE, PGBENCH_NOT, PGBENCH_PERMUTE, PGBENCH_PI, PGBENCH_POW, PGBENCH_RANDOM, PGBENCH_RANDOM_EXPONENTIAL, PGBENCH_RANDOM_GAUSSIAN, PGBENCH_RANDOM_ZIPFIAN, PGBENCH_RSHIFT, PGBENCH_SQRT, PGBENCH_SUB, PGBT_BOOLEAN, PGBT_DOUBLE, PGBT_INT, PGBT_NULL, setBoolValue(), setDoubleValue(), setIntValue(), setNullValue(), type, PgBenchValue::type, PgBenchValue::u, unlikely, CState::use_file, and val.
Referenced by evalFunc().
|
static |
Definition at line 2858 of file pgbench.c.
References PgBenchExpr::constant, ENODE_CONSTANT, ENODE_FUNCTION, ENODE_VARIABLE, PgBenchExpr::etype, evalFunc(), PgBenchExpr::function, lookupVariable(), makeVariableValue(), pg_fatal, pg_log_error, PgBenchExpr::u, Variable::value, PgBenchExpr::variable, CState::variables, and PgBenchExpr::varname.
Referenced by evalLazyFunc(), evalStandardFunc(), and executeMetaCommand().
|
static |
Definition at line 3404 of file pgbench.c.
References getVariable(), pg_log_error, and pg_strcasecmp().
Referenced by executeMetaCommand().
|
static |
Definition at line 4308 of file pgbench.c.
References __pg_log_level, appendPQExpBuffer(), Command::argc, Command::argv, Assert(), buf, CState::command, commandFailed(), ParsedScript::commands, CState::con, conditional_stack_empty(), conditional_stack_peek(), conditional_stack_poke(), conditional_stack_pop(), conditional_stack_push(), CState::cstack, CSTATE_ABORTED, CSTATE_END_COMMAND, CSTATE_SLEEP, CSTATE_WAIT_RESULT, evaluateExpr(), evaluateSleep(), Command::expr, i, CState::id, IFSTATE_ELSE_FALSE, IFSTATE_ELSE_TRUE, IFSTATE_FALSE, IFSTATE_IGNORED, IFSTATE_NONE, IFSTATE_TRUE, initPQExpBuffer(), Command::meta, META_COMMAND, META_ELIF, META_ELSE, META_ENDIF, META_ENDPIPELINE, META_IF, META_SET, META_SETSHELL, META_SHELL, META_SLEEP, META_STARTPIPELINE, META_SYNCPIPELINE, now(), CState::num_syncs, PG_LOG_DEBUG, pg_log_debug, pg_time_now_lazy(), PQ_PIPELINE_OFF, PQ_PIPELINE_ON, PQenterPipelineMode(), PQpipelineStatus(), PQpipelineSync(), PQsendPipelineSync(), prepareCommandsInPipeline(), printfPQExpBuffer(), putVariableValue(), QUERY_PREPARED, QUERY_SIMPLE, querymode, runShellCommand(), CState::sleep_until, sql_script, termPQExpBuffer(), Command::type, unlikely, CState::use_file, valueTruth(), and CState::variables.
Referenced by advanceConnectionState().
|
static |
Definition at line 1526 of file pgbench.c.
References pg_log_error, pg_log_error_detail, PGRES_COMMAND_OK, PQclear(), PQerrorMessage(), PQexec(), and PQresultStatus().
Referenced by createPartitions(), initCreateFKeys(), initCreatePKeys(), initCreateTables(), initDropTables(), initGenerateDataClientSide(), initGenerateDataServerSide(), initTruncateTables(), and initVacuum().
|
static |
Definition at line 6154 of file pgbench.c.
References builtin_script, i, len, lengthof, listAvailableScripts(), name, and pg_log_error.
Referenced by main().
|
static |
Definition at line 7749 of file pgbench.c.
References CState::con, and PQfinish().
Referenced by advanceConnectionState(), and disconnect_all().
|
static |
Definition at line 5617 of file pgbench.c.
References Command::argc, Command::argv, Command::first_line, i, Command::lines, pg_free(), termPQExpBuffer(), and Command::varprefix.
Referenced by ParseScript().
|
static |
|
static |
Definition at line 852 of file pgbench.c.
References Assert(), pg_log_error, pg_log_error_detail, PGRES_TUPLES_OK, PQclear(), PQerrorMessage(), PQexecParams(), PQgetvalue(), PQresultStatus(), table, and val.
Referenced by initPopulateTable().
|
static |
Definition at line 1139 of file pgbench.c.
References Assert(), and pg_prng_double().
Referenced by evalStandardFunc().
Definition at line 4527 of file pgbench.c.
References StatsData::deadlock_failures, and StatsData::serialization_failures.
Referenced by printProgressReport(), and printResults().
|
static |
Definition at line 1163 of file pgbench.c.
References Assert(), MIN_GAUSSIAN_PARAM, and pg_prng_double_normal().
Referenced by evalStandardFunc().
Definition at line 1271 of file pgbench.c.
References FNV_OFFSET_BASIS, FNV_PRIME, i, and val.
Referenced by evalStandardFunc().
Definition at line 1296 of file pgbench.c.
References MM2_MUL, MM2_MUL_TIMES_8, MM2_ROT, and val.
Referenced by evalStandardFunc().
|
static |
Definition at line 2901 of file pgbench.c.
References META_ASET, META_ELIF, META_ELSE, META_ENDIF, META_ENDPIPELINE, META_GSET, META_IF, META_NONE, META_SET, META_SETSHELL, META_SHELL, META_SLEEP, META_STARTPIPELINE, META_SYNCPIPELINE, and pg_strcasecmp().
Referenced by process_backslash_command().
|
static |
Definition at line 1205 of file pgbench.c.
References pg_prng_double().
Referenced by advanceConnectionState().
|
static |
Definition at line 1998 of file pgbench.c.
References Command::argc, Command::argv, getVariable(), and i.
Referenced by sendCommand().
|
static |
Definition at line 1128 of file pgbench.c.
References pg_prng_uint64_range().
Referenced by chooseScript(), and evalStandardFunc().
|
static |
Definition at line 4538 of file pgbench.c.
References ESTATUS_DEADLOCK_ERROR, ESTATUS_SERIALIZATION_ERROR, failures_detailed, and pg_fatal.
Referenced by doLog().
|
static |
Definition at line 3229 of file pgbench.c.
References ERRCODE_T_R_DEADLOCK_DETECTED, ERRCODE_T_R_SERIALIZATION_FAILURE, ESTATUS_DEADLOCK_ERROR, ESTATUS_OTHER_SQL_ERROR, and ESTATUS_SERIALIZATION_ERROR.
Referenced by readCommandResponse().
|
static |
Definition at line 5347 of file pgbench.c.
References Assert(), ERRCODE_UNDEFINED_TABLE, PART_HASH, PART_NONE, PART_RANGE, partition_method, partitions, PG_DIAG_SQLSTATE, pg_fatal, pg_log_error, pg_log_error_hint, pg_log_warning, PGRES_TUPLES_OK, PQclear(), PQdb(), PQerrorMessage(), PQexec(), PQgetisnull(), PQgetvalue(), PQntuples(), PQresultErrorField(), PQresultStatus(), ps, and scale.
Referenced by main().
Definition at line 3535 of file pgbench.c.
References Assert(), CONNECTION_BAD, pg_log_error, PQstatus(), PQTRANS_ACTIVE, PQTRANS_IDLE, PQTRANS_INERROR, PQTRANS_INTRANS, PQTRANS_UNKNOWN, PQtransactionStatus(), TSTATUS_CONN_ERROR, TSTATUS_IDLE, TSTATUS_IN_BLOCK, and TSTATUS_OTHER_ERROR.
Referenced by advanceConnectionState().
|
static |
Definition at line 1657 of file pgbench.c.
References Assert(), PgBenchValue::bval, PgBenchValue::dval, INT64_FORMAT, PgBenchValue::ival, lookupVariable(), name, pg_strdup(), PGBT_BOOLEAN, PGBT_DOUBLE, PGBT_INT, PGBT_NO_VALUE, PGBT_NULL, snprintf, Variable::svalue, PgBenchValue::type, PgBenchValue::u, and Variable::value.
Referenced by assignVariables(), evaluateSleep(), getQueryParams(), and runShellCommand().
|
static |
Definition at line 1257 of file pgbench.c.
References Assert(), computeIterativeZipfian(), MAX_ZIPFIAN_PARAM, and MIN_ZIPFIAN_PARAM.
Referenced by evalStandardFunc().
|
static |
Definition at line 7765 of file pgbench.c.
References timer_exceeded.
Referenced by setalarm().
|
static |
Definition at line 4954 of file pgbench.c.
References INT64_FORMAT, naccounts, and printfPQExpBuffer().
Referenced by initGenerateDataClientSide().
|
static |
Definition at line 4936 of file pgbench.c.
References INT64_FORMAT, and printfPQExpBuffer().
Referenced by initGenerateDataClientSide().
|
static |
Definition at line 5216 of file pgbench.c.
References executeStatement(), fprintf, i, and lengthof.
Referenced by runInitSteps().
|
static |
Definition at line 5178 of file pgbench.c.
References appendPQExpBuffer(), appendPQExpBufferStr(), PQExpBufferData::data, executeStatement(), fprintf, i, index_tablespace, initPQExpBuffer(), lengthof, PQescapeIdentifier(), PQfreemem(), resetPQExpBuffer(), and termPQExpBuffer().
Referenced by runInitSteps().
|
static |
Definition at line 4831 of file pgbench.c.
References appendPQExpBuffer(), createPartitions(), PQExpBufferData::data, executeStatement(), fillfactor, fprintf, i, initPQExpBuffer(), lengthof, PART_NONE, partition_method, PARTITION_METHOD, PQescapeIdentifier(), PQfreemem(), printfPQExpBuffer(), scale, SCALE_32BIT_THRESHOLD, table, tablespace, termPQExpBuffer(), and unlogged_tables.
Referenced by runInitSteps().
|
static |
Definition at line 4740 of file pgbench.c.
References executeStatement(), and fprintf.
Referenced by runInitSteps().
|
static |
Definition at line 5088 of file pgbench.c.
References executeStatement(), fprintf, initAccount(), initBranch(), initPopulateTable(), initTeller(), initTruncateTables(), naccounts, nbranches, and ntellers.
Referenced by runInitSteps().
|
static |
Definition at line 5120 of file pgbench.c.
References PQExpBufferData::data, executeStatement(), fprintf, initPQExpBuffer(), initTruncateTables(), INT64_FORMAT, naccounts, nbranches, ntellers, printfPQExpBuffer(), scale, and termPQExpBuffer().
Referenced by runInitSteps().
|
static |
Definition at line 4963 of file pgbench.c.
References CancelRequested, chars, PQExpBufferData::data, fprintf, get_table_relkind(), initPQExpBuffer(), INT64_FORMAT, j, LOG_STEP_SECONDS, pg_fatal, pg_snprintf(), PG_TIME_GET_DOUBLE, pg_time_now(), PGRES_COPY_IN, PQclear(), PQendcopy(), PQerrorMessage(), PQexec(), PQputline(), PQresultStatus(), PQserverVersion(), scale, start, table, termPQExpBuffer(), and use_quiet.
Referenced by initGenerateDataClientSide().
|
static |
Definition at line 1114 of file pgbench.c.
References base_random_sequence, pg_prng_seed(), and pg_prng_uint64().
Referenced by main().
|
static |
Definition at line 1420 of file pgbench.c.
Referenced by create_sql_command(), initStats(), and process_backslash_command().
|
static |
Definition at line 1460 of file pgbench.c.
References StatsData::cnt, StatsData::deadlock_failures, initSimpleStats(), StatsData::lag, StatsData::latency, StatsData::retried, StatsData::retries, StatsData::serialization_failures, StatsData::skipped, start, and StatsData::start_time.
Referenced by doLog(), main(), ParseScript(), printProgressReport(), and threadRun().
|
static |
Definition at line 4945 of file pgbench.c.
References INT64_FORMAT, ntellers, and printfPQExpBuffer().
Referenced by initGenerateDataClientSide().
|
static |
Definition at line 4926 of file pgbench.c.
References executeStatement().
Referenced by initGenerateDataClientSide(), and initGenerateDataServerSide().
|
static |
Definition at line 5165 of file pgbench.c.
References executeStatement(), and fprintf.
Referenced by runInitSteps().
|
static |
Definition at line 977 of file pgbench.c.
References str.
Referenced by makeVariableValue().
|
static |
Definition at line 2151 of file pgbench.c.
References PGBENCH_AND, PGBENCH_CASE, and PGBENCH_OR.
Referenced by evalFunc(), and evalLazyFunc().
|
static |
Definition at line 6142 of file pgbench.c.
References builtin_script, fprintf, i, lengthof, and name.
Referenced by findBuiltin(), and main().
|
static |
Definition at line 1818 of file pgbench.c.
References enlargeVariables(), lookupVariable(), name, Variable::name, Variables::nvars, pg_log_error, pg_strdup(), Variable::svalue, valid_variable_name(), Variables::vars, and Variables::vars_sorted.
Referenced by putVariable(), and putVariableValue().
Definition at line 1630 of file pgbench.c.
References compareVariableNames(), sort-test::key, name, Variables::nvars, qsort, Variables::vars, and Variables::vars_sorted.
Referenced by evaluateExpr(), getVariable(), lookupCreateVariable(), and main().
int main | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 6658 of file pgbench.c.
References agg_interval, Assert(), barrier, base_random_sequence, TState::bench_start, checkInitSteps(), StatsData::cnt, ParsedScript::commands, conditional_stack_create(), TState::conn_duration, TState::create_time, CSTATE_FINISHED, dbName, StatsData::deadlock_failures, DEFAULT_INIT_STEPS, DEFAULT_NXACTS, BuiltinScript::desc, disconnect_all(), doConnect(), duration, end_time, epoch_shift, exit_on_abort, failures_detailed, fillfactor, findBuiltin(), fprintf, get_progname(), get_user_name_or_exit(), getopt_long(), GetTableInfo(), gettimeofday(), i, index_tablespace, initRandomState(), initStats(), INT64CONST, is_connect, j, StatsData::lag, StatsData::latency, TState::latency_late, latency_limit, listAvailableScripts(), TState::logfile, logfile_prefix, lookupVariable(), main_pid, max_tries, mergeSimpleStats(), Variable::name, BuiltinScript::name, nclients, no_argument, TState::nstate, nthreads, NUM_QUERYMODE, num_scripts, nxacts, optarg, optind, option_parse_int(), parseScriptWeight(), PART_HASH, PART_NONE, PART_RANGE, partition_method, partitions, per_script_stats, pg_fatal, pg_free(), pg_log_debug, pg_log_error, pg_log_error_hint, pg_logging_increase_verbosity(), pg_logging_init(), pg_malloc(), pg_malloc0(), pg_prng_uint64(), pg_realloc(), pg_strcasecmp(), pg_strdup(), pg_time_now(), PGBT_NO_VALUE, pghost, pgport, postprocess_sql_command(), PQdb(), PQfinish(), PQhost(), PQport(), printResults(), printVersion(), process_builtin(), process_file(), progname, progress, progress_timestamp, putVariable(), putVariableInt(), putVariableValue(), querymode, QUERYMODE, random_seed, report_per_command, required_argument, StatsData::retried, StatsData::retries, runInitSteps(), sample_rate, scale, BuiltinScript::script, StatsData::serialization_failures, set_random_seed(), setalarm(), StatsData::skipped, SQL_COMMAND, sql_script, start_time, CState::state, TState::state, TState::stats, Variable::svalue, tablespace, TState::thread, THREAD_BARRIER_DESTROY, THREAD_BARRIER_INIT, THREAD_CREATE, THREAD_JOIN, threadRun(), throttle_delay, TState::tid, total_weight, tryExecuteStatement(), TState::ts_choose_rs, TState::ts_sample_rs, TState::ts_throttle_rs, type, PgBenchValue::type, unlogged_tables, usage(), use_log, use_quiet, username, Variable::value, verbose_errors, and ParsedScript::weight.
|
static |
Definition at line 1690 of file pgbench.c.
References is_an_int(), Variable::name, pg_log_error, pg_strcasecmp(), pg_strncasecmp(), PGBT_NO_VALUE, setBoolValue(), setDoubleValue(), setIntValue(), setNullValue(), strtodouble(), strtoint64(), Variable::svalue, PgBenchValue::type, and Variable::value.
Referenced by evaluateExpr().
|
static |
Definition at line 1444 of file pgbench.c.
References SimpleStats::count, SimpleStats::max, SimpleStats::min, SimpleStats::sum, and SimpleStats::sum2.
Referenced by main(), and printProgressReport().
|
static |
Definition at line 5456 of file pgbench.c.
References Command::argc, Command::argv, Assert(), PQExpBufferData::data, Command::lines, MAX_ARGS, name, parseVariable(), pg_free(), pg_log_error, pg_strdup(), replaceVariable(), and sprintf.
Referenced by postprocess_sql_command().
|
static |
Definition at line 5935 of file pgbench.c.
References addScript(), Command::argc, Command::argv, COMMANDS_ALLOC_NUM, create_sql_command(), Command::first_line, free_command(), initPQExpBuffer(), initStats(), Command::meta, META_ASET, META_GSET, pg_malloc(), pg_realloc(), pg_strdup(), pgbench_callbacks, process_backslash_command(), ps, PSCAN_BACKSLASH, PSCAN_EOL, PSCAN_INCOMPLETE, psql_scan(), psql_scan_create(), psql_scan_destroy(), psql_scan_finish(), psql_scan_get_location(), psql_scan_setup(), resetPQExpBuffer(), SQL_COMMAND, syntax_error(), termPQExpBuffer(), Command::type, and Command::varprefix.
Referenced by process_builtin(), and process_file().
|
static |
Definition at line 6190 of file pgbench.c.
References pg_fatal, pg_malloc(), pg_strdup(), and WSEP.
Referenced by main().
|
static |
Definition at line 1915 of file pgbench.c.
References i, IS_HIGHBIT_SET, name, and pg_malloc().
Referenced by assignVariables(), and parseQuery().
Definition at line 1329 of file pgbench.c.
References i, pg_leftmost_one_pos64(), pg_prng_seed(), pg_prng_uint64(), pg_prng_uint64_range(), and val.
Referenced by evalStandardFunc().
|
inlinestatic |
Definition at line 877 of file pgbench.c.
References INSTR_TIME_GET_MICROSEC, INSTR_TIME_SET_CURRENT, and now().
Referenced by advanceConnectionState(), doLog(), initPopulateTable(), main(), pg_time_now_lazy(), runInitSteps(), set_random_seed(), and threadRun().
|
inlinestatic |
Definition at line 887 of file pgbench.c.
References now(), and pg_time_now().
Referenced by advanceConnectionState(), doRetry(), executeMetaCommand(), printVerboseErrorMessages(), processXactStats(), and threadRun().
|
static |
Definition at line 5637 of file pgbench.c.
References Command::argc, Command::argv, Assert(), PQExpBufferData::data, Command::first_line, Command::lines, parseQuery(), pg_strdup(), Command::prepname, psprintf(), QUERY_EXTENDED, QUERY_PREPARED, QUERY_SIMPLE, querymode, SQL_COMMAND, strlcpy(), and Command::type.
Referenced by main().
|
static |
Definition at line 3110 of file pgbench.c.
References allocCStatePrepared(), Command::argc, Command::argv, ParsedScript::commands, CState::con, CState::id, pg_log_debug, pg_log_error, PGRES_COMMAND_OK, PQclear(), PQerrorMessage(), PQprepare(), PQresultStatus(), CState::prepared, Command::prepname, SQL_COMMAND, sql_script, Command::type, and CState::use_file.
Referenced by prepareCommandsInPipeline(), and sendCommand().
|
static |
Definition at line 3143 of file pgbench.c.
References allocCStatePrepared(), Assert(), CState::command, ParsedScript::commands, j, Command::meta, META_COMMAND, META_ENDPIPELINE, META_STARTPIPELINE, prepareCommand(), CState::prepared, sql_script, type, Command::type, and CState::use_file.
Referenced by executeMetaCommand().
|
static |
Definition at line 6248 of file pgbench.c.
References StatsData::cnt, cur, StatsData::deadlock_failures, epoch_shift, fprintf, getFailures(), i, initStats(), INT64_FORMAT, StatsData::lag, StatsData::latency, latency_limit, max_tries, mergeSimpleStats(), now(), nthreads, PG_TIME_GET_DOUBLE, progress_timestamp, StatsData::retried, StatsData::retries, StatsData::serialization_failures, StatsData::skipped, snprintf, TState::stats, SimpleStats::sum, SimpleStats::sum2, and throttle_delay.
Referenced by threadRun().
|
static |
Definition at line 6387 of file pgbench.c.
References StatsData::cnt, SimpleStats::count, StatsData::deadlock_failures, duration, failures_detailed, getFailures(), i, INT64_FORMAT, is_connect, StatsData::lag, StatsData::latency, latency_limit, SimpleStats::max, max_tries, nclients, nthreads, num_scripts, nxacts, PART_NONE, partition_method, PARTITION_METHOD, partitions, per_script_stats, PG_TIME_GET_DOUBLE, printf, printSimpleStats(), progress, querymode, QUERYMODE, report_per_command, StatsData::retried, StatsData::retries, scale, StatsData::serialization_failures, StatsData::skipped, sql_script, ParsedScript::stats, SimpleStats::sum, throttle_delay, and total_weight.
Referenced by main().
|
static |
Definition at line 6342 of file pgbench.c.
References SimpleStats::count, printf, SimpleStats::sum, and SimpleStats::sum2.
Referenced by printResults().
|
static |
Definition at line 3572 of file pgbench.c.
References appendPQExpBuffer(), appendPQExpBufferStr(), buf, createPQExpBuffer(), CState::id, latency_limit, max_tries, now(), pg_log_info, pg_time_now_lazy(), printfPQExpBuffer(), resetPQExpBuffer(), CState::tries, and CState::txn_scheduled.
Referenced by advanceConnectionState().
|
static |
Definition at line 6356 of file pgbench.c.
References _, formatPGVersionNumber(), PQparameterStatus(), PQserverVersion(), printf, server_version, and generate_unaccent_rules::stdout.
Referenced by main().
|
static |
Definition at line 5674 of file pgbench.c.
References Command::argc, Command::argv, PQExpBufferData::data, Command::expr, expr_lex_one_word(), expr_scanner_finish(), expr_scanner_get_substring(), expr_scanner_init(), expr_yyparse(), Command::first_line, getMetaCommand(), initPQExpBuffer(), initSimpleStats(), j, MAX_ARGS, Command::meta, META_ASET, META_COMMAND, META_ELIF, META_ELSE, META_ENDIF, META_ENDPIPELINE, META_GSET, META_IF, META_SET, META_SETSHELL, META_SHELL, META_SLEEP, META_STARTPIPELINE, META_SYNCPIPELINE, pg_malloc0(), pg_strcasecmp(), pg_strdup(), source, Command::stats, syntax_error(), termPQExpBuffer(), and Command::type.
Referenced by ParseScript().
|
static |
Definition at line 6135 of file pgbench.c.
References BuiltinScript::desc, ParseScript(), and BuiltinScript::script.
Referenced by main().
|
static |
Definition at line 6109 of file pgbench.c.
References buf, fd(), filename, free, ParseScript(), pg_fatal, and read_file_contents().
Referenced by main(), and process_psqlrc_file().
|
static |
Definition at line 4689 of file pgbench.c.
References accumStats(), CState::cnt, doLog(), CState::estatus, ESTATUS_NO_ERROR, TState::latency_late, latency_limit, now(), per_script_stats, pg_time_now_lazy(), progress, sql_script, TState::stats, ParsedScript::stats, throttle_delay, CState::tries, CState::txn_begin, CState::txn_scheduled, CState::use_file, and use_log.
Referenced by advanceConnectionState().
|
static |
Definition at line 1855 of file pgbench.c.
References free, lookupCreateVariable(), name, pg_strdup(), PGBT_NO_VALUE, Variable::svalue, PgBenchValue::type, val, Variable::value, and value.
Referenced by main(), and readCommandResponse().
|
static |
Definition at line 1897 of file pgbench.c.
References name, putVariableValue(), setIntValue(), val, and value.
Referenced by main(), and runShellCommand().
|
static |
Definition at line 1878 of file pgbench.c.
References free, lookupCreateVariable(), name, Variable::svalue, Variable::value, and value.
Referenced by executeMetaCommand(), main(), and putVariableInt().
|
static |
Definition at line 6076 of file pgbench.c.
References buf, fd(), pg_malloc(), and pg_realloc().
Referenced by process_file().
|
static |
Definition at line 3262 of file pgbench.c.
References Assert(), canRetryError(), CState::command, commandError(), CState::con, error(), CState::estatus, ESTATUS_META_COMMAND_ERROR, getSQLErrorStatus(), CState::id, META_ASET, META_ENDPIPELINE, META_GSET, META_NONE, CState::num_syncs, PG_DIAG_SQLSTATE, pg_free(), pg_log_debug, pg_log_error, PGRES_COMMAND_OK, PGRES_EMPTY_QUERY, PGRES_FATAL_ERROR, PGRES_NONFATAL_ERROR, PGRES_PIPELINE_SYNC, PGRES_TUPLES_OK, PQclear(), PQerrorMessage(), PQexitPipelineMode(), PQfname(), PQgetResult(), PQgetvalue(), PQnfields(), PQntuples(), PQresultErrorField(), PQresultStatus(), psprintf(), putVariable(), CState::use_file, CState::variables, and verbose_errors.
Referenced by advanceConnectionState().
|
static |
Definition at line 1942 of file pgbench.c.
References len, pg_realloc(), and value.
Referenced by assignVariables(), and parseQuery().
|
static |
Definition at line 5262 of file pgbench.c.
References appendPQExpBuffer(), appendPQExpBufferStr(), PQExpBufferData::data, doConnect(), fprintf, initCreateFKeys(), initCreatePKeys(), initCreateTables(), initDropTables(), initGenerateDataClientSide(), initGenerateDataServerSide(), initPQExpBuffer(), initVacuum(), pg_fatal, pg_log_error, PG_TIME_GET_DOUBLE, pg_time_now(), PQfinish(), ResetCancelConn(), SetCancelConn(), setup_cancel_handler(), start, and termPQExpBuffer().
Referenced by main().
|
static |
Definition at line 2943 of file pgbench.c.
References arg, getVariable(), i, len, pg_log_debug, pg_log_error, putVariableInt(), SHELL_COMMAND_SIZE, and timer_exceeded.
Referenced by executeMetaCommand().
Definition at line 3176 of file pgbench.c.
References Command::argc, Command::argv, assignVariables(), CState::command, CState::con, free, getQueryParams(), CState::id, MAX_ARGS, pg_log_debug, pg_strdup(), PQsendQuery(), PQsendQueryParams(), PQsendQueryPrepared(), prepareCommand(), Command::prepname, QUERY_EXTENDED, QUERY_PREPARED, QUERY_SIMPLE, querymode, and CState::variables.
Referenced by advanceConnectionState().
|
static |
Definition at line 6616 of file pgbench.c.
References base_random_sequence, pg_log_error, pg_log_error_detail, pg_log_info, pg_prng_seed(), pg_strong_random(), pg_time_now(), and random_seed.
Referenced by main().
|
static |
|
static |
Definition at line 2128 of file pgbench.c.
References PgBenchValue::bval, PGBT_BOOLEAN, PgBenchValue::type, and PgBenchValue::u.
Referenced by evalLazyFunc(), evalStandardFunc(), and makeVariableValue().
|
static |
Definition at line 2144 of file pgbench.c.
References PgBenchValue::dval, PGBT_DOUBLE, PgBenchValue::type, and PgBenchValue::u.
Referenced by evalStandardFunc(), and makeVariableValue().
|
static |
Definition at line 2136 of file pgbench.c.
References PgBenchValue::ival, PGBT_INT, PgBenchValue::type, and PgBenchValue::u.
Referenced by evalStandardFunc(), makeVariableValue(), and putVariableInt().
|
static |
Definition at line 2120 of file pgbench.c.
References PgBenchValue::ival, PGBT_NULL, PgBenchValue::type, and PgBenchValue::u.
Referenced by evalLazyFunc(), evalStandardFunc(), and makeVariableValue().
|
static |
Definition at line 5553 of file pgbench.c.
Referenced by create_sql_command().
|
static |
bool strtodouble | ( | const char * | str, |
bool | errorOK, | ||
double * | dv | ||
) |
Definition at line 1085 of file pgbench.c.
References pg_log_error, str, and unlikely.
Referenced by makeVariableValue().
bool strtoint64 | ( | const char * | str, |
bool | errorOK, | ||
int64 * | result | ||
) |
Definition at line 1014 of file pgbench.c.
References PG_INT64_MIN, pg_log_error, pg_mul_s64_overflow(), pg_sub_s64_overflow(), str, and unlikely.
Referenced by makeVariableValue().
void syntax_error | ( | const char * | source, |
int | lineno, | ||
const char * | line, | ||
const char * | command, | ||
const char * | msg, | ||
const char * | more, | ||
int | column | ||
) |
Definition at line 5517 of file pgbench.c.
References appendPQExpBuffer(), buf, fprintf, initPQExpBuffer(), pg_log_error, printfPQExpBuffer(), source, and termPQExpBuffer().
Referenced by expr_yyerror_more(), ParseScript(), process_backslash_command(), and string_to_uuid().
|
static |
Definition at line 7449 of file pgbench.c.
References add_socket_to_set(), advanceConnectionState(), agg_interval, alloc_socket_set(), arg, barrier, TState::bench_start, clear_socket_set(), CState::con, TState::conn_duration, CSTATE_ABORTED, CSTATE_CHOOSE_SCRIPT, CSTATE_FINISHED, CSTATE_SLEEP, CSTATE_THROTTLE, CSTATE_WAIT_RESULT, CSTATE_WAIT_ROLLBACK_RESULT, disconnect_all(), doConnect(), doLog(), EINTR, epoch_shift, exit_on_abort, free_socket_set(), i, initStats(), is_connect, TState::logfile, logfile_prefix, main_pid, MAXPGPATH, now(), TState::nstate, pg_fatal, PG_INT64_MAX, pg_log_error, pg_time_now(), pg_time_now_lazy(), pg_usleep(), PQerrorMessage(), PQsocket(), printProgressReport(), progress, CState::sleep_until, snprintf, socket_has_input(), SOCKET_WAIT_METHOD, start, TState::started_time, CState::state, TState::state, THREAD_BARRIER_WAIT, THREAD_FUNC_RETURN, TState::throttle_trigger, TState::tid, CState::txn_scheduled, use_log, and wait_on_socket_set().
Referenced by main().
|
static |
Definition at line 1542 of file pgbench.c.
References pg_log_error, pg_log_error_detail, PGRES_COMMAND_OK, PQclear(), PQerrorMessage(), PQexec(), and PQresultStatus().
Referenced by main().
|
static |
Definition at line 896 of file pgbench.c.
References ALL_INIT_STEPS, DEFAULT_INIT_STEPS, printf, and progname.
Referenced by main().
|
static |
Definition at line 1764 of file pgbench.c.
References IS_HIGHBIT_SET, and name.
Referenced by lookupCreateVariable().
|
static |
Definition at line 2050 of file pgbench.c.
References Assert(), PgBenchValue::bval, PgBenchValue::dval, PgBenchValue::ival, PGBT_BOOLEAN, PGBT_DOUBLE, PGBT_INT, PGBT_NULL, PgBenchValue::type, and PgBenchValue::u.
Referenced by evalLazyFunc(), and executeMetaCommand().
|
static |
Definition at line 2008 of file pgbench.c.
References Assert(), PGBT_BOOLEAN, PGBT_DOUBLE, PGBT_INT, PGBT_NO_VALUE, PGBT_NULL, and PgBenchValue::type.
Referenced by coerceToBool(), coerceToDouble(), and coerceToInt().
|
static |
Definition at line 7958 of file pgbench.c.
References select.
Referenced by threadRun().
|
static |
Definition at line 259 of file pgbench.c.
Referenced by doLog(), main(), and threadRun().
|
static |
Definition at line 481 of file pgbench.c.
Referenced by BarrierArriveAndDetach(), BarrierArriveAndDetachExceptLast(), BarrierArriveAndWait(), BarrierAttach(), BarrierDetach(), BarrierDetachImpl(), BarrierInit(), BarrierParticipants(), BarrierPhase(), main(), pthread_barrier_destroy(), pthread_barrier_init(), pthread_barrier_wait(), and threadRun().
|
static |
Definition at line 478 of file pgbench.c.
Referenced by initRandomState(), main(), and set_random_seed().
|
static |
Definition at line 781 of file pgbench.c.
Referenced by findBuiltin(), and listAvailableScripts().
|
static |
Definition at line 298 of file pgbench.c.
Referenced by doConnect(), main(), pg_database_size_name(), and PQsetdbLogin().
|
static |
Definition at line 175 of file pgbench.c.
Referenced by advanceConnectionState(), doRetry(), main(), pgss_planner(), pgss_ProcessUtility(), printResults(), and test_timing().
|
static |
Definition at line 176 of file pgbench.c.
Referenced by advanceConnectionState(), main(), pqConnectDBComplete(), pqSocketCheck(), PQsocketPoll(), pqWaitTimed(), test_timing(), and wait_until_connected().
|
static |
Definition at line 450 of file pgbench.c.
Referenced by doLog(), main(), printProgressReport(), and threadRun().
|
static |
Definition at line 771 of file pgbench.c.
Referenced by main(), and threadRun().
|
static |
Definition at line 292 of file pgbench.c.
Referenced by doLog(), getResultString(), main(), and printResults().
|
static |
Definition at line 188 of file pgbench.c.
Referenced by btoptions(), createPartitions(), default_reloptions(), gistbuild(), gistoptions(), hashoptions(), initCreateTables(), main(), spgoptions(), and table_block_relation_estimate_size().
|
static |
Definition at line 218 of file pgbench.c.
Referenced by initCreatePKeys(), and main().
|
static |
Definition at line 266 of file pgbench.c.
Referenced by advanceConnectionState(), main(), printResults(), and threadRun().
|
static |
Definition at line 212 of file pgbench.c.
Referenced by advanceConnectionState(), doLog(), doRetry(), main(), printProgressReport(), printResults(), printVerboseErrorMessages(), and processXactStats().
|
static |
Definition at line 299 of file pgbench.c.
Referenced by main(), and threadRun().
|
static |
Definition at line 270 of file pgbench.c.
Referenced by main(), and threadRun().
|
static |
Definition at line 290 of file pgbench.c.
Referenced by doLog(), doRetry(), main(), printProgressReport(), printResults(), and printVerboseErrorMessages().
|
static |
Definition at line 264 of file pgbench.c.
Referenced by main(), and printResults().
|
static |
Definition at line 265 of file pgbench.c.
Referenced by main(), printProgressReport(), and printResults().
|
static |
Definition at line 766 of file pgbench.c.
Referenced by addScript(), allocCStatePrepared(), chooseScript(), main(), and printResults().
|
static |
Definition at line 174 of file pgbench.c.
Referenced by advanceConnectionState(), main(), and printResults().
|
static |
Definition at line 234 of file pgbench.c.
Referenced by createPartitions(), GetTableInfo(), initCreateTables(), main(), and printResults().
Definition at line 235 of file pgbench.c.
Referenced by initCreateTables(), and printResults().
|
static |
Definition at line 224 of file pgbench.c.
Referenced by createPartitions(), dshash_create(), GetTableInfo(), main(), pg_partition_tree(), printResults(), and ReindexPartitions().
|
static |
Definition at line 261 of file pgbench.c.
Referenced by main(), printResults(), and processXactStats().
|
static |
|
static |
Definition at line 295 of file pgbench.c.
Referenced by ConnectDatabase(), doConnect(), initialize_environment(), main(), and PQsetdbLogin().
|
static |
Definition at line 296 of file pgbench.c.
Referenced by ConnectDatabase(), doConnect(), initialize_environment(), main(), and PQsetdbLogin().
|
static |
Definition at line 300 of file pgbench.c.
Referenced by doConnect(), main(), and usage().
|
static |
Definition at line 262 of file pgbench.c.
Referenced by _bt_parallel_scan_and_sort(), _gin_parallel_scan_and_build(), _gin_process_worker_data(), CheckpointWriteDelay(), heapam_index_build_range_scan(), IsCheckpointOnSchedule(), main(), printResults(), processXactStats(), pullback(), pushfwd(), reindex_index(), table_index_build_range_scan(), table_index_build_scan(), threadRun(), WaitForLockers(), WaitForLockersMultiple(), and WaitForOlderSnapshots().
|
static |
Definition at line 263 of file pgbench.c.
Referenced by main(), and printProgressReport().
|
static |
Definition at line 714 of file pgbench.c.
Referenced by executeMetaCommand(), main(), postprocess_sql_command(), printResults(), and sendCommand().
|
static |
Definition at line 715 of file pgbench.c.
Referenced by main(), and printResults().
|
static |
Definition at line 238 of file pgbench.c.
Referenced by main(), and set_random_seed().
|
static |
Definition at line 267 of file pgbench.c.
Referenced by advanceConnectionState(), main(), and printResults().
|
static |
|
static |
Definition at line 182 of file pgbench.c.
Referenced by AdjustDays(), AdjustFractDays(), AdjustFractMicroseconds(), AdjustFractSeconds(), AdjustFractYears(), AdjustMicroseconds(), AdjustYears(), apply_typmod(), apply_typmod_special(), ArrayGetOffset(), cash_numeric(), consider_groupingsets_paths(), createPartitions(), executeItemOptUnwrapTarget(), float8_regr_accum(), GetTableInfo(), gincostestimate(), initCreateTables(), initGenerateDataServerSide(), initPopulateTable(), int4_cash(), int8_cash(), main(), make_numeric_typmod(), numeric(), numeric_cash(), numeric_out_sci(), numeric_round(), numeric_to_number(), numeric_trunc(), and printResults().
|
static |
Definition at line 765 of file pgbench.c.
Referenced by addScript(), advanceConnectionState(), allocCStatePrepared(), chooseScript(), commandError(), executeMetaCommand(), main(), prepareCommand(), prepareCommandsInPipeline(), printResults(), and processXactStats().
|
static |
Definition at line 217 of file pgbench.c.
Referenced by _selectTablespace(), add_tablespace_footer(), apw_compare_blockinfo(), apw_dump_now(), apw_load_buffers(), autoprewarm_database_main(), describeOneTableDetails(), dumpDatabase(), dumpTableSchema(), FileSetCreate(), FileSetPath(), gen_reindex_command(), initCreateTables(), main(), process_rel_infos(), recordDependencyOnTablespace(), reindex_all_databases(), reindex_one_database(), shdepLockAndCheckObject(), and TempTablespacePath().
|
static |
Definition at line 204 of file pgbench.c.
Referenced by accumStats(), advanceConnectionState(), doLog(), main(), printProgressReport(), printResults(), and processXactStats().
|
static |
Definition at line 304 of file pgbench.c.
Referenced by advanceConnectionState(), doRetry(), handle_sig_alarm(), and runShellCommand().
|
static |
Definition at line 767 of file pgbench.c.
Referenced by chooseScript(), main(), and printResults().
|
static |
Definition at line 193 of file pgbench.c.
Referenced by createPartitions(), initCreateTables(), and main().
|
static |
Definition at line 257 of file pgbench.c.
Referenced by doLog(), main(), processXactStats(), and threadRun().
|
static |
Definition at line 258 of file pgbench.c.
Referenced by initPopulateTable(), and main().
|
static |
Definition at line 297 of file pgbench.c.
Referenced by doConnect(), and main().
|
static |
Definition at line 769 of file pgbench.c.
Referenced by advanceConnectionState(), main(), and readCommandResponse().