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 1kECa1-0000Ma-7u for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Sep 2020 14:20:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kECa0-0000RG-4Q for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Sep 2020 14:20:40 +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 1kECZz-0000R9-Tc for pgsql-hackers@lists.postgresql.org; Fri, 04 Sep 2020 14:20:39 +0000 Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kECZx-00044W-MG for pgsql-hackers@lists.postgresql.org; Fri, 04 Sep 2020 14:20:38 +0000 Received: by mail-qk1-x741.google.com with SMTP id b14so6421412qkn.4 for ; Fri, 04 Sep 2020 07:20:37 -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=qh4KVs3ufzIJzTfVYhngQN6JNb8vM7P63ZWhaEZ6ylQ=; b=RLyfgMwRh1kAKaMIeScnW2gnviysixoHmkj0V2+G/bOSx0k4OI1II1PPI74UNLa9y1 8CmVi4mJ1fLdYwjT3vhzFdPPvFP3d0pJAQ+iRF55npfebgHS840LsAz0MpKqCKM3UNZ3 /rGl3CXw6PA6M+tiGOGGkOo6dPWGtweZvVn6m2aamA6TiqycW54eV66IhJVedNgcJHH0 KVATogxzOMq+fyMPl344qzfs8SbyQulzDHCXx7Jd8joZpjGJLo7gEih4cekoDkzMabOb /znhKSoyBvM/9JXgQjf8DwuMnTKqCV40hbzzhcoo3Gsyr9sRsF3GEtKHt5mQkPykVPei EHFw== 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=qh4KVs3ufzIJzTfVYhngQN6JNb8vM7P63ZWhaEZ6ylQ=; b=pqQ4qu8rtIB4kQhtt/IPx2BKlU472eKcvGebLzLpMOL51ClNS9X0Bku7QdzI3C/pCR PpGFbSh52+aUtjCsLAP8O/mstv5glMUbCdZmpxYNKSTL7CkkJFoNZUjKI4t9S3fLZeiO ClKRj4yu0b9rtwIgW3D6bp21KdGWDQrL66hUF6yH/du073doh8OxRn7VC4XCdtKWN2jy 5c+HqOUxE4EEInj+nTIZxg7TCeOcvMFzEuCNZXBHvg1amojgnh9EU8ARa4Y6VCf6E/3U PRt3fchR29I+74pFlynog/ab7iYywre3ODCwMQFyy0k5VhzqaaJe7oLradFw4Gk+m1Ub M3oQ== X-Gm-Message-State: AOAM533RWaaNGJi69zf3Qo9r03ZJZ8GIF5jsRXvbJ00qrIN+d7Sxa8IR ujz+LExnjDR5Msm3FXJMqtwQGZ5L44U1w1NsXRAhTkBs78+Qs0Do/0mx3fJAErtmhbYRztmNGSU Bi3f+PyePVQanmaCq/eSEFr/56/wHE8zNO/cVB8z8hrI/0dwLW9Jqd9M3y+daapl3lXgv/wxyuU aNv4Or5BQ8nUiAQtx7 X-Google-Smtp-Source: ABdhPJyNhA/zXBF1PML774JmJjzsVJqkFw/1Mu6RGTYhBrccKuNpvEh3g2xHwZn/5biflqfJ8+eh+w== X-Received: by 2002:a05:620a:20d4:: with SMTP id f20mr8373504qka.222.1599229236021; Fri, 04 Sep 2020 07:20:36 -0700 (PDT) Received: from perhan.alvh.no-ip.org ([190.95.19.47]) by smtp.gmail.com with ESMTPSA id t20sm4635731qke.79.2020.09.04.07.20.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Sep 2020 07:20:35 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 8E18C2A154C; Fri, 4 Sep 2020 10:20:33 -0400 (-04) Date: Fri, 4 Sep 2020 10:20:33 -0400 From: Alvaro Herrera To: Tom Lane Cc: pgsql-hackers@lists.postgresql.org Subject: Re: Rare deadlock failure in create_am test Message-ID: <20200904142033.GA8294@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <839004.1599185607@sss.pgh.pa.us> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Sep-03, Tom Lane wrote: > So it's not hard to understand the problem: DROP of an index AM, cascading > to an index, will need to acquire lock on the index and then lock on the > index's table. Any other operation on the table, like say autovacuum, > is going to acquire locks in the other direction. Oh, of course. > I'm inclined to think that the best fix is to put > > begin; > lock table [fast_emp4000]; > ... > commit; > > around the DROP CASCADE. Yeah, sounds good. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services