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 1uCcNT-00HVC5-8N for pgsql-general@arkaria.postgresql.org; Wed, 07 May 2025 10:51:51 +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 1uCcNR-00DT2N-W3 for pgsql-general@arkaria.postgresql.org; Wed, 07 May 2025 10:51:50 +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 1uCcNR-00DT2E-KN for pgsql-general@lists.postgresql.org; Wed, 07 May 2025 10:51:49 +0000 Received: from mail-oa1-x2c.google.com ([2001:4860:4864:20::2c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uCcNP-000Zp8-0k for pgsql-general@lists.postgresql.org; Wed, 07 May 2025 10:51:48 +0000 Received: by mail-oa1-x2c.google.com with SMTP id 586e51a60fabf-2d54b936ad9so3053691fac.1 for ; Wed, 07 May 2025 03:51:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746615107; x=1747219907; darn=lists.postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=+KJ9A0xxb+GA9Re7eQ07LWUUkPMEH206PT8NfDDdyio=; b=KdOp7kuqZJ21dj1swEkdvjYiJ2hbhvHbUry1pAoaLsARxy2P0QSarpGzlrcHUaBOer aHSjXotRXTuDm7vUNPx1o2UdMLUgZyoo3NarQUoSZUtauxzCgJzpxHk3WtTfsPrA785k XDBYxoDgWqmjMSA2kFKzWPGvbKKXPFwr+op7zicx52j0kFzVI6wzGA7yn0XO5WkeYyrS TTB5GhBiGMRyP9pB9GdqzoyIuORMzyoYAHaFFJ8h629VPUgvGcfHVG6rApGce/OsCRyz vRJFyna8b7Tdi9wzA/zIyGe89r3Y91HzbGV6AX6d8wcLe8nwWCws9mTRQ5/+8SvZosPa 3J6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746615107; x=1747219907; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=+KJ9A0xxb+GA9Re7eQ07LWUUkPMEH206PT8NfDDdyio=; b=abH6lajBVAhppuo/tQlw2uIg7oLYum9p3QcTm34Sg14LQRgUBC8f3JDxE9Y4JX07Eu N+CHwdgdA/KE3VbrvYKLgTSABpK5AZ8fjmfHMFBCMFFDr9Y5BjsYMtUXTNdheK2c6EdP B1c1zC3pct4R6yvaB5qJcSQjavcsvBi2b84HzIiTpaiNRCUskOGcBcFEECqOjqbrLw7o JJ6btb2aFbsS9pwF2490eM9hWkbWTBlfsdnw41jcQR/vSGuKk8NmC58/9geIilUci9zh x1a+ZlND9vqkhMVw0GXAwptKmBgu3+Jdji0O06e+CBRnVCiXI8jPxJSKRbVAWcU0EHEt RcYw== X-Gm-Message-State: AOJu0YxOxURuqShSrTInfabRym9KuwKItvT9MsmzZE9gzoOD1hdTbLec uOdqbH913L+bctLpHm+lgY2URNZ4v1YxV/ibIC5dQqoMRQZOMeSr7CkN6sgOdrm57qtr7V9cnhk wlOQ1B9VLy67sF0tWkeho7aWvbuC0YaOk3vc= X-Gm-Gg: ASbGnctDFEuooNQjnzvNrWHH98EauyCQHws/JvAjvTKvddzBta4L1yAlX5h7RZT4bXM gO4dCUFiJ6lnulMojfanaMtv83v/Z/lpJh+hxN5JfQPbq0Qwidf3M5hsxroaZhM37YkZ9Bt9C9p qHLNqvnr35y/YSTBxtxkoG X-Google-Smtp-Source: AGHT+IFbz017+oyD2U2iL71czSFOacnxapUrca5XikIQB8sD2mTa5mwI70726eA9K0YbcgWBFAjX5fnsCvGzdo/n60A= X-Received: by 2002:a05:6870:7181:b0:29e:559b:d694 with SMTP id 586e51a60fabf-2db5c126f5amr1698086fac.32.1746615107291; Wed, 07 May 2025 03:51:47 -0700 (PDT) MIME-Version: 1.0 From: Luca Ferrari Date: Wed, 7 May 2025 12:51:11 +0200 X-Gm-Features: ATxdqUGtabLm36-xIy_3u-SHfHUN8kTp5yPUwI_KXXx4fPpCOSwWhVoIU3JzniM Message-ID: Subject: pg_rewind problem: cannot find WAL To: pgsql-general Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi all, running 17.4 on ubuntu 24.04 machines. I've three hosts, pg-1 (primary) and two physical replicas. I then promote host pg-3 as a master (pg_promote()) and want to rewind the pg-1 to follow the new master, so: ssh pg-3 'sudo -u postgres /usr/lib/postgresql/17/bin/pg_rewind -D /var/lib/postgresql/17/main --source-server="user=replica_fluca host=pg-3 dbname=replica_fluca"' pg_rewind: servers diverged at WAL location 0/B8550F8 on timeline 1 pg_rewind: error: could not open file "/var/lib/postgresql/17/main/pg_wal/00000001000000000000000A": No such file or directory pg_rewind: error: could not find previous WAL record at 0/AFFF4E8 But the file 0x010000A is not there: % ssh pg-3 'sudo ls /var/lib/postgresql/17/main/pg_wal' 00000001000000000000000B.partial 00000002.history 00000002000000000000000B 00000002000000000000000C 00000002000000000000000D 00000002000000000000000E archive_status summaries % ssh pg-1 'sudo ls /var/lib/postgresql/17/main/pg_wal' 000000010000000000000005.00000028.backup 00000001000000000000000B 00000001000000000000000C 00000001000000000000000D 00000001000000000000000E archive_status summaries Do i have to ensure the old primary pg-1 does a wal switch before promoting the other one and try to rewind? Thanks, Luca