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 "common/int.h"
#include "common/logging.h"
#include "common/string.h"
#include "common/username.h"
#include "fe_utils/cancel.h"
#include "fe_utils/conditional.h"
#include "getopt_long.h"
#include "libpq-fe.h"
#include "pgbench.h"
#include "port/pg_bitutils.h"
#include "portability/instr_time.h"
Go to the source code of this file.
Data Structures | |
struct | socket_set |
struct | Variable |
struct | SimpleStats |
struct | StatsData |
struct | RandomState |
struct | CState |
struct | TState |
struct | Command |
struct | ParsedScript |
struct | BuiltinScript |
Macros | |
#define | POLL_USING_SELECT |
#define | M_PI 3.14159265358979323846 |
#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 void * |
#define | THREAD_FUNC_RETURN_TYPE void * |
#define | THREAD_FUNC_RETURN return NULL |
#define | THREAD_FUNC_CC |
#define | THREAD_BARRIER_T int |
#define | THREAD_BARRIER_INIT(barrier, n) (*(barrier) = 0) |
#define | THREAD_BARRIER_WAIT(barrier) |
#define | THREAD_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 | 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 | MAX_PREPARE_NAME 32 |
#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 struct RandomState | RandomState |
typedef enum MetaCommand | MetaCommand |
typedef enum QueryMode | QueryMode |
typedef struct Command | Command |
typedef struct ParsedScript | ParsedScript |
typedef struct BuiltinScript | BuiltinScript |
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 (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 (RandomState *random_state) |
static int64 | getrand (RandomState *random_state, int64 min, int64 max) |
static int64 | getExponentialRand (RandomState *random_state, int64 min, int64 max, double parameter) |
static int64 | getGaussianRand (RandomState *random_state, int64 min, int64 max, double parameter) |
static int64 | getPoissonRand (RandomState *random_state, double center) |
static int64 | computeIterativeZipfian (RandomState *random_state, int64 n, double s) |
static int64 | getZipfianRand (RandomState *random_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) |
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 (CState *st, char *name) |
static char * | getVariable (CState *st, char *name) |
static bool | makeVariableValue (Variable *var) |
static bool | valid_variable_name (const char *name) |
static Variable * | lookupCreateVariable (CState *st, const char *context, char *name) |
static bool | putVariable (CState *st, const char *context, char *name, const char *value) |
static bool | putVariableValue (CState *st, const char *context, char *name, const PgBenchValue *value) |
static bool | putVariableInt (CState *st, 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 (CState *st, char *sql) |
static void | getQueryParams (CState *st, 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 (CState *st, char *variable, char **argv, int argc) |
static void | preparedStatementName (char *buffer, int file, int state) |
static void | commandFailed (CState *st, const char *cmd, const char *message) |
static int | chooseScript (TState *thread) |
static bool | sendCommand (CState *st, Command *command) |
static bool | readCommandResponse (CState *st, MetaCommand meta, char *varprefix) |
static bool | evaluateSleep (CState *st, int argc, char **argv, int *usecs) |
static void | advanceConnectionState (TState *thread, CState *st, StatsData *agg) |
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 | 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 (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 | 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 ALL_INIT_STEPS "dtgGvpf" /* all possible steps */ |
Definition at line 171 of file pgbench.c.
Referenced by checkInitSteps(), and usage().
#define COMMANDS_ALLOC_NUM 128 |
Referenced by ParseScript().
#define DEFAULT_INIT_STEPS "dtgvp" /* default -I setting */ |
#define DEFAULT_NXACTS 10 /* default nxacts */ |
#define ERRCODE_UNDEFINED_TABLE "42P01" |
Definition at line 76 of file pgbench.c.
Referenced by brin_desummarize_range(), brin_summarize_range(), bt_index_check_internal(), errorMissingRTE(), GetTableInfo(), MarkInheritDetached(), parserOpenTable(), pg_class_aclmask_ext(), pg_class_ownercheck(), pg_extension_config_dump(), plpgsql_parse_wordrowtype(), RangeVarGetRelidExtended(), RemoveInheritance(), transformLockingClause(), and vacuum_open_relation().
#define FNV_OFFSET_BASIS UINT64CONST(0xcbf29ce484222325) |
Definition at line 82 of file pgbench.c.
Referenced by getHashFnv1a().
#define FNV_PRIME UINT64CONST(0x100000001b3) |
Definition at line 81 of file pgbench.c.
Referenced by getHashFnv1a().
#define LOG_STEP_SECONDS 5 /* seconds between log messages */ |
Definition at line 173 of file pgbench.c.
Referenced by initGenerateDataClientSide().
#define M_PI 3.14159265358979323846 |
Definition at line 73 of file pgbench.c.
Referenced by evalStandardFunc(), and getGaussianRand().
#define MAX_ARGS 256 |
Definition at line 521 of file pgbench.c.
Referenced by parseQuery(), process_backslash_command(), and sendCommand().
#define MAX_FARGS 16 |
Definition at line 2047 of file pgbench.c.
Referenced by evalStandardFunc().
#define MAX_PREPARE_NAME 32 |
Definition at line 2819 of file pgbench.c.
Referenced by sendCommand().
#define MAX_SCRIPTS 128 /* max number of SQL scripts allowed */ |
Definition at line 306 of file pgbench.c.
Referenced by addScript().
#define MAX_ZIPFIAN_PARAM 1000.0 /* maximum parameter for zipfian */ |
Definition at line 179 of file pgbench.c.
Referenced by evalStandardFunc(), and getZipfianRand().
#define META_COMMAND 2 |
Definition at line 515 of file pgbench.c.
Referenced by advanceConnectionState(), CheckConditional(), executeMetaCommand(), and process_backslash_command().
#define MIN_GAUSSIAN_PARAM 2.0 /* minimum parameter for gauss */ |
Definition at line 176 of file pgbench.c.
Referenced by evalStandardFunc(), and getGaussianRand().
#define MIN_ZIPFIAN_PARAM 1.001 /* minimum parameter for zipfian */ |
Definition at line 178 of file pgbench.c.
Referenced by evalStandardFunc(), and getZipfianRand().
#define MM2_MUL UINT64CONST(0xc6a4a7935bd1e995) |
Definition at line 83 of file pgbench.c.
Referenced by getHashMurmur2().
#define MM2_MUL_TIMES_8 UINT64CONST(0x35253c9ade8f4ca8) |
Definition at line 84 of file pgbench.c.
Referenced by getHashMurmur2().
#define MM2_ROT 47 |
Definition at line 85 of file pgbench.c.
Referenced by getHashMurmur2().
#define naccounts 100000 |
Definition at line 254 of file pgbench.c.
Referenced by createPartitions(), initGenerateDataClientSide(), and initGenerateDataServerSide().
#define nbranches |
Definition at line 251 of file pgbench.c.
Referenced by initGenerateDataClientSide(), and initGenerateDataServerSide().
#define ntellers 10 |
Definition at line 253 of file pgbench.c.
Referenced by initGenerateDataClientSide(), and initGenerateDataServerSide().
#define PARAMS_ARRAY_SIZE 7 |
Referenced by doConnect().
#define PG_TIME_GET_DOUBLE | ( | t | ) | (0.000001 * (t)) |
Definition at line 689 of file pgbench.c.
Referenced by advanceConnectionState(), initGenerateDataClientSide(), printProgressReport(), printResults(), and runInitSteps().
#define SCALE_32BIT_THRESHOLD 20000 |
Definition at line 263 of file pgbench.c.
Referenced by initCreateTables().
#define SHELL_COMMAND_SIZE 256 /* maximum size allowed for shell command */ |
Definition at line 307 of file pgbench.c.
Referenced by runShellCommand().
#define SOCKET_WAIT_METHOD "select" |
Definition at line 104 of file pgbench.c.
Referenced by threadRun().
#define SQL_COMMAND 1 |
Definition at line 514 of file pgbench.c.
Referenced by advanceConnectionState(), create_sql_command(), main(), ParseScript(), postprocess_sql_command(), and sendCommand().
#define THREAD_BARRIER_DESTROY | ( | barrier | ) |
#define THREAD_BARRIER_WAIT | ( | barrier | ) |
Definition at line 162 of file pgbench.c.
Referenced by threadRun().
#define THREAD_FUNC_RETURN return NULL |
Definition at line 158 of file pgbench.c.
Referenced by threadRun().
#define THREAD_FUNC_RETURN_TYPE void * |
#define WSEP '@' /* weight separator */ |
Definition at line 285 of file pgbench.c.
Referenced by parseScriptWeight().
typedef struct BuiltinScript BuiltinScript |
typedef enum MetaCommand MetaCommand |
typedef struct ParsedScript ParsedScript |
typedef int64 pg_time_usec_t |
typedef struct RandomState RandomState |
typedef struct SimpleStats SimpleStats |
typedef struct socket_set socket_set |
enum ConnectionStateEnum |
Definition at line 362 of file pgbench.c.
enum MetaCommand |
Enumerator | |
---|---|
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_ENDPIPELINE |
Definition at line 523 of file pgbench.c.
enum partition_method_t |
Enumerator | |
---|---|
PART_NONE | |
PART_RANGE | |
PART_HASH |
enum QueryMode |
Enumerator | |
---|---|
QUERY_SIMPLE | |
QUERY_EXTENDED | |
QUERY_PREPARED | |
NUM_QUERYMODE |
Definition at line 540 of file pgbench.c.
Definition at line 1295 of file pgbench.c.
References addToSimpleStats(), StatsData::cnt, StatsData::lag, StatsData::latency, StatsData::skipped, and throttle_delay.
Referenced by doLog(), and processXactStats().
|
static |
Definition at line 6994 of file pgbench.c.
References fd(), socket_set::fds, socket_set::maxfd, and pg_log_fatal.
Referenced by setalarm(), and threadRun().
|
static |
Definition at line 5379 of file pgbench.c.
References CheckConditional(), ParsedScript::commands, ParsedScript::desc, MAX_SCRIPTS, num_scripts, and pg_log_fatal.
Referenced by ParseScript().
|
static |
Definition at line 1251 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 3119 of file pgbench.c.
References addToSimpleStats(), Assert, 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(), TState::conn_duration, CState::cstack, CSTATE_ABORTED, CSTATE_CHOOSE_SCRIPT, CSTATE_END_COMMAND, CSTATE_END_TX, CSTATE_FINISHED, CSTATE_PREPARE_THROTTLE, CSTATE_SKIP_COMMAND, CSTATE_SLEEP, CSTATE_START_COMMAND, CSTATE_START_TX, CSTATE_THROTTLE, CSTATE_WAIT_RESULT, ParsedScript::desc, doConnect(), duration, end_time, executeMetaCommand(), finishCon(), getPoissonRand(), 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_log_debug, pg_log_error, PG_TIME_GET_DOUBLE, pg_time_now(), pg_time_now_lazy(), PQ_PIPELINE_OFF, PQ_PIPELINE_ON, PQconsumeInput(), PQisBusy(), PQpipelineStatus(), CState::prepared, processXactStats(), readCommandResponse(), report_per_command, sendCommand(), SQL_COMMAND, CState::state, Command::stats, CState::stmt_begin, throttle_delay, TState::throttle_trigger, timer_exceeded, TState::ts_throttle_rs, CState::txn_begin, CState::txn_scheduled, Command::type, CState::use_file, and Command::varprefix.
Referenced by threadRun().
|
static |
Definition at line 6975 of file pgbench.c.
References pg_malloc0().
Referenced by setalarm(), and threadRun().
|
static |
Definition at line 1742 of file pgbench.c.
References free, getVariable(), name, parseVariable(), replaceVariable(), and val.
Referenced by sendCommand().
|
static |
Definition at line 5029 of file pgbench.c.
References ParsedScript::commands, conditional_stack_create(), conditional_stack_destroy(), conditional_stack_empty(), conditional_stack_peek(), conditional_stack_poke(), conditional_stack_pop(), conditional_stack_push(), ConditionError(), ParsedScript::desc, i, IFSTATE_ELSE_FALSE, IFSTATE_FALSE, Command::meta, META_COMMAND, META_ELIF, META_ELSE, META_ENDIF, META_IF, and Command::type.
Referenced by addScript().
|
static |
Definition at line 4374 of file pgbench.c.
References ALL_INIT_STEPS, pg_log_fatal, and pg_log_info.
Referenced by main().
|
static |
Definition at line 2835 of file pgbench.c.
References getrand(), i, num_scripts, total_weight, TState::ts_choose_rs, and ParsedScript::weight.
Referenced by advanceConnectionState().
|
static |
Definition at line 6987 of file pgbench.c.
References socket_set::fds, and socket_set::maxfd.
Referenced by setalarm(), and threadRun().
|
static |
Definition at line 1809 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 1878 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 1850 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 2827 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 1412 of file pgbench.c.
References name.
Referenced by lookupVariable().
|
static |
Definition at line 1043 of file pgbench.c.
References pg_erand48(), and RandomState::xseed.
Referenced by getZipfianRand().
|
static |
Definition at line 5018 of file pgbench.c.
References pg_log_fatal.
Referenced by CheckConditional().
|
static |
Definition at line 4727 of file pgbench.c.
References appendPQExpBufferStr(), Command::argc, Command::argv, PQExpBufferData::data, Command::expr, Command::first_line, initPQExpBuffer(), initSimpleStats(), Command::lines, Command::meta, META_NONE, pg_malloc(), skip_sql_comments(), SQL_COMMAND, Command::stats, Command::type, and Command::varprefix.
Referenced by ParseScript().
|
static |
Definition at line 3936 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 3902 of file pgbench.c.
References finishCon(), and i.
Referenced by main(), and threadRun().
|
static |
Definition at line 1347 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 3777 of file pgbench.c.
References accumStats(), agg_interval, Assert, StatsData::cnt, CState::cnt, fprintf, CState::id, initStats(), INT64_FORMAT, StatsData::lag, StatsData::latency, latency_limit, logfile, TState::logfile, SimpleStats::max, SimpleStats::min, now(), pg_erand48(), pg_time_now(), sample_rate, StatsData::skipped, StatsData::start_time, SimpleStats::sum, SimpleStats::sum2, throttle_delay, TState::ts_sample_rs, CState::use_file, use_log, and RandomState::xseed.
Referenced by processXactStats(), and threadRun().
|
static |
Definition at line 2619 of file pgbench.c.
References evalLazyFunc(), evalStandardFunc(), and isLazyFunc().
Referenced by evaluateExpr().
|
static |
Definition at line 1937 of file pgbench.c.
References a1, a2, Assert, coerceToBool(), evaluateExpr(), PgBenchExprLink::expr, isLazyFunc(), PgBenchExprLink::next, PGBENCH_AND, PGBENCH_CASE, PGBENCH_OR, PGBT_NULL, setBoolValue(), setNullValue(), PgBenchValue::type, and valueTruth().
Referenced by evalFunc().
|
static |
Definition at line 2054 of file pgbench.c.
References generate_unaccent_rules::args, Assert, PgBenchValue::bval, coerceToBool(), coerceToDouble(), coerceToInt(), CState::command, CState::cs_func_rs, PgBenchValue::dval, evaluateExpr(), 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(), PgBenchValue::type, generate_unaccent_rules::type, PgBenchValue::u, CState::use_file, and val.
Referenced by evalFunc().
|
static |
Definition at line 2635 of file pgbench.c.
References PgBenchExpr::constant, ENODE_CONSTANT, ENODE_FUNCTION, ENODE_VARIABLE, PgBenchExpr::etype, evalFunc(), PgBenchExpr::function, lookupVariable(), makeVariableValue(), pg_log_error, pg_log_fatal, PgBenchExpr::u, Variable::value, and PgBenchExpr::variable.
Referenced by evalLazyFunc(), evalStandardFunc(), and executeMetaCommand().
Definition at line 3075 of file pgbench.c.
References getVariable(), pg_log_error, and pg_strcasecmp().
Referenced by executeMetaCommand().
|
static |
Definition at line 3578 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, PQExpBufferData::data, 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, PG_LOG_DEBUG, pg_log_debug, pg_time_now_lazy(), PQ_PIPELINE_OFF, PQ_PIPELINE_ON, PQenterPipelineMode(), PQpipelineStatus(), PQpipelineSync(), printfPQExpBuffer(), putVariableValue(), QUERY_SIMPLE, querymode, runShellCommand(), CState::sleep_until, termPQExpBuffer(), Command::type, unlikely, CState::use_file, and valueTruth().
Referenced by advanceConnectionState().
|
static |
Definition at line 1316 of file pgbench.c.
References pg_log_fatal, pg_log_info, PGRES_COMMAND_OK, PQclear(), PQerrorMessage(), PQexec(), and PQresultStatus().
Referenced by createPartitions(), initCreateFKeys(), initCreatePKeys(), initCreateTables(), initDropTables(), initGenerateDataClientSide(), initGenerateDataServerSide(), initTruncateTables(), and initVacuum().
|
static |
Definition at line 5300 of file pgbench.c.
References i, lengthof, listAvailableScripts(), and pg_log_fatal.
Referenced by main().
|
static |
Definition at line 6807 of file pgbench.c.
References CState::con, and PQfinish().
Referenced by advanceConnectionState(), and disconnect_all().
|
static |
Definition at line 4753 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 |
Definition at line 6981 of file pgbench.c.
References pg_free().
Referenced by setalarm(), and threadRun().
|
static |
Definition at line 937 of file pgbench.c.
References Assert, pg_erand48(), and RandomState::xseed.
Referenced by evalStandardFunc().
|
static |
Definition at line 961 of file pgbench.c.
References Assert, M_PI, MIN_GAUSSIAN_PARAM, pg_erand48(), and RandomState::xseed.
Referenced by evalStandardFunc().
|
static |
Definition at line 1087 of file pgbench.c.
References FNV_OFFSET_BASIS, FNV_PRIME, and i.
Referenced by evalStandardFunc().
|
static |
Definition at line 1112 of file pgbench.c.
References MM2_MUL, MM2_MUL_TIMES_8, and MM2_ROT.
Referenced by evalStandardFunc().
|
static |
Definition at line 2679 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, and pg_strcasecmp().
Referenced by process_backslash_command().
|
static |
Definition at line 1021 of file pgbench.c.
References pg_erand48(), and RandomState::xseed.
Referenced by advanceConnectionState().
Definition at line 1778 of file pgbench.c.
References Command::argc, Command::argv, getVariable(), and i.
Referenced by sendCommand().
|
static |
Definition at line 917 of file pgbench.c.
References pg_erand48(), and RandomState::xseed.
Referenced by chooseScript(), evalStandardFunc(), and permute().
Definition at line 4482 of file pgbench.c.
References Assert, ERRCODE_UNDEFINED_TABLE, PART_HASH, PART_NONE, PART_RANGE, partition_method, partitions, PG_DIAG_SQLSTATE, pg_log_fatal, pg_log_info, pg_log_warning, PGRES_TUPLES_OK, PQclear(), PQdb(), PQerrorMessage(), PQexec(), PQgetisnull(), PQgetvalue(), PQntuples(), PQresultErrorField(), PQresultStatus(), and scale.
Referenced by main().
|
static |
Definition at line 1447 of file pgbench.c.
References Assert, PgBenchValue::bval, PgBenchValue::dval, INT64_FORMAT, PgBenchValue::ival, lookupVariable(), 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 1073 of file pgbench.c.
References Assert, computeIterativeZipfian(), MAX_ZIPFIAN_PARAM, and MIN_ZIPFIAN_PARAM.
Referenced by evalStandardFunc().
|
static |
|
static |
Definition at line 4348 of file pgbench.c.
References executeStatement(), fprintf, i, and lengthof.
Referenced by runInitSteps().
|
static |
Definition at line 4310 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 4005 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 3914 of file pgbench.c.
References executeStatement(), and fprintf.
Referenced by runInitSteps().
|
static |
Definition at line 4113 of file pgbench.c.
References CancelRequested, PQExpBufferData::data, executeStatement(), fprintf, i, initPQExpBuffer(), initTruncateTables(), INT64_FORMAT, LOG_STEP_SECONDS, naccounts, nbranches, ntellers, pg_log_fatal, PG_TIME_GET_DOUBLE, pg_time_now(), PGRES_COPY_IN, PQclear(), PQendcopy(), PQerrorMessage(), PQexec(), PQputline(), PQresultStatus(), printfPQExpBuffer(), scale, termPQExpBuffer(), and use_quiet.
Referenced by runInitSteps().
|
static |
Definition at line 4252 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 898 of file pgbench.c.
References pg_jrand48(), and RandomState::xseed.
Referenced by main().
|
static |
Definition at line 1242 of file pgbench.c.
Referenced by create_sql_command(), initStats(), and process_backslash_command().
|
static |
Definition at line 1282 of file pgbench.c.
References StatsData::cnt, initSimpleStats(), StatsData::lag, StatsData::latency, StatsData::skipped, and StatsData::start_time.
Referenced by doLog(), main(), ParseScript(), printProgressReport(), and threadRun().
|
static |
Definition at line 4100 of file pgbench.c.
References executeStatement().
Referenced by initGenerateDataClientSide(), and initGenerateDataServerSide().
|
static |
Definition at line 4297 of file pgbench.c.
References executeStatement(), and fprintf.
Referenced by runInitSteps().
|
static |
Definition at line 761 of file pgbench.c.
References generate_unaccent_rules::str.
Referenced by makeVariableValue().
|
static |
Definition at line 1930 of file pgbench.c.
References PGBENCH_AND, PGBENCH_CASE, and PGBENCH_OR.
Referenced by evalFunc(), and evalLazyFunc().
|
static |
Definition at line 1590 of file pgbench.c.
References lookupVariable(), Variable::name, CState::nvariables, pg_log_error, pg_malloc(), pg_realloc(), pg_strdup(), Variable::svalue, valid_variable_name(), CState::variables, and CState::vars_sorted.
Referenced by putVariable(), and putVariableValue().
Definition at line 1420 of file pgbench.c.
References compareVariableNames(), sort-test::key, Variable::name, name, CState::nvariables, qsort, CState::variables, and CState::vars_sorted.
Referenced by evaluateExpr(), getVariable(), lookupCreateVariable(), and main().