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 1jGyHJ-0007P6-HT for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Mar 2020 05:08:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jGyHI-0003rK-9H for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Mar 2020 05:08:32 +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 1jGyHH-0003rC-Sw for pgsql-hackers@lists.postgresql.org; Wed, 25 Mar 2020 05:08:32 +0000 Received: from mail-qk1-x731.google.com ([2607:f8b0:4864:20::731]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jGyHB-0003Mz-4w for pgsql-hackers@postgresql.org; Wed, 25 Mar 2020 05:08:30 +0000 Received: by mail-qk1-x731.google.com with SMTP id b62so1372271qkf.6 for ; Tue, 24 Mar 2020 22:08:25 -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=2jTyDfPbDJCrAC0H8LD1KjWlrPrNk8fCjki1P9BS53M=; b=cyH7F4fzanmi+NdJvaUyBh//8IgOeEF6oyXhPsd45VRqTSf+42p2sTchHHn1Z2epsq zUw9qUYAk44D369mHLFlACfW+8tKX1VV/2OLXNYK0dqZ8iL4ZiWVBRT8wCJMjHAtnMH7 ilPznU/fUT9M5pKm/RhX1ZEzfPlFedsfHpPclbM5SOFCAfiVFVSIcER/OfvVSX1NnBkZ 9iekXBb6VH9PMHK6llquOOexuoIwNhTFXGsGxfOvQX/Ykl6IykOMaC35+xlCyrxMOPj/ 1uNcbY87CcIZzy5BCZf98XgGln5+Q9pok2vgrWY+pBhHO6W9mLTGIa3w+K9JoO/2uR2L 7jaw== 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=2jTyDfPbDJCrAC0H8LD1KjWlrPrNk8fCjki1P9BS53M=; b=Q5lbOXBAxAQCpA+iD6hkWMsLNxJqXk3OtscMMrZtIaoRS3YGtN18JKc2cqyxNNt0S0 FK19cCG/wBWG6n6JSkiu0f9+/E0ov39DrHACZP5y2sFLARFWJtRCryvb/e3eSY5rBK6Y j8EArWSpDGNrFG0BgKWET7cMjMfv08NZg4jJyCiEdjU9dIMNKSN/f3qZvE6T7puryBJO jgtMaIniYO7+5u/1YZZhHjqKuC6eP6adcqZWH8rGSYso2Z44YK0AYG6ZYGdEEpDcPMNG VN5xOrXAAuK5MjQ8141OvyOfNWgw9DrsP0ZGEuk5zAm7VIxeOSFKKi+6JtYf7bcsM4Gq zsJQ== X-Gm-Message-State: ANhLgQ2WQr7JjzUh+EB4aSNEl3bdM7dXsYSOrbOd0UUIh+LL6inLQtLL LNjnEg4GGE3Xr3mgAWtZa2d7U+SXJyw= X-Google-Smtp-Source: ADFU+vuwAYcS2FrWcHbCMc9AmWBV11FHp38iIEypEvnDgdUQOtnAZqv+uco/GOxL5VH0pDRMxwR7Tg== X-Received: by 2002:a37:7846:: with SMTP id t67mr1237234qkc.77.1585112904408; Tue, 24 Mar 2020 22:08:24 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id d24sm15056556qkl.8.2020.03.24.22.08.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Mar 2020 22:08:23 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id A4314800C28; Wed, 25 Mar 2020 00:08:19 -0500 (CDT) Date: Wed, 25 Mar 2020 00:08:19 -0500 From: Justin Pryzby To: Amit Kapila Cc: Masahiko Sawada , Alvaro Herrera , Andres Freund , Michael Paquier , pgsql-hackers Subject: Re: error context for vacuum to include block number Message-ID: <20200325050819.GP21443@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 10:22:21AM +0530, Amit Kapila wrote: > On Wed, Mar 25, 2020 at 10:05 AM Masahiko Sawada > wrote: > > > > On Wed, 25 Mar 2020 at 12:44, Amit Kapila wrote: > > > > > > On Tue, Mar 24, 2020 at 7:51 PM Masahiko Sawada > > > wrote: > > > > > > > > > > > > I got the point. But if we set the error context before that, I think > > > > we need to change the error context message. The error context message > > > > of heap truncation phase is "while truncating relation \"%s.%s\" to %u > > > > blocks", but cbarg->blkno will be the number of blocks of the current > > > > relation. > > > > > > > > case VACUUM_ERRCB_PHASE_TRUNCATE: > > > > if (BlockNumberIsValid(cbarg->blkno)) > > > > errcontext("while truncating relation \"%s.%s\" to %u blocks", > > > > cbarg->relnamespace, cbarg->relname, cbarg->blkno); > > > > break; > > > > > > > > > > Do you mean to say that actually we are just prefetching or reading > > > the pages in count_nondeletable_pages() but the message doesn't have > > > any such indication? If not that, what problem do you see with the > > > message? What is your suggestion? > > > > 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. > > > > Won't the latest patch by Justin will fix this as he has updated the > block count after count_nondeletable_pages? Apart from that, I feel The issue is if the error happens *during* count_nondeletable_pages(). We don't want it to say "truncating relation to 100 blocks". > the first call to update_vacuum_error_cbarg in lazy_truncate_heap > should have input parameter as vacrelstats->nonempty_pages instead of > new_rel_pages to indicate the remaining pages after truncation? Yea, I think that addresses the issue. -- Justin