PostgreSQL Source Code
git master
|
#include "postgres_fe.h"
#include <sys/select.h>
#include <sys/time.h>
#include "datatype/timestamp.h"
#include "isolationtester.h"
#include "libpq-fe.h"
#include "pg_getopt.h"
#include "pqexpbuffer.h"
Go to the source code of this file.
Data Structures | |
struct | IsoConnInfo |
Macros | |
#define | PREP_WAITING "isolationtester_waiting" |
#define | STEP_NONBLOCK 0x1 /* return as soon as cmd waits for a lock */ |
#define | STEP_RETRY 0x2 /* this is a retry of a previously-waiting cmd */ |
Typedefs | |
typedef struct IsoConnInfo | IsoConnInfo |
Functions | |
static void | check_testspec (TestSpec *testspec) |
static void | run_testspec (TestSpec *testspec) |
static void | run_all_permutations (TestSpec *testspec) |
static void | run_all_permutations_recurse (TestSpec *testspec, int *piles, int nsteps, PermutationStep **steps) |
static void | run_named_permutations (TestSpec *testspec) |
static void | run_permutation (TestSpec *testspec, int nsteps, PermutationStep **steps) |
static int | try_complete_steps (TestSpec *testspec, PermutationStep **waiting, int nwaiting, int flags) |
static bool | try_complete_step (TestSpec *testspec, PermutationStep *pstep, int flags) |
static int | step_qsort_cmp (const void *a, const void *b) |
static int | step_bsearch_cmp (const void *a, const void *b) |
static bool | step_has_blocker (PermutationStep *pstep) |
static void | printResultSet (PGresult *res) |
static void | isotesterNoticeProcessor (void *arg, const char *message) |
static void | blackholeNoticeProcessor (void *arg, const char *message) |
static void | disconnect_atexit (void) |
int | main (int argc, char **argv) |
Variables | |
static IsoConnInfo * | conns = NULL |
static int | nconns = 0 |
static bool | any_new_notice = false |
static int64 | max_step_wait = 360 * USECS_PER_SEC |
#define PREP_WAITING "isolationtester_waiting" |
Definition at line 19 of file isolationtester.c.
Definition at line 60 of file isolationtester.c.
Definition at line 61 of file isolationtester.c.
typedef struct IsoConnInfo IsoConnInfo |
|
static |
Definition at line 1139 of file isolationtester.c.
Referenced by main().
|
static |
Definition at line 252 of file isolationtester.c.
References PermutationStep::blockers, PermutationStepBlocker::blocktype, exit(), fprintf, free, i, j, name, PermutationStep::name, PermutationStep::nblockers, TestSpec::npermutations, TestSpec::nsessions, Session::nsteps, Permutation::nsteps, TestSpec::permutations, pg_malloc(), PSB_ONCE, qsort, Step::session, TestSpec::sessions, PermutationStepBlocker::step, PermutationStep::step, step_bsearch_cmp(), step_qsort_cmp(), PermutationStepBlocker::stepname, Session::steps, Permutation::steps, and Step::used.
Referenced by main().
|
static |
Definition at line 77 of file isolationtester.c.
References conn, conns, i, nconns, and PQfinish().
Referenced by main().
|
static |
Definition at line 1126 of file isolationtester.c.
References any_new_notice, arg, printf, IsoConnInfo::sessionname, and IsoConnInfo::total_notices.
Referenced by main().
int main | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 87 of file isolationtester.c.
References appendPQExpBuffer(), appendPQExpBufferStr(), IsoConnInfo::backend_pid, IsoConnInfo::backend_pid_str, blackholeNoticeProcessor(), check_testspec(), conn, IsoConnInfo::conn, CONNECTION_OK, conns, PQExpBufferData::data, disconnect_atexit(), exit(), EXIT_FAILURE, fprintf, getopt(), i, initPQExpBuffer(), isotesterNoticeProcessor(), max_step_wait, Session::name, nconns, TestSpec::nsessions, optind, parseresult, pg_malloc0(), PGRES_COMMAND_OK, PGRES_TUPLES_OK, PQbackendPID(), PQclear(), PQconnectdb(), PQerrorMessage(), PQexecParams(), PQprepare(), PQresultStatus(), PQsetNoticeProcessor(), PQstatus(), PREP_WAITING, printf, psprintf(), res, run_testspec(), IsoConnInfo::sessionname, TestSpec::sessions, spec_yyparse(), generate_unaccent_rules::stdout, termPQExpBuffer(), and USECS_PER_SEC.
|
static |
Definition at line 1113 of file isolationtester.c.
References _PQprintOpt::align, _PQprintOpt::fieldSep, _PQprintOpt::header, PQprint(), res, and generate_unaccent_rules::stdout.
Referenced by run_permutation(), and try_complete_step().
|
static |
Definition at line 406 of file isolationtester.c.
References free, i, TestSpec::nsessions, Session::nsteps, pg_malloc(), pg_malloc0(), run_all_permutations_recurse(), and TestSpec::sessions.
Referenced by run_testspec().
|
static |
Definition at line 446 of file isolationtester.c.
References i, Step::name, PermutationStep::name, TestSpec::nsessions, Session::nsteps, run_permutation(), TestSpec::sessions, PermutationStep::step, and Session::steps.
Referenced by run_all_permutations().
|
static |
Definition at line 486 of file isolationtester.c.
References i, TestSpec::npermutations, Permutation::nsteps, TestSpec::permutations, run_permutation(), and Permutation::steps.
Referenced by run_testspec().
|
static |
Definition at line 520 of file isolationtester.c.
References IsoConnInfo::active_step, PermutationStep::blockers, PermutationStepBlocker::blocktype, conn, IsoConnInfo::conn, conns, exit(), fprintf, free, gettimeofday(), i, j, max_step_wait, name, Step::name, PermutationStep::name, PermutationStep::nblockers, nconns, TestSpec::nsessions, TestSpec::nsetupsqls, PermutationStepBlocker::num_notices, pg_malloc(), PGRES_COMMAND_OK, PGRES_TUPLES_OK, PQclear(), PQerrorMessage(), PQexec(), PQresultStatus(), PQsendQuery(), printf, printResultSet(), PSB_NUM_NOTICES, res, Step::session, TestSpec::sessions, Session::setupsql, TestSpec::setupsqls, Step::sql, start_time, generate_unaccent_rules::stdout, PermutationStepBlocker::step, PermutationStep::step, STEP_NONBLOCK, STEP_RETRY, PermutationStepBlocker::target_notices, Session::teardownsql, TestSpec::teardownsql, IsoConnInfo::total_notices, try_complete_step(), try_complete_steps(), USECS_PER_SEC, and waiting.
Referenced by run_all_permutations_recurse(), and run_named_permutations().
|
static |
Definition at line 394 of file isolationtester.c.
References TestSpec::permutations, run_all_permutations(), and run_named_permutations().
Referenced by main().
|
static |
Definition at line 508 of file isolationtester.c.
References a, b, and Step::name.
Referenced by check_testspec().
|
static |
Definition at line 1080 of file isolationtester.c.
References IsoConnInfo::active_step, PermutationStep::blockers, PermutationStepBlocker::blocktype, conns, i, PermutationStep::nblockers, PSB_NUM_NOTICES, PSB_ONCE, PSB_OTHER_STEP, Step::session, PermutationStepBlocker::step, PermutationStep::step, PermutationStepBlocker::target_notices, and IsoConnInfo::total_notices.
Referenced by try_complete_step().
|
static |
Definition at line 499 of file isolationtester.c.
References a, b, and Step::name.
Referenced by check_testspec().
|
static |
Definition at line 818 of file isolationtester.c.
References IsoConnInfo::active_step, IsoConnInfo::backend_pid, IsoConnInfo::backend_pid_str, pgNotify::be_pid, PermutationStep::blockers, PermutationStepBlocker::blocktype, conn, IsoConnInfo::conn, conns, EINTR, exit(), pgNotify::extra, fprintf, gettimeofday(), i, max_step_wait, Session::name, Step::name, PermutationStep::nblockers, TestSpec::nsessions, PG_DIAG_MESSAGE_PRIMARY, PG_DIAG_SEVERITY, PGRES_COMMAND_OK, PGRES_EMPTY_QUERY, PGRES_FATAL_ERROR, PGRES_TUPLES_OK, PQcancelBlocking(), PQcancelCreate(), PQcancelErrorMessage(), PQcancelFinish(), PQclear(), PQconsumeInput(), PQerrorMessage(), PQexecPrepared(), PQfreemem(), PQgetResult(), PQgetvalue(), PQisBusy(), PQnotifies(), PQntuples(), PQresStatus(), PQresultErrorField(), PQresultErrorMessage(), PQresultStatus(), PQsocket(), PREP_WAITING, printf, printResultSet(), PSB_ONCE, pgNotify::relname, res, select, Step::session, IsoConnInfo::sessionname, TestSpec::sessions, snprintf, Step::sql, start_time, PermutationStep::step, step_has_blocker(), STEP_NONBLOCK, STEP_RETRY, USECS_PER_SEC, and waiting.
Referenced by run_permutation(), and try_complete_steps().
|
static |
Definition at line 755 of file isolationtester.c.
References any_new_notice, try_complete_step(), and waiting.
Referenced by run_permutation().
Definition at line 44 of file isolationtester.c.
Referenced by isotesterNoticeProcessor(), and try_complete_steps().
|
static |
Definition at line 40 of file isolationtester.c.
Referenced by describeRoles(), disconnect_atexit(), main(), run_permutation(), step_has_blocker(), and try_complete_step().
|
static |
Definition at line 47 of file isolationtester.c.
Referenced by main(), run_permutation(), and try_complete_step().
|
static |
Definition at line 41 of file isolationtester.c.
Referenced by disconnect_atexit(), main(), and run_permutation().