Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VcHZv-0001Ve-Bz for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Nov 2013 16:28:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VcHZu-0004wK-SE for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Nov 2013 16:28:06 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VcHUm-0004AO-Oi for pgsql-hackers@postgresql.org; Fri, 01 Nov 2013 16:22:49 +0000 Received: from mail-qa0-f51.google.com ([209.85.216.51]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VcHUY-0005yo-EJ for pgsql-hackers@postgresql.org; Fri, 01 Nov 2013 16:22:44 +0000 Received: by mail-qa0-f51.google.com with SMTP id ii20so718817qab.17 for ; Fri, 01 Nov 2013 09:22:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=HbjvMfQfyrFAmQ06HslvGj310nooPjozNSB+4ddgCu0=; b=BELCUmN4/M5GL1xp0s+mtiSdxUE11cvseechgokEu/vABITs6S5FojyB9A0omJfIhf 7iV1HUayb4tmzmx7xG5LQyE6POGWKgkRu2Xksx3nt0z/NGr9oSyDNah+vyzM+ASYT9FI 0lFh8QFpGkqriWJLIp76Z8YdNVyz5tTaiQLCLZHHfiLyo1ZGUQ8L1GFHvEhIxgQ3eNCz h3aCq5L1yBhjcgBrbf/jbE3km3Szhz6y7MOPdbeVEXtNX6JcNwSXrhmJtnpXmSvdRsLD NoyRyaKRPtJxOWvRXBdBammZcSQ68EDM7RTrTtJVRtdA0giXa+Zm5+OZwe2bV0ZZ5zkB xzxw== X-Gm-Message-State: ALoCoQk0MUK8Cs96E6iHhGWw6EX+hNnbK12OULF73ymZHmNpvEW5EYVDixEeNabMnxhrmkeV9Neb X-Received: by 10.49.12.194 with SMTP id a2mr3417372qec.95.1383322953289; Fri, 01 Nov 2013 09:22:33 -0700 (PDT) Received: from tornado.leadboat.com (c-107-4-219-91.hsd1.va.comcast.net. [107.4.219.91]) by mx.google.com with ESMTPSA id a9sm18912335qed.6.2013.11.01.09.22.32 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 01 Nov 2013 09:22:32 -0700 (PDT) Date: Fri, 1 Nov 2013 12:22:30 -0400 From: Noah Misch To: Robert Haas Cc: Heikki Linnakangas , Tom Lane , Andres Freund , Andrew Dunstan , "pgsql-hackers@postgresql.org" Subject: Re: Something fishy happening on frogmouth Message-ID: <20131101162230.GA649568@tornado.leadboat.com> References: <20131030133718.GB11429@awork2.anarazel.de> <28492.1383140966@sss.pgh.pa.us> <527223E8.2020207@vmware.com> <20131031095021.GA31628@alap2.anarazel.de> <22875.1383229757@sss.pgh.pa.us> <5272EC6A.2020004@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On Fri, Nov 01, 2013 at 12:27:31AM -0400, Robert Haas wrote: > On Thu, Oct 31, 2013 at 7:48 PM, Heikki Linnakangas wrote: > > On 31.10.2013 16:43, Robert Haas wrote: > >> There should be no cases where the main shared memory > >> segment gets cleaned up and the dynamic shared memory segments do not. > > > > 1. initdb -D data1 > > 2. initdb -D data2 > > 3. postgres -D data1 > > 4. killall -9 postgres > > 5. postgres -D data2 > > > > The system V shmem segment orphaned at step 4 will be cleaned up at step 5. > > The DSM segment will not. Note that dynamic_shared_memory_type='mmap' will give the desired behavior. > If we want the behavior, we could mimic what the main shared memory > code does here: instead of choosing a random value for the control > segment identifier and saving it in a state file, start with something > like port * 100 + 1000000 (the main shared memory segment uses port * > 100, so we'd want something at least slightly different) and search > forward one value at a time from there until we find an unused ID. This approach used for the main sysv segment has its own problems. If the first postmaster had to search forward but the second postmaster does not, the second postmaster will not reach the old segment to clean it up. It might be suitably-cheap insurance to store the DSM control segment handle in PGShmemHeader. Then if, by whatever means good or bad, we find a main sysv segment to clean up, we can always clean up the associated DSM segment(s). -- Noah Misch EnterpriseDB http://www.enterprisedb.com -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers