From: | Marina Polyakova <m(dot)polyakova(at)postgrespro(dot)ru> |
---|---|
To: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
Cc: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, pgsql-hackers(at)postgresql(dot)org, Ildus Kurbangaliev <i(dot)kurbangaliev(at)postgrespro(dot)ru>, Teodor Sigaev <teodor(at)sigaev(dot)ru> |
Subject: | Re: [HACKERS] WIP Patch: Pgbench Serialization and deadlock errors |
Date: | 2018-06-14 12:11:13 |
Message-ID: | [email protected] |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 13-06-2018 22:59, Alvaro Herrera wrote:
> For context: in the backend, elog() is only used for internal messages
> (i.e. "can't-happen" conditions), and ereport() is used for user-facing
> messages. There are many things ereport() has that elog() doesn't,
> such
> as additional message fields (HINT, DETAIL, etc) that I think could
> have
> some use in pgbench as well. If you use elog() then you can't have
> that.
AFAIU originally it was not supposed that the pgbench error messages
have these fields, so will it be good to change the final output to
stderr?.. For example:
- fprintf(stderr, "%s", PQerrorMessage(con));
- fprintf(stderr, "(ignoring this error and continuing anyway)\n");
+ ereport(LOG,
+ (errmsg("Ignoring the server error and continuing anyway"),
+ errdetail("%s", PQerrorMessage(con))));
- fprintf(stderr, "%s", PQerrorMessage(con));
- if (sqlState && strcmp(sqlState, ERRCODE_UNDEFINED_TABLE) == 0)
- {
- fprintf(stderr, "Perhaps you need to do initialization (\"pgbench
-i\") in database \"%s\"\n", PQdb(con));
- }
-
- exit(1);
+ ereport(ERROR,
+ (errmsg("Server error"),
+ errdetail("%s", PQerrorMessage(con)),
+ sqlState && strcmp(sqlState, ERRCODE_UNDEFINED_TABLE) == 0 ?
+ errhint("Perhaps you need to do initialization (\"pgbench -i\")
in database \"%s\"\n",
+ PQdb(con)) : 0));
--
Marina Polyakova
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
From | Date | Subject | |
---|---|---|---|
Next Message | Fabio Pardi | 2018-06-14 12:14:00 | Re: question on streaming replication |
Previous Message | Rajkumar Raghuwanshi | 2018-06-14 11:56:23 | server crashed with TRAP: FailedAssertion("!(!parallel_aware || pathnode->path.parallel_safe)" |