Peter Eisentraut [Fri, 17 Aug 2018 19:50:04 +0000 (21:50 +0200)]
Fix up conntest test programs
Allow asynctest to run without an explicitly specified connection
string. That way it can pick up the connection parameters from the
environment. The run-conntest.sh driver script was already calling it
that way.
Fix the location of the pgbouncer binary in run-conntest.sh.
Peter Eisentraut [Thu, 16 Aug 2018 19:10:47 +0000 (21:10 +0200)]
Improve test script robustness
Consistently exit with an error if the OS is not supported by the
firewall manipulation commands. Previously, it would in some cases
print an error but not exit.
Peter Eisentraut [Wed, 25 Jul 2018 10:57:24 +0000 (12:57 +0200)]
Fast close
Disconnect a server in session pool mode immediately if it is in
"close_needed" (reconnect) mode. This ensures that the RECONNECT
command doesn't have to wait for session end.
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