Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jGxwU-0006o4-W3 for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Mar 2020 04:47:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jGxwT-0004UX-CJ for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Mar 2020 04:47:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jGxwS-0004UQ-SS for pgsql-hackers@lists.postgresql.org; Wed, 25 Mar 2020 04:47:01 +0000 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jGxwP-0003DT-Eo for pgsql-hackers@postgresql.org; Wed, 25 Mar 2020 04:46:59 +0000 Received: by mail-qt1-x844.google.com with SMTP id x16so1174625qts.11 for ; Tue, 24 Mar 2020 21:46:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=mtK0MUMe0DodYh3Zb4RSfEd8OLIIW3XMo7vU/6Eoz28=; b=MDVjmRfYCYsgOVR5pmonzljTu0BYxtwMXF7ipXG8JTJ/HA8buFTb38ymZ3y5tzm+OX VAXqDblTtknok8CDrhfLbNdKAoRZiuz4i4XZehNN52obCJTT09OivKq8znYsmyKq57Vb cE1JrnbeYFUwdQGRmSGfi7W8Jvl+XlQXT7b6gTqIScURk69lYz8Ty6IweT+vByujLXUK uGlgZxHtntdcCz5m39arNxHHFcTQAACuyeP+qJmPvkYK6i/s3HyVqkQ1MsaTqEdlNVdn swu1ggs3mhGvHcEu4mPpze0FEudNFmiIkCHunpc7M0vSar6nDvX0GUFhnfVZ5WGamJ4v SvsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=mtK0MUMe0DodYh3Zb4RSfEd8OLIIW3XMo7vU/6Eoz28=; b=AV4kob6bWz7iS5uFDWfhxr2vR1q/KLkjVgkJea4FEpiDqAE0mWYlbtmM6iqiWsgb9i kxVkhVIRBNlZL5oDGRWCw/W7zIT6jLxKFtpu92YYS1YU8vi71lC8xg2e7wC1QI40husk 0S/nDtDJ+UKMOOxH9iiUne6PEggZka2pHFEq0ssSYqI6oO/1Kym/DKJqmVG6KuPzYeTA RuWbqqiD0IXQHcX0VqOkxCATB5KDr+O9QQVtsJp7JqiAwABYDrhLqA3cTj0zgzmM0Vux R6fSSNuc/UL3PRSm6P6/EveJzrVyFwXB+SptBOnYyC1q8Z8YCmBoytOifxWepQureOUG OPzQ== X-Gm-Message-State: ANhLgQ2GOj/SNZSK/o/bZ4BHo3H0RNH/swIitUJIKcDZWI81hHeJFNJ0 Cum8JSz3Vag1l6LEm3OBwST5bA== X-Google-Smtp-Source: ADFU+vvN4viiXwq1z7Tkv5JB4nRWbt85cu3zIiwh3uxuZp1ONcoCpskRkfGLNP7bJ/RvLT0yiKIKtQ== X-Received: by 2002:ac8:3386:: with SMTP id c6mr1268280qtb.236.1585111616404; Tue, 24 Mar 2020 21:46:56 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id c12sm16739238qtb.49.2020.03.24.21.46.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Mar 2020 21:46:55 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id 9742B800C28; Tue, 24 Mar 2020 23:46:51 -0500 (CDT) Date: Tue, 24 Mar 2020 23:46:51 -0500 From: Justin Pryzby To: Masahiko Sawada Cc: Amit Kapila , Alvaro Herrera , Andres Freund , Michael Paquier , pgsql-hackers@postgresql.org Subject: Re: error context for vacuum to include block number Message-ID: <20200325044651.GO21443@telsasoft.com> References: <20200324041616.GA21443@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, Mar 25, 2020 at 01:34:43PM +0900, Masahiko Sawada wrote: > I meant that with the patch, suppose that the table has 100 blocks and > we're truncating it to 50 blocks in RelationTruncate(), the error > context message will be "while truncating relation "aaa.bbb" to 100 > blocks", which is not correct. > I think it should be "while truncating > relation "aaa.bbb" to 50 blocks". We can know the relation can be > truncated to 50 blocks by the result of count_nondeletable_pages(). So > if we update the arguments before it we will use the number of blocks > of relation before truncation. Hm, yea, at that point it's: |new_rel_pages = RelationGetNumberOfBlocks(onerel); ..so we can do better. > My suggestion is either that we change the error message to, for > example, "while truncating relation "aaa.bbb" having 100 blocks", or > that we change the patch so that we can use "50 blocks" in the error > context message. We could do: update_vacuum_error_cbarg(vacrelstats, VACUUM_ERRCB_PHASE_TRUNCATE, InvalidBlockNumber, NULL, false); new_rel_pages = count_nondeletable_pages(onerel, vacrelstats); vacrelstats->blkno = new_rel_pages; ... case VACUUM_ERRCB_PHASE_TRUNCATE: if (BlockNumberIsValid(cbarg->blkno)) errcontext("while truncating relation \"%s.%s\" to %u blocks", cbarg->relnamespace, cbarg->relname, cbarg->blkno); else /* Error happened before/during count_nondeletable_pages() */ errcontext("while truncating relation \"%s.%s\"", cbarg->relnamespace, cbarg->relname); break; -- Justin