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 1lKHSO-0005VP-B1 for pgsql-general@arkaria.postgresql.org; Thu, 11 Mar 2021 09:18:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lKHSN-0000Om-9e for pgsql-general@arkaria.postgresql.org; Thu, 11 Mar 2021 09:18: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 1lKHSM-0000OT-UT for pgsql-general@lists.postgresql.org; Thu, 11 Mar 2021 09:18:11 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lKHSL-0006yk-BI for pgsql-general@lists.postgresql.org; Thu, 11 Mar 2021 09:18:10 +0000 Received: by mail-ej1-x630.google.com with SMTP id e19so44763943ejt.3 for ; Thu, 11 Mar 2021 01:18:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=e7cILgRTgUKcJSeNfpn5wBFFaukDqXLFjiRRy/8h47I=; b=E52GR/GZbkveitDI+oS0xzyy37o4VzWXUu3iGJwuVzbrdVQiF5wIvC9GhHCwCkOu/u ARg4Q+HZCQxbq4pATZ1XHdQ9LECkwOIMnvAgWM0HqTIacH0JruBowGYj3B1Exui9ofDX vsqP4O9GMWqNez5T6TgLFQcngfkzc6G1rUeL5QnBbmTu3ng+Hhb5ihlmB+Mc+dN0uf1T T4f2CfTSuNmlA6xJQ0yZ+4EJm+/LNTUxxDds0wnd67voI9/od9Do6YMcoIDAUyg8oOwO nfHiV9JncqYF8obbEGIkLf4D0cLwnJj9WgPjj8W+fJv3DuwvW9k+LtuseI0txdanfjbh y+ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=e7cILgRTgUKcJSeNfpn5wBFFaukDqXLFjiRRy/8h47I=; b=ItLqiYBO/IcVpIMTbCVceSQ1zuN/idWUkSw7VNnRM7ubENj3hzMdWe61fAQoVhwjYL D/EjyDmx5x65OVr8/wRbXtYuyEaou2x8fum47dXkmeVBw4iqT002a96NBHqI3crZbdQ4 oHaLKCtpUrBuHhhRC5LDoFGx87eIZ1UV4DbGpDw+er0wFQXvctIjFzNrn+oqbmZt6sBk QMYxEhPaz/AHjbg9nR5HhiSAnl3SEL2QBasya/4d9FsR/Ff5lSiBejMX3d6JNY25aSML 9+rz8O6ivHaoN9hup/qhd34Q36GxHJDW4YnwUI3SEo8Z5dXXmBeya0pgKcrq70Y0JvHf iwWQ== X-Gm-Message-State: AOAM531jyXf9DqQyIQ82eU/H1J7lTPNL5pSTf6HMWv4B9rvVR9B4XRjW o92ZrUZM0Xbj+gHT0tAN6iteog== X-Google-Smtp-Source: ABdhPJxUk/FhQor/tzuzesk5DkJEv3/LCs8laDQufX7+n2b3/WniigwsoGzwc1QbnEoPXNPLPUix/A== X-Received: by 2002:a17:906:388d:: with SMTP id q13mr2197606ejd.34.1615454288296; Thu, 11 Mar 2021 01:18:08 -0800 (PST) Received: from localhost.localdomain (217-149-174-6.nat.highway.telekom.at. [217.149.174.6]) by smtp.gmail.com with ESMTPSA id r24sm935565edw.11.2021.03.11.01.18.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Mar 2021 01:18:08 -0800 (PST) Message-ID: <8824049ee9e1f6476cf65ebb156c71fb2b44fa87.camel@cybertec.at> Subject: Re: WAL-files is not removing authomaticaly From: Laurenz Albe To: Andrew Anderson Cc: "pgsql-generallists.postgresql.org" Date: Thu, 11 Mar 2021 10:18:07 +0100 In-Reply-To: References: <7eee13c535a2f1de6e8dece0791531f3dc7f2c0e.camel@cybertec.at> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 2021-03-11 at 09:43 +0200, Andrew Anderson wrote: > > Never, ever, remove WAL files manually. > > A crash might render your database unrecoverable. > You're right, it's not a good idea. > > > You'll have to figure out what is blocking WAL removal. > This is my favorite dream! > > > Are there archive failures reported in "pg_stat_archiver" and the log? > master=# select * from pg_stat_archiver; > archived_count | last_archived_wal | last_archived_time | failed_count | last_failed_wal | last_failed_time | stats_reset > ----------------+--------------------------+-------------------------------+--------------+-----------------+------------------+------------------------------ > 3021 | 000000010000000B000000C9 | 2021-03-11 08:53:56.133796+02 | 0 | | | 2021-01-06 14:33:40.70147+02 > (1 row) > > In today's logs there is no any errors: > $ grep "FATAL\|WARNING" /opt/pglogs/master.log > $ > > $ grep "FATAL\|WARNING" /opt/pglogs/slave.log > $ > > > You say that replication is working fine, but try > > > > SELECT pg_current_wal_lsn(); > > > > on the primary and compare that with the "restart_lsn" of the replication slot. > > It parameters is differ: > master=# SELECT pg_current_wal_lsn(); > pg_current_wal_lsn > -------------------- > B/CB099398 > (1 row) > > master=# select * from pg_replication_slots; > slot_name | plugin | slot_type | datoid | database | temporary | active | active_pid | xmin | catalog_xmin | restart_lsn | confirmed_flush_lsn > ----------------------+--------+-----------+--------+----------+-----------+--------+------------+------+--------------+-------------+--------------------- > standby_slot | | physical | | | f | t | 2631806 | | | B/CB0AC068 | > (1 row) > > But when I add new data to the table on master, it apears on slave. > > > Look for strange messages in the log file on both servers. > Looking for strange messages gives nothing, in today's logs there is no any strange messages, just about connects of applications. All that looks fine. If that happens again, set "log_min_messages" to "debug2". Then the log file will contain information abotu the WAL segments that PostgreSQL is trying to remove. That might give you some insight. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com