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 1kFDWL-0000ke-DA for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Sep 2020 09:33:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kFDWK-0008C2-BO for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Sep 2020 09:33:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kFDWJ-0008Bv-TL for pgsql-hackers@lists.postgresql.org; Mon, 07 Sep 2020 09:33:04 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kFDWH-0000bD-80 for pgsql-hackers@postgresql.org; Mon, 07 Sep 2020 09:33:03 +0000 Received: by mail-pl1-x641.google.com with SMTP id d19so805178pld.0 for ; Mon, 07 Sep 2020 02:33:00 -0700 (PDT) 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=05fcDLGINhBEsjeaEY15QhmD6LCzHqMO9gPd+6DhTJM=; b=cQXTD4+X9JlV/bvQep2N3khPfUqRxmvqgRwvQf8NYRe/On0EXyl/Y1U5IRD13gVz2E 7sClwnvSJa80N1HrSoM4iuUajB41kuhQn75jVxwYCCbUijLgpsHF3a5V2h8H8ZugP8M+ 0dRTxT4tBMOxX/n5WZmNtUX0fa6b3x6tT4z68= 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=05fcDLGINhBEsjeaEY15QhmD6LCzHqMO9gPd+6DhTJM=; b=aWLoXYdt3MvjKUU5a9rTGjJNiOx8lOnusiQUMtXQKHqvBLwiLaDPgUS7BdrWpB3hms zBSYAWLShOXzVUCrPrrckvcd4ArOq2oh/tzGvhusVPva0cd++ETFn9FeKN6/7sAIhtU3 7lWkyq+aTZtmyI6/St6QzUrXfZTBx1ATlBgCk58u1mZdc6NGfZ4k8bY0CGwHDg/KHylA 7p/pkxtoFW0iuErPRhcdmt3nItb5EsW6Uy/wVhj8sflk5pNYo03zZ3kDccxpi60W/j/J u+XNldbLjhR4m7/jJO6o8LIO56ROtIhX6oKunzJ4UGb1C9MvzqzPtBTMjiWORUkQ0NG8 tDKw== X-Gm-Message-State: AOAM5311WR+gu9qq75YNorBq3oNHi5VAPmQT5rJKQ6QE/6DT/NNqDh6R tJe6DLFwFj0AEDw0fF89TbZ/Cw== X-Google-Smtp-Source: ABdhPJwOGhG80Hl1BkogrrJcOKl+5xtZAfjwDO70EB+WJp/93IubEtioGXitGzeQzfLSHVANTJ9V3g== X-Received: by 2002:a17:90a:a583:: with SMTP id b3mr19692500pjq.127.1599471178980; Mon, 07 Sep 2020 02:32:58 -0700 (PDT) Received: from rfd.leadboat.com ([2600:1702:a20:5750::43]) by smtp.gmail.com with ESMTPSA id l1sm14532751pfc.164.2020.09.07.02.32.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Sep 2020 02:32:58 -0700 (PDT) Date: Mon, 7 Sep 2020 02:32:55 -0700 From: Noah Misch To: Kyotaro Horiguchi Cc: tgl@sss.pgh.pa.us, pryzby@telsasoft.com, pgsql-hackers@postgresql.org Subject: Re: v13: CLUSTER segv with wal_level=minimal and parallel index creation Message-ID: <20200907093255.GA3609623@rfd.leadboat.com> References: <20200907033451.GB7158@telsasoft.com> <1625111.1599453183@sss.pgh.pa.us> <20200907.134528.1788420979518620237.horikyota.ntt@gmail.com> <20200907.174036.603784943439284546.horikyota.ntt@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200907.174036.603784943439284546.horikyota.ntt@gmail.com> 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, Sep 07, 2020 at 05:40:36PM +0900, Kyotaro Horiguchi wrote: > At Mon, 07 Sep 2020 13:45:28 +0900 (JST), Kyotaro Horiguchi wrote in > > The cause is that the worker had received pending-sync entry correctly > > but not never created a relcache entry for the relation using > > RelationBuildDesc. So the rd_firstRelfilenodeSubid is not correctly > > set. > > > > I'm investigating it. > > Relcaches are loaded from a file with old content at parallel worker > startup. The relcache entry is corrected by invalidation at taking a > lock but pending syncs are not considered. > > Since parallel workers don't access the files so we can just ignore > the assertion safely, but I want to rd_firstRelfilenodeSubid flag at > invalidation, as attached PoC patch. > [patch: When RelationInitPhysicalAddr() handles a mapped relation, re-fill > rd_firstRelfilenodeSubid from RelFileNodeSkippingWAL(), like > RelationBuildDesc() would do.] As a PoC, this looks promising. Thanks. Would you add a test case such that the following demonstrates the bug in the absence of your PoC? printf '%s\n%s\n%s\n' 'log_statement = all' 'wal_level = minimal' 'max_wal_senders = 0' >/tmp/minimal.conf make check TEMP_CONFIG=/tmp/minimal.conf Please have the test try both a nailed-and-mapped relation and a "nailed, but not mapped" relation. I am fairly confident that your PoC fixes the former case, but the latter may need additional code.