Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sU38w-0003MU-52 for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Jul 2024 11:48:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sU38u-0006JL-3l for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Jul 2024 11:48:20 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sU38t-0006IB-Li for pgsql-hackers@lists.postgresql.org; Wed, 17 Jul 2024 11:48:20 +0000 Received: from mail-yw1-x1130.google.com ([2607:f8b0:4864:20::1130]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sU38q-0000tp-W0 for pgsql-hackers@postgresql.org; Wed, 17 Jul 2024 11:48:18 +0000 Received: by mail-yw1-x1130.google.com with SMTP id 00721157ae682-65fdfd7b3deso39802227b3.0 for ; Wed, 17 Jul 2024 04:48:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joeconway.com; s=google; t=1721216896; x=1721821696; darn=postgresql.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=SmUFM1xP9tRpeZQn5ql8w8Zka6H984Wf4LZw2UMYhsE=; b=qFoXg8wmWJYTh4YpqRlW4Cr2uPwof2RbHwfPSIrRl/BbcO/diSm/S9PBqksZ+oZqFO 76QDzvuN8wfX9JeLlzbzMvIjNFgsBQHyPQ+hQgiaNPKTIHR9R8hRu5J2+l0Qjl1eGL4c fZ/FVxGA9wFWyjDGLoGhRtUti/bPbp32dN8yX+BecLEjbmZJ+GVbdN7ddrAcfMzJ+Kbz 6wf/L8i/PqP+7mjBsPSVwSMeLyZO4ZdMWnNejxrS1tAJaOdLT4FMR91C+yNCRWPvzfeF VQmG9j2xQiPhqT3RCr+hr/wSgyNZKZcsSN7dzLW12x3LpCLfAyYHDqZya5mU/IG6Ca2y gYWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721216896; x=1721821696; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=SmUFM1xP9tRpeZQn5ql8w8Zka6H984Wf4LZw2UMYhsE=; b=D8gcmX+en8C9mvSAnLlAZeqHoGWDKHK7aqWUH3mmskc7MUTahJqtpJlyXs3n3KEifG dPBjO+IM8BRCM+LBbs729U0UCJbmz3k5D3lMEzAdQAb8um8akBOsT5tlKG9OtoxBxwrT odihNDdqP7ytq8K1OyQhaf/GoAAj9Ajw9kEWjOsfYIN3uMNs69Hk1pgvDt9xjSPVf3rK U3ovBY611Lp5mc2f5DXp9CxBG0DPlLlSuWa9/NUchceeuvIU0XYoAa/2U8h8QTPZ6Dux hBRejC0AyZMxJmV1jK9iGLVcYHI2rU0IvpZ1mWZb9w6L7OS98XEb92vDcA73lj28b9hN B4Cw== X-Forwarded-Encrypted: i=1; AJvYcCUxck6J7apZPVlRbP4OCgOMMBV1MlFpzQeQIfojmu+VbvyURTZOcLlDfSyx48Rn21SdaPTwrI8M0fHfm2p9bImga0KzBy4JahpxK8GX X-Gm-Message-State: AOJu0Yy+0/nnJ1x6df/vwQG7x9mOCs/A37WL44yX3hacUK/j0cpnUeCG 5VXjgLBjjv9YrZ4+8TXifDqJEStUTFCMXEGHxl9WWXndn6fhC07alr4KeYYHqovttUqaJQvRupk VT2FBtQ== X-Google-Smtp-Source: AGHT+IHgpsbOR6Zfg8qsa09SsVpD7/Hxk9tRnqrAktF1YrkDSoSyJPQEQyFXmktRcC2L4QOpqWvaAw== X-Received: by 2002:a05:690c:a86:b0:64a:956b:c063 with SMTP id 00721157ae682-66500573364mr18914517b3.39.1721216895977; Wed, 17 Jul 2024 04:48:15 -0700 (PDT) Received: from [192.168.4.41] (162-239-31-113.lightspeed.dybhfl.sbcglobal.net. [162.239.31.113]) by smtp.gmail.com with ESMTPSA id 00721157ae682-65fc2af64cfsm15154307b3.74.2024.07.17.04.48.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 17 Jul 2024 04:48:15 -0700 (PDT) Message-ID: Date: Wed, 17 Jul 2024 07:48:15 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: RFC: pg_stat_logmsg To: Michael Paquier , Tomas Vondra Cc: Gurjeet Singh , Masahiko Sawada , PostgreSQL-development References: <89742024-d51a-c66b-90b9-67f837072cd2@joeconway.com> <3b1683bc-2630-a0d0-6083-8a45aa1b54bf@joeconway.com> <5dc12198-80ff-4e70-b187-11ef33418411@enterprisedb.com> Content-Language: en-US From: Joe Conway Autocrypt: addr=mail@joeconway.com; keydata= xsFNBEpXMCsBEADDnXUQzjlyi/cX02Gtdy2CLcroE5CsC7DJKdOBDbfgn0kfiIYoV5JniG4l VyzZUodY8yUAagqLYolh0UkBzs9N+qkm7erde4ypw3jzVQ37BuzIvk3nMUbuDZDgxWqX+nVS sKc+BQ5BpzgCHg48leoRO2ohjvYnUhgH3j2rFZCzaj6qQ7mv+XoxOJmUlVQtG06Jwkk7Vu14 7U9nMMM6hyUKzVnmCphnlcMNo26UyVU70MwFfFJgcI0c5fpp8byN56eD6VJVnufO5WAuEhzE qcrSJR2FAlmM90GBY+6vP29twLDCHuSFvrnujNCx/BvCC/a3/gPvyAFp4JtMm9eXAmq3m/Kw 94nTJXVdcbQeQQDp3KIG7MmWS4lnGvPn8v0CjgNaLv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G/R/k4qa7s9/dgKvMbyH3fHhp/ceKag80Xo8IFurRl 0ZJP3sHJ2QDHCVLat7jRZ+43hi1WlIhFbrgn6IyI0i7XR/W8JjrC5MsKq4TUwGH077sU/kcH YebVJZRbUUst2hAGHDFVBcG12qoKf+ltL9qXJc1y7BGeCoUW6QjOpljpq6ZL4FQUsM0RSRjs 5egE3szPcIf5SyPK6WDOApoAq6M7BBFMGDZwEylYMtr0YekA1u86UA9D2xwLHEbBBp/uiby1 c9JbPJ1Pn8zJP8WZNeRw4Q9TtqVK09+oLirMUSpIDd6KdZ1VgRxOK2re7tjDvkVuYsSrsiJ+ 1iJNEnp9iK0ok0DlJpSCe6KhkxpaTdeoWMXdKuJWec0NIqoAd54ZgBPnr+UPxTixgPq/p6Q= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 7/16/24 19:08, Michael Paquier wrote: > On Wed, Jul 17, 2024 at 12:14:36AM +0200, Tomas Vondra wrote: >> I noticed this patch hasn't moved since September 2023, so I wonder >> what's the main blocker / what is needed to move this? > > + /* Location of permanent stats file (valid when database is shut down) */ > + #define PGLM_DUMP_FILE PGSTAT_STAT_PERMANENT_DIRECTORY > "/pg_stat_logmsg.stat > > Perhaps this does not count as a valid reason, but does it really make > sense to implement things this way, knowing that this could be changed > to rely on a potential pluggable pgstats? I mean this one I've > proposed: > https://www.postgresql.org/message-id/Zmqm9j5EO0I4W8dx%40paquier.xyz Yep, see my adjacent reply to Tomas. > One potential implementation is to stick that to be fixed-numbered, > because there is a maximum cap to the number of entries proposed by > the patch, while keeping the whole in memory. > > + logmsg_store(ErrorData *edata, Size *logmsg_offset, > + int *logmsg_len, int *gc_count) > > The patch shares a lot of perks with pg_stat_statements that don't > scale well. I'm wondering if it is a good idea to duplicate these > properties in a second, different, module, like the external file can > could be written out on a periodic basis depending on the workload. > I am not saying that the other thread is a magic solution for > everything (not looked yet at how this would plug with the cap in > entries that pg_stat_statements wants), just one option on the table. > >> As for the code, I wonder if the instability of line numbers could be a >> problem - these can change (a little bit) between minor releases, so >> after an upgrade we'll read the dump file with line numbers from the old >> release, and then start adding entries with new line numbers. Do we need >> to handle this in some way? > > Indeed. Perhaps a PostgreSQL version number assigned to each entry to > know from which binary an entry comes from? This would cost a couple > of extra bytes for each entry still that would be the best information > possible to match that with a correct code tree. If it comes to that, > even getting down to a commit SHA1 could be useful to provide the > lowest level of granularity. Another thing would be to give up on the > line number, stick to the uniqueness in the stats entries with the > errcode and the file name, but that won't help for things like > tablecmds.c. I think including version in the key makes most sense. Also do we even have a mechanism to grab the commit sha in running code? -- Joe Conway PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com