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 1jHuHW-0002TJ-Gc for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Mar 2020 19:04:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jHuHU-0003pJ-7L for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Mar 2020 19:04:36 +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 1jHuHT-0003mU-MP for pgsql-hackers@lists.postgresql.org; Fri, 27 Mar 2020 19:04:35 +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 1jHuHQ-0000Fk-Rv for pgsql-hackers@postgresql.org; Fri, 27 Mar 2020 19:04:34 +0000 Received: by mail-qt1-x844.google.com with SMTP id z12so9529988qtq.5 for ; Fri, 27 Mar 2020 12:04:32 -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=rlTHaYodLUI6boM+1YSac3ABeh5Rl9XxPKqI+x+CwRE=; b=vZn2iJ6hcCakjn8oXUHgu4ahEp8jDFKNauyMeZz70ofNUW/0QSHh/vjbFhyKT29EX2 4paCEFFHNFsg/wCIhw6Sk/lGb5p6eFV/G+2xvghypvzfmoheb0Trys8dvCtjsNjCJA6T PY23qqBiVGg9gL+4IeGj/gkKa1od6yonm6BxURDqRXFma/foXWp51KF445+/EKSXsUVw Jtl46v4ohoB3HGxw9+lxUH+2lDZ6aSBxgVmPEMPKmjfIDs94H5fIk0pYiO9PMrIPo1j3 a8lCRznjQonaL+3pviZhk054FBpgzxG4+1hYY6d8itEq8qSBxPo+VF1JvOwNwa/V/bqd Le7g== 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=rlTHaYodLUI6boM+1YSac3ABeh5Rl9XxPKqI+x+CwRE=; b=QTocOiRv+KCUy8Pekv+idWPNpCrLuETA7zTOWg7DqrJhHhF0MnATZxydxZ/5iIuZmg susXlBpXXAaseI0XLMdHehHc8vBeHMuU3DcRbK3+U4GHXGGv5RRwVSmrE1zmamBKhQf4 7fPx2Kd8T7gTbt2+z+QzwaIOO8sQgCdozqYzD7rX3ent8cHTI1AeHSPUITYFc0WNrzAK Rg7utmZymrDJbM/ADAN2BlyX4CAcOKPtrt9vNAw6OMu4jssOfbAhqJUojNbQJuVXeLRN 5/1tagYOYNoKasB+y+ha7coBYD2FV9fpEVS1VHShj7YOGzYEE8F8gyJX+uDsOeO5CD9N dY0w== X-Gm-Message-State: ANhLgQ27gerP9pJIz4uoWfTTVXT9yq+GpRtqbZjPMKLHKmleA6t42sY+ kekuPM/YLESXVseya2Txtp1WNQ== X-Google-Smtp-Source: ADFU+vv6omcGjQXP3u7b3TPQCFm4PkK004COVhkEpJd7mGFDmIQBsPGJAnCrNtn0y/LH+7+9Mgz3kw== X-Received: by 2002:ac8:1bda:: with SMTP id m26mr803286qtk.2.1585335871502; Fri, 27 Mar 2020 12:04:31 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id d25sm4339494qtj.86.2020.03.27.12.04.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Mar 2020 12:04:30 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id 2B5BF80096B; Fri, 27 Mar 2020 14:04:29 -0500 (CDT) Date: Fri, 27 Mar 2020 14:04:29 -0500 From: Justin Pryzby To: Amit Kapila Cc: Masahiko Sawada , Alvaro Herrera , Andres Freund , Michael Paquier , pgsql-hackers@postgresql.org Subject: Re: error context for vacuum to include block number Message-ID: <20200327190428.GS20103@telsasoft.com> References: <20200326044115.GB28385@telsasoft.com> <20200326150457.GB17431@telsasoft.com> <20200326221752.GR17431@telsasoft.com> <20200327044424.GD20103@telsasoft.com> <20200327061601.GE20103@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 Fri, Mar 27, 2020 at 11:50:30AM +0530, Amit Kapila wrote: > > > The crash scenario I'm trying to avoid would be like statement_timeout or other > > > asynchronous event occurring between two non-atomic operations. > > > > > +if (errinfo->phase==VACUUM_ERRCB_PHASE_VACUUM_INDEX && errinfo->indname==NULL) > > +{ > > +kill(getpid(), SIGINT); > > +pg_sleep(1); // that's needed since signals are delivered asynchronously > > +} > > I'm not sure if those are possible outside of "induced" errors. Maybe the > > function is essentially atomic due to no CHECK_FOR_INTERRUPTS or similar? > > Yes, this is exactly the point. I think unless you have > CHECK_FOR_INTERRUPTS in that function, the problems you are trying to > think won't happen. Hm, but I caused a crash *without* adding CHECK_FOR_INTERRUPTS, just kill+sleep. The kill() could come from running pg_cancel_backend(). And the sleep() just encourages a context switch, which can happen at any time. I'm not convinced that the function couldn't be interrupted by a signal. -- Justin