Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Y8rXW-0002GB-Cp for pgsql-hackers@arkaria.postgresql.org; Wed, 07 Jan 2015 14:24:50 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Y8rXV-0001zQ-U5 for pgsql-hackers@arkaria.postgresql.org; Wed, 07 Jan 2015 14:24:49 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Y8rXU-0001zK-W5 for pgsql-hackers@postgreSQL.org; Wed, 07 Jan 2015 14:24:49 +0000 Received: from smtp-outbound-1.vmware.com ([208.91.2.12]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1Y8rXR-0007JU-P1 for pgsql-hackers@postgreSQL.org; Wed, 07 Jan 2015 14:24:47 +0000 Received: from sc9-mailhost2.vmware.com (sc9-mailhost2.vmware.com [10.113.161.72]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 6CDD828382; Wed, 7 Jan 2015 06:24:43 -0800 (PST) Received: from EX13-CAS-011.vmware.com (EX13-CAS-011.vmware.com [10.113.191.63]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 6B498B14B7; Wed, 7 Jan 2015 06:24:43 -0800 (PST) Received: from [192.168.1.90] (10.113.160.246) by EX13-MBX-024.vmware.com (10.113.191.44) with Microsoft SMTP Server (TLS) id 15.0.913.22; Wed, 7 Jan 2015 06:24:25 -0800 Message-ID: <54AD4182.7040601@vmware.com> Date: Wed, 7 Jan 2015 16:24:02 +0200 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.3.0 MIME-Version: 1.0 To: Andres Freund CC: PostgreSQL-development Subject: Re: [COMMITTERS] pgsql: Change how first WAL segment on new timeline after promotion is References: <20150103185957.GB15316@alap3.anarazel.de> <54AABFA2.3050409@vmware.com> <20150106132257.GE15316@alap3.anarazel.de> In-Reply-To: <20150106132257.GE15316@alap3.anarazel.de> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.113.160.246] X-ClientProxiedBy: EX13-CAS-013.vmware.com (10.113.191.65) To EX13-MBX-024.vmware.com (10.113.191.44) X-Pg-Spam-Score: -6.9 (------) 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 01/06/2015 03:22 PM, Andres Freund wrote: > On 2015-01-05 18:45:22 +0200, Heikki Linnakangas wrote: >> On 01/03/2015 08:59 PM, Andres Freund wrote: >>> Did you perhaps intend to use XLogFileInit(use_existing = true) >>> instead of XLogFileOpen()? That works for me. >> >> Hmm, that doesn't sound right either. XLogFileInit is used when you switch >> to a new segment, not to open an old segment for writing. It happens to >> work, because with use_existing = true it will in fact always open the old >> segment, instead of creating a new one, but I don't think that's in the >> spirit of how that function's intended to be used. > > Well, its docs say "Create a new XLOG file segment, or open a > pre-existing one.", so it's not that mismatched. We really don't know > whether the EndOfLog's segment already exist in this scenario. Also, > doesn't XLogWrite() essentially use it in the same way? XLogWrite() is smarter. It uses XLogFileInit() when switching to a new segment, and XLogFileOpen when writing to the middle of a segment. Committed the fix to not open the segment at all. - Heikki -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers