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 1nFmmf-0002Ai-9h for pgsql-docs@arkaria.postgresql.org; Fri, 04 Feb 2022 00:49: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 1nFmme-0000PO-6W for pgsql-docs@arkaria.postgresql.org; Fri, 04 Feb 2022 00:49:04 +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 1nFmmd-0000PE-VV for pgsql-docs@lists.postgresql.org; Fri, 04 Feb 2022 00:49:03 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nFmmb-0002XV-Kz for pgsql-docs@lists.postgresql.org; Fri, 04 Feb 2022 00:49:02 +0000 Received: from [192.168.11.9] (p2019072-ipbf2307funabasi.chiba.ocn.ne.jp [122.30.130.72]) by oss.nttdata.com (Postfix) with ESMTPSA id 629A06067A; Fri, 4 Feb 2022 09:48:59 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.5 at oss.nttdata.com Content-Type: multipart/mixed; boundary="------------Bg1Nfz8JOFh1yhogjJ10sbtu" Message-ID: Date: Fri, 4 Feb 2022 09:48:58 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: maximum number of backtrace frames logged by backtrace_functions Content-Language: en-US To: Tom Lane , Peter Eisentraut Cc: pgsql-docs@lists.postgresql.org References: <0f0ed9f3-3892-e8a3-51c9-ed268dff6bdd@oss.nttdata.com> <4e16a3e9-e717-05e1-d905-6c21beba80f8@enterprisedb.com> <252159.1643899696@sss.pgh.pa.us> From: Fujii Masao In-Reply-To: <252159.1643899696@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------Bg1Nfz8JOFh1yhogjJ10sbtu Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2022/02/03 23:48, Tom Lane wrote: > Peter Eisentraut writes: >> How about we issue a message when the backtrace is cut off. Then it's >> immediately visible to the user, instead of hidden away somewhere in the >> documentation. Something like this (untested): > > +1 for idea (I didn't test it either). +1. I made this change to the patch and confirmed that it worked fine. For the record, I tested that by setting backtrace_functions to 'pg_wal_replay_pause' and executing it. This function will report an error when it's called not during recovery. In the test, "SELECT pg_wal_replay_pause()" caused backtrace but "backtrace limited to %zu frames" message was not output because the number of backtrace frames was less than 100. Then I created the function "foo" as follows and executed "SELECT foo(0)" to generate more than 100 backtrace frames. In this case "backtrace limited to %zu frames" message was successfully output. CREATE FUNCTION foo (x int) RETURNS void AS $$ BEGIN IF x = 10 THEN PERFORM pg_wal_replay_pause(); ELSE PERFORM foo(x + 1); END IF; END; $$ LANGUAGE plpgsql; > Is "nframes" useful enough to > include in the report? Probably No because "nframes" is equal to "lengthof(buf)" in the case where more than 100 frames are generated. Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION --------------Bg1Nfz8JOFh1yhogjJ10sbtu Content-Type: text/plain; charset=UTF-8; name="backtrace_limit_report.patch" Content-Disposition: attachment; filename="backtrace_limit_report.patch" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL3NyYy9iYWNrZW5kL3V0aWxzL2Vycm9yL2Vsb2cuYyBiL3NyYy9iYWNr ZW5kL3V0aWxzL2Vycm9yL2Vsb2cuYwppbmRleCA3NDAyNjk2OTg2Li45OTMzMzg2OTU5IDEw MDY0NAotLS0gYS9zcmMvYmFja2VuZC91dGlscy9lcnJvci9lbG9nLmMKKysrIGIvc3JjL2Jh Y2tlbmQvdXRpbHMvZXJyb3IvZWxvZy5jCkBAIC05NjYsNiArOTY2LDkgQEAgc2V0X2JhY2t0 cmFjZShFcnJvckRhdGEgKmVkYXRhLCBpbnQgbnVtX3NraXApCiAKIAkJZm9yIChpbnQgaSA9 IG51bV9za2lwOyBpIDwgbmZyYW1lczsgaSsrKQogCQkJYXBwZW5kU3RyaW5nSW5mbygmZXJy dHJhY2UsICJcbiVzIiwgc3RyZnJtc1tpXSk7CisJCWlmIChuZnJhbWVzID49IGxlbmd0aG9m KGJ1ZikpCisJCQlhcHBlbmRTdHJpbmdJbmZvKCZlcnJ0cmFjZSwgIlxuKGJhY2t0cmFjZSBs aW1pdGVkIHRvICV6dSBmcmFtZXMpIiwKKwkJCQkJCQkgbGVuZ3Rob2YoYnVmKSk7CiAJCWZy ZWUoc3RyZnJtcyk7CiAJfQogI2Vsc2UK --------------Bg1Nfz8JOFh1yhogjJ10sbtu--