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 "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 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) |
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) |
#define COMMANDS_ALLOC_NUM 128 |
#define DEFAULT_INIT_STEPS "dtgvp" /* default -I setting */ |
#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 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 484 of file pgbench.c.
enum EStatus |
enum MetaCommand |
enum partition_method_t |
enum QueryMode |
enum TStatus |
|
static |
Definition at line 1449 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 7870 of file pgbench.c.
References exit(), fd(), pg_log_error, and pg_log_error_hint.
Referenced by threadRun().
|
static |
Definition at line 6191 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 1401 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 3587 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, res, Command::retries, sendCommand(), SQL_COMMAND, sql_script, 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 7851 of file pgbench.c.
References pg_malloc0().
Referenced by threadRun().
|
static |
Definition at line 3067 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 1934 of file pgbench.c.
References free, getVariable(), name, parseVariable(), replaceVariable(), and val.
Referenced by sendCommand().
Definition at line 3223 of file pgbench.c.
References ESTATUS_DEADLOCK_ERROR, and ESTATUS_SERIALIZATION_ERROR.
Referenced by advanceConnectionState(), doRetry(), and readCommandResponse().
|
static |
Definition at line 5853 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 5201 of file pgbench.c.
References ALL_INIT_STEPS, exit(), pg_fatal, pg_log_error, and pg_log_error_detail.
Referenced by main().
|
static |
Definition at line 3045 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 7863 of file pgbench.c.
Referenced by threadRun().
|
static |
Definition at line 2002 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 2071 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 2043 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 3036 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 3026 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 1594 of file pgbench.c.
References name.
Referenced by lookupVariable().
|
static |
Definition at line 1199 of file pgbench.c.
References b, pg_prng_double(), and x.
Referenced by getZipfianRand().
|
static |
|
static |
Definition at line 5547 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 4737 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 3472 of file pgbench.c.
References Assert(), CState::con, CState::id, pg_log_error, PGRES_PIPELINE_SYNC, PQclear(), PQexitPipelineMode(), PQgetResult(), PQpipelineSync(), PQresultStatus(), and res.
Referenced by advanceConnectionState().
|
static |
|
static |
Definition at line 1529 of file pgbench.c.
References conn, CONNECTION_BAD, dbName, 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 4544 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, 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 3426 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 1771 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 2819 of file pgbench.c.
References generate_unaccent_rules::args, evalLazyFunc(), evalStandardFunc(), and isLazyFunc().
Referenced by evaluateExpr().
|
static |
Definition at line 2130 of file pgbench.c.
References a1, a2, generate_unaccent_rules::args, Assert(), coerceToBool(), evaluateExpr(), isLazyFunc(), PGBENCH_AND, PGBENCH_CASE, PGBENCH_OR, PGBT_NULL, setBoolValue(), setNullValue(), and valueTruth().
Referenced by evalFunc().
|
static |
Definition at line 2247 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, res, setBoolValue(), setDoubleValue(), setIntValue(), setNullValue(), size, type, PgBenchValue::type, PgBenchValue::u, unlikely, CState::use_file, and val.
Referenced by evalFunc().
|
static |
Definition at line 2835 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, and CState::variables.
Referenced by evalLazyFunc(), evalStandardFunc(), and executeMetaCommand().
Definition at line 3381 of file pgbench.c.
References getVariable(), pg_log_error, and pg_strcasecmp().
Referenced by executeMetaCommand().
|
static |
Definition at line 4283 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 1498 of file pgbench.c.
References exit(), pg_log_error, pg_log_error_detail, PGRES_COMMAND_OK, PQclear(), PQerrorMessage(), PQexec(), PQresultStatus(), and res.
Referenced by createPartitions(), initCreateFKeys(), initCreatePKeys(), initCreateTables(), initDropTables(), initGenerateDataClientSide(), initGenerateDataServerSide(), initTruncateTables(), and initVacuum().
|
static |
Definition at line 6118 of file pgbench.c.
References builtin_script, exit(), i, len, lengthof, listAvailableScripts(), name, and pg_log_error.
Referenced by main().
|
static |
Definition at line 7686 of file pgbench.c.
References CState::con, and PQfinish().
Referenced by advanceConnectionState(), and disconnect_all().
|
static |
Definition at line 5576 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 1111 of file pgbench.c.
References Assert(), and pg_prng_double().
Referenced by evalStandardFunc().
|
static |
Definition at line 4502 of file pgbench.c.
References StatsData::deadlock_failures, and StatsData::serialization_failures.
Referenced by printProgressReport(), and printResults().
|
static |
Definition at line 1135 of file pgbench.c.
References Assert(), MIN_GAUSSIAN_PARAM, and pg_prng_double_normal().
Referenced by evalStandardFunc().
|
static |
Definition at line 1243 of file pgbench.c.
References FNV_OFFSET_BASIS, FNV_PRIME, i, and val.
Referenced by evalStandardFunc().
|
static |
Definition at line 1268 of file pgbench.c.
References MM2_MUL, MM2_MUL_TIMES_8, MM2_ROT, and val.
Referenced by evalStandardFunc().
|
static |
Definition at line 2878 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 1177 of file pgbench.c.
References pg_prng_double().
Referenced by advanceConnectionState().
|
static |
Definition at line 1970 of file pgbench.c.
References Command::argc, Command::argv, getVariable(), and i.
Referenced by sendCommand().
|
static |
Definition at line 1100 of file pgbench.c.
References pg_prng_uint64_range().
Referenced by chooseScript(), and evalStandardFunc().
Definition at line 4513 of file pgbench.c.
References ESTATUS_DEADLOCK_ERROR, ESTATUS_SERIALIZATION_ERROR, failures_detailed, and pg_fatal.
Referenced by doLog().
|
static |
Definition at line 3206 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().
Definition at line 5306 of file pgbench.c.
References Assert(), ERRCODE_UNDEFINED_TABLE, exit(), 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, res, and scale.
Referenced by main().
Definition at line 3512 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 1629 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 1229 of file pgbench.c.
References Assert(), computeIterativeZipfian(), MAX_ZIPFIAN_PARAM, and MIN_ZIPFIAN_PARAM.
Referenced by evalStandardFunc().
|
static |
|
static |
Definition at line 4929 of file pgbench.c.
References INT64_FORMAT, naccounts, and printfPQExpBuffer().
Referenced by initGenerateDataClientSide().
|
static |
Definition at line 4911 of file pgbench.c.
References INT64_FORMAT, and printfPQExpBuffer().
Referenced by initGenerateDataClientSide().
|
static |
Definition at line 5175 of file pgbench.c.
References executeStatement(), fprintf, i, and lengthof.
Referenced by runInitSteps().
|
static |
Definition at line 5137 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 4806 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, tablespace, termPQExpBuffer(), and unlogged_tables.
Referenced by runInitSteps().
|
static |
Definition at line 4715 of file pgbench.c.
References executeStatement(), and fprintf.
Referenced by runInitSteps().
|
static |
Definition at line 5047 of file pgbench.c.
References executeStatement(), fprintf, initAccount(), initBranch(), initPopulateTable(), initTeller(), initTruncateTables(), naccounts, nbranches, and ntellers.
Referenced by runInitSteps().
|
static |
Definition at line 5079 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 4938 of file pgbench.c.
References CancelRequested, chars, PQExpBufferData::data, fprintf, initPQExpBuffer(), INT64_FORMAT, j, LOG_STEP_SECONDS, partitions, pg_fatal, pg_snprintf(), PG_TIME_GET_DOUBLE, pg_time_now(), PGRES_COPY_IN, PQclear(), PQendcopy(), PQerrorMessage(), PQexec(), PQputline(), PQresultStatus(), PQserverVersion(), res, scale, termPQExpBuffer(), and use_quiet.
Referenced by initGenerateDataClientSide().
|
static |
Definition at line 1086 of file pgbench.c.
References base_random_sequence, pg_prng_seed(), and pg_prng_uint64().
Referenced by main().
|
static |
Definition at line 1392 of file pgbench.c.
Referenced by create_sql_command(), initStats(), and process_backslash_command().
|
static |
Definition at line 1432 of file pgbench.c.
References StatsData::cnt, StatsData::deadlock_failures, initSimpleStats(), StatsData::lag, StatsData::latency, StatsData::retried, StatsData::retries, StatsData::serialization_failures, StatsData::skipped, and StatsData::start_time.
Referenced by doLog(), main(), ParseScript(), printProgressReport(), and threadRun().
|
static |
Definition at line 4920 of file pgbench.c.
References INT64_FORMAT, ntellers, and printfPQExpBuffer().
Referenced by initGenerateDataClientSide().
|
static |
Definition at line 4901 of file pgbench.c.
References executeStatement().
Referenced by initGenerateDataClientSide(), and initGenerateDataServerSide().
|
static |
Definition at line 5124 of file pgbench.c.
References executeStatement(), and fprintf.
Referenced by runInitSteps().
|
static |
Definition at line 949 of file pgbench.c.
References generate_unaccent_rules::str.
Referenced by makeVariableValue().
|
static |
Definition at line 2123 of file pgbench.c.
References PGBENCH_AND, PGBENCH_CASE, and PGBENCH_OR.
Referenced by evalFunc(), and evalLazyFunc().
|
static |
Definition at line 6106 of file pgbench.c.
References builtin_script, fprintf, i, lengthof, and name.
Referenced by findBuiltin(), and main().
|
static |
Definition at line 1790 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 1602 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 6615 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(), exit_on_abort, failures_detailed, fillfactor, findBuiltin(), fprintf, get_progname(), get_user_name_or_exit(), getopt_long(), GetTableInfo(), gettimeofday(), i, index_tablespace, initRandomState(), initStats(), 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.
Definition at line 1662 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 1416 of file pgbench.c.
References SimpleStats::count, SimpleStats::max, SimpleStats::min, SimpleStats::sum, and SimpleStats::sum2.
Referenced by main(), and printProgressReport().
Definition at line 5415 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 5903 of file pgbench.c.
References addScript(), Command::argc, Command::argv, COMMANDS_ALLOC_NUM, create_sql_command(), expr_scanner_get_lineno(), expr_scanner_offset(), 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_setup(), resetPQExpBuffer(), SQL_COMMAND, syntax_error(), termPQExpBuffer(), Command::type, and Command::varprefix.
Referenced by process_builtin(), and process_file().
|
static |
Definition at line 6154 of file pgbench.c.
References pg_fatal, pg_malloc(), pg_strdup(), and WSEP.
Referenced by main().
|
static |
Definition at line 1887 of file pgbench.c.
References i, IS_HIGHBIT_SET, name, and pg_malloc().
Referenced by assignVariables(), and parseQuery().
|
static |
Definition at line 1301 of file pgbench.c.
References i, pg_leftmost_one_pos64(), pg_prng_seed(), pg_prng_uint64(), pg_prng_uint64_range(), size, and val.
Referenced by evalStandardFunc().
|
inlinestatic |
Definition at line 850 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 860 of file pgbench.c.
References now(), and pg_time_now().
Referenced by advanceConnectionState(), doRetry(), executeMetaCommand(), printVerboseErrorMessages(), processXactStats(), and threadRun().
|
static |
Definition at line 5596 of file pgbench.c.
References Command::argc, Command::argv, Assert(), PQExpBufferData::data, exit(), 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 3087 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, res, SQL_COMMAND, sql_script, Command::type, and CState::use_file.
Referenced by prepareCommandsInPipeline(), and sendCommand().
|
static |
Definition at line 3120 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 6212 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 6351 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 6306 of file pgbench.c.
References SimpleStats::count, printf, SimpleStats::sum, and SimpleStats::sum2.
Referenced by printResults().
|
static |
Definition at line 3549 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 6320 of file pgbench.c.
References _, fflush(), formatPGVersionNumber(), PQparameterStatus(), PQserverVersion(), printf, server_version, and generate_unaccent_rules::stdout.
Referenced by main().
|
static |
Definition at line 5633 of file pgbench.c.
References Command::argc, Command::argv, PQExpBufferData::data, exit(), Command::expr, expr_lex_one_word(), expr_parse_result, expr_scanner_finish(), expr_scanner_get_lineno(), expr_scanner_get_substring(), expr_scanner_init(), expr_scanner_offset(), 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(), Command::type, and yyscanner.
Referenced by ParseScript().
|
static |
Definition at line 6099 of file pgbench.c.
References BuiltinScript::desc, ParseScript(), and BuiltinScript::script.
Referenced by main().
|
static |
Definition at line 6073 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 4664 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 1827 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 1869 of file pgbench.c.
References name, putVariableValue(), setIntValue(), val, and value.
Referenced by main(), and runShellCommand().
|
static |
Definition at line 1850 of file pgbench.c.
References free, lookupCreateVariable(), name, Variable::svalue, Variable::value, and value.
Referenced by executeMetaCommand(), main(), and putVariableInt().
|
static |
Definition at line 6040 of file pgbench.c.
References buf, fd(), pg_malloc(), and pg_realloc().
Referenced by process_file().
|
static |
Definition at line 3239 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(), res, CState::use_file, CState::variables, and verbose_errors.
Referenced by advanceConnectionState().
|
static |
Definition at line 1914 of file pgbench.c.
References len, pg_realloc(), and value.
Referenced by assignVariables(), and parseQuery().
|
static |
Definition at line 5221 of file pgbench.c.
References appendPQExpBuffer(), appendPQExpBufferStr(), PQExpBufferData::data, doConnect(), exit(), 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(), and termPQExpBuffer().
Referenced by main().
|
static |
Definition at line 2920 of file pgbench.c.
References arg, fflush(), getVariable(), i, len, pg_log_debug, pg_log_error, putVariableInt(), res, SHELL_COMMAND_SIZE, and timer_exceeded.
Referenced by executeMetaCommand().
Definition at line 3153 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 6569 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 |
Definition at line 7708 of file pgbench.c.
References handle_sig_alarm(), pqsignal(), and SIGALRM.
Referenced by main().
|
static |
Definition at line 2100 of file pgbench.c.
References PgBenchValue::bval, PGBT_BOOLEAN, PgBenchValue::type, and PgBenchValue::u.
Referenced by evalLazyFunc(), evalStandardFunc(), and makeVariableValue().
|
static |
Definition at line 2116 of file pgbench.c.
References PgBenchValue::dval, PGBT_DOUBLE, PgBenchValue::type, and PgBenchValue::u.
Referenced by evalStandardFunc(), and makeVariableValue().
|
static |
Definition at line 2108 of file pgbench.c.
References PgBenchValue::ival, PGBT_INT, PgBenchValue::type, and PgBenchValue::u.
Referenced by evalStandardFunc(), makeVariableValue(), and putVariableInt().
|
static |
Definition at line 2092 of file pgbench.c.
References PgBenchValue::ival, PGBT_NULL, PgBenchValue::type, and PgBenchValue::u.
Referenced by evalLazyFunc(), evalStandardFunc(), and makeVariableValue().
|
static |
|
static |
Definition at line 1057 of file pgbench.c.
References pg_log_error, generate_unaccent_rules::str, and unlikely.
Referenced by makeVariableValue().
Definition at line 986 of file pgbench.c.
References PG_INT64_MIN, pg_log_error, pg_mul_s64_overflow(), pg_sub_s64_overflow(), generate_unaccent_rules::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 5476 of file pgbench.c.
References appendPQExpBuffer(), buf, exit(), fprintf, initPQExpBuffer(), pg_log_error, printfPQExpBuffer(), source, and termPQExpBuffer().
Referenced by ParseScript(), process_backslash_command(), and string_to_uuid().
|
static |
Definition at line 7386 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(), 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, 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 1514 of file pgbench.c.
References pg_log_error, pg_log_error_detail, PGRES_COMMAND_OK, PQclear(), PQerrorMessage(), PQexec(), PQresultStatus(), and res.
Referenced by main().
|
static |
Definition at line 869 of file pgbench.c.
References ALL_INIT_STEPS, DEFAULT_INIT_STEPS, printf, and progname.
Referenced by main().
|
static |
Definition at line 1736 of file pgbench.c.
References IS_HIGHBIT_SET, and name.
Referenced by lookupCreateVariable().
|
static |
Definition at line 2022 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 1980 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 |
int agg_interval |
Definition at line 258 of file pgbench.c.
Referenced by doLog(), main(), and threadRun().
|
static |
Definition at line 479 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 476 of file pgbench.c.
Referenced by initRandomState(), main(), and set_random_seed().
|
static |
Definition at line 779 of file pgbench.c.
Referenced by findBuiltin(), and listAvailableScripts().
const char* dbName = NULL |
Definition at line 297 of file pgbench.c.
Referenced by doConnect(), main(), pg_database_size_name(), and PQsetdbLogin().
int duration = 0 |
Definition at line 174 of file pgbench.c.
Referenced by advanceConnectionState(), doRetry(), main(), pgss_planner(), pgss_ProcessUtility(), printResults(), and test_timing().
int64 end_time = 0 |
Definition at line 175 of file pgbench.c.
Referenced by advanceConnectionState(), main(), pqSocketCheck(), pqSocketPoll(), and test_timing().
pg_time_usec_t epoch_shift |
Definition at line 448 of file pgbench.c.
Referenced by doLog(), main(), printProgressReport(), and threadRun().
Definition at line 769 of file pgbench.c.
Referenced by main(), and threadRun().
Definition at line 291 of file pgbench.c.
Referenced by doLog(), getResultString(), main(), and printResults().
int fillfactor = 100 |
Definition at line 187 of file pgbench.c.
Referenced by btoptions(), createPartitions(), default_reloptions(), gistbuild(), gistoptions(), hashoptions(), initCreateTables(), main(), spgoptions(), and table_block_relation_estimate_size().
char* index_tablespace = NULL |
Definition at line 217 of file pgbench.c.
Referenced by initCreatePKeys(), and main().
bool is_connect |
Definition at line 265 of file pgbench.c.
Referenced by advanceConnectionState(), main(), printResults(), and threadRun().
int64 latency_limit = 0 |
Definition at line 211 of file pgbench.c.
Referenced by advanceConnectionState(), doLog(), doRetry(), main(), printProgressReport(), printResults(), printVerboseErrorMessages(), and processXactStats().
char* logfile_prefix = NULL |
Definition at line 298 of file pgbench.c.
Referenced by main(), and threadRun().
int main_pid |
Definition at line 269 of file pgbench.c.
Referenced by main(), and threadRun().
uint32 max_tries = 1 |
Definition at line 289 of file pgbench.c.
Referenced by doLog(), doRetry(), main(), printProgressReport(), printResults(), and printVerboseErrorMessages().
int nclients = 1 |
Definition at line 263 of file pgbench.c.
Referenced by main(), and printResults().
int nthreads = 1 |
Definition at line 264 of file pgbench.c.
Referenced by main(), printProgressReport(), and printResults().
|
static |
Definition at line 764 of file pgbench.c.
Referenced by addScript(), allocCStatePrepared(), chooseScript(), main(), and printResults().
int nxacts = 0 |
Definition at line 173 of file pgbench.c.
Referenced by advanceConnectionState(), main(), and printResults().
|
static |
Definition at line 233 of file pgbench.c.
Referenced by createPartitions(), GetTableInfo(), initCreateTables(), main(), and printResults().
Definition at line 234 of file pgbench.c.
Referenced by initCreateTables(), and printResults().
|
static |
Definition at line 223 of file pgbench.c.
Referenced by createPartitions(), dshash_create(), GetTableInfo(), initPopulateTable(), main(), pg_partition_tree(), printResults(), and ReindexPartitions().
Definition at line 260 of file pgbench.c.
Referenced by main(), printResults(), and processXactStats().
|
static |
const char* pghost = NULL |
Definition at line 294 of file pgbench.c.
Referenced by connectDatabase(), doConnect(), initialize_environment(), main(), and PQsetdbLogin().
const char* pgport = NULL |
Definition at line 295 of file pgbench.c.
Referenced by connectDatabase(), doConnect(), initialize_environment(), main(), and PQsetdbLogin().
const char* progname |
Definition at line 299 of file pgbench.c.
Referenced by doConnect(), main(), and usage().
int progress = 0 |
Definition at line 261 of file pgbench.c.
Referenced by _bt_parallel_scan_and_sort(), 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().
Definition at line 262 of file pgbench.c.
Referenced by main(), and printProgressReport().
|
static |
Definition at line 712 of file pgbench.c.
Referenced by executeMetaCommand(), main(), postprocess_sql_command(), printResults(), and sendCommand().
|
static |
Definition at line 713 of file pgbench.c.
Referenced by main(), and printResults().
int64 random_seed = -1 |
Definition at line 237 of file pgbench.c.
Referenced by main(), and set_random_seed().
Definition at line 266 of file pgbench.c.
Referenced by advanceConnectionState(), main(), and printResults().
double sample_rate = 0.0 |
int scale = 1 |
Definition at line 181 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 763 of file pgbench.c.
Referenced by addScript(), advanceConnectionState(), allocCStatePrepared(), chooseScript(), commandError(), executeMetaCommand(), main(), prepareCommand(), prepareCommandsInPipeline(), printResults(), and processXactStats().
char* tablespace = NULL |
Definition at line 216 of file pgbench.c.
Referenced by _selectTablespace(), add_tablespace_footer(), apw_compare_blockinfo(), apw_dump_now(), apw_load_buffers(), describeOneTableDetails(), dumpDatabase(), dumpTableSchema(), FileSetCreate(), FileSetPath(), get_rel_infos(), initCreateTables(), main(), recordDependencyOnTablespace(), reindex_all_databases(), reindex_one_database(), run_reindex_command(), shdepLockAndCheckObject(), and TempTablespacePath().
double throttle_delay = 0 |
Definition at line 203 of file pgbench.c.
Referenced by accumStats(), advanceConnectionState(), doLog(), main(), printProgressReport(), printResults(), and processXactStats().
volatile sig_atomic_t timer_exceeded = false |
Definition at line 303 of file pgbench.c.
Referenced by advanceConnectionState(), doRetry(), handle_sig_alarm(), and runShellCommand().
|
static |
Definition at line 765 of file pgbench.c.
Referenced by chooseScript(), main(), and printResults().
Definition at line 192 of file pgbench.c.
Referenced by createPartitions(), initCreateTables(), and main().
bool use_log |
Definition at line 256 of file pgbench.c.
Referenced by doLog(), main(), processXactStats(), and threadRun().
bool use_quiet |
Definition at line 257 of file pgbench.c.
Referenced by initPopulateTable(), and main().
const char* username = NULL |
Definition at line 296 of file pgbench.c.
Referenced by BackgroundWorkerInitializeConnection(), check_password(), doConnect(), dumpUserConfig(), get_object_address_defacl(), get_object_address_usermapping(), get_user_name(), getObjectDescription(), getObjectIdentityParts(), has_any_column_privilege_name_id(), has_column_privilege_name_id_attnum(), has_column_privilege_name_id_name(), has_database_privilege_name_id(), has_database_privilege_name_name(), has_foreign_data_wrapper_privilege_name_id(), has_foreign_data_wrapper_privilege_name_name(), has_function_privilege_name_id(), has_function_privilege_name_name(), has_language_privilege_name_id(), has_language_privilege_name_name(), has_parameter_privilege_name_name(), has_schema_privilege_name_id(), has_schema_privilege_name_name(), has_sequence_privilege_name_id(), has_server_privilege_name_id(), has_server_privilege_name_name(), has_table_privilege_name_id(), has_tablespace_privilege_name_id(), has_tablespace_privilege_name_name(), has_type_privilege_name_id(), has_type_privilege_name_name(), InitPostgres(), log_status_format(), main(), mock_scram_secret(), passwordFromFile(), pg_fe_getusername(), pg_has_role_name_id(), pg_has_role_name_name(), PostgresMain(), PostgresSingleUserMain(), process_pgfdw_appname(), prompt_for_password(), scram_mock_salt(), and scram_verify_plain_password().
Definition at line 767 of file pgbench.c.
Referenced by advanceConnectionState(), main(), and readCommandResponse().