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 1oj7rq-0001S0-0H for pgsql-admin@arkaria.postgresql.org; Thu, 13 Oct 2022 23:43:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oj7qq-0000l7-7T for pgsql-admin@arkaria.postgresql.org; Thu, 13 Oct 2022 23:42:56 +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 1oj7qp-0000fM-7i for pgsql-admin@lists.postgresql.org; Thu, 13 Oct 2022 23:42:55 +0000 Received: from resqmta-c1p-024060.sys.comcast.net ([2001:558:fd00:56::3]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oj7ql-0006vK-2A for pgsql-admin@lists.postgresql.org; Thu, 13 Oct 2022 23:42:54 +0000 Received: from resomta-c1p-023269.sys.comcast.net ([96.102.18.227]) by resqmta-c1p-024060.sys.comcast.net with ESMTP id j6GUo8RX20YO3j7qeohYTO; Thu, 13 Oct 2022 23:42:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=20190202a; t=1665704564; bh=KONXtV5OCvjNhi3yF5y8gu0bJvSbb77+1WEjXH060u8=; h=Received:Received:Received:From:To:Subject:Date:Message-ID: MIME-Version:Content-Type; b=a29xkO7ZHS9/4FYkJstMLAZyXj1Zs//XKOkv+/3FIg8DVd7GVUlVexFlKMCNOdVcB X/dp/qGuKLO8lD7S+qiIXKHeunTh8xmvxsJ5wiU4q6vpC4bxyI4z/izXYuK6Tfqy4p SMDimFw2iWJq8RQf8clgX9Tf0IO1eywrIqp70om3Sjqt5jsfkeKSikhI6qSyKl69lG GqfSkBZtX0d3w1ueHcPgmXlTazHwE9Ao5UMXtfC5WdF1ijjE6OI4v6o/U2I3Msi3mM 5xSqPjee8CwO2IPQgBTpfC1nK8MkQNT71lPiyj05jPfbbZYxhzf+/vZ3JMaIV77mos jyqFrZeCr1FOg== Received: from R9N0YC2TC3.localdomain ([IPv6:2601:249:8780:7950:9446:338b:f6bd:bde8]) by resomta-c1p-023269.sys.comcast.net with ESMTPA id j7qconnyUUNJTj7qdo6MI5; Thu, 13 Oct 2022 23:42:43 +0000 X-Xfinity-VMeta: sc=-100.00;st=legit Received: by R9N0YC2TC3.localdomain (Postfix, from userid 503) id 08DB5A5D048; Thu, 13 Oct 2022 18:42:42 -0500 (CDT) From: Jerry Sievers To: Dhirendra Singh Cc: pgsql-admin@lists.postgresql.org Subject: Re: standby server is complaining about missing wal file after switchover References: Date: Thu, 13 Oct 2022 18:42:42 -0500 In-Reply-To: (Dhirendra Singh's message of "Thu, 13 Oct 2022 19:12:43 +0530") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (darwin) MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Dhirendra Singh writes: > Hi, > My postgres version is 14.2 > I have setup streaming replication between a primary and a standby using replication slot and without > archive. > I have created replication slot "slot1" on the primary. > I did switchover following below steps. > 1. shutdown the primary server. > 2. created replicated slot "slot1" on standby and promoted it to primary. > 3. run pg_rewind on the old primary and made it standby. > 4. started the old primary as new standby. > > I got following error in the new standby. it is complaining about missing wal file on the new primary. > > 2022-10-13 12:58:48.497 UTC [25] LOG: fetching timeline history file for timeline 2 from primary > server > 2022-10-13 12:58:48.508 UTC [25] LOG: started streaming WAL from primary at 0/B000000 on > timeline 1 > 2022-10-13 12:58:48.508 UTC [25] FATAL: could not receive data from WAL stream: ERROR: > requested WAL segment 00000002000000000000000B has already been removed > 2022-10-13 12:58:48.509 UTC [21] LOG: new target timeline is 2 > 2022-10-13 12:58:48.580 UTC [28] LOG: started streaming WAL from primary at 0/B000000 on > timeline 2 > 2022-10-13 12:58:48.580 UTC [28] FATAL: could not receive data from WAL stream: ERROR: > requested WAL segment 00000002000000000000000B has already been removed > > why the new primary has removed the wal file even though i created replication slot on it before > promoting. > value of max_slot_wal_keep_size is -1 and wal_keep_size is 0 Dunno but did you call the pg_create_physical_replication_slot() function with arg2=true to have it immediately keep the WAL pointer? I believe otherwise not until the slot has been connected to does it retain anything. HTH > > Thanks, > Dhirendra.