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 1iq5qV-0006pB-TE for pgsql-hackers@arkaria.postgresql.org; Sat, 11 Jan 2020 01:45:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iq5qT-0001N5-Fd for pgsql-hackers@arkaria.postgresql.org; Sat, 11 Jan 2020 01:45:45 +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 1iq5qT-0001My-6O for pgsql-hackers@lists.postgresql.org; Sat, 11 Jan 2020 01:45:45 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iq5qQ-0003It-Ar for pgsql-hackers@postgresql.org; Sat, 11 Jan 2020 01:45:44 +0000 Received: by mail-wm1-x341.google.com with SMTP id p9so3931995wmc.2 for ; Fri, 10 Jan 2020 17:45:41 -0800 (PST) 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:references:mime-version :content-disposition:in-reply-to; bh=7GC5xe7Db/zUHLgYVSESdQ/KB5BlkS5cj+FMSrJJAW4=; b=H9yAjXL/dMGVenZvrajsjQuibFs/3FAD1/RDwJ2YGNP8DBkt5fqxn7PG8OYL2KwFiQ lQcm6amAf0cDe6pVjQiSQtM91ymiPlqov9+GSBckjuR+3fuFrcC6Lpei+mBozNkARBu1 iEh2YcJ3g9QP4IPXuIUMdeN0e3v4DxLWG06D9krwk6q7XE4Q95b9Vx7yXLtK3RcpOqVf PH0RaJHafPFpg+C3PvQq1lKta5kGdmGWamXlhy2BOFq5RmLm5uF+WOZJ06C7Pq5WUdgA vjTkHaYSkYjPwmw3QidjgAYv2ywnJrd+jLsnAit832ik8jma6FOYErzniSt+prq7MCWE KQdw== 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; bh=7GC5xe7Db/zUHLgYVSESdQ/KB5BlkS5cj+FMSrJJAW4=; b=dwJRt/xY9ESDkeVjSIQSr6+ZDXHECW1S9waxvH6iWXIB3eiG0h97xGTB91ZRYBoJNx DslMnhErEb7E4+iR7nMtDd7+AdIMsW06H1W66ophqU9FxCKjvmwucFaqY9ztkxxSrlpI Ga2amJwd0RJUQBIlrUtGF0dEaWROW4iAEXb2Ug8Zjomy9PlRpVeJIDoumcVXCmfWuOu7 EXTEwAVGFAipN4FbbZuiIgY5+YrSEKaHOlAxNUHPyqqTQ5pAC1suhr3knmyOuyLniPz0 i06oKYRZt49MsxRI3w5dKiQs2RLVu3+ZdzfKpHGRXSR1ZUuJUm7dexLrraNSfkK3dHaq spPg== X-Gm-Message-State: APjAAAUiWALAkDb4Dd5pRRLq2PDU1ETouYwLQHU8tvSpscgQoVho3GFn KTdIv+KQPIoV0RxZbb5iVajXqFPVg5I= X-Google-Smtp-Source: APXvYqzZeqs7WcGQ3fA6i1A7RwnSjZxDKKI8ekEnjVNj7zl6iNI8LgU+vV5QWSsieItSQx4Obv5XMg== X-Received: by 2002:a7b:c416:: with SMTP id k22mr6830506wmi.10.1578707140234; Fri, 10 Jan 2020 17:45:40 -0800 (PST) Received: from localhost (ip-86-49-253-92.net.upcbroadband.cz. [86.49.253.92]) by smtp.gmail.com with ESMTPSA id h8sm4478555wrx.63.2020.01.10.17.45.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2020 17:45:39 -0800 (PST) Date: Sat, 11 Jan 2020 02:45:38 +0100 From: Tomas Vondra To: Alvaro Herrera Cc: Andrey Borodin , PostgreSQL Hackers , Peter Geoghegan Subject: Re: Amcheck: do rightlink verification with lock coupling Message-ID: <20200111014538.y4u6fynjeha2nml6@development> References: <0EB0CFA8-CBD8-4296-8049-A2C0F28FAE8C@yandex-team.ru> <20190912131612.GA24926@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20190912131612.GA24926@alvherre.pgsql> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, Sep 12, 2019 at 10:16:12AM -0300, Alvaro Herrera wrote: >On 2019-Sep-12, Andrey Borodin wrote: > >> This patch violates one of amcheck design principles: current code >> does not ever take more than one page lock. I do not know: should we >> hold this rule or should we use more deep check? > >The check does seem worthwhile to me. > >As far as I know, in btree you can lock the right sibling of a page >while keeping lock on the page itself, without risk of deadlock. So I'm >not sure what's the issue with that. This is in the README: > > In most cases we release our lock and pin on a page before attempting > to acquire pin and lock on the page we are moving to. In a few places > it is necessary to lock the next page before releasing the current one. > This is safe when moving right or up, but not when moving left or down > (else we'd create the possibility of deadlocks). > >I suppose Peter was concerned about being able to run amcheck without >causing any trouble at all for concurrent operation; maybe we can retain >that property by making this check optional. > Peter, any opinion on this proposed amcheck patch? In the other thread [1] you seemed to agree this is worth checking, and Alvaro's proposal to make this check optional seems like a reasonable compromise with respect to the locking. [1] https://www.postgresql.org/message-id/flat/DA9B33AC-53CB-4643-96D4-7A0BBC037FA1@yandex-team.ru -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services