Peter Eisentraut [Thu, 26 Jul 2018 11:56:30 +0000 (13:56 +0200)]
test.sh: Sort out netcat zoo
The previous code distinguished between Linux and non-Linux netcat.
This didn't stand the test of time, since Linux distributions now ship
multiple variants of netcat and other operating systems also provide
multiple options. So instead try to detect the variant from the help
output. Also, the previous uses of the -q and -w options behaved
strangely with some versions and/or were inconsistent with the
documentation. So abandon those options and just rely on the existing
killall call.
The test_server_connect_timeout_establish test should now pass again on
hopefully most configurations.
Peter Eisentraut [Tue, 24 Jul 2018 10:19:18 +0000 (12:19 +0200)]
Fix -Wimplicit-fallthrough warnings
These warnings started showing up with GCC 7. The code was already
correct, but the intent is now a bit clearer. Compilation with recent
GCCs should now be warning-free again.
Peter Eisentraut [Thu, 19 Jul 2018 12:54:17 +0000 (14:54 +0200)]
doc: Small improvement in quick start
Add an indication that the "SHOW HELP" example output is not complete.
Then we don't have to feel obliged to update it every time we add
something to the actual help output.
If we fail to calloc the rule buffer, going to failed: will deref
rule via the rule_free() call. Avoid by returning false directly
and bypass the failed: block.
If the fopen() call fails parse_namefile() frees the filename buffer
fn, and the caller does the same. Avoid freeing in parse_namefile()
and leave the cleanup to the caller.
Peter Eisentraut [Tue, 26 Dec 2017 21:49:36 +0000 (16:49 -0500)]
Fix psql invocation in tests
Always run psql with -X, otherwise some tests fail if there is something
in .psqlrc producing output. Also fix some potential portability
problems in option syntax: Put non-option arguments last, don't mix
options with and without arguments.
Peter Eisentraut [Thu, 14 Dec 2017 18:54:58 +0000 (13:54 -0500)]
Fix handling of absent rst2man
The makefile line
RST2MAN ?= rst2man
didn't have the desired effect, because config.mak sets RST2MAN, and ?=
doesn't do anything if the variable is set to empty. So instead let
configure put in a default value if the program cannot be found.
Euler Taveira [Fri, 8 Dec 2017 22:00:24 +0000 (22:00 +0000)]
Use default values in config file
Instead of using arbritary values, use the default values. It is to
avoid surprises if you just remove comment character (;). I also did
some cosmetic changes. While at it, add some default information for
auth_user.
Tomas Vondra [Sun, 24 Sep 2017 16:49:35 +0000 (18:49 +0200)]
Add SHOW STATS_TOTALS / STATS_AVERAGES as admin commands
We already had SHOW STATS, but after adding the wait_time colums it
got a bit too wide for regular screens. That's incovenient, as the
admin interface does not selecting only some of the columns.
But in most cases we're only interested either in totals or averages,
not both at the same time. So let's add commands showing only the
relevant subset of columns.
Tomas Vondra [Wed, 20 Sep 2017 21:22:39 +0000 (23:22 +0200)]
Track total time spent waiting for server
There already is maxwait column in pool details, showing how long
the oldest client is currently waiting. Which is useful, but it does
not allow us to easily break client time into the three basic
categories: busy, idle and waiting.
This adds tracking of total time spent waiting for a server, and
adds it as wait_time into SHOW STATS. The total value is simply
accumulated over time, the average value is 'per second' value.
The value is only updated when a client acquires a server, so if
a client is waiting indefinitely, the wait time won't be reflected
in the value. That would require inspecting the the list of waiting
clients, which seems like overkill. Moreover, that's what maxwait
is good for.
Tomas Vondra [Wed, 20 Sep 2017 19:00:17 +0000 (21:00 +0200)]
Track separate stats for queries and transactions
The documentation claimed avg_query tracks average query duration,
but it was only updated when switching into 'idle' state. So in
transaction or session pooling modes, it was actually the duration
of the whole transaction, including 'idle in transaction' time and
time spen executing (multiple) queries.
This was causing confusion, e.g. when the application was keeping
transactions open without executing any queries. In that case the
avg_query metric was increasing although the database was handling
queries just fine (without any slow-down).
Instead of just fixing the avg_query metric, it seems quite useful
to have timing data both for queries and transactions. So this
patch replaces
This is also related to the definition of 'request' which was used
to compute the avg_query, and so it equal to a transaction. This
patch replaces the counter with two - one for transactions and one
for queries. As we also computed avg_req, the patch replaces