Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1coB3d-0003kC-0w for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Mar 2017 15:41:49 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1coB3c-0000mt-Js for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Mar 2017 15:41:48 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1coB3a-0000kp-Su for pgsql-hackers@postgresql.org; Wed, 15 Mar 2017 15:41:46 +0000 Received: from mail.thelabyrinth.net ([45.56.70.56]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1coB3Y-0005hp-MG for pgsql-hackers@postgresql.org; Wed, 15 Mar 2017 15:41:46 +0000 Received: from Davids-iMac.local (c-73-55-5-246.hsd1.fl.comcast.net [73.55.5.246]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dsteele) by mail.thelabyrinth.net (Postfix) with ESMTPSA id 7168A5567A; Wed, 15 Mar 2017 15:41:41 +0000 (UTC) Subject: Re: Backend crash on non-exclusive backup cancel To: Michael Paquier , Anastasia Lubennikova References: <20170314152714.22419.22145.pgcf@coridan.postgresql.org> Cc: PostgreSQL mailing lists From: David Steele Message-ID: <72ad0edb-766f-b70b-8ca7-a3af3d52c8eb@pgmasters.net> Date: Wed, 15 Mar 2017 11:41:40 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.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 3/15/17 2:28 AM, Michael Paquier wrote: > On Wed, Mar 15, 2017 at 12:27 AM, Anastasia Lubennikova > wrote: >> As far as I understand, in this thread were discussed two bugs of pg_stop_backup(). >> Thanks to the clear descriptions above, I easily reproduced both of them. >> >> BUG#1: >> Server crashes on assertion on call of pg_stop_backup(false) after interrupted call of pg_stop_backup(false). >> TRAP: FailedAssertion("!(XLogCtl->Insert.nonExclusiveBackups > 0)", File: "xlog.c", Line: 10747) >> >> BUG#2: >> Failure to start an exclusive backup with the same name, if previous exclusive backup was stopped in another session. >> >> Both problems seem to be fixed with patch "backup-session-locks-fixes.patch". >> Speaking of the patch itself, I have a question: shouldn't we also update sessionBackupState >> in pg_stop_backup_callback() along with XLogCtl->Insert.exclusiveBackupState? > > No, that's not necessary. sessionBackupState is not changed until the > code path where pg_stop_backup_callback() is active, and remains > unchanged until it gets deactivated. > >> And couple of minor notes: >> 1) + * Routines to starting stop, and get status of a base backup >> Probably should be: + * Routines to start, stop and get status of a base backup >> And also this comment should be moved below the enum. >> >> 2) This is used in parallel of the shared memory status >> s/ in parallel of/ in parallel with > > Agreed on both points. I have tested this patch and it behaves as expected and fixes the original issue I reported. One nit, I think: + * SESSION_BACKUP_EXCLUSIVE in this one. Actual verification that an Would be better phrased as: + * SESSION_BACKUP_EXCLUSIVE in this function. Actual verification that an Thanks, -- -David david@pgmasters.net -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers