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.89) (envelope-from ) id 1iL2We-0005d8-ID for pgsql-hackers@arkaria.postgresql.org; Thu, 17 Oct 2019 09:56:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iL2Wd-0003ib-Bi for pgsql-hackers@arkaria.postgresql.org; Thu, 17 Oct 2019 09:56:55 +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 1iL2Wc-0003iP-RJ for pgsql-hackers@lists.postgresql.org; Thu, 17 Oct 2019 09:56:55 +0000 Received: from mail-ed1-x541.google.com ([2a00:1450:4864:20::541]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iL2Wa-00069a-5g for pgsql-hackers@lists.postgresql.org; Thu, 17 Oct 2019 09:56:53 +0000 Received: by mail-ed1-x541.google.com with SMTP id r4so1253484edy.4 for ; Thu, 17 Oct 2019 02:56:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=JTyCNUhleoCCEpm29Ayq2T/hEYnKqR6k0VIeqjSa7Wk=; b=yevqXkMyBlBIqzsE2XO5aY5Un30CngLcbfQEYIecF58FJnQyIuq+QjGc4NT6tmSSgi rToQnGBPv44UCzYa/42KRKILWvOa+9QTrVSVoQqQwRjLcz2cQr8pGH8FZ5AwB9Tvrkeq P+KyKryXYsNujpKjlkIikOksgOnEB30fTAEKsftYJYp8UMiNNWiJKZQAV6LyUjlf1YUZ 0qE+Jfmfl0yE1volqaVRyxw8lPhKVv3Og+S8Z8xw9HwvogLAh+KZt5BgPAOV4+dGap9L yiBye+pxfQtmu2l7RlCZ5kEj8YxHIukEX4I5Xh5JNZBwRhPqpAASO6JBqZnehIj5bGSN qMNw== 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:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=JTyCNUhleoCCEpm29Ayq2T/hEYnKqR6k0VIeqjSa7Wk=; b=sWavsMky7dybz+AfhHjM8FwyvPlJu6XoXaquY+3hPfGkKRdssfcRtf1Sgil7gCKqHX kOzQdGrUMjiOmPIT7EyaUTWQDQn6HuenHvAKNSlCnihVfO7Tfo4u6Igcy2BTxAB4tFio jO/ApZGkz7M/k555u1DrblEZF/0G95Gl7aLUIBpbedEh4crPDCfUQSucbYuIbVbC7P5G S+cnrRmcWUO5rJ74CK4VAq8NmcRVlkCZa0nGXLAv9dFe4jKU8TDS7nVeUyMM44FSpprV kFX5ysqk8vd/Ji3qJvlMEpJTQmBFfZBf4ZahKujW5o2/4xRRopUBPVq3Jqu3qIfYHjaS vn9w== X-Gm-Message-State: APjAAAU93eFE5H5kL3qJxIR623xlxTKZ/Hlp5uSil++q6wlT1reOmNlN uRMVQnRuFtLzlRyRgYS1qeNqUw== X-Google-Smtp-Source: APXvYqxPfM9BDD/CRI3X3lLr7ztADuBpheVjAbSxZvvpONyIHXOV8lwatImlPV+nBTN4v+sut/dcJg== X-Received: by 2002:a17:906:4908:: with SMTP id b8mr2525630ejq.83.1571306210746; Thu, 17 Oct 2019 02:56:50 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([82.102.24.174]) by smtp.gmail.com with ESMTPSA id q33sm84660eda.60.2019.10.17.02.56.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 02:56:50 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 2C7D2300A24; Thu, 17 Oct 2019 06:56:48 -0300 (-03) Date: Thu, 17 Oct 2019 06:56:48 -0300 From: Alvaro Herrera To: Michael Paquier Cc: Justin Pryzby , pgsql-hackers@lists.postgresql.org, Peter Eisentraut , Andreas Karlsson Subject: Re: v12.0: segfault in reindex CONCURRENTLY Message-ID: <20191017095648.GA22473@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20191017085024.GG17439@paquier.xyz> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019-Oct-17, Michael Paquier wrote: > On Thu, Oct 17, 2019 at 05:33:22AM -0300, Alvaro Herrera wrote: > > Hmm, I wonder if it isn't the right solution to set 'progress' to false > > in that spot, instead. index_drop says it must only be called by the > > dependency machinery; are we depending on that to pass-through the need > > to update progress status? I'm going over that code now. > > pgstat_progress_end_command() is done for REINDEX CONCURRENTLY after > the concurrent drop, so it made sense to me to still report any PID > REINDEX CONC is waiting for at this stage. Yeah, okay. So let's talk about your proposed new comment. First, there are two spots where WaitForLockers is called in index_drop and you're proposing to patch the second one. I think we should patch the first one and reference that one from the second one. I propose something like this (sorry for crude pasting): * Note: the reason we use actual lock acquisition here, rather than * just checking the ProcArray and sleeping, is that deadlock is * possible if one of the transactions in question is blocked trying * to acquire an exclusive lock on our table. The lock code will * detect deadlock and error out properly. * * Note: we report progress through WaitForLockers() unconditionally * here, even though it will only be used by REINDEX CONCURRENTLY and * not DROP INDEX CONCURRENTLY. */ and then /* * Wait till every transaction that saw the old index state has - * finished. + * finished. See above about progress reporting. */ -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services