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 1oxmcK-0007Qe-I8 for pgsql-hackers@arkaria.postgresql.org; Wed, 23 Nov 2022 10:04:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oxmcJ-0001Wg-9U for pgsql-hackers@arkaria.postgresql.org; Wed, 23 Nov 2022 10:04:31 +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 1oxmcI-0001WX-Ud for pgsql-hackers@lists.postgresql.org; Wed, 23 Nov 2022 10:04:31 +0000 Received: from mail-ua1-x929.google.com ([2607:f8b0:4864:20::929]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oxmcD-00057E-7z for pgsql-hackers@postgresql.org; Wed, 23 Nov 2022 10:04:30 +0000 Received: by mail-ua1-x929.google.com with SMTP id w17so5657614uam.1 for ; Wed, 23 Nov 2022 02:04:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=5iZUGGJXQ6OU7WLshxeFeU2aTIjwYqOT/TGB8l7lGr8=; b=EJMCkdRt7xZD8hnYSryW7AJ/3k/s0ct21vceeYmfXL/4fSOTuD181mXkq/5O+qgJtI H0UAni6mtV7f4y4OFmmkwCuI2/uankBLJ9BKmsz8+WKLX63leQivhuYaCwK+JK4BbbRh S5RSVCL6zgY+BEhV/cL7xOeNx1f0PSOjpy58fQddgznZ47UhpjJymTkval+uy6i5tw65 L2fiFodbSfbs1QYWIV0N9cB7WbAd1hLcIpEJwAGn0wkRopZNY+bWMOjCkIVtYwcv7KlN +rPfn9dZbeY8BaQS025V9Y8W+y0+infuiUs4JE/g5sBj9xOcloVZpVlKfwTa7qsMBDlt XkrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=5iZUGGJXQ6OU7WLshxeFeU2aTIjwYqOT/TGB8l7lGr8=; b=oyPJQ83wC93gE/lg67m3JmfvgF2b8wK6J73HSmvrEbfRKzBM78q/6VsdXda681DaFH +kpKIpk2SWn4Wqcmi7PKxasltF8b1QMKtLnZGfEQzWpjn7cTCFbzRZYGccSLD94cVh8o vtaMmQ3dPmV7HgXHXvwDncQk+ZiohZ0NnCy1hqrZwRptYEMbz7LcOloUFoAcYczTHbDF AmzjLpvidOhKWAR+B0eslTXM4N0L3KDvnbtxidYxfYsD0XMZdwP2ms47TOcs9jo35slK XLSiDCv72TMxzhOiPZPQ/vx607lzNAyZiRhWJAzAQnsybvpgOlfvaC1iw9LjcL10+hgy Jwgg== X-Gm-Message-State: ANoB5pmN8tDkTh3Gc5Uz3iP22KQuF3qDHt2wJxp971tnnbf2HjUOuygF NDBC8sPnJo5vE4I0/PGNwv50MHTYXHIPQsr5gkA= X-Google-Smtp-Source: AA0mqf54yeJsDU9FTGjIGD4lDC1nA/NapB+OM9hZv+EoTbmogRR5yvtsIRgq5PNdIYr7dVmz0f/GfCN2BQZ+0pN/chQ= X-Received: by 2002:ab0:20b5:0:b0:418:bee3:5614 with SMTP id y21-20020ab020b5000000b00418bee35614mr7443744ual.20.1669197863161; Wed, 23 Nov 2022 02:04:23 -0800 (PST) MIME-Version: 1.0 References: <20221123014224.xisi44byq3cf5psi@awork3.anarazel.de> In-Reply-To: <20221123014224.xisi44byq3cf5psi@awork3.anarazel.de> From: Thomas Munro Date: Wed, 23 Nov 2022 23:03:45 +1300 Message-ID: Subject: Re: odd buildfarm failure - "pg_ctl: control file appears to be corrupt" To: Andres Freund Cc: pgsql-hackers@postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Nov 23, 2022 at 2:42 PM Andres Freund wrote: > The failure has to be happening in wait_for_postmaster_promote(), because the > standby2 is actually successfully promoted. I assume this is ext4. Presumably anything that reads the controlfile, like pg_ctl, pg_checksums, pg_resetwal, pg_control_system(), ... by reading without interlocking against writes could see garbage. I have lost track of the versions and the thread, but I worked out at some point by experimentation that this only started relatively recently for concurrent read() and write(), but always happened with concurrent pread() and pwrite(). The control file uses the non-p variants which didn't mash old/new data like grated cheese under concurrency due to some implementation detail, but now does.