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 1ksGq1-0004Ty-G2 for pgsql-hackers@arkaria.postgresql.org; Thu, 24 Dec 2020 02:58:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ksGpx-00036u-9G for pgsql-hackers@arkaria.postgresql.org; Thu, 24 Dec 2020 02:58:45 +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 1ksGpw-00036l-Q8 for pgsql-hackers@lists.postgresql.org; Thu, 24 Dec 2020 02:58:45 +0000 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ksGpu-00029G-6F for pgsql-hackers@postgresql.org; Thu, 24 Dec 2020 02:58:43 +0000 Received: by mail-pg1-x531.google.com with SMTP id f17so759898pge.6 for ; Wed, 23 Dec 2020 18:58:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=f/KTKe0mEs2SyNHuDC4FczLjo8xeiEA2ZQRbv+ZMohg=; b=MT6OE3ySirqRMLljP8PbnNIrFfipEi9nK4ROA/Ku8xb4QHez6u5dow0J++/kaDGo+f qpiTbYZJ4ZFfLZF4+1Cs6anWRxIU1dqbb3nkWfMhM8gahsDCHtsG3+ymwIXIO2uABBdD jYv7AcizAsdzmI8tuMWjrEYsbNx1L3xETlicY= 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=f/KTKe0mEs2SyNHuDC4FczLjo8xeiEA2ZQRbv+ZMohg=; b=Nr2GuznM7eoZNjRv4P9NCbu9IRnSKxqrHArGPFmPgLUCeBp/RSqFyBVFNgky4hwBZ1 jlq48NLbXZXW+pN23O8hNDT+yfnX0COEmh/z0VU68fDz2gXP0qH6aNoVxrxe12M04hfM tRt7XQDJNSCMMssUeQp2eA4R6TUJhtiqooagUl5WyL6YptAqrxXRCB2c4Cl7+eqOJECS enbgQm9kkwPZM+dfwAzziKJdfVfUwbAOfog+VREsGiDBWI2lXWSS2TpFZlp/oL+hM9K5 qiDXwQax4GGYdb/V8jii0gD7XMPe0HbsqEHh4BHgpDoabLweB1CcQcNpaZAJmLwfu1D5 53RQ== X-Gm-Message-State: AOAM531Epka9L0q4EDZrshHOu6xjbHoX5/Ohl3fnWnRfffFZw4Xj57/L XHi/KgOeGljMzQadj82nQuQnFw== X-Google-Smtp-Source: ABdhPJyjBZflIxewnFoA586kTEZ1E47CIx2xau/bh4Q9aZRwll3Q25N03AxelG8v/85b0piN31gsww== X-Received: by 2002:a63:ca51:: with SMTP id o17mr7872380pgi.314.1608778720512; Wed, 23 Dec 2020 18:58:40 -0800 (PST) Received: from rfd.leadboat.com ([2600:1702:a20:5750::43]) by smtp.gmail.com with ESMTPSA id a136sm26440677pfd.149.2020.12.23.18.58.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Dec 2020 18:58:39 -0800 (PST) Date: Wed, 23 Dec 2020 18:58:36 -0800 From: Noah Misch To: Andres Freund Cc: Peter Geoghegan , Robert Haas , Peter Eisentraut , Alvaro Herrera , Marco Nenciarini , Petr Jelinek , Thomas Munro , Simon Riggs , PostgreSQL-development Subject: Re: [PATCH] Logical decoding of TRUNCATE Message-ID: <20201224025836.GA4158910@rfd.leadboat.com> References: <20180405170712.av633jvnnizmd5sn@alvherre.pgsql> <1baed811-47b2-5b7d-c641-4b7eb01d650f@2ndquadrant.com> <20201220041319.GA3602688@rfd.leadboat.com> <20201220231308.yi4t3xj2btpanxs5@alap3.anarazel.de> <20201221174247.67pnoem5dtscocv4@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201221174247.67pnoem5dtscocv4@alap3.anarazel.de> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Mon, Dec 21, 2020 at 09:42:47AM -0800, Andres Freund wrote: > On 2020-12-20 15:54:31 -0800, Peter Geoghegan wrote: > > On Sun, Dec 20, 2020 at 3:13 PM Andres Freund wrote: > > > Hm. Do I understand correctly that this problem is hit solely because > > > the parallel mode code relies on there already have been a transaction > > > snapshot set, thus avoiding the error? And that the code normally only > > > works because GetTransactionSnapshot() will already have been called > > > somewhere, before EnterParallelMode()? > > > > It seems unlikely that InitializeParallelDSM() was ever intended to be > > run in a background worker. > > IDK, the environment in a bgworker shouldn't be that different from the > normal query environment in a normal connection. And it's far from > insane to want to be able to run a paralell query in a bgworker (and I > *think* I have seen that work before). This case here seems more like > an accidental dependency than anything to me, once that could perhaps > even hint at problems in normal backends too. Yeah. SPI_execute("TRUNCATE foo", false, 0) has no trouble doing a parallel index build in a bgworker. Let's ignore intention and be pleased about that.