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 1i6Fyb-0003W1-LK for pgsql-committers@arkaria.postgresql.org; Fri, 06 Sep 2019 15:16:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i6Fya-0004pw-9l for pgsql-committers@arkaria.postgresql.org; Fri, 06 Sep 2019 15:16:40 +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 1i6FyZ-0004gE-RF for pgsql-committers@lists.postgresql.org; Fri, 06 Sep 2019 15:16:40 +0000 Received: from mail-yw1-xc43.google.com ([2607:f8b0:4864:20::c43]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i6FyW-00082R-86 for pgsql-committers@lists.postgresql.org; Fri, 06 Sep 2019 15:16:39 +0000 Received: by mail-yw1-xc43.google.com with SMTP id n11so2311490ywn.6 for ; Fri, 06 Sep 2019 08:16:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=from:subject:to:references:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=hKgL6Kqslm/y+5hxdsLtJbEBrFykQRHUoUZZncp+UNw=; b=wkMscq1R9eeyr945crwjOkLpOa6FYIM1Z/FOVEh44ewANQumI8jRRJGI09KJiqdx0U V3OOm2esjvE3uf6UOjYcssAXN59p28xnEKxD8o/sBjSuAsNz5W4ggDqrQqmxClePbbkk gQhSm1XgzRVXdcQHT8Zn0gGY3Lvi3XNG5Ul8PNPa2d5PIDL35o593QGm92X5e/yGiBW5 Q4bg1fTExRzsJxyemq0lRz0II2FjgfJPMVP2/ldOMMCI99X73G5EA4ubHYtXGRfH/pBI rd8P54arO+fkTOuy79BXpkl9PaNmJA64He/f0ft4jzzMgFUW25zluo3eWXraGOSuLhSp 4ZlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:references:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding:content-language; bh=hKgL6Kqslm/y+5hxdsLtJbEBrFykQRHUoUZZncp+UNw=; b=db8ZUgxBhhvX80RAsDMS5adZawwBd2SM1FsDlT55JQTH87RBfSYFmF26hgBT8HlxE4 ZAc804armWXmbWiPicT8bGRNWPmucPJtS49692aF7nZnnQc9nVb76Y0cID0/q/hftOdh YOWrwjQBMqTevlcAlKQ0fMngOd6mA9MX6TQWSgsFkzKDG9t31lg/Ra4ZerCKvQH1pKC3 Nieu2LgDK9hUBKcSmh+GxSp12hG/mUwFhWswoJCpo0sh9Lz7POn170LX0MTzfrnfsKTs L2jpCRv1YWshQa8VeSdygOGb0Xm6DdZtoRVobcOhDTmhzta9wVdoslsrKKC9oI+AKphh 5Arw== X-Gm-Message-State: APjAAAW41khqBtVoocJgcE/igzjOLNDb3ruJZ3/9ORSwnhWKvxNqKeJj wk9CFe/EnV04Bvr9AqmtinhHZUCaPi5nPoIu+tXdafvuvNS/eHcuCqEUEDB+Iin/OwiD58/g1dp 3lnWSEtggQUBuZ3NIaygHmCrmY+gl9Y0WqEx4QX0O9qHIMRWpqG1W1qmhx7xD5srAV0xbSyMiDv XNla25tz5CRwfNz535x09N2wHdF7A= X-Google-Smtp-Source: APXvYqx42WkGz7Z12hA60o8ZPWKllSFw7BUyXoTBS4da3GvuznN6IpduA9ehDn4NeWHxKqXk8auBzQ== X-Received: by 2002:a81:8205:: with SMTP id s5mr6758916ywf.218.1567782544527; Fri, 06 Sep 2019 08:09:04 -0700 (PDT) Received: from [192.168.10.146] (99-10-92-30.lightspeed.rlghnc.sbcglobal.net. [99.10.92.30]) by smtp.gmail.com with ESMTPSA id l77sm1204250ywb.32.2019.09.06.08.09.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Sep 2019 08:09:02 -0700 (PDT) From: Andrew Dunstan X-Google-Original-From: Andrew Dunstan Subject: Re: pgsql: Use data directory inode number, not port, to select SysV resour To: Tom Lane , pgsql-committers@lists.postgresql.org References: Openpgp: preference=signencrypt Autocrypt: addr=andrew.dunstan@2ndQuadrant.com; prefer-encrypt=mutual; keydata= xsBNBE7KWFkBCAClridxur2AIc7eW2AR7izbfp3EnNefie2HbLF0izW5Ik5UjX2HBXBx4syI gY6b0ugohXrr274+baoAlvSbq6cAoQuEVrk5IZFzt20b1Xkx65FwGSEj526yiKLocqkJceSq Xr9xcA5SGY+FZv441chh5SU92v4q6z+6LPpoHOh97ptAVXZYNTtU0LevyvD5lja0TzbvJm6C eFXitJfnm1pLEr0DGJCR/iUOl/N62Kh4855zZC7NHIjQHPOvV5Stz/l5ilDhvGVk+xkXFPys SjZoUr1rXhYLpiyi5sR0X9FHXT0KnGuz1F5ERO7ZTLSSQ6fJwPj6gOk9K+vvoKvoeql5ABEB AAHNL0FuZHJldyBEdW5zdGFuIDxhbmRyZXcuZHVuc3RhbkAybmRRdWFkcmFudC5jb20+wsCY BBMBAgBCAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAUJDyV6hBYhBOQ+WEYd/Hy/RGkV pZn6f8tZ/DuBBQJcH/EVAhkBAAoJEJn6f8tZ/DuB7BEH/iDWZEbVft2m2MT6SPjARzTupt/l xLLZ/Cl6n2US2hov5+fBbnR5xvECk/YCOfG9ICvKNlpFjceqNLRKStd8cmndnI+kDw91uNM2 hpL4aJMeW65XCHvqXlOLSwv5chBpXz9NG7FMaJ+q+59sWEWjcTNmjXgkEHn53y+1pc7nSLDe cr5ZI1aB3nGXRm1SoDY5PYZkUKMykW+YBZwgcs/Q5tRaE+siN7DKbz8E628+PerwAkmHPVXN MdJFD6gs4S0gDFA8IxcyIwZU2v4By+brzcJ9Se3FK5BYxBDHtaYZxgSrJAvOUOrLIZPQTQfL TtnVs3C3JTfrxCH1ceHtnA6dRuTOwE0ETspYWQEIANGc4zQULOxhbqO2dyD51YhqCNRmm9oK Waqf+wmW4tpDe/VVcxAnNizd4LWCHfzpb5cHAtGkOPePMfzWVf6nvdF7d3eglbtf59+zG7O7 llV0xSSoFiieQBsrGvqDInXYX/4mRRXMtyhM353/tixC9RWLs1oofyYmCPPXXY7h9R7en3B8 BoVrRFcdzlIY/NFNhFGW/9dkEiGjgna2Rk6e15kln4ZvFBWUg23p93w/pqXcxY6+k/8TEk+C 4R+M6w7o2PLGOjdZ+kPiUcw5H85zf/yZJwQXzisXaNduwWB6Vads9YC9dj6kPR1c4VGRqAaY L++LAEOqrlvm2TvqQqZRtnEAEQEAAcLAZQQYAQIADwIbDAUCXA6fpAUJDyV6xAAKCRCZ+n/L Wfw7geU4B/9vFFsVmWxerDWgNjyiK80zIPmlw/iwdUlU6FIu0JWLMg4093kvxBs7RMZV9hBq n3ekBvD4IvFsVLJrw9qzSI2FH3UeYy5WXpEs01Ppia60NOlvRDqXbryzuvfe+iYo6bVP3Ikr TPTNYL/BePUTD2DPvSI82SbGTyzuA7SJv6NRqqQDMIy1fU6KyQFLmQJp/QJyhKWzm9jWh8ee w8jVaoMY0Kbq5N7RqisEx1Lu/Iw646UphdYzQNymf+kbiU5Kf4I6DhzV8w9sie1Bo1juNj3I c5/fFJsmxljbnaDbXPcnFsur1Oo9mIHFakgWgOBMuxoWfjONiLjjLh/9+ZIqSSLX Message-ID: <176e86ba-1a46-9d8c-5ae4-9865a463b411@2ndQuadrant.com> Date: Fri, 6 Sep 2019 11:09:02 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-MW List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 9/5/19 1:32 PM, Tom Lane wrote: > Use data directory inode number, not port, to select SysV resource keys. > > This approach provides a much tighter binding between a data directory > and the associated SysV shared memory block (and SysV or named-POSIX > semaphores, if we're using those). Key collisions are still possible, > but only between data directories stored on different filesystems, > so the situation should be negligible in practice. More importantly, > restarting the postmaster with a different port number no longer > risks failing to identify a relevant shared memory block, even when > postmaster.pid has been removed. A standalone backend is likewise > much more certain to detect conflicting leftover backends. > > (In the longer term, we might now think about deprecating the port as > a cluster-wide value, so that one postmaster could support sockets > with varying port numbers. But that's for another day.) > > The hazards fixed here apply only on Unix systems; our Windows code > paths already use identifiers derived from the data directory path > name rather than the port. > > src/test/recovery/t/017_shm.pl, which intends to test key-collision > cases, has been substantially rewritten since it can no longer use > two postmasters with identical port numbers to trigger the case. > Instead, use Perl's IPC::SharedMem module to create a conflicting > shmem segment directly. The test script will be skipped if that > module is not available. (This means that some older buildfarm > members won't run it, but I don't think that that results in any > meaningful coverage loss.) > > Patch by me; thanks to Noah Misch and Peter Eisentraut for discussion > and review. > > Discussion: https://postgr.es/m/16908.1557521200@sss.pgh.pa.us > This has caused the 017_shm.pl tests to be skipped on jacana and bowerbird, and to fail completely on my msys2 test system where the Perl has the relevant IPC:: modules, unlike the buildfarm animals. Maybe we need to fall back on the older code on Windows? cheers andrew -- Andrew Dunstan https://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services