Re: pgbench - use pg logging capabilities
Michael Paquier <[email protected]>
| Newsgroups | gmane.comp.db.postgresql.devel.general |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Jan 03, 2020 at 01:01:18PM +0100, Fabien COELHO wrote:
> Without looking at the context I thought that argv[0] was the program name,
> which is not the case here. I put it back everywhere, including the DEBUG
> message.
The variable names in Command are confusing IMO...
> Ok. I homogeneised another similar message.
>
> Patch v3 attached hopefully fixes all of the above.
+ pg_log_error("gaussian parameter must be at least "
+ "%f (not %f)", MIN_GAUSSIAN_PARAM, param);
I would keep all the error message strings to be on the same line.
That makes grepping for them easier on the same, and that's the usual
convention even if these are larger than 72-80 characters.
#ifdef DEBUG
- printf("shell parameter name: \"%s\", value: \"%s\"\n", argv[1], res);
+ pg_log_debug("%s: shell parameter name: \"%s\", value: \"%s\"", argv[0], argv[1], res);
#endif
Worth removing this ifdef?
- fprintf(stderr, "%s", PQerrorMessage(con));
+ pg_log_fatal("unexpected copy in result");
+ pg_log_error("%s", PQerrorMessage(con));
exit(1);
[...]
- fprintf(stderr, "%s", PQerrorMessage(con));
+ pg_log_fatal("cannot count number of branches");
+ pg_log_error("%s", PQerrorMessage(con));
These are inconsistent with the rest, why not combining both?
I think that I would just remove the "debug" variable defined in
pgbench.c all together, and switch the messages for the duration and
the one in executeMetaCommand to use info-level logging..
--
Michael
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl4S7LoACgkQnvQgOdby QH157Q//TmlU9FM+NVsRxLBgEjgFGTslJw595xA2Kr3yj38qGJSoYB8wsh3AYLIo gfFrp+IcI0justgOPWVhtiPJTB4sGVS5YfS8hhnhJV+Y7PqzizHHBUbA2SUWBRt6 QPp5vpA8v8a6DzspRnzU1DfLVOoKbFMBhXwcB+M31W5LTXmIS47/WJZHsOXZvCEY 1IrTj3LFF2tsBoWDoZ49hQ3AB8DeLJdbiBnG2jIDIHDE6+w1E3i+nBdkHJmUokJe 5AHDKVEiVGjb+59PEbuPsyOeBa2hwdced7vHcYVqL9469X4ehEDLXPmmYjsyX8Rw mvN3WThUCJItUOA+AxG+meTfPc21/02uywPND55hw9wXkOL7wwm8Ik26iWla6M7s 3nQARjVzk+Y15Cy4hCQds2w3iObGZ8EfcVxSUTpE9teCmygpmxcjFe97QsEx7ZOQ Jkmo2STvRFg2u/aSsKii6kAWRAPGeIfbyNLD21b9VWmhqIeLA+2gjWr9aSByIwni ls7yOIMrFxSllHIkSqXw0CjkZUh08Fz/yQ1P/lTZLcPBKuvw6/ANjPAfnK+IASIj tzx8uA3DPW0JvZ+uwoSpQxtIPGQT+LQJpdiPMWS2n/8lw7Jqrp27G5kWr6ckuKMJ VALaFSUrf4kmaQAleM4BDn9oGQY92ziNMYG3pXPXeHx94eQPAOE= =MfwN -----END PGP SIGNATURE-----