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 1oZWg9-0001wK-KW for pgsql-bugs@arkaria.postgresql.org; Sat, 17 Sep 2022 12:12:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oZWg7-00017w-7m for pgsql-bugs@arkaria.postgresql.org; Sat, 17 Sep 2022 12:12:11 +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 1oZWg6-00017m-Pi for pgsql-bugs@lists.postgresql.org; Sat, 17 Sep 2022 12:12:10 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oZWg1-0004zW-Vg for pgsql-bugs@lists.postgresql.org; Sat, 17 Sep 2022 12:12:10 +0000 Received: from mail.postgrespro.ru (cyclops.postgrespro.ru [93.174.131.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 3D66E21C04FB for ; Sat, 17 Sep 2022 15:12:03 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1663416724; bh=y1IyXfQnZlnx80upCT0Ll1yAjgLWe9wYAoaYAT/sFGk=; h=Date:From:To:Subject; b=jVaQymWLHxl0s3hLws00pFYeiItqtomdF2fc4oTPgepJXGGtlw5Yu9/W2ZhFZHO+b uY0/b/cFQMK++OlfZnA72j9JMhWe/I7dHv5W3RqWrXysQBMihep7BQBJ8/XEK1c9PA flBMkkb7Z4UF9uy/fdNiRkv8YDQ6PWGLhtZEsDLU= MIME-Version: 1.0 Date: Sat, 17 Sep 2022 15:12:03 +0300 From: Marina Polyakova To: pgsql-bugs@lists.postgresql.org Subject: Bug in pg_upgrade live check right after starting the old server on Windows User-Agent: Roundcube Webmail/1.4.11 Message-ID: X-Sender: m.polyakova@postgrespro.ru Organization: Postgres Professional Content-Type: multipart/mixed; boundary="=_8b7c542a272b20896d6257d1a065e528" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --=_8b7c542a272b20896d6257d1a065e528 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Hello! I got a problem on a Windows machine on master [1] when running pg_upgrade live check right after starting the old server (note that instead of the expected banner 'Performing Consistency Checks on Old Live Server' there's a banner 'Performing Consistency Checks'): > bin\initdb.exe -D data_old > bin\initdb.exe -D data_new > bin\pg_ctl.exe -D data_old -l logfile_old start && bin\pg_upgrade.exe > -d C:\postgrespro\inst\data_old -D C:\postgrespro\inst\data_new -b > C:\postgrespro\inst\bin -B C:\postgrespro\inst\bin -p 5432 --check > --retain && bin\pg_ctl.exe -D data_old stop waiting for server to start.... done server started Performing Consistency Checks ----------------------------- Checking cluster versions ok ... *Clusters are compatible* pg_ctl: PID file "data_old/postmaster.pid" does not exist Is server running? From pg_upgrade_server_start.log with debug output (see diff_debug_pg_ctl_start.patch): command: "C:/postgrespro/inst/bin/pg_ctl" -w -l "C:/postgrespro/inst/data_new/pg_upgrade_output.d/20220917T044300.887/log/pg_upgrade_server.log" -D "C:/postgrespro/inst/data_old" -o "-p 5432 -b " start >> "C:/postgrespro/inst/data_new/pg_upgrade_output.d/20220917T044300.887/log/pg_upgrade_server_start.log" 2>&1 pg_ctl: another server might be running; trying to start server anyway pg_ctl: do_start old_pid 6100 waiting for server to start...pg_ctl: wait_for_postmaster_start pmpid 6100 pg_ctl: wait_for_postmaster_start pmstart 1663414980 pg_ctl: wait_for_postmaster_start start_time 1663414982 done server started And adding a sufficient pause between the old server start and pg_upgrade solves the problem: > bin\pg_ctl.exe -D data_old -l logfile_old start && sleep 2 && > bin\pg_upgrade.exe -d C:\postgrespro\inst\data_old -D > C:\postgrespro\inst\data_new -b C:\postgrespro\inst\bin -B > C:\postgrespro\inst\bin -p 5432 --check --retain && bin\pg_ctl.exe -D > data_old stop waiting for server to start.... done server started Performing Consistency Checks on Old Live Server ------------------------------------------------ Checking cluster versions ok ... *Clusters are compatible* waiting for server to shut down.... done server stopped The patch to check the previous postmaster pid when running pg_ctl start [2] works for me, but it was reverted [3]... [1] https://github.com/postgres/postgres/commit/fdd8937c071e85e2b7606939fb28284f008e15d1 [2] https://github.com/postgres/postgres/commit/6a5084eed49552bfc8859c438c8d74ad09fc5d3f [3] https://github.com/postgres/postgres/commit/f38291e927fa8c04eb772e6a17a3dd44da2b69e8 -- Marina Polyakova Postgres Professional: http://www.postgrespro.com The Russian Postgres Company --=_8b7c542a272b20896d6257d1a065e528 Content-Transfer-Encoding: base64 Content-Type: text/x-diff; name=diff_debug_pg_ctl_start.patch Content-Disposition: attachment; filename=diff_debug_pg_ctl_start.patch; size=937 ZGlmZiAtLWdpdCBhL3NyYy9iaW4vcGdfY3RsL3BnX2N0bC5jIGIvc3JjL2Jpbi9wZ19jdGwvcGdf Y3RsLmMKaW5kZXggOTI5MWM2MWQwMDBmZWViMjQ0M2I0OWY4NzM5ODA5YTQzM2E3NzgxZC4uNTU0 ZGZiZDJmODQ3YzgzMGViM2NhNmZjNjY3N2I5NTcxMWYzMmVmOSAxMDA2NDQKLS0tIGEvc3JjL2Jp bi9wZ19jdGwvcGdfY3RsLmMKKysrIGIvc3JjL2Jpbi9wZ19jdGwvcGdfY3RsLmMKQEAgLTYyMiw2 ICs2MjIsMTEgQEAgd2FpdF9mb3JfcG9zdG1hc3Rlcl9zdGFydChwZ3BpZF90IHBtX3BpZCwgYm9v bCBkb19jaGVja3BvaW50KQogCQkJICovCiAJCQlwbXBpZCA9IGF0b2wob3B0bGluZXNbTE9DS19G SUxFX0xJTkVfUElEIC0gMV0pOwogCQkJcG1zdG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