Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lwF0G-00080A-S8 for pgsql-hackers@arkaria.postgresql.org; Thu, 24 Jun 2021 02:22:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lwF0E-00048I-Nj for pgsql-hackers@arkaria.postgresql.org; Thu, 24 Jun 2021 02:22:02 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lwF0D-00048A-EY for pgsql-hackers@lists.postgresql.org; Thu, 24 Jun 2021 02:22:02 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lwF0A-0004lg-E8 for pgsql-hackers@postgresql.org; Thu, 24 Jun 2021 02:22:00 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 0219824D3; Wed, 23 Jun 2021 22:21:55 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Wed, 23 Jun 2021 22:21:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=GdO2j+iEMItvdRG02lnK8JzANwk dPAujTTHf7OGdVBY=; b=vrA6b6eqjhu+SFBBI9BYro8dP6wx8X8iQefy0kJ2E6g 800KnW5+BsicFNpp3E2cq9XlW/kVfEzXHZdf186uKzaSecqx/1HnvsmJsIlwS8qM puQvnGJ1Fjrzypv/WAGFfu0QAilIJ4Ha+gEC1u4tj/zvXV0iOnrA1/xlmmiATwzp NvlWYBfE91rSOobWxJqa2A/RcNqkaCozArpb3bQsBNovlED3+dN9ygcZAliMPOhZ FITi1ZYmdbDGoG76ZFFqjH2uSddc9eo12rrzWpPNIqvVE89fqKJf91BPlHCj8HoO QJlU34k+SVjg7X9a2Y23qpcMcMihY+Y8Q+b0jE/3bPg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=GdO2j+ iEMItvdRG02lnK8JzANwkdPAujTTHf7OGdVBY=; b=wAt7jLvkSLfUS7k8mxMv/y eOPMYL1oMKxQjWca8IjYuhK+MyeIJmKahH+V66rtEgiS452img+u+AWyj13Ipr6Y /wHgycc8WE/YeRR5Oo8TEr42AfQCToUX2BEF9krdkT6Qng1k+oB+6u0g/j5A6Q+g jDFIo6CkJfwpPSH6Q01tMoOYySUx86dlJyibgUOn6zxKHrOMAezyEnVriZ8LPd0A JBtG7MsThbzk5sUU0G8F8zirO60eu0PvcrDbZ6l3x6Jx2ZWkAnw7RaZgOL8HQPsV 73kcAvlPFAz1K20hMCdg9wkaTE8Tp+rJYHP1sdD2JtATLl+9B7K/6L/CWQyIZCbg == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeeggedgheduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvuffkfhggtggujgesghdtroertddt vdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpeehgedtueehkeetgeeuvedtleel keeggeefteefjeejgfekheeikeevjeehudejheenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiii X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 23 Jun 2021 22:21:52 -0400 (EDT) Date: Thu, 24 Jun 2021 11:21:48 +0900 From: Michael Paquier To: Fabien COELHO Cc: Alvaro Herrera , Andrew Dunstan , Thomas Munro , Gregory Smith , PostgreSQL-development , david.christensen@crunchydata.com Subject: Re: pgbench logging broken by time logic changes Message-ID: References: <202106231308.lxr26cahwxuc@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="nkZLiGfws8WioM09" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --nkZLiGfws8WioM09 Content-Type: multipart/mixed; boundary="bMulltpajNfWo92U" Content-Disposition: inline --bMulltpajNfWo92U Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Jun 23, 2021 at 10:01:28PM +0200, Fabien COELHO wrote: > Thanks for the hint! Why not, having the ability to collect data is a good > thing, so attached v10 does that. If something go wrong, the TODO section > could be extended around all calls. +check_pgbench_logs($bdir, '001_pgbench_log_1', $nthreads, 1, 3, + qr{^\d{10,} \d{1,2} \d+ \d+ \d+ \d+ \d+ \d+ \d+ \d+ \d+$}); FWIW, I am still seeing problems with the regex pattern you are using here, because this fails to detect the number of fields we should have generated here, for one. If you are not convinced, just run your new test and extend or reduce the amount of data generated by logAgg() in your patch: the tests will still pass. So I have investigated this stuff in details. The regular expressions are correctly shaped, but the use of grep() in check_pgbench_logs() seems to be incorrect. For example, let's take an aggregate report generated by your new test: "1624498086 13 27632 60597490 1683 2853 3227 883179 120 386 123" Here are some extra ones, shorter and longer: "1624498086 13 27632 60597490 1683 2853 3227 8831"; "1624498086 13 27632 60597490 1683 2853 3227 883179 120 386 123 123"; Using grep() with "$re" results in all the fields matching. Using on the contrary "/$re/" in grep(), like list_files(), would only match the first one, which is correct. Please see attached a small script to show my point, called perl_grep.pl. With this issue fixed, I have bumped into what looks like a different bug in the tests. 001_pgbench_log_2 uses pgbench with 2 clients, but expects only patterns in the logs where the first column value uses only 0. With two clients, those first values can be either 0 or 1 due to the client ID set. It seems to me that we had better fix this issue and back-patch where this has been introduced so as we have exact match checks with the log formarts, no? Please see the attached. Thoughts? -- Michael --bMulltpajNfWo92U Content-Type: text/x-perl; charset=us-ascii Content-Disposition: attachment; filename="perl_grep.pl" use strict; use warnings; use Test::More; my $field_correct = "1624498086 13 27632 60597490 1683 2853 3227 883179 120 386 123"; my $field_broken_short = "1624498086 13 27632 60597490 1683 2853 3227 8831"; my $field_broken_long = "1624498086 13 27632 60597490 1683 2853 3227 883179 120 386 123 123"; my $re = qr{^\d{10,} \d{1,2} \d+ \d+ \d+ \d+ \d+ \d+ \d+ \d+ \d+$}; my @array_broken = ($field_correct, $field_broken_short, $field_broken_long); my @array_correct = ($field_correct, $field_correct); # All the element should match here. ok(grep($re, @array_correct) == @array_correct, 're+array_correct'); ok(grep(/$re/, @array_correct) == @array_correct, '/re/+array_correct'); # Only one element should match here. ok(grep($re, @array_broken) == 1, 're+array_broken'); ok(grep(/$re/, @array_broken) == 1, '/re/+array_broken'); --bMulltpajNfWo92U Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="pgbench-tap-fix.patch" Content-Transfer-Encoding: quoted-printable diff --git a/src/bin/pgbench/t/001_pgbench_with_server.pl b/src/bin/pgbench= /t/001_pgbench_with_server.pl index 923203ea51..ef8e40240b 100644 --- a/src/bin/pgbench/t/001_pgbench_with_server.pl +++ b/src/bin/pgbench/t/001_pgbench_with_server.pl @@ -1194,7 +1194,7 @@ sub check_pgbench_logs my $clen =3D @contents; ok( $min <=3D $clen && $clen <=3D $max, "transaction count for $log ($clen)"); - ok( grep($re, @contents) =3D=3D $clen, + ok( grep(/$re/, @contents) =3D=3D $clen, "transaction format for $prefix"); close $fh or die "$@"; }; @@ -1213,7 +1213,7 @@ pgbench( "--log-prefix=3D$bdir/001_pgbench_log_2"); =20 check_pgbench_logs($bdir, '001_pgbench_log_2', 1, 8, 92, - qr{^0 \d{1,2} \d+ \d \d+ \d+$}); + qr{^{0,1} \d{1,2} \d+ \d \d+ \d+$}); =20 # check log file in some detail pgbench( --bMulltpajNfWo92U-- --nkZLiGfws8WioM09 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmDT7DwACgkQnvQgOdby QH0apRAAgMFwmYrP1478CtZKiJeCbkgPOQuad2i7NmrS8bGH0IfLuC/PXeYGN6Hp DPNhfUVsYizEEOlzF39WNu2/XRNInKlUUUL9mIruV3/Ymo3Sc2k3/5hTcV2uTSRA siSYVpFDDjyW1susfe8hr7JkiRv7PFewPXsjoYxYQOvt9cu65TzZ7mOVC0Da8j86 fFs//P79oSvSXVtZZz+VLMZ8iQUPJbEhaCQkhUdByeJsiT1B4LV2qDTUrf3jv1n1 ay2sEhYVTlwnDX/sATIUlcCfB2V1NjLnOR/c5Q5bV/yyaUEnYfo1BUb1vF35y2X/ PTeKcB2I7uEnbdwMbXGPpQTIQner74C8EiPNN2QyB8mNUUofT0TDhDn35fg+EohK k1QoR9X+LCfgl146Kfh9xZw30zvxu6zLLJz4/6kpu3bctsOTaUV3eYqUq9O4Szi/ 2Ln3xeQbHcYoBuTS0HONdUJ6uB9GqesPhIflrFcpTxPMpKPPLlts6Dw0ouVyNdWZ fzBMT+KIYhEsZZOS1OzPkJP2ifIOge1TQV0YHNBwvyquzexWuPtWTY/NT5nGZMCT Mb0WmiiSqZERkUjcoEoYVfnb0UsPuw3ot0LEvfATDZ1+ZD15eln3zZQMnFOlgJGF p+cAyXCbLl5t/FdJbwReLB4CU+xdBbK0ky+Nqi8+3voKOl61DxI= =Wf6Z -----END PGP SIGNATURE----- --nkZLiGfws8WioM09--