Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tze9H-004iDF-Um for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Apr 2025 16:07:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tze9F-0047yA-D3 for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Apr 2025 16:07:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tze9F-0047y2-2w for pgsql-hackers@lists.postgresql.org; Tue, 01 Apr 2025 16:07:33 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tze9C-002N34-2V for pgsql-hackers@postgresql.org; Tue, 01 Apr 2025 16:07:31 +0000 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-223fb0f619dso108871495ad.1 for ; Tue, 01 Apr 2025 09:07:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1743523649; x=1744128449; darn=postgresql.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=1qfCTeYD6s0sc5915bqMb4Nf9IA58Eyqz5PKmdfUStQ=; b=a6bjLPOggRsyfC4Qzbv6wE0sTdbqYR0hEcD10Z1/NG1/oO3HBsQZf/cK2sWa7TGZOW 5XnWADzk8H0m0cN6AYEZdHdIimTcGj746Jtcath/RO8g5DNI4QjwKgTIQgjUgOz/vawF gWdfqyM8b0LQgXj4mugB7ENreKIPsoffJQ0Iw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743523649; x=1744128449; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1qfCTeYD6s0sc5915bqMb4Nf9IA58Eyqz5PKmdfUStQ=; b=PALWqrSIRhgsUvIZRZZAF+kig1GVCu+HQWSGfBncgAcPj1GzSmlZAAUw8z9HSlGIDI V4a7kLJZfXcZENQMHzUy+NjqqklVVwPVODZ92NUYHaOnHx3rQ3aNST3wddO0MjJGasef ZQICdkplP7dV+k9TjWvGqBRbWMtyAct/OTy40P4RMjezbycFpsfSp+yIZyBgmVIhtWx+ PBfrR/eYHnvVN7jUqUarvENv8og6gv+7FkkusaSQnamfuY+PiQs1sg23yThNJT/PqiuX zafNtdmIZQ/hcW0blELoIXknW/6zQIoTHubLGbubN/JxT7qdPNvio0RuYeBzdg8Nfod4 /VCA== X-Gm-Message-State: AOJu0YzTzhXEeQ9JUDmEl7EYBGzySoPEfUy/Ui+0qsseuAuZ+bZe/Kdl JSU+cxFJoMdMJxgtHvfHNqjhruIFjfMBC4iw/zFp0oxYIdCNulvInza79aL4kA== X-Gm-Gg: ASbGncse3ApQd1stmAaVGYB1IJWoYx67LisjOV5EF9fK3UmSJJHwTgrawK63mc4n7pm ry6YjLZigt62f+zmTV1dQ5od5G6IJBabItRqKBlx8Ppwu8zAvtV5vUwoWOD167ZwqsGKrPlbq6Q WCHvsN2dThhFd9ice1pzGizeURkV+4VaTyjrKr0lNjVXDO1ntlvsfkWy21iI5PsUhfFKAQateEw tpdPSL+UlBJT1VUeQJsbfXtJLO9PQ0kDeQoUNsvjmgTFHYpQzsywyxxcXuXP2z3vosIpYEDVIVs cI3HRj5R/r1sLBQvBEnZmiXDuIEmhNVpikFs1EPrLw== X-Google-Smtp-Source: AGHT+IHQGgf+Qn4EkBhn2CG4W1RmYQhKLI1pV2W+L5oab1fJjlzfhq07f7PS5pCBaZ8vtrnOv8wnjA== X-Received: by 2002:a05:6a00:4608:b0:736:57cb:f2aa with SMTP id d2e1a72fcca58-739b601f14amr4017934b3a.13.1743523649513; Tue, 01 Apr 2025 09:07:29 -0700 (PDT) Received: from google.com ([2601:647:5600:80d0::31cd]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-73970e27129sm9372919b3a.57.2025.04.01.09.07.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Apr 2025 09:07:29 -0700 (PDT) Date: Tue, 1 Apr 2025 09:07:27 -0700 From: Noah Misch To: Andres Freund Cc: pgsql-hackers@postgresql.org, Thomas Munro , Heikki Linnakangas , Robert Haas , Jakub Wartak , Jelte Fennema-Nio , Antonin Houska Subject: Re: AIO v2.5 Message-ID: <20250401160727.bd.nmisch@google.com> References: <20250329134143.ca.nmisch@google.com> <20250329212929.a6.nmisch@google.com> <7s6fclfekpcxoaaorwrq67v4vmgixf2dcjcgznuj7vxs3ie3wq@okqbi5vabqbx> <20250401151159.51.nmisch@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.2.12 (2023-09-09) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Apr 01, 2025 at 11:55:20AM -0400, Andres Freund wrote: > On 2025-04-01 08:11:59 -0700, Noah Misch wrote: > > On Mon, Mar 31, 2025 at 08:41:39PM -0400, Andres Freund wrote: > I haven't yet pushed the changes, but will work on that in the afternoon. > > I plan to afterwards close the CF entry and will eventually create a new one > for write support, although probably only rebasing onto > https://postgr.es/m/stj36ea6yyhoxtqkhpieia2z4krnam7qyetc57rfezgk4zgapf%40gcnactj4z56m > and addressing some of the locking issues. Sounds good. > WRT the locking issues, I've been wondering whether we could make > LWLockWaitForVar() work that purpose, but I doubt it's the right approach. > Probably better to get rid of the LWLock*Var functions and go for the approach > I had in v1, namely a version of LWLockAcquire() with a callback that gets > called between LWLockQueueSelf() and PGSemaphoreLock(), which can cause the > lock acquisition to abort. What are the best thing(s) to read to understand the locking issues? > > > +# Verify checksum handling when creating database from an invalid database. > > > +# This also serves as a minimal check that cross-database IO is handled > > > +# reasonably. > > > > To me, "invalid database" is a term of art from the message "cannot connect to > > invalid database". Hence, I would change "invalid database" to "database w/ > > invalid block" or similar, here and below. (Alternatively, just delete "from > > an invalid database". It's clear from the context.) > > Yea, I agree, this is easy to misunderstand when stepping back. I went for "with > an invalid block". Sounds good. > > > + if (corrupt_checksum) > > > + { > > > + bool successfully_corrupted = 0; > > > + > > > + /* > > > + * Any single modification of the checksum could just end up being > > > + * valid again. To be sure > > > + */ > > > > Unfinished sentence. > > Oops. See below. > > > > That said, I'm not following why we'd need this loop. If this test code > > were changing the input to the checksum, it's true that an input bit flip > > might reach the same pd_checksum. The test case is changing pd_checksum, > > not the input bits. > > We might be changing the input, due to the zero/corrupt_header options. Or we > might be called on a page that is *already* corrupted. I did encounter that > situation once while writing tests, where the tests only passed if I made the > + 1 a + 2. Which was, uh, rather confusing and left me feel like I was cursed > that day. Got it. > > I don't see how changing pd_checksum could leave the > > page still valid. There's only one valid pd_checksum value for a given > > input page. > > I updated the comment to: > /* > * Any single modification of the checksum could just end up being > * valid again, due to e.g. corrupt_header changing the data in a way > * that'd result in the "corrupted" checksum, or the checksum already > * being invalid. Retry in that, unlikely, case. > */ Works for me.