Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oJMX7-0001bH-96 for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Aug 2022 22:08:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oJMX6-0002EM-5K for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Aug 2022 22:08:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oJMX5-0002EC-SK for pgsql-hackers@lists.postgresql.org; Wed, 03 Aug 2022 22:08:03 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oJMX3-0001IU-Ah for pgsql-hackers@lists.postgresql.org; Wed, 03 Aug 2022 22:08:03 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 22B345C00AF; Wed, 3 Aug 2022 18:07:58 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 03 Aug 2022 18:07:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; t=1659564478; x=1659650878; bh=K8r5nil/pV 2q1ZhGMkdVN1hpXKvsdMwYJiKeQ8K9G/E=; b=IBrQIy1WEN3hsKXt4U7VZ+rtUS YhNhpw0wTXZ2yM7S59qsUvurvlzOKrFWGgw5tztsiWmW2lTflCOoo9u02GMnwXgF bVxaRwZnOWvT1RIEW6E9Qff+kj2LO1YKfenIMJL+g/NxBq19/3HQLieaTxnyR7Z4 Fv02gc1ZY5ynTYDxkKVkEDledpri4d4QCA22Sx717wop4KT2O44VOjUbbZBHnP6X WcWNL2LlVy9S3ko9bt/omydNKtE0tu1GDL1ZCMnrpXmh7r0PeiW329KneyFa9dy2 K62EF2+T3Tic2FjCpi+dF0hh8U6I2vpkNQ4ehJxWUuIhRG7Vk6i7qhIo5ewg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1659564478; x=1659650878; bh=K8r5nil/pV2q1ZhGMkdVN1hpXKvs dMwYJiKeQ8K9G/E=; b=XrhdPNpNvtzi0avB6ypJuEyKk5sY2n2vbIyPlvtPQMm2 30vglWAb2itTJBCLKJ6OqqRJd95Cg1nN94DMogPmd6yyzYUvOcyCccsMFDocFjmg WnFkAxWJICzQ4rxaIKT1kmqZfCTVf+X1cNiUKCCEBoM0c5iM9NhgjxDmTnU0wUEn r+3bV3THfXO9XeWoceSAJTGa4Wb5C3KxfqlKgZCs4fwrvLVgtWvhb1dJbG/hLhAn 7qnf4cQDcJIrYdF72y50dJojKj5UWd+UzEO3OgjyBrWnyAI3CR5RJuM0qYD1wo6R OEZ+rkZArq8GOZSHyArkYofadrLLMdv3x7gCCker2w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvddvkedgtdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughr vghsucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrf grthhtvghrnhepvdfffeevhfetveffgeeiteefhfdtvdffjeevhfeuteegleduheetvedu ieettddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh eprghnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 3 Aug 2022 18:07:57 -0400 (EDT) Date: Wed, 3 Aug 2022 15:07:56 -0700 From: Andres Freund To: Robert Haas Cc: Tom Lane , Thomas Munro , Melanie Plageman , PostgreSQL Hackers Subject: Re: Unstable tests for recovery conflict handling Message-ID: <20220803220756.be7lljtuakaenjzu@awork3.anarazel.de> References: <394950.1651077914@sss.pgh.pa.us> <447238.1651082925@sss.pgh.pa.us> <2454340.1658858273@sss.pgh.pa.us> <20220726181611.4xw3blxigqzsz4d4@alap3.anarazel.de> <2468550.1658860230@sss.pgh.pa.us> <20220726200354.hunrcu6zfjakxfnk@alap3.anarazel.de> <20220803175702.lhqqhcyhuykwbkcu@awork3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2022-08-03 16:33:46 -0400, Robert Haas wrote: > On Wed, Aug 3, 2022 at 1:57 PM Andres Freund wrote: > > The reason nothing might get logged in some cases is that > > e.g. ResolveRecoveryConflictWithLock() tells > > ResolveRecoveryConflictWithVirtualXIDs() to *not* report the waiting: > > /* > > * Prevent ResolveRecoveryConflictWithVirtualXIDs() from reporting > > * "waiting" in PS display by disabling its argument report_waiting > > * because the caller, WaitOnLock(), has already reported that. > > */ > > > > so ResolveRecoveryConflictWithLock() can end up looping indefinitely without > > logging anything. > > I understand why we need to avoid adding "waiting" to the PS status > when we've already done that, but it doesn't seem like that should > imply skipping ereport() of log messages. > > I think we could redesign the way the ps display works to make things > a whole lot simpler. Let's have a function set_ps_display() and > another function set_ps_display_suffix(). What gets reported to the OS > is the concatenation of the two. Calling set_ps_display() implicitly > resets the suffix to empty. > > AFAICS, that'd let us get rid of this tricky logic, and some other > tricky logic as well. Here, we'd just say set_ps_display_suffix(" > waiting") and not worry about whether the caller might have already > done something similar. That sounds like it'd be an improvement. Of course we still need to fix that we can signal at a rate not allowing the other side to handle the conflict, but at least that'd be easier to identify... > > Another question I have about ResolveRecoveryConflictWithLock() is whether > > it's ok that we don't check deadlocks around the > > ResolveRecoveryConflictWithVirtualXIDs() call? It might be ok, because we'd > > only block if there's a recovery conflict, in which killing the process ought > > to succeed? > > The startup process is supposed to always "win" in any deadlock > situation, so I'm not sure what you think is a problem here. We get > the conflicting lockers. We kill them. If they don't die, that's a > bug, but killing ourselves doesn't really help anything; if we die, > the whole system goes down, which seems undesirable. The way deadlock timeout for the startup process works is that we wait for it to pass and then send PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK to the backends. So it's not that the startup process would die. The question is basically whether there are cases were PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK would resolve a conflict but PROCSIG_RECOVERY_CONFLICT_LOCK wouldn't. It seems plausible that there isn't, but it's also not obvious enough that I'd fully trust it. Greetings, Andres Freund