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 1hdMY8-0007je-PX for pgsql-hackers@arkaria.postgresql.org; Tue, 18 Jun 2019 22:25:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hdMY7-0003N5-L2 for pgsql-hackers@arkaria.postgresql.org; Tue, 18 Jun 2019 22:25:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hdMY7-0003My-7w for pgsql-hackers@lists.postgresql.org; Tue, 18 Jun 2019 22:25:55 +0000 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hdMY4-0008Hy-AE for pgsql-hackers@lists.postgresql.org; Tue, 18 Jun 2019 22:25:54 +0000 Received: by mail-qt1-x844.google.com with SMTP id a15so17499687qtn.7 for ; Tue, 18 Jun 2019 15:25:52 -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=m44SbMSsgePAqlC1teLFPf1r8DSDqiVkl9f/Urxfe5s=; b=R0vDS9wlOw9/pwYZDWpGxl2SP8dp0sjjVIuCwTXCX//w6jD/UmsAuqIT2dZFPutOkw 2ByQfeTT4xpKjMNnXMA1oE4hjwejl8cjkt8IT63/OZjkV6KBCzzxPYEemosa3pM2n12f 5RlmGRQ6xLO4kT8f3ER5Zi3EXer2iNt/xnrM9FqYzYuSDqr6fyuA9eJYYfyaxL3vBguv T9rbg8zaJ9IFrHB8vz255HRS8PLRDlkD6/5fSD227UkiACzlak0BSQq3TrdWigaGDRQJ RKIdkZVQ+6Qttuq/7zJV8H+Z6oBRowJAIXEClm8Qu0DBXn1VpDqURFSjjp9Gei7JmEbj D7Aw== 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=m44SbMSsgePAqlC1teLFPf1r8DSDqiVkl9f/Urxfe5s=; b=NXnahvBCFgxPqoyP/IubVVrhP9pM6RDGkyOqencJCKv9SH4sxCGPuUqUZTMjv5UY4t WqFXQ6aKUFcqxXlBOd7ExCBw/7/RLB1ZNbCqO4wp9u6LtdzkCIE2cGe7HNozjMglSDTK 47lHL9eGyNu+hJsGa16HM5sMEGkrHMlsUDZkKJ1ipbB9ux/0RdJItAJzpgCHqNmqCW0K TdqpjpP/4bdsbPgiFLHm5KORPQfHDd3CSpwm7JIU6ICe4GPoBZq2ggOD90oXfGu6gOvy iIGNbHEwiVPrDQScfN3KHl2DH2vSvEcjyGOo7fwAIGDzZIeW1LnSZ0yX3UwlDBIqNwMv 6LyA== X-Gm-Message-State: APjAAAUmbsA6E7wjeuTJGXsWvnW6DBr4dc6IEaHF6L341ZTLKdZI3XLq hCHj+8dHOYS6ke7DxyywrshLG7UZ6s4= X-Google-Smtp-Source: APXvYqxHyxPwR6AhNtLx062+qziyjndlOVsfdJ1qO4H6c7ub8+Sy9Rq2Uv0059LurQXAUKvLtz9FpQ== X-Received: by 2002:ac8:4919:: with SMTP id e25mr32812612qtq.214.1560896750606; Tue, 18 Jun 2019 15:25:50 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([190.121.29.3]) by smtp.gmail.com with ESMTPSA id y16sm7561312qkf.93.2019.06.18.15.25.49 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 18 Jun 2019 15:25:49 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id B286F1202D2; Tue, 18 Jun 2019 18:25:47 -0400 (-04) Date: Tue, 18 Jun 2019 18:25:47 -0400 From: Alvaro Herrera To: Oleksii Kliukin Cc: Tom Lane , pgsql-hackers@lists.postgresql.org Subject: Re: pgsql: Avoid spurious deadlocks when upgrading a tuple lock Message-ID: <20190618222547.GA18769@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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 2019-Jun-18, Oleksii Kliukin wrote: > Sorry, I was confused, as I was looking only at > https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=de87a084c0a5ac927017cd0834b33a932651cfc9 > > without taking your subsequent commit that silences compiler warnings at > https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=3da73d6839dc47f1f47ca57974bf28e5abd9b572 > into consideration. With that commit, the danger is indeed in resetting the > skip mechanism on each jump and potentially causing deadlocks. Yeah, I understand the confusion. Anyway, as bugs go, this one seems pretty benign. It would result in a unexplained deadlock, very rarely, and only for people who use a very strange locking pattern that includes (row-level) lock upgrades. I think it also requires aborted savepoints too, though I don't rule out the possibility that there might be a way to reproduce this without that. I pushed the patch again just now, with the new permutation. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services