mirror of
https://github.com/postgres/postgres.git
synced 2025-05-28 00:03:23 -04:00
Indicate session name in isolationtester notices
When a session under isolationtester produces printable notices (NOTICE, WARNING) we were just printing them unadorned, which can be confusing when debugging. Prefix them with the session name, which makes things clearer. Author: Álvaro Herrera Reviewed-by: Hari Babu Kommi Discussion: https://postgr.es/m/20181024213451.75nh3f3dctmcdbfq@alvherre.pgsql
This commit is contained in:
parent
319a810180
commit
a28e10e82e
@ -10,7 +10,7 @@ step drop_and_commit:
|
||||
DROP TABLE part2;
|
||||
COMMIT;
|
||||
|
||||
WARNING: skipping vacuum of "part2" --- relation no longer exists
|
||||
s2: WARNING: skipping vacuum of "part2" --- relation no longer exists
|
||||
step vac_specified: <... completed>
|
||||
|
||||
starting permutation: lock vac_all_parts drop_and_commit
|
||||
@ -35,7 +35,7 @@ step drop_and_commit:
|
||||
DROP TABLE part2;
|
||||
COMMIT;
|
||||
|
||||
WARNING: skipping analyze of "part2" --- relation no longer exists
|
||||
s2: WARNING: skipping analyze of "part2" --- relation no longer exists
|
||||
step analyze_specified: <... completed>
|
||||
|
||||
starting permutation: lock analyze_all_parts drop_and_commit
|
||||
@ -60,7 +60,7 @@ step drop_and_commit:
|
||||
DROP TABLE part2;
|
||||
COMMIT;
|
||||
|
||||
WARNING: skipping vacuum of "part2" --- relation no longer exists
|
||||
s2: WARNING: skipping vacuum of "part2" --- relation no longer exists
|
||||
step vac_analyze_specified: <... completed>
|
||||
|
||||
starting permutation: lock vac_analyze_all_parts drop_and_commit
|
||||
|
@ -4,7 +4,7 @@ starting permutation: s1_begin s1_lock s2_auth s2_vacuum s1_commit s2_reset
|
||||
step s1_begin: BEGIN;
|
||||
step s1_lock: LOCK vacuum_tab IN SHARE UPDATE EXCLUSIVE MODE;
|
||||
step s2_auth: SET ROLE regress_vacuum_conflict;
|
||||
WARNING: skipping "vacuum_tab" --- only table or database owner can vacuum it
|
||||
s2: WARNING: skipping "vacuum_tab" --- only table or database owner can vacuum it
|
||||
step s2_vacuum: VACUUM vacuum_tab;
|
||||
step s1_commit: COMMIT;
|
||||
step s2_reset: RESET ROLE;
|
||||
@ -12,7 +12,7 @@ step s2_reset: RESET ROLE;
|
||||
starting permutation: s1_begin s2_auth s2_vacuum s1_lock s1_commit s2_reset
|
||||
step s1_begin: BEGIN;
|
||||
step s2_auth: SET ROLE regress_vacuum_conflict;
|
||||
WARNING: skipping "vacuum_tab" --- only table or database owner can vacuum it
|
||||
s2: WARNING: skipping "vacuum_tab" --- only table or database owner can vacuum it
|
||||
step s2_vacuum: VACUUM vacuum_tab;
|
||||
step s1_lock: LOCK vacuum_tab IN SHARE UPDATE EXCLUSIVE MODE;
|
||||
step s1_commit: COMMIT;
|
||||
@ -22,14 +22,14 @@ starting permutation: s1_begin s2_auth s1_lock s2_vacuum s1_commit s2_reset
|
||||
step s1_begin: BEGIN;
|
||||
step s2_auth: SET ROLE regress_vacuum_conflict;
|
||||
step s1_lock: LOCK vacuum_tab IN SHARE UPDATE EXCLUSIVE MODE;
|
||||
WARNING: skipping "vacuum_tab" --- only table or database owner can vacuum it
|
||||
s2: WARNING: skipping "vacuum_tab" --- only table or database owner can vacuum it
|
||||
step s2_vacuum: VACUUM vacuum_tab;
|
||||
step s1_commit: COMMIT;
|
||||
step s2_reset: RESET ROLE;
|
||||
|
||||
starting permutation: s2_auth s2_vacuum s1_begin s1_lock s1_commit s2_reset
|
||||
step s2_auth: SET ROLE regress_vacuum_conflict;
|
||||
WARNING: skipping "vacuum_tab" --- only table or database owner can vacuum it
|
||||
s2: WARNING: skipping "vacuum_tab" --- only table or database owner can vacuum it
|
||||
step s2_vacuum: VACUUM vacuum_tab;
|
||||
step s1_begin: BEGIN;
|
||||
step s1_lock: LOCK vacuum_tab IN SHARE UPDATE EXCLUSIVE MODE;
|
||||
@ -40,7 +40,7 @@ starting permutation: s1_begin s1_lock s2_auth s2_analyze s1_commit s2_reset
|
||||
step s1_begin: BEGIN;
|
||||
step s1_lock: LOCK vacuum_tab IN SHARE UPDATE EXCLUSIVE MODE;
|
||||
step s2_auth: SET ROLE regress_vacuum_conflict;
|
||||
WARNING: skipping "vacuum_tab" --- only table or database owner can analyze it
|
||||
s2: WARNING: skipping "vacuum_tab" --- only table or database owner can analyze it
|
||||
step s2_analyze: ANALYZE vacuum_tab;
|
||||
step s1_commit: COMMIT;
|
||||
step s2_reset: RESET ROLE;
|
||||
@ -48,7 +48,7 @@ step s2_reset: RESET ROLE;
|
||||
starting permutation: s1_begin s2_auth s2_analyze s1_lock s1_commit s2_reset
|
||||
step s1_begin: BEGIN;
|
||||
step s2_auth: SET ROLE regress_vacuum_conflict;
|
||||
WARNING: skipping "vacuum_tab" --- only table or database owner can analyze it
|
||||
s2: WARNING: skipping "vacuum_tab" --- only table or database owner can analyze it
|
||||
step s2_analyze: ANALYZE vacuum_tab;
|
||||
step s1_lock: LOCK vacuum_tab IN SHARE UPDATE EXCLUSIVE MODE;
|
||||
step s1_commit: COMMIT;
|
||||
@ -58,14 +58,14 @@ starting permutation: s1_begin s2_auth s1_lock s2_analyze s1_commit s2_reset
|
||||
step s1_begin: BEGIN;
|
||||
step s2_auth: SET ROLE regress_vacuum_conflict;
|
||||
step s1_lock: LOCK vacuum_tab IN SHARE UPDATE EXCLUSIVE MODE;
|
||||
WARNING: skipping "vacuum_tab" --- only table or database owner can analyze it
|
||||
s2: WARNING: skipping "vacuum_tab" --- only table or database owner can analyze it
|
||||
step s2_analyze: ANALYZE vacuum_tab;
|
||||
step s1_commit: COMMIT;
|
||||
step s2_reset: RESET ROLE;
|
||||
|
||||
starting permutation: s2_auth s2_analyze s1_begin s1_lock s1_commit s2_reset
|
||||
step s2_auth: SET ROLE regress_vacuum_conflict;
|
||||
WARNING: skipping "vacuum_tab" --- only table or database owner can analyze it
|
||||
s2: WARNING: skipping "vacuum_tab" --- only table or database owner can analyze it
|
||||
step s2_analyze: ANALYZE vacuum_tab;
|
||||
step s1_begin: BEGIN;
|
||||
step s1_lock: LOCK vacuum_tab IN SHARE UPDATE EXCLUSIVE MODE;
|
||||
|
@ -5,7 +5,7 @@ step lock_share:
|
||||
BEGIN;
|
||||
LOCK part1 IN SHARE MODE;
|
||||
|
||||
WARNING: skipping vacuum of "part1" --- lock not available
|
||||
s2: WARNING: skipping vacuum of "part1" --- lock not available
|
||||
step vac_specified: VACUUM (SKIP_LOCKED) part1, part2;
|
||||
step commit:
|
||||
COMMIT;
|
||||
@ -26,7 +26,7 @@ step lock_share:
|
||||
BEGIN;
|
||||
LOCK part1 IN SHARE MODE;
|
||||
|
||||
WARNING: skipping analyze of "part1" --- lock not available
|
||||
s2: WARNING: skipping analyze of "part1" --- lock not available
|
||||
step analyze_specified: ANALYZE (SKIP_LOCKED) part1, part2;
|
||||
step commit:
|
||||
COMMIT;
|
||||
@ -47,7 +47,7 @@ step lock_share:
|
||||
BEGIN;
|
||||
LOCK part1 IN SHARE MODE;
|
||||
|
||||
WARNING: skipping vacuum of "part1" --- lock not available
|
||||
s2: WARNING: skipping vacuum of "part1" --- lock not available
|
||||
step vac_analyze_specified: VACUUM (ANALYZE, SKIP_LOCKED) part1, part2;
|
||||
step commit:
|
||||
COMMIT;
|
||||
@ -68,7 +68,7 @@ step lock_share:
|
||||
BEGIN;
|
||||
LOCK part1 IN SHARE MODE;
|
||||
|
||||
WARNING: skipping vacuum of "part1" --- lock not available
|
||||
s2: WARNING: skipping vacuum of "part1" --- lock not available
|
||||
step vac_full_specified: VACUUM (SKIP_LOCKED, FULL) part1, part2;
|
||||
step commit:
|
||||
COMMIT;
|
||||
@ -89,7 +89,7 @@ step lock_access_exclusive:
|
||||
BEGIN;
|
||||
LOCK part1 IN ACCESS EXCLUSIVE MODE;
|
||||
|
||||
WARNING: skipping vacuum of "part1" --- lock not available
|
||||
s2: WARNING: skipping vacuum of "part1" --- lock not available
|
||||
step vac_specified: VACUUM (SKIP_LOCKED) part1, part2;
|
||||
step commit:
|
||||
COMMIT;
|
||||
@ -110,7 +110,7 @@ step lock_access_exclusive:
|
||||
BEGIN;
|
||||
LOCK part1 IN ACCESS EXCLUSIVE MODE;
|
||||
|
||||
WARNING: skipping analyze of "part1" --- lock not available
|
||||
s2: WARNING: skipping analyze of "part1" --- lock not available
|
||||
step analyze_specified: ANALYZE (SKIP_LOCKED) part1, part2;
|
||||
step commit:
|
||||
COMMIT;
|
||||
@ -132,7 +132,7 @@ step lock_access_exclusive:
|
||||
BEGIN;
|
||||
LOCK part1 IN ACCESS EXCLUSIVE MODE;
|
||||
|
||||
WARNING: skipping vacuum of "part1" --- lock not available
|
||||
s2: WARNING: skipping vacuum of "part1" --- lock not available
|
||||
step vac_analyze_specified: VACUUM (ANALYZE, SKIP_LOCKED) part1, part2;
|
||||
step commit:
|
||||
COMMIT;
|
||||
@ -154,7 +154,7 @@ step lock_access_exclusive:
|
||||
BEGIN;
|
||||
LOCK part1 IN ACCESS EXCLUSIVE MODE;
|
||||
|
||||
WARNING: skipping vacuum of "part1" --- lock not available
|
||||
s2: WARNING: skipping vacuum of "part1" --- lock not available
|
||||
step vac_full_specified: VACUUM (SKIP_LOCKED, FULL) part1, part2;
|
||||
step commit:
|
||||
COMMIT;
|
||||
|
@ -48,6 +48,8 @@ static int step_qsort_cmp(const void *a, const void *b);
|
||||
static int step_bsearch_cmp(const void *a, const void *b);
|
||||
|
||||
static void printResultSet(PGresult *res);
|
||||
static void isotesterNoticeProcessor(void *arg, const char *message);
|
||||
static void blackholeNoticeProcessor(void *arg, const char *message);
|
||||
|
||||
/* close all connections and exit */
|
||||
static void
|
||||
@ -171,6 +173,21 @@ main(int argc, char **argv)
|
||||
exit_nicely();
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up notice processors for the user-defined connections, so that
|
||||
* messages can get printed prefixed with the session names. The
|
||||
* control connection gets a "blackhole" processor instead (hides all
|
||||
* messages).
|
||||
*/
|
||||
if (i != 0)
|
||||
PQsetNoticeProcessor(conns[i],
|
||||
isotesterNoticeProcessor,
|
||||
(void *) (testspec->sessions[i - 1]->name));
|
||||
else
|
||||
PQsetNoticeProcessor(conns[i],
|
||||
blackholeNoticeProcessor,
|
||||
NULL);
|
||||
|
||||
/*
|
||||
* Suppress NOTIFY messages, which otherwise pop into results at odd
|
||||
* places.
|
||||
@ -881,3 +898,17 @@ printResultSet(PGresult *res)
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* notice processor, prefixes each message with the session name */
|
||||
static void
|
||||
isotesterNoticeProcessor(void *arg, const char *message)
|
||||
{
|
||||
fprintf(stderr, "%s: %s", (char *) arg, message);
|
||||
}
|
||||
|
||||
/* notice processor, hides the message */
|
||||
static void
|
||||
blackholeNoticeProcessor(void *arg, const char *message)
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user