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 1u28hc-00Dc29-Im for pgsql-general@arkaria.postgresql.org; Tue, 08 Apr 2025 13:09:20 +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 1u28ha-008TNk-Sw for pgsql-general@arkaria.postgresql.org; Tue, 08 Apr 2025 13:09:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u28ha-008TNc-Gw for pgsql-general@lists.postgresql.org; Tue, 08 Apr 2025 13:09:18 +0000 Received: from mail-vk1-xa2d.google.com ([2607:f8b0:4864:20::a2d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1u28hY-0048N8-0N for pgsql-general@lists.postgresql.org; Tue, 08 Apr 2025 13:09:18 +0000 Received: by mail-vk1-xa2d.google.com with SMTP id 71dfb90a1353d-523f721bc63so5715538e0c.0 for ; Tue, 08 Apr 2025 06:09:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744117754; x=1744722554; darn=lists.postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=xVem9Pls7YgqSLYvTkjBLInvYh4GqlmJobu7v3iJmjQ=; b=jjOn3c5Fd9f+hbhXCCpo70vY4kXf8VNlGQE0FHzRVGYYGIRFdjrkQQbVFZK9Q8cpmt 5ZGeM6JcG6tzZyt1V7K1ILQR88n7r/vhSskNeT4qDu6mnx2lCT6mIRUNA1kPlOeRLH5P Yj25k/kiMzMk2Gm5SdClLYwBlbXgS3Pjrk2008RFiE5JKNAISSZBJTy1945O4u/TGwtB Uz0DsKlN+BmD84QDHYoZGUa4+CbupMosA6T0err0cY3tGffs6g9rPKcAPql0FqEEgov7 k+XG8tp42DdpArzy2HjEULLNqOclFyJCm09iThjh5dOJvS/riXFIrufhvqE+kccp5ZSI EEMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744117754; x=1744722554; h=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=xVem9Pls7YgqSLYvTkjBLInvYh4GqlmJobu7v3iJmjQ=; b=am1HGV4jpXxqlbFQrEfGvGlh/Pb7hbwDr3qSsgt3QG7QPekff6/GgH5SXxlNea6O7Y NnoIHEtJXtSphHHCpjmfrUd6BvZvyilSLxQDZ8pIhlOVkHygMerbkiSeY3r5zGFK6uYd a6N2W2S4yj8dwPvhSrIZ2Q7Nno+oE26kzsXRSXLYQw0L/0znYbyYEwRNhSmJ8dwxVIxU x+Buz71bZecMy1a4ftFriBQ/JNbFHf9c23VQuLfUxMGEh9zJTdp4C0HkZCl9Ix3BskgO 8dwSD+xCKwCoWYXT3YwC5cKrr8yQAYyLLupauG7bYW+0yKkliIhXrN5dVPuoRY+p5JEX teHA== X-Gm-Message-State: AOJu0Yx7eIPkkFGBdNaVWeJ8j/lbboJEq49VARDQC4QWn2PGo3Pdxk12 30Jl0OJzGAc6MYGDj1g876mX1yRH2oklnZfNaF+W6SmS9hO+beaG/Td1CZ0mStiq3L0OdPKCT+y UudkCMEeH3wFSKybdkuTadZhHJ4n5EQ== X-Gm-Gg: ASbGncs08pYPpZJ1UQwAkE9R+hJuzgepT0Q0LqUNKUV9our/tRyXjZJsbW2R37K7MEr Y14TMy6Ttp0W+LPjaZ93DvzSTnNGMc678lcN1QJ73EVl5Jem1MVW+Z1YngaQOd4wPiP4NAB/H4k gU+WLoY38JQrAz/WTireGOrG8iquEEchL5E87VZCh8S2EDpJrECeLgcR6v7oM= X-Google-Smtp-Source: AGHT+IGNLjB9F1hrMUMBO/S41QPcJeAuXoV2nqeJqbym7Z6NugIkrOTeStbRrB7kvfkDJVVfXI/WxsQ/TAKR5U8Sa5Q= X-Received: by 2002:a05:6122:88c:b0:51e:ffd1:67f3 with SMTP id 71dfb90a1353d-5279ac1dfeemr2146010e0c.7.1744117753976; Tue, 08 Apr 2025 06:09:13 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Atul Kumar Date: Tue, 8 Apr 2025 18:39:01 +0530 X-Gm-Features: ATxdqUEx-BTC5YrU2M06GNUKycHYGmF0IAJjy_Ura76Xi9QKqEyMEn3wirzXYC8 Message-ID: Subject: Re: Wal file query To: pgsql-general Content-Type: multipart/alternative; boundary="0000000000002c24b40632440fa5" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000002c24b40632440fa5 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I got the error: Wal control functions cannot be executed during recovery. I need the solution that should in when streaming replication is configured. My postgres version is 13.20 Regards. On Tue, 8 Apr 2025, 17:32 Kashif Zeeshan, wrote: > Hi Atul > > Start by looking at the current WAL LSN and insert LSN. The > pg_current_wal_lsn is the location of the last write. The > pg_current_wal_insert_lsn is the logical location and reflects data in > the buffer that has not been written to disk. There is also a flush value > that shows what has been written to durable storage. > > [postgres] # select pg_current_wal_lsn(), pg_current_wal_insert_lsn(); > pg_current_wal_lsn | pg_current_wal_insert_lsn > --------------------+--------------------------- > 76/7D000000 | 76/7D000028 > (1 row) > > Although you can guess the name of the WAL file based on the above output= , it is best to use the pg_walfile_name function. > > > [postgres] # select pg_walfile_name('76/7D000028'); > pg_walfile_name > -------------------------- > 00000001000000760000007D > (1 row) > > > For details visit following link : https://www.crunchydata.com/blog/postg= res-wal-files-and-sequuence-numbers > > > Thanks > > Kashif Zeeshan > > > > On Tue, Apr 8, 2025 at 4:44=E2=80=AFPM Atul Kumar = wrote: > >> In streaming replication What is the way to check which "WAL file" is >> currently in use in primary and in standby ? >> >> >> Regards. >> > --0000000000002c24b40632440fa5 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I got the error:

Wal control functions cannot be executed during recovery.

I need the solution that should in w= hen streaming replication is configured.=C2=A0

<= /div>
My postgres version is 13.20
=

Regards.=C2=A0

On Tue, 8 Apr 2025, 17:32 Kashif Zeeshan, <kashi.zeeshan@gmail.com> wrote:=
Hi=C2=A0Atul
=
Start by looking at the current WAL LSN and insert LSN. The = pg_current_wal_lsn is the location of the last write. The pg_current_wal_insert_lsn is the logical location and reflects data in the buffer that has not=20 been written to disk. There is also a flush value that shows what has=20 been written to durable storage.
[postgres] # select pg_current_wal_lsn(), pg_current_wal_inse=
rt_lsn();
 pg_current_wal_lsn | pg_current_wal_insert_lsn
--------------------+---------------------------
 76/7D000000        | 76/7D000028
(1 row)
Although you can guess the name of the WAL file bas=
ed on the above output, it is best to use the pg_walfile_name =
function.

[po=
stgres] # select pg_walfile_name('76/7D000028');
     pg_walfile_name
--------------------------
 00000001000000760000007D
(1 row)

For details visi=
t following link : https://=
www.crunchydata.com/blog/postgres-wal-files-and-sequuence-numbers

Thanks
Kashif Zeeshan


On Tue, Apr 8= , 2025 at 4:44=E2=80=AFPM Atul Kumar <akumar14871@gmail.com> w= rote:
In streaming replication=C2=A0What is the way to check which &quo= t;WAL file" is currently in use in primary=C2=A0 and in standby ?


Regard= s.
--0000000000002c24b40632440fa5--